/*
 * Palette pulled from the Perform[cb] marketing site (screenshot shared
 * 2026-09-04): coral-red logo mark as the "focus" accent, teal/cyan as
 * the secondary action color, soft mint-tinted background instead of
 * flat white, pill-shaped nav/buttons. Approximated by eye from the
 * screenshot, not sampled pixel values — close enough for an internal
 * tool, not a pixel-perfect brand-guideline match.
 */
:root {
  --coral: #ee5a36;
  --coral-dark: #d9481f;
  --teal: #2bb8c4;
  --teal-dark: #1f97a2;
  --teal-light: #8fdce3;
  --ink: #26313a;
  --ink-soft: #5b6b74;
  --bg-mint: #eafafb;
  --card: #ffffff;
  --border: #e2eef0;
  --danger: #d9481f;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 1.5rem 2rem 3rem;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, #e3f7f8 0%, transparent 45%),
    radial-gradient(circle at 100% 20%, #eef9ee 0%, transparent 40%),
    var(--bg-mint);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--card);
  border-radius: 999px;
  padding: 0.75rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 18px rgba(38, 49, 58, 0.08);
}

header h1 { margin: 0; font-size: 1.15rem; }
header h1 a {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
header h1 a::before {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-dark) 100%);
}

#tabs { display: flex; gap: 0.4rem; flex: 1; }
#tabs a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9rem;
}
#tabs a.active {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
}

#refreshArea { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--ink-soft); }
#refreshBtn {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 500;
  cursor: pointer;
}
#refreshBtn:hover { background: var(--teal); color: #fff; }
#refreshBtn:disabled { opacity: 0.6; cursor: default; background: #fff; color: var(--teal-dark); }

#who { font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }
#who a { color: var(--teal-dark); }

.button {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-dark) 100%);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(238, 90, 54, 0.35);
}

/*
 * "Your tasks" banner — persistent across pages (see app.js loadMyTasks).
 * Coral accent, not teal: this is the one piece of the app that's about
 * the signed-in viewer's own action items rather than status browsing, so
 * it gets the "focus" brand color, matching your note on the logo.
 */
.my-tasks-banner {
  background: #fff5f1;
  border: 1px solid #f6c9b7;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.my-tasks-banner summary {
  cursor: pointer;
  padding: 0.85rem 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--coral-dark);
}
.my-tasks-banner summary::-webkit-details-marker { display: none; }
.my-tasks-banner summary::marker { content: none; }
.my-tasks-banner table { margin: 0; border-radius: 0; box-shadow: none; }
.my-tasks-banner td a { color: var(--teal-dark); }

/*
 * "Team tasks" banner — same shape as "Your tasks", but teal (the app's
 * status-browsing color) rather than coral, so the viewer's own action
 * items stay the one thing on the page in the "focus" color.
 */
