* { box-sizing: border-box; }
:root {
  --bg: #0b1020;
  --panel: #131b35;
  --muted: #9aa4c7;
  --text: #e6e9f5;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --accent: #22d3ee;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1b2350, transparent 60%),
              radial-gradient(900px 600px at 100% 0%, #0f172a, transparent 50%),
              var(--bg);
}
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(11,16,32,0.9), rgba(11,16,32,0.6));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand { display:flex; align-items:center; gap: 12px; }
.logo { width: 40px; height: 40px; }
.titles h1 { font-size: 20px; margin: 0; }
.subtitle { margin: 0; font-size: 12px; color: var(--muted); }
.actions { display:flex; gap: 8px; align-items: center; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.auth { display: flex; gap: 6px; }
.auth input { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); background: rgba(7,10,24,0.6); color: var(--text); }

.container { max-width: 980px; margin: 20px auto; padding: 0 16px; }
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 14px; font-size: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
label span { display:block; margin-bottom: 6px; font-weight: 600; font-size: 12px; color: var(--muted); }
input[type="text"], input[type="date"], input[type="time"], input[type="number"], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(7,10,24,0.6); color: var(--text);
}
input::placeholder { color: #8b93b3; }

.form-actions { display:flex; gap: 10px; margin-top: 12px; }
.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: var(--text); cursor: pointer; }
.btn:hover { background: rgba(255,255,255,0.1); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-600)); border: none; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.icon { padding: 8px 10px; }

.list-header { display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.title-and-search { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-and-search h2 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-and-search #search { max-width: 260px; }
.filters { display:flex; gap: 8px; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item { display:flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); background: rgba(10,14,32,0.6); }
.task-item .row1 { display:flex; align-items:center; gap: 8px; }
.task-item .title { font-weight: 600; }
.task-item .notes { color: var(--muted); font-size: 13px; }
.task-item .meta { color: #a7b0d9; font-size: 12px; margin-top: 4px; }
.task-item .item-actions { margin-left: auto; display:flex; gap: 8px; }

.checkbox { position: relative; display:inline-flex; align-items: center; }
.checkbox input { position:absolute; opacity: 0; }
.checkmark { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #94a3b8; display:inline-block; background: transparent; position: relative; }
.checkbox input:checked + .checkmark { background: var(--success); border-color: var(--success); }
.checkbox input:checked + .checkmark::after { content:''; position:absolute; left: 6px; top: 2px; width: 6px; height: 12px; border: solid #052e2b; border-width: 0 3px 3px 0; transform: rotate(45deg); }

.badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.3px; }
.badge.priority { background: linear-gradient(135deg, #f43f5e, #ef4444); }
.badge.overdue { background: linear-gradient(135deg, #fb923c, #f59e0b); }
.badge.due-today { background: linear-gradient(135deg, #22d3ee, #06b6d4); }
.hidden { display:none; }

.empty { color: var(--muted); text-align:center; padding: 16px; }
.footer { text-align:center; color: var(--muted); padding: 20px; }

.chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  color: #cbd5e1;
}

/* Grey out tasks completed today */
.task-item.completed-today {
  opacity: 0.6;
}
.task-item.completed-today .title {
  text-decoration: line-through;
  color: var(--muted);
}

/* Grey out tasks that are not due today (future) without crossing out */
.task-item.not-today {
  opacity: 0.6;
}

/* Make uncompleted due-today tasks brighter for clear contrast */
.task-item.due-today-item {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.24);
}
.task-item.due-today-item .title {
  color: #ffffff;
}

/* Category header layout: ensure actions don't overlap and list can span full width */
details.category-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-actions { display: inline-flex; gap: 8px; }

/* Tabs */
.tabs { display:flex; gap:8px; margin-bottom: 12px; }
.tab { padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: var(--text); cursor: pointer; }
.tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-600)); border: none; }

@media (max-width: 640px) {
  .titles h1 { font-size: 18px; }
  .actions { gap: 6px; }
  .title-and-search h2 { white-space: nowrap; }
  /* Hide search input by default on mobile; show when active */
  #search { display: none; }
  #search.active { display: inline-block; width: 60vw; }
  /* Make category Rename/Delete buttons smaller on mobile */
  details.category-section summary .btn,
  .category-section summary .btn {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
  }
  /* Unified background under the navbar on mobile */
  body { background: var(--bg) !important; }
  .app-header { background: var(--bg) !important; backdrop-filter: none; }
  /* Slightly smaller task fonts on mobile and brighter titles */
  .task-item .title { font-size: 14px; color: #ffffff; }
  .task-item .notes { font-size: 12px; }
  .task-item .meta { font-size: 11px; }

  /* Irene mobile header: force two rows */
  #page-irene .list-header { align-items: flex-start; }
  #page-irene .title-and-search {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 6px;
  }
  #page-irene .title-and-search .irene-group-row,
  #page-irene .title-and-search .irene-row-2 {
    width: 100%;
    display: flex;
  }
  #page-irene .title-and-search .irene-row-2 > #irene-search { flex: 1; }
}


/* Flashing style for Update button when a new version is available */
@keyframes ttt-update-flash {
  0%, 100% { box-shadow: 0 0 0 rgba(79,70,229,0); transform: translateZ(0); }
  50% { box-shadow: 0 0 0 6px rgba(79,70,229,0.35), 0 0 18px rgba(34,211,238,0.6); }
}
#btn-update.flash {
  animation: ttt-update-flash 1.2s ease-in-out infinite;
  border-color: rgba(79,70,229,0.8);
}
@media (prefers-reduced-motion: reduce) {
  #btn-update.flash { animation: none; }
}

/* Irene plus button */
.btn.icon.plus { font-size: 18px; font-weight: 700; background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.4); width: 32px; height: 32px; display:inline-flex; align-items:center; justify-content:center; border-radius: 8px; color: #a7f3d0; }
.btn.icon.plus.pulse { animation: irene-pulse 0.4s ease-out 1; }
@keyframes irene-pulse { 0%{ transform: scale(1); } 50%{ transform: scale(1.15); } 100%{ transform: scale(1); } }

/* Smaller edit/delete icon buttons (reduced ~30%) */
.item-actions .btn.icon.edit,
.item-actions .btn.icon.delete,
.cat-actions .btn.icon.edit,
.cat-actions .btn.icon.delete {
  font-size: 12px; /* ~30% smaller than default text size */
  padding: 6px 8px; /* reduced padding from 8x10 */
  line-height: 1;
}

/* Chart legends */
.chart-legend { display:flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 12px; }
.legend-item { display:flex; align-items:center; gap: 8px; color: #cbd5e1; }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; display:inline-block; }
.legend-item .name { opacity: 0.9; }
.legend-item .val { margin-left: 6px; opacity: 0.85; }

/* Make the Selected tasks multi-select a single line tall */
#pie-selected-tasks { max-height: 36px; }
