/* Landing page tweaks */
.overview-tiles { margin-bottom: 16px; }

/* Baseline Checkup button groups */
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn-group .btn.option {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
}
.btn-group .btn.option:hover { background: #fff7ed; border-color: rgba(210,153,83,0.35); }
.btn-group .btn.option.active {
  background: #fff3e0;
  border-color: rgba(210,153,83,0.65);
  box-shadow: 0 4px 12px rgba(210,153,83,0.18);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Shared color variables for tiles and task states */
:root {
  /* RGB components only; use with rgba(var(--name), alpha) */
  --tint-overdue: 180, 35, 24;      /* red/amber for overdue/urgent */
  --tint-week: 245, 158, 11;        /* amber for due this week */
  --tint-upcoming: 59, 130, 246;    /* blue for upcoming/future */
  --tint-completed: 16, 185, 129;   /* green for completed */
  --tint-active: 99, 102, 241;      /* indigo (spare) */

  --tile-border-alpha: 0.25;        /* subtle colored borders */
  --card-border-alpha: 0.28;        /* task card border strength */
  --header-tint-alpha: 0.12;        /* header background tint */
  
  /* Brand palette */
  --floral-white: #fbf6efff;
  --white-smoke: #f2f2f2ff;
  --raisin-black: #2d2f3aff;
  --prussian-blue: #2f3e56ff;
  --cambridge-blue: #9db89dff;
  --persian-red: #c6453dff;
  --goldenrod: #dfae3dff;
  --slate-gray: #7a8a94ff;
}


/* =============================== */
/* Hero header as top banner       */
/* =============================== */
.hero {
  position: relative;
  z-index: 10;
  width: 100%;
  /* warm gradient retained using brand variables */
  background: linear-gradient(180deg, var(--floral-white) 0%, var(--white-smoke) 55%, var(--floral-white) 100%);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  margin: 0 0 6px 0; /* tighter space beneath banner */
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero .greeting {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--raisin-black);
  margin-bottom: 4px;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 800;
}

.hero .sub {
  color: var(--slate-gray);
}

.quick-actions { display: flex; gap: 10px; }
.hero-actions { display: flex; gap: 10px; align-items: center; }
.user-menu-wrap { position: relative; z-index: 3000; }

.hero-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.hero-search .search-icon { opacity: 0.7; }

.hero-search input {
  width: 280px; max-width: 42vw;
  border: none; outline: none; background: transparent;
  color: #2b2b2b; font-size: 14px;
}
.hero-search input::placeholder { color: rgba(43,43,43,0.5); }

/* Mobile hero improvements */
@media (max-width: 768px) {
  .hero {
    padding: 12px 16px;
  }
  
  .hero-inner {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .hero-text {
    width: 100%;
  }
  
  .hero .greeting {
    font-size: 22px;
  }
  
  .hero .sub {
    font-size: 14px;
    margin-top: 4px;
  }
  
  .hero-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  /* Hide search bar on mobile */
  .hero-search {
    display: none;
  }
  
  .hero-title-row {
    gap: 8px;
  }
  
  .hero-lead-icon {
    width: 28px;
    height: 28px;
  }
}

.hero-title-row { display:flex; align-items:center; gap:10px; }
.hero-lead-icon {
  width: 32px; height: 32px; display:grid; place-items:center;
  background: var(--goldenrod); color: var(--prussian-blue); border-radius: 8px;
}
.qa-icon-img {
  width: 28px;
  height: 28px;
  display: inline-block;
  border-radius: 6px;
}
.hero-lead-icon .qa-icon { width: 100%; height: 100%; }

.hero-divider { height: 0; border-bottom: 1px solid var(--border); display:none; }
.avatar-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none; cursor: pointer;
  color: var(--prussian-blue); font-weight: 700;
  background: var(--goldenrod);
  box-shadow: 0 6px 18px rgba(210, 153, 83, 0.22);
}
.avatar-btn:hover { filter: brightness(1.05); }
.avatar-btn:active { transform: translateY(1px); }

.user-menu {
  position: absolute; right: 0; top: 48px; min-width: 220px;
  background: rgba(255, 250, 245, 0.9); /* warm glass */
  border: 1px solid rgba(210, 153, 83, 0.25); /* warm border */
  border-radius: 14px; padding: 8px;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 20px 40px rgba(210, 153, 83, 0.18); /* warm shadow */
  z-index: 10;
  /* closed state */
  opacity: 0; transform: translateY(-6px) scale(0.98);
  pointer-events: none; visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}
.user-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; visibility: visible; }

.user-menu button {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: #fff;
  color: #2b2b2b !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 16px rgba(210,153,83,0.12);
  font-weight: 700;
}
.user-menu button + button { margin-top: 6px; }
.user-menu button:hover { background: #fff7ed !important; border-color: rgba(210,153,83,0.35); }
.user-menu button:active { transform: translateY(1px); }
.user-menu button:focus { outline: none; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35); }

/* Full-width anchor buttons in avatar menu */
.user-menu .menu-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #fff;
  color: #2b2b2b !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 16px rgba(210,153,83,0.12);
  font-weight: 700;
  text-decoration: none;
}
.user-menu .menu-btn + .menu-btn { margin-top: 6px; }
.user-menu .menu-btn:hover { background: #fff7ed !important; border-color: rgba(210,153,83,0.35); }
.user-menu .menu-btn:active { transform: translateY(1px); }
.user-menu .menu-btn:focus { outline: none; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35); }
.pill-btn {
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  color: #fff;
  background: linear-gradient(180deg, #2f80ed, #1c64f2);
  box-shadow: 0 6px 18px rgba(28,100,242,0.25);
  font-weight: 600;
}
.pill-btn:hover { filter: brightness(1.05); }
.pill-btn:active { transform: translateY(1px); }

/* quick actions below hero */
.hero + .quick-actions { margin-top: 10px; margin-bottom: 14px; }

.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--prussian-blue);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.quick-btn:hover { background: var(--white-smoke); }