.team-tasks-banner { background: #f0fafb; border-color: #bfe7eb; }
.team-tasks-banner summary { color: var(--teal-dark); }
.unassigned { color: var(--ink-soft); font-style: italic; }

/* Tile grid */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.tile {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(38, 49, 58, 0.05);
  transition: box-shadow 0.15s, transform 0.15s;
}
.tile:hover { box-shadow: 0 8px 20px rgba(38, 49, 58, 0.12); transform: translateY(-2px); }
.tile-name { font-weight: 600; margin-bottom: 0.5rem; color: var(--ink); }
.badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.badge { font-size: 0.72rem; background: #eef4f5; color: var(--ink-soft); border-radius: 999px; padding: 0.15rem 0.55rem; font-weight: 500; }
.progress-bar { background: #e7f2f3; border-radius: 999px; height: 6px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill { background: linear-gradient(90deg, var(--teal-light), var(--teal)); height: 100%; }
.tile-stats { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: var(--ink-soft); }
.overdue-badge { background: #fdeae3; color: var(--danger); border-radius: 999px; padding: 0.1rem 0.55rem; font-weight: 600; font-size: 0.75rem; }
.tile-next-due { font-size: 0.78rem; color: #8a97a0; margin-top: 0.4rem; }

/* Detail view */
#backLink { display: inline-block; margin-bottom: 1rem; color: var(--teal-dark); text-decoration: none; font-weight: 500; }
#detailName { color: var(--ink); }
table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); }
th { color: var(--ink-soft); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr.overdue td { color: var(--danger); font-weight: 600; }
tr.done td { color: #9aa7ae; text-decoration: line-through; }
tr.done input[type="checkbox"] { text-decoration: none; }
td a { color: var(--teal-dark); font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/*
 * Expandable department/phase sections on the detail page — a card grid
 * (same visual language as the overview tiles), each expanding in place,
 * rather than one full-width bar per section (that read as ugly/wasteful
 * for sections with only 1-2 tasks in them — most of them, in practice).
 */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start; /* don't stretch short collapsed cards to match a tall expanded neighbor */
}
.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(38, 49, 58, 0.05);
}
.section[open] { grid-column: span 2; } /* expanded cards get more room for the task table */

/*
 * Per-group tint, computed (not eyeballed) from the dataviz skill's
 * validated 8-hue categorical palette (references/palette.md), mixed to
 * a light pastel (12% hue / 88% white) for the card background and a
 * slightly deeper mix (35% hue) for the left accent border — full-strength
 * slot colors would be too loud for a card background. Text always stays
 * in the standard ink color (never the tint hue) — color here is a
 * wayfinding cue alongside the always-present text label, not the sole
 * way to tell sections apart. Fixed order across the whole app: IT/
 * Accounting/Finance/Marketing/Culture (ONOFF departments, appear on both
 * the onboarding and offboarding pages) get slots 1-5; PREOFF/POSTO/BEN
 * (POT phases, offboarding-only) get slots 6-8. POPS (ECT, onboarding-only)
 * never appears alongside the POT phases, so it reuses the app's own teal
 * rather than a categorical slot — it's a structurally different kind of
 * bucket (one whole project) than a department/phase breakdown anyway.
 */
.section { border-left: 4px solid transparent; }
.group-it            { background: #e5effa; border-left-color: #b4d0f1; }
.group-accounting     { background: #fdede7; border-left-color: #f8cab8; }
.group-finance         { background: #e4f5ef; border-left-color: #afe3d0; }
.group-marketing      { background: #fdf4e0; border-left-color: #f9dea6; }
.group-culture        { background: #fceff4; border-left-color: #f7d1df; }
.group-preoff          { background: #e0f0e0; border-left-color: #a6d4a6; }
.group-posto           { background: #e9e7f4; border-left-color: #c0bae0; }
.group-ben              { background: #fce9e9; border-left-color: #f5bfbf; }
.group-pops            { background: #e6f6f8; border-left-color: #b5e6ea; }
.group-general, .group-other { background: #f4f4f2; border-left-color: #dcdcd6; }

/* Locked placeholder (POPS data, viewer lacks POPS access) — visible so
   its absence doesn't look like a bug, but plainly non-interactive: no
   cursor pointer, no expand affordance, no stats. */
.section-locked {
  background: #f4f4f2;
  border-left-color: #dcdcd6;
  padding: 1rem 1.1rem;
  color: var(--ink-soft);
}
.section-locked .section-label { color: var(--ink-soft); margin-bottom: 0.3rem; }
.section-locked-note { font-size: 0.8rem; }
.lock-icon { font-size: 0.85rem; }
.section summary {
  cursor: pointer;
  padding: 1rem 1.1rem;
  list-style: none;
}
.section summary::-webkit-details-marker { display: none; }
.section summary::marker { content: none; }
.section-label {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chevron::before { content: "+"; color: var(--teal-dark); font-weight: 700; }
.section[open] .chevron::before { content: "\2212"; } /* minus sign */
.section .progress-bar { margin-bottom: 0.5rem; }
.section-stats { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: var(--ink-soft); }
.section table { margin: 0; border-radius: 0; box-shadow: none; font-size: 0.85rem; }
.section table th:first-child, .section table td:first-child { width: 2rem; }

@media (max-width: 640px) {
  .section[open] { grid-column: span 1; } /* single column on narrow screens anyway */
}

#errorState { color: var(--danger); }

/* Settings gear + dropdown (holds the manual notification test -- see
   index.html's comment above #settingsBtn). */
#refreshArea { position: relative; }
#settingsBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
}
#settingsBtn:hover, #settingsBtn[aria-expanded="true"] { border-color: var(--teal); color: var(--teal-dark); }
.settings-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 10;
  width: 15rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(38, 49, 58, 0.16);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--ink);
}
.settings-menu[hidden] { display: none; }
.settings-menu-title { font-weight: 600; }
.settings-menu-note { margin: 0; color: var(--ink-soft); font-size: 0.78rem; }
.settings-menu label { display: flex; flex-direction: column; gap: 0.2rem; color: var(--ink-soft); font-size: 0.78rem; }
.settings-menu select { font: inherit; font-size: 0.85rem; color: var(--ink); padding: 0.25rem 0.3rem; }
#testNotifBtn {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
#testNotifBtn:hover { background: var(--teal); color: #fff; }
#testNotifBtn:disabled { opacity: 0.6; cursor: default; background: #fff; color: var(--teal-dark); }
#testNotifResult { font-size: 0.78rem; color: var(--ink-soft); }
#testNotifResult:empty { display: none; }