.qa-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--goldenrod);
  color: var(--prussian-blue);
  font-weight: 700;
}

/* Keep hero readable if OS requests dark */
@media (prefers-color-scheme: dark) {
  .hero { background: rgba(255,255,255,0.85) !important; border-color: rgba(0,0,0,0.08) !important; }
  .quick-btn { background: #ffffff !important; color: var(--raisin-black) !important; }
}

/* =============================== */
/* Overview tiles                  */
/* =============================== */
.top-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.panel-card {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--border, rgba(0,0,0,0.06));
  background: rgba(255,255,255,0.65);
  box-shadow: 0 12px 36px rgba(197,143,76,0.08);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  margin-bottom: 16px; /* give space beneath stacked cards */
}
.panel-title { margin: 0 0 10px; font-size: 14px; color: var(--text-sec, #6b7280); font-weight: 700; font-family: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
.overview-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Overview tiles -> soft cards with subtle borders */
.overview-tiles .tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.8);
  border: 2px solid rgba(0,0,0,0.06);
  box-shadow: 0 10px 28px rgba(197,143,76,0.06);
  text-align: center;
  min-height: 82px;
}

.overview-tiles .tile .count {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--raisin-black); /* numbers */
}
.overview-tiles .tile .label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--slate-gray);
}

/* Variant tints and border accents using brand palette (toned down) */
.overview-tiles .tile.overdue { border-color: color-mix(in srgb, var(--persian-red) 28%, transparent); }
.overview-tiles .tile.overdue .count { color: #000; }

.overview-tiles .tile.week { border-color: color-mix(in srgb, var(--goldenrod) 28%, transparent); }
.overview-tiles .tile.week .count { color: #000; }

.overview-tiles .tile.completed { border-color: color-mix(in srgb, var(--cambridge-blue) 28%, transparent); }
.overview-tiles .tile.completed .count { color: #000; }

.overview-tiles .tile.upcoming { border-color: color-mix(in srgb, var(--prussian-blue) 28%, transparent); }
.overview-tiles .tile.upcoming .count { color: #000; }

@media (max-width: 640px) {
  .overview-tiles { grid-template-columns: 1fr; }
}

/* Two-column layout for task sections */
#tasks-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
/* Allow selected sections to span both columns */
.task-section.span-all { grid-column: 1 / -1; }
@media (max-width: 900px) {
  #tasks-container { grid-template-columns: 1fr; }
}

.tile {
  padding: 14px 16px;
  border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--raisin-black) 6%, transparent);
  background: rgba(255,255,255,0.65);
  box-shadow: 0 12px 36px rgba(197,143,76,0.08);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.tile .label { color: var(--slate-gray); font-size: 12px; margin-bottom: 6px; }
.tile .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--raisin-black); }

/* Accent rings (fallback generic tiles) */
.tile.overdue { border-color: color-mix(in srgb, var(--persian-red) 28%, transparent); }
.tile.week { border-color: color-mix(in srgb, var(--goldenrod) 28%, transparent); }
.tile.completed { border-color: color-mix(in srgb, var(--cambridge-blue) 28%, transparent); }
.tile.upcoming { border-color: color-mix(in srgb, var(--prussian-blue) 28%, transparent); }

@media (max-width: 768px) {
  .overview-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-panels { 
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media (max-width: 520px) {
  .overview-tiles { grid-template-columns: 1fr; }
}


/* =============================== */
/* Utility grid helpers            */
/* =============================== */
.grid { display: grid; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.grid.gap { gap: 16px; }
@media (max-width: 900px) {
  .grid.cols-2 { grid-template-columns: 1fr; }
}


/* =============================== */
/* Home banner edit affordance     */
/* =============================== */
.home-banner { position: relative; }
.home-banner .banner-edit-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: none;
  align-items: center;
  justify-content: center;
  color: #1f2937;
}
.home-banner .banner-edit-btn .icon { width: 14px; height: 14px; display: block; }
.home-banner:hover .banner-edit-btn { display: inline-flex; }
.home-banner .banner-edit-btn:hover { background: #ffffff; }


/* =============================== */
/* Urgent Attention card           */
/* =============================== */
.urgent .card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0; /* header/body handle their own padding like task cards */
  border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--persian-red) 28%, transparent);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 36px color-mix(in srgb, var(--persian-red) 18%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  overflow: hidden; /* mirror task-card rounded containment */
}
.urgent .card .card-header {
  position: relative;
  padding: 14px 18px 10px 18px; /* tightened bottom padding */
  color: var(--text);
  background: rgba(var(--tint-overdue), calc(var(--header-tint-alpha) - 0.02));
}
.urgent .card .card-header .title { font-weight: 800; font-size: 20px; color: var(--text); }
.urgent .card .card-header .desc { margin-top: 4px; opacity: 0.95; font-weight: 500; color: var(--text-sec); }
.urgent .card .card-header .corner-dot {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(0,0,0,0.06);
}
.urgent .card .card-header .corner-dot .icon { width: 14px; height: 14px; display: block; }
.urgent .card .card-body {
  padding: 0 16px 14px 16px; /* no top padding so body touches header */
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.urgent .card .card-body { flex-wrap: wrap; }
.urgent .card .card-body .text { flex: 1 1 220px; }
.urgent .card .card-body .info {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px 0; /* remove top margin to eliminate white gap under header */
}
.urgent .card .card-body .info-item .label {
  font-size: 12px;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.urgent .card .card-body .info-item .value {
  display: block;
  margin-top: 2px;
  color: var(--text);
}
.urgent .badge.freq { background: #e8eef7; color: #1f3a5f; border-radius: 10px; }

@media (max-width: 640px) {
  .urgent .card .card-body .info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.urgent .title { font-weight: 700; color: #1f2937; }
.urgent .subtitle { color: #6b7280; font-size: 13px; }
.urgent .text { flex: 1 1 auto; min-width: 0; }
.urgent .actions { flex: 0 1 auto; }
.urgent .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.urgent .actions .btn { height: 38px; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(0,0,0,0.08); background: #fff; display: inline-flex; align-items: center; gap: 6px; color: #1f2937; white-space: nowrap; box-shadow: 0 4px 12px rgba(210,153,83,0.12); font-weight: 600; font-size: 14px; text-decoration: none; }
.urgent .actions .primary {
  background: var(--goldenrod); /* soft success tint */
  color: var(--raisin-black);
  box-shadow: none;
}
.urgent .actions .primary:hover {
  background: color-mix(in srgb, var(--goldenrod) 28%, transparent);
  box-shadow: none;
}
.urgent .actions .ghost { background: #ffffff; border-color: rgba(0,0,0,0.06); box-shadow: 0 6px 16px rgba(210,153,83,0.14); }
.urgent .actions .ghost:hover { background: #fff7ed; }

/* Match urgent card icons to task card icon sizing */
.urgent .actions .icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  color: currentColor; /* inherit button text color */
  vertical-align: -2px;
}
/* Subtle default for ghost buttons in urgent; sharpen on hover */
.urgent .actions .ghost .icon { opacity: 0.85; }
.urgent .actions .ghost:hover .icon { opacity: 1; }


/* Quick Actions (below hero) */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0 20px;
}
.quick-actions .quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--prussian-blue);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}
.quick-actions .quick-btn:hover {
  background: #f3f6fb; /* subtle slate hover */
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.quick-actions .quick-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.quick-actions .quick-btn .qa-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px; /* no bubble background */
  background: transparent;
  color: var(--brand-navy);
  line-height: 1;
}
@media (max-width: 768px) {
  .quick-actions {
    gap: 8px;
    margin: 8px 0 16px;
  }
  
  .quick-actions .quick-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 10px 12px;
    font-size: 14px;
    justify-content: center;
  }
  
  .quick-actions .quick-btn .qa-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .quick-actions .quick-btn {
    flex: 1 1 100%;
  }
}

/* Layout: Top panels (Overview + Urgent) side-by-side with matched heights */
.top-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch; /* grid items match tallest */
}
.top-panels > section {
  display: flex; /* allow child panel-card to stretch */
}
.top-panels > section .panel-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Stack top panels on mobile */
@media (max-width: 768px) {
  .top-panels {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}

/* Final override: keep variables light when OS is dark */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #f5f7fb !important;
    --card: #ffffff !important;
    --card-elevated: rgba(255,255,255,0.75) !important;
    --text: #111827 !important;
    --text-sec: #6b7280 !important;
    --border: rgba(0,0,0,0.08) !important;
    --shadow: 0 8px 24px rgba(0,0,0,0.08) !important;
    --radius: 14px !important;
    --radius-lg: 18px !important;
    --accent: #0a84ff !important;
    --accent-press: #0066d6 !important;
    --success: #34c759 !important;
    --warn: #ffcc00 !important;
    --danger: #ff3b30 !important;
  }
}

/* Monday-style table */
.task-table {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    --task-grid: minmax(280px, 4.6fr) minmax(110px, 1.3fr) minmax(140px, 1.6fr) minmax(120px, 1.4fr) minmax(380px, 3.4fr);
}

.task-table__header,
.task-row {
    display: grid;
    grid-template-columns: var(--task-grid);
    align-items: center;
    padding-left: 6px; /* reserve space for status rail */
    column-gap: 0;
}

.task-table__header {
    background: color-mix(in srgb, var(--accent) 7%, var(--card));
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    font-weight: 700;
    color: var(--text);
}

.task-table .col,
.task-row .cell { padding: 12px; min-width: 0; }

.task-row {
    border-top: 1px solid var(--border);
    background: var(--card);
    transition: background 0.12s ease;
    position: relative;
}
.task-row:hover { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }

/* status rail without affecting layout */
.task-table__header { position: relative; }
.task-table__header::before,
.task-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 0 6px 6px 0;
    background: transparent;
}
.task-row.overdue::before { background: var(--danger); }
.task-row.upcoming::before { background: var(--warn); }
.task-row.future::before { background: #9ca3af; }
.task-row.completed::before { background: var(--success); }
.task-row.completed { opacity: 0.85; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    text-transform: capitalize;
    background: #eef2ff;
    color: #3730a3;
}
.pill.high { background: color-mix(in srgb, var(--persian-red) 28%, transparent);; color: #b42318; }
.pill.medium { background: color-mix(in srgb, var(--goldenrod) 28%, transparent); color: #664d03; }
.pill.low { background: #e7f3ff; color: #0b5ed7; }

/* Align columns */
.task-table .col.due, .task-row .cell.due { text-align: center; }
.task-table .col.category, .task-row .cell.category { text-align: center; }
.task-table .col.priority, .task-row .cell.priority { text-align: center; }
.task-table .col.actions { justify-self: end; }
.task-row .cell.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.task-row .cell.actions button { white-space: nowrap; }

/* Ghost button variant */
.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}
.ghost:hover { background: color-mix(in srgb, var(--accent) 8%, var(--card)); }

@media (prefers-color-scheme: dark) {
  .task-row:hover { background: #171b24; }
  .pill { background: #222833; color: #cfd5e3; }
  .pill.high { background: #3a2224; color: #ff9aa0; }
  .pill.medium { background: #3a3421; color: color-mix(in srgb, var(--goldenrod) 28%, transparent); }
  .pill.low { background: #203247; color: #8ec8ff; }
}

/* Task cards layout */
.task-card-list {
  display: grid;
  gap: 18px; /* increased spacing between cards */
  grid-template-columns: 1fr; /* default single column */
}

/* Upcoming section shows cards in two columns */
#upcoming-tasks .task-card-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px; /* extra spacing for two-column layout */
}
@media (max-width: 900px) {
  #upcoming-tasks .task-card-list { grid-template-columns: 1fr; }
}

/* Overdue section mirrors Upcoming: two columns on desktop, one on mobile */
#overdue-tasks .task-card-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 900px) {
  #overdue-tasks .task-card-list { grid-template-columns: 1fr; }
}

/* Clamped lists: show a subset with a fade hint and See more link */
.clamped-list {
  position: relative;
  overflow: hidden;
}
.clamped-list.has-more::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--panel-bg, #fff));
  pointer-events: none;
}
.clamped-list.clamp-6 {
  /* Target ~3 rows in two-column layout (desktop). Cards vary; allow room with some buffer */
  max-height: 860px;
}
.clamped-list.clamp-4 {
  /* Target ~4 cards in single column sections */
  max-height: 920px;
}
@media (max-width: 900px) {
  /* On mobile, cards are single column; reduce clamp heights */
  .clamped-list.clamp-6 { max-height: 760px; }
  .clamped-list.clamp-4 { max-height: 720px; }
}

.list-more { margin-top: 8px; text-align: center; }
.list-more .btn { min-width: 140px; }

/* Base task card: clean, simple */
.task-card {
    position: relative;
    border-radius: 12px;
    background: #ffffff;
    border: none; /* remove default border */
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    /* ensure inner content stays within rounded corners */
    overflow: clip;
    overflow: hidden; /* fallback */
    /* define fixed status accent width; color set by state classes below */
    border-left: 5px solid #e5e7eb; /* neutral fallback */
}

/* Remove colored headers; keep spacing only */
.task-card .card-header {
    background: transparent;
    padding: 14px 16px 0 16px;
  }

/* Dashboard state accents: only change the border color */
.task-card.overdue, .task-card.urgent { border-left-color: var(--persian-red); }
.task-card.upcoming { border-left-color: var(--goldenrod); }
.task-card.future { border-left-color: var(--prussian-blue); }
.task-card.completed { border-left-color: var(--cambridge-blue); }

/* Optional: slightly dim completed content */
.task-card.completed .title { color: var(--raisin-black); opacity: 0.95; }
.task-card.completed .desc,
.task-card.completed .info .value { opacity: 0.9; }

/* Title/desc styling */
.task-card .card-header .title {
    font-weight: 800;
    color: var(--raisin-black);
  }
  .task-card .card-header .desc {
    color: var(--text-sec, #6b7280);
    margin-top: 4px;
  }
  
  /* Info rows and actions spacing */
  .task-card .card-body {
    background: transparent;
    padding: 12px 16px 16px 16px;
  }
  
  /* Disable old pseudo accent bars if any */
  .task-card::before,
  .task-card::after { content: none !important; display: none !important; }

  /* Left accent bar handled by .task-card border-left above */

.task-card .card-header .corner-dot {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(0,0,0,0.06);
}
.task-card .card-header .corner-dot .icon { width: 14px; height: 14px; display: block; }

/* Seasonal icon next to titles */
.task-card .card-header .season-icon,
.urgent .card .card-header .season-icon {
  width: 18px;
  height: 18px;
  color: #6b7280; /* subtle neutral tone */
  flex: 0 0 auto;
}

.task-card .card-body {
  padding: 14px 16px 16px 16px;
  background: var(--card);
}
.task-card.urgent .card-body { padding-top: 10px; }

.task-card .info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.task-card .info-item .label {
  font-size: 12px;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.task-card .info-item .value {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-weight: 600;
}

.task-card .actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* Match urgent button shape/spacing on task cards (buttons use specific classes, not .btn) */
.task-card .actions .complete-btn,
.task-card .actions .snooze-btn,
.task-card .actions .edit-btn,
.task-card .actions .history-btn,
.task-card .actions .reset-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1f2937;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(210,153,83,0.12);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

/* Complete button uses soft success variant */
.task-card .actions .complete-btn {
  background: var(--goldenrod) ;
  color: #0b2b12;
  box-shadow: none; /* override base .actions button shadow */
}
.task-card .actions .complete-btn:hover { background: color-mix(in srgb, var(--goldenrod) 28%, transparent)}

/* Ghost buttons like urgent */
.task-card .actions .snooze-btn.ghost,
.task-card .actions .edit-btn.ghost,
.task-card .actions .history-btn.ghost,
.task-card .actions .reset-btn.ghost {
  background: #ffffff;
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 6px 16px rgba(210,153,83,0.14);
}
.task-card .actions .snooze-btn.ghost:hover,
.task-card .actions .edit-btn.ghost:hover,
.task-card .actions .history-btn.ghost:hover,
.task-card .actions .reset-btn.ghost:hover { background: #fff7ed; }

/* Small icons for action buttons */
.task-card .actions .icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  color: currentColor; /* inherit button text color */
  vertical-align: -2px;
}

/* Subtle default for ghost buttons in task cards; sharpen on hover */
.task-card .actions .ghost .icon { opacity: 0.85; }
.task-card .actions .ghost:hover .icon { opacity: 1; }

/* Primary button tweak for card (ensure consistency) */
.task-card .complete-btn {
  background: #e8f7ee;
  border: 1px solid rgba(16,185,129,0.35);
  color: #0b2b12;
  box-shadow: none;
}
.task-card .complete-btn:hover { background: #dff3e7; }

/* Badge frequency inside card */
.task-card .badge.freq {
  background: #e8eef7;
  color: #1f3a5f;
  border-radius: 10px; ;
}

/* Keep hero search input transparent despite global input resets */
.hero-search input[type="search"],
.hero-search input[type="text"],
.hero-search input {
  background: transparent !important;
  border: none !important;
  border-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

.hero-search input:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

@media (prefers-color-scheme: dark) {
  .task-card .badge.freq { background: #253044; color: #c9d7f0; border-radius: 10px; }
}

/* Force light theme overrides */
html { color-scheme: light; }
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --card-elevated: rgba(255,255,255,0.75);
  --text: #111827;
  --text-sec: #6b7280;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 14px;
  --radius-lg: 18px;
  --accent: #0a84ff;
  --accent-press: #0066d6;
  --success: #34c759;
  --warn: #ffcc00;
  --danger: #ff3b30;
}

/* Reset inputs and selects to light */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text);
}

/* Reset pills to light mapping */
.pill { background: #eef2ff; color: #3730a3; }
.pill.high { background: #fde2e1; color: #b42318; }
.pill.medium { background: #fff3cd; color: #664d03; }
.pill.low { background: #e7f3ff; color: #0b5ed7; }

/* Reset card frequency badge to light */
.task-card .badge.freq { background: #ffffff; color: #1f3a5f; border-radius: 10px; }

/* Hard reset: keep light theme even when OS is dark */
@media (prefers-color-scheme: dark) {
  body,
  /* .task-section, */
  .task,
  .checkbox-item,
  .task-table,
  .task-row,
  .task-card .card-body,
  .modal .modal-content {
    background: var(--card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
  body { background: var(--bg) !important; }
  .modal .modal-header,
  .modal .modal-actions {
    border-color: var(--border) !important;
  }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    background: #ffffff !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
  }
}

/* Design tokens */
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --card-elevated: rgba(255,255,255,0.75);
    --text: #111827;
    --text-sec: #6b7280;
    --border: rgba(0,0,0,0.08);
    --shadow: 0 8px 24px rgba(0,0,0,0.08);
    --radius: 14px;
    --radius-lg: 18px;
    --accent: #0a84ff; /* iOS blue */
    --accent-press: #0066d6;
    --success: #34c759; /* iOS green */
    --warn: #ffcc00;   /* iOS yellow */
    --danger: #ff3b30; /* iOS red */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c10;              /* darker page bg */
    --card: #12151b;            /* darker card */
    --card-elevated: rgba(26,30,38,0.72);
    --text: #f3f4f6;            /* brighter text */
    --text-sec: #c0c4cc;        /* lighter secondary */
    --border: rgba(255,255,255,0.18); /* stronger borders */
    --shadow: 0 10px 32px rgba(0,0,0,0.7);
    --accent: #0a84ff;
    --accent-press: #3c9bff;
  }
}

/* Dark-mode component contrast tweaks */
@media (prefers-color-scheme: dark) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    background: #1b1f27;
    border-color: rgba(255,255,255,0.18);
    color: var(--text);
  }

  .task-section { background: transparent; }
  .task { background: #141924; }
  .checkbox-item { background: #151a24; }
  .modal .modal-content { background: #141821; }
  .modal .modal-header { border-bottom-color: rgba(255,255,255,0.14); }
  .modal .modal-actions { border-top-color: rgba(255,255,255,0.14); }

  /* iOS switch track darker when off */
  .checkbox-item input[type="checkbox"] { background: #2a2f39; }
}

/* Modal (centered overlay) */
.modal {
    position: fixed;
    inset: 0;
    display: none; /* toggled to flex when open */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    padding: 20px;
}

.modal .modal-content {
    background: var(--card);
    width: 100%;
    max-width: 560px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* Modal header title to match card titles */
.modal .modal-header h3 {
    margin: 0;
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
}

.modal .modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    color: var(--text);
}

.modal .modal-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Modal buttons: match task card/urgent shapes */
.modal .modal-header button,
.modal .modal-actions button {
    height: 38px;
    padding: 0 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Ghost-style for header close buttons */
.modal .modal-header button {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 6px 16px rgba(210,153,83,0.14);
}
.modal .modal-header button:hover { background: #fff7ed; }

/* Primary save button in footer: match task card complete (soft success) */
#edit-save,
#history-save {
    background: #e8f7ee;
    color: #0b2b12;
    border: 1px solid rgba(16,185,129,0.35);
    box-shadow: none;
}
#edit-save:hover,
#history-save:hover { background: #dff3e7; }

/* Footer cancel buttons use ghost style */
#edit-cancel,
#close-history {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 6px 16px rgba(210,153,83,0.14);
}
#edit-cancel:hover,
#close-history:hover { background: #fff7ed; }

.badge.priority.low { background: #e7f3ff; color: #0b5ed7; }
.badge.priority.medium { background: #fff3cd; color: #664d03; }
.badge.priority.high { background: #fde2e1; color: #b42318; }

/* Forms inside modal */
.modal .form-row {
    margin-bottom: 12px;
}
.modal .form-row label { font-weight: 600; margin-bottom: 6px; display:block; }
.modal .form-row input,
.modal .form-row select,
.modal .form-row textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* Inline validation */
.modal .form-row input.invalid,
.modal .form-row select.invalid,
.modal .form-row textarea.invalid {
    border-color: #b42318;
    background: #fde2e1;
}
.error-text {
    color: #b42318;
    font-size: 12px;
    margin-top: 6px;
    min-height: 14px;
}

/* Home Details (questionnaire) scoped styles */
.home-details { margin-top: 8px; }
.home-details .hd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

/* Questionnaire Wizard (moved from inline <style> in questionnaire.html) */
#wizard .card { background:#f8f9fa; border:1px solid #ddd; border-radius:12px; padding:26px; margin: 16px 0 22px; }
#wizard .wizard-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
#wizard .wizard-actions { display:flex; gap:10px; }
#wizard .progress { height:10px; background:#eee; border-radius:999px; overflow:hidden; margin:12px 0 22px; }
#wizard .progress > .bar { height:100%; width:0%; background:#28a745; transition: width .25s ease; }
#wizard .steps { margin-top: 10px; }
#wizard .step { display:none; }
#wizard .step.active { display:block; }
#wizard .step h2 { margin-top:0; margin-bottom:6px; }
#wizard .nav-buttons { display:flex; justify-content:space-between; gap:10px; margin-top:22px; }
#wizard .nav-buttons .left, #wizard .nav-buttons .right { display:flex; gap:10px; }
#wizard .muted { color:#555; }
#wizard .radio-group, #wizard .checkbox-group { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:14px; }
#wizard .form-group { margin: 18px 0 22px; }
#wizard .inline { display:flex; gap:10px; align-items:center; }
#wizard .inline.inline-wrap { flex-wrap:wrap; gap:14px; }
#wizard .success { text-align:center; padding:30px; }
#wizard .success h2 { color:#28a745; }
#wizard .hint { font-size: 13px; color:#666; }
#wizard label { font-weight: 600; }
#wizard .section-divider { margin: 22px 0; height: 1px; background: rgba(0,0,0,0.06); border-radius: 999px; }
#wizard .section-sub { margin: 0 0 10px; color:#6b7280; font-weight:600; font-size:14px; }
#wizard .season-selector .inline { 
    justify-content: space-between;
    & > div {
        flex: 1;
    }
 }

/* Wizard button look to match task cards */
#wizard .btn {
  display:inline-flex; align-items:center; justify-content:center;
  height:38px; padding:0 14px; border-radius:14px; font-weight:600; font-size:14px;
  border:1px solid #e5e7eb; background:#ffffff; color:#1f2937;
  box-shadow:0 6px 16px rgba(210,153,83,0.14); cursor:pointer;
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
  text-decoration:none;
}
#wizard .btn:hover { background:#fff7ed; }
#wizard .btn:active { transform:translateY(1px); }
#wizard .btn-ghost { background:#ffffff; border:1px solid rgba(0,0,0,0.06); box-shadow:0 6px 16px rgba(210,153,83,0.14); color:#1f2937; }
#wizard .btn-ghost:hover { background:#fff7ed; }
#wizard .btn-success-soft { background:#e8f7ee; border:1px solid rgba(16,185,129,0.35); color:#0b2b12; box-shadow:none; }
#wizard .btn-success-soft:hover { background:#dff3e7; }

/* Wizard option cards */
#wizard .option-cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:14px; }
#wizard .option-card { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:16px 14px; border-radius:14px; border:1px solid rgba(0,0,0,0.08); background:#ffffff; box-shadow:0 8px 22px rgba(210,153,83,0.10); cursor:pointer; transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease; text-align:center; }
#wizard .option-card:hover { background:#fffdf8; border-color: rgba(210,153,83,0.35); }
#wizard .option-card:active { transform: translateY(1px); }
#wizard .option-card .icon { width: 28px; height: 28px; color:#6b7280; }
#wizard .option-card .title { font-weight:700; color:#1f2937; }
#wizard .option-card input[type="radio"] { position:absolute; inset:0; opacity:0; pointer-events:none; }
#wizard .option-card input[type="checkbox"] { position:absolute; inset:0; opacity:0; pointer-events:none; }
#wizard .option-card.selected { border-color: rgba(16,185,129,0.45); box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }

/* Compact pill variant */
#wizard .option-cards.buttons { display:flex; flex-wrap:wrap; gap:10px; }
#wizard .option-cards.buttons .option-card { flex-direction: row; gap:8px; padding:10px 14px; border-radius:999px; box-shadow:0 6px 16px rgba(210,153,83,0.10); min-width: max-content; text-align:left; }
#wizard .option-cards.buttons .option-card .icon { width:18px; height:18px; }

/* Wizard inline error (was #saveError inline style) */
#wizard .wizard-error { display:none; margin-bottom:12px; padding:10px 12px; border-radius:10px; border:1px solid rgba(220,38,38,0.25); background:#fff1f2; color:#7f1d1d; font-weight:600; }
.home-details .hd-actions { display: flex; gap: 10px; }
.home-details .hd-actions.footer { margin-top: 14px; justify-content: flex-end; }

/* Muted, square-with-rounded-corners buttons (override pill globals) */
.home-details .hd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px; /* square-ish */
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.home-details .hd-btn:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
}
.home-details .hd-btn.primary {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.home-details .hd-btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
}
.home-details .hd-btn.ghost {
  background: #ffffff;
}
.home-details .hd-btn.ghost:hover { background: #fff7ed; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    /* Warm gold/peach gradient background */
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, select, textarea {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.container {
    max-width: 1148px;
    margin: 0 auto;
    padding: 24px;
    padding-top: calc(2px + env(safe-area-inset-top));
}

.auth-section {
    background: var(--card);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 50px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab-button {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
}

.tab-button.active {display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 12px; /* square-ish */
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text);
}

input[type="text"], 
input[type="email"], 
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--card);
    color: var(--text);
}

/* Global button baseline: match task-card shape & neutral ghost style */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 6px 16px rgba(210,153,83,0.14);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    text-decoration: none;
}
button:hover,
.btn:hover { background: #fff7ed; }
button:active,
.btn:active { transform: translateY(1px); }

/* Utility variants */
.btn-ghost { background: #ffffff; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 6px 16px rgba(210,153,83,0.14); color: #1f2937; text-decoration: none; }
.btn-ghost:hover { background: #fff7ed; }

.btn-success-soft { background: #e8f7ee; border: 1px solid rgba(16,185,129,0.35); color: #0b2b12; box-shadow: none; }
.btn-success-soft:hover { background: #dff3e7; }

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--card-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.nav button { margin-left: 10px; }

h1, h2 { color: var(--text); margin-bottom: 20px; }
/* Section titles match panel-title aesthetics */
.task-section > h2 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-sec, #80806b);
    font-weight: 600;
}

.task-section {
    /* Neutral wrapper; inner .panel-card controls visuals */
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

/* Task sections use default .panel-card styling to match overview */

.task {
    border: 1px solid var(--border);
    padding: 16px;
    margin: 12px 0;
    border-radius: var(--radius);
    background: var(--card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.task.overdue {
    border-left: 4px solid var(--danger);
    background: color-mix(in srgb, var(--danger) 6%, var(--card));
}

.task.upcoming {
    border-left: 4px solid var(--warn);
}

.task.future {
    border-left: 4px solid #9ca3af;
}

.task.completed {
    border-left: 4px solid var(--success);
    opacity: 0.7;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 700;
    margin-bottom: 5px;
}

.task-description {
    color: var(--text-sec);
    font-size: 14px;
    margin-bottom: 5px;
}

.task-date {
    font-size: 12px;
    color: #9ca3af;
}

.task-actions {
    display: flex;
    gap: 10px;
}

.task-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

.complete-btn {
  background-color: #e8f7ee;
  color: #0b2b12;
  border: 1px solid rgba(16,185,129,0.35);
  box-shadow: none;
}
.complete-btn:hover { background-color: #dff3e7; }

.reset-btn { background-color: var(--warn); color: #111827; }

.reset-btn:hover { background-color: #e6b400; }

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.checkbox-item label {
    font-weight: 600;
    color: var(--text);
    order: 1;
    margin-right: 12px;
}

/* iOS-style switch */
.checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #e9e9ec;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.12);
    transition: background 0.2s ease;
    order: 2;
}
.checkbox-item input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}
.checkbox-item input[type="checkbox"]:checked { background: var(--accent); }
.checkbox-item input[type="checkbox"]:checked::after { transform: translateX(20px); }

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    max-width: 400px;
}

.flash-message {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-in forwards;
}

.flash-message .flash-text { flex: 1 1 auto; }
.flash-message .flash-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 1; } /* default stay; JS will remove element */
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Catalog CSV Panel */
.catalog-panel {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.catalog-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.catalog-controls .inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.catalog-results {
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 6px;
    padding: 12px;
    max-height: 320px;
    overflow: auto;
    font-size: 14px;
}

.issues .issue-row { padding: 8px 0; border-bottom: 1px dashed #e5e5e5; }
.issues .issue-row:last-child { border-bottom: none; }
.issues .issue-head { font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.issues .issue-list { margin-left: 18px; color: #7a7a7a; }

.preview .preview-row { padding: 4px 0; color: #333; }
.dim { color: #6c757d; }
.badge { display: inline-block; padding: 2px 6px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-size: 12px; }
.link { color: #0b5ed7; text-decoration: none; }
.link:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    /* Reduce spacing on mobile */
    .task-section {
        margin-bottom: 16px;
    }
    
    .panel-card {
        padding: 16px;
    }
    
    .panel-title {
        font-size: 18px;
    }
    
    /* Make overview tiles stack on mobile */
    .overview-tiles {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Task cards more compact */
    .task-card {
        padding: 12px;
    }
    
    .task-card .title {
        font-size: 15px;
    }
    
    .task-card .desc {
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 12px;
    }
    
    .nav {
        flex-direction: column;
        gap: 10px;
    }
    
    .task {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .task-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }
}

/* FINAL last-wins light theme enforcement */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #f5f7fb !important;
    --card: #ffffff !important;
    --card-elevated: rgba(255,255,255,0.75) !important;
    --text: #111827 !important;
    --text-sec: #6b7280 !important;
    --border: rgba(0,0,0,0.08) !important;
    --shadow: 0 8px 24px rgba(0,0,0,0.08) !important;
    --accent: #0a84ff !important;
    --accent-press: #0066d6 !important;
    --success: #34c759 !important;
    --warn: #ffcc00 !important;
    --danger: #ff3b30 !important;
  }

  body { background: var(--bg) !important; color: var(--text) !important; }
.task, .checkbox-item, .task-table, .task-row, .task-card .card-body,
  .modal .modal-content { background: var(--card) !important; color: var(--text) !important; border-color: var(--border) !important; }
  .modal .modal-header, .modal .modal-actions { border-color: var(--border) !important; }

  /* Reset components that had dark-specific styles */
  .task-row:hover { background: color-mix(in srgb, var(--accent) 4%, var(--card)) !important; }
  .pill { background: color-mix(in srgb, var(--cambridge-blue) 28%, transparent) !important; color: var(--raisin-black) !important; border-radius: 10px; }
  .pill.high { background: color-mix(in srgb, var(--persian-red) 28%, transparent) !important; color: var(--raisin-black) !important; border-radius: 10px; }
  .pill.medium { background: color-mix(in srgb, var(--goldenrod) 28%, transparent) !important; color: var(--raisin-black) !important; border-radius: 10px; }
  .pill.low { background: color-mix(in srgb, var(--cambridge-blue) 28%, transparent) !important; color: var(--raisin-black) !important; border-radius: 10px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
    background: #ffffff !important; color: var(--text) !important; border-color: var(--border) !important;
  }
}

/* Ultimate page background override (last-wins) */
:root { --page-bg: var(--floral-white); }
html, body { background: var(--page-bg) !important; }
@media (prefers-color-scheme: dark) {
  html, body { background: var(--page-bg) !important; }
}

.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    fill: currentColor; /* inherit text color */
  }

/* ===== LOADING STATES ===== */
.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
}

.loader-content {
  position: relative;
  background: white;
  padding: 32px 48px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid #f3f4f6;
  border-top-color: var(--goldenrod);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  color: var(--raisin-black);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

/* Inline spinner for buttons */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* Loading state for sections */
.section-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #6b7280;
}

.section-loading .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
  margin-bottom: 12px;
}

.section-loading p {
  font-size: 14px;
  margin: 0;
}

/* ===== EMPTY STATES ===== */
.empty-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  min-height: 300px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  color: #d1d5db;
}

.empty-state-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--raisin-black);
  margin: 0 0 8px 0;
}

.empty-state-description {
  font-size: 15px;
  color: #6b7280;
  margin: 0 0 24px 0;
  max-width: 400px;
  line-height: 1.6;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Compact empty state for smaller sections */
.empty-state-compact {
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  font-style: italic;
}

.empty-state-compact svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}