/* ============================================================ tokens
   Gradus brand palette:
     Midnight Navy #0A1F3D · Charcoal Slate #1F2937 · Accent Teal #3B7A89
     Deep Blue Gray #334155 · Light Neutral #E2E8F0
   Status colours (red / amber / green) keep their meaning everywhere (PRD §43). */
:root {
  --navy: #0A1F3D;
  --navy-2: #12294B;
  --charcoal: #1F2937;
  --teal: #3B7A89;
  --slate: #334155;
  --neutral: #E2E8F0;

  --bg: #EEF2F6;
  --surface: #ffffff;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0A1F3D;
  --text-2: #475569;
  --text-3: #64748B;
  --brand: #3B7A89;
  --brand-hover: #2F6573;
  --brand-soft: #E3F0F3;
  --brand-text: #2F6573;

  /* Navigation chrome is always Midnight Navy, in both themes. */
  --side-bg: #0A1F3D;
  --side-text: #B8C4D6;
  --side-text-strong: #F1F5F9;
  --side-hover: rgba(226, 232, 240, .08);
  --side-active: rgba(59, 122, 137, .28);
  --side-border: rgba(226, 232, 240, .1);

  --red: #C62828;      --red-soft: #FDECEC;   --red-border: #F3C2C2;
  --amber: #A85D00;    --amber-soft: #FFF4E0; --amber-border: #F6D9A6;
  --green: #1E7A46;    --green-soft: #E6F5EC; --green-border: #B6E0C6;
  --blue: #2F6573;     --blue-soft: #E3F0F3;  --blue-border: #B5D5DD;
  --purple: #5B4BB0;   --purple-soft: #EEEBFA;
  --neutral-soft: #EEF2F6;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(10, 31, 61, .05), 0 1px 3px rgba(10, 31, 61, .07);
  --shadow-lg: 0 12px 32px rgba(10, 31, 61, .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06152B;
    --surface: #0A1F3D;
    --surface-2: #12294B;
    --border: #22385A;
    --border-strong: #334155;
    --text: #E2E8F0;
    --text-2: #A9B6C8;
    --text-3: #7C8BA1;
    --brand: #3B7A89;
    --brand-hover: #47909F;
    --brand-soft: #123844;
    --brand-text: #6FBCCB;
    --side-bg: #06152B;
    --side-border: rgba(226, 232, 240, .08);
    --red: #F17171;    --red-soft: #3A1D27;   --red-border: #5C2A33;
    --amber: #F0B45B;  --amber-soft: #3A2C14; --amber-border: #5A4320;
    --green: #5FCF8E;  --green-soft: #12302A; --green-border: #22503A;
    --blue: #6FBCCB;   --blue-soft: #123844;  --blue-border: #1E5463;
    --purple: #B4A6F2; --purple-soft: #261F45;
    --neutral-soft: #12294B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body.modal-open { overflow: hidden; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .6rem; }
p { margin: .4rem 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; word-break: break-word; }
.red { color: var(--red); }
.ok { color: var(--green); font-weight: 700; }
.k { color: var(--text-2); font-size: .82rem; }
.req { color: var(--red); font-weight: 600; }
.spacer { flex: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ============================================================ layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand-name { font-weight: 700; }
.sidebar .brand-name { color: var(--side-text-strong); }
.sidebar .brand .muted { color: var(--side-text); }
.logo { width: 36px; height: 36px; flex-shrink: 0; display: block; }
.wordmark { font-weight: 800; letter-spacing: -.02em; }
.new-task { margin: 0 4px 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text-strong); text-decoration: none; }
.nav-item.active { background: var(--side-active); color: var(--side-text-strong); border-left-color: var(--teal); }
.nav-item.active .ic { color: #7FC6D4; }
.ic { width: 19px; height: 19px; flex-shrink: 0; }
.badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
}
.sidebar-foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--side-border); color: var(--side-text-strong); display: flex; align-items: center; gap: 8px; }
.me { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.sidebar-foot .muted { color: var(--side-text); }
.sidebar-foot .icon-btn { color: var(--side-text); }
.sidebar-foot .icon-btn:hover { background: var(--side-hover); color: var(--side-text-strong); }
.me-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
main { padding: 28px 32px 64px; max-width: 1280px; width: 100%; outline: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--side-bg); color: var(--side-text-strong);
    border-bottom: 1px solid var(--side-border); position: sticky; top: 0; z-index: 30;
  }
  .topbar .brand-name { flex: 1; }
  .topbar .icon-btn { color: var(--side-text); }
  .topbar .logo { width: 28px; height: 28px; }
  .notif-btn { position: relative; }
  .notif-btn .badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; font-size: .68rem; }
  main { padding: 18px 16px 48px; }
  h1 { font-size: 1.35rem; }
}

/* ============================================================ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn .ic { width: 17px; height: 17px; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.08); background: var(--green); }
.btn-warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--red); }
.btn-ghost-danger { color: var(--red); border-color: var(--red-border); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand); }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 600; font-size: .88rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.inline { display: flex; gap: 8px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-2); white-space: nowrap; }
.inline-label input { width: auto; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type=number] { width: 80px; }
.hint { font-size: .84rem; color: var(--text-2); margin: 4px 0 12px; }
.hint.warn { color: var(--amber); }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-weight: 500; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 8px; font-weight: 600; font-size: .88rem; }
.seg input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.prio-seg input:checked + .p-low { background: var(--neutral-soft); border-color: var(--text-3); color: var(--text); }
.prio-seg input:checked + .p-high { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.prio-seg input:checked + .p-urgent { background: var(--red); border-color: var(--red); color: #fff; }

/* ============================================================ chips & pills */
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; line-height: 1.5;
}
.prio-low { background: var(--neutral-soft); color: var(--text-2); }
.prio-medium { background: var(--blue-soft); color: var(--blue); }
.prio-high { background: var(--amber-soft); color: var(--amber); }
.prio-urgent { background: var(--red); color: #fff; }
.status-assigned { background: var(--neutral-soft); color: var(--text); }
.status-not_started { background: var(--neutral-soft); color: var(--text-2); }
.status-in_progress { background: var(--blue-soft); color: var(--blue); }
.status-blocked { background: var(--red-soft); color: var(--red); }
.status-submitted { background: var(--purple-soft); color: var(--purple); }
.status-completed { background: var(--green-soft); color: var(--green); }
.status-cancelled { background: var(--neutral-soft); color: var(--text-3); text-decoration: line-through; }
.warn-red { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.warn-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.warn-green { background: var(--green-soft); color: var(--green); }
.warn-blue { background: var(--blue-soft); color: var(--blue); }
.warn-neutral { background: var(--neutral-soft); color: var(--text-2); }
.chip.type { background: transparent; border: 1px solid var(--border-strong); }
.chip.lead { background: var(--brand-soft); color: var(--brand-text); }
.role-admin { background: var(--purple-soft); color: var(--purple); }
.role-manager { background: var(--blue-soft); color: var(--blue); }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 6px; }
.pill { font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; }
.pill-red { background: var(--red-soft); color: var(--red); font-weight: 600; }
.pill-amber { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.pill-blue { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); font-size: .75rem; color: var(--text-2); text-align: center; }

.avatar {
  --h: 220; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  background: hsl(var(--h) 60% 90%); color: hsl(var(--h) 55% 30%); font-weight: 700; font-size: .78rem;
}
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 35% 26%); color: hsl(var(--h) 70% 85%); } }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

.progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress-track { flex: 1; height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--brand); border-radius: 99px; }
.progress-fill.done { background: var(--green); }
.progress-label { font-size: .8rem; font-weight: 600; color: var(--text-2); min-width: 34px; text-align: right; }

/* ============================================================ page structure */
.page-head { margin-bottom: 20px; }
.page-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.section { margin: 28px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2, .section-head h3 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-blue { border-color: var(--blue-border); background: var(--blue-soft); }
.crumbs { font-size: .85rem; color: var(--text-2); margin-bottom: 10px; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.loading { display: flex; gap: 10px; align-items: center; color: var(--text-2); padding: 40px 0; justify-content: center; }
.loading.boot { min-height: 100vh; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { padding: 12px 14px; border-radius: var(--radius); margin: 12px 0; border: 1px solid; }
.banner-amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 12px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 9px 14px; color: var(--text-2); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand-text); border-bottom-color: var(--brand); }

/* ============================================================ dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat-grid.compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 16px 0; }
.stat {
  display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong); color: var(--text); box-shadow: var(--shadow);
}
a.stat:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.stat-n { font-size: 1.7rem; font-weight: 750; line-height: 1.1; }
.stat-l { font-size: .82rem; color: var(--text-2); font-weight: 500; }
.stat-red { border-left-color: var(--red); } .stat-red .stat-n { color: var(--red); }
.stat-amber { border-left-color: var(--amber); } .stat-amber .stat-n { color: var(--amber); }
.stat-blue { border-left-color: var(--blue); } .stat-blue .stat-n { color: var(--blue); }
.stat-green { border-left-color: var(--green); } .stat-green .stat-n { color: var(--green); }
.stat-neutral { border-left-color: var(--text-3); }
.stat-zero .stat-n { color: var(--text-3); }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att a {
  display: grid; grid-template-columns: minmax(140px, .9fr) minmax(0, 1.3fr) minmax(0, 1.3fr); gap: 4px 14px; align-items: center;
  padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
}
.att a:hover { text-decoration: none; border-color: var(--border-strong); }
.att-red a { border-left-color: var(--red); }
.att-amber a { border-left-color: var(--amber); }
.att-blue a { border-left-color: var(--blue); }
.att-who { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.att-task { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.att-why { font-weight: 600; font-size: .9rem; }
.att-red .att-why { color: var(--red); }
.att-amber .att-why { color: var(--amber); }
.att-blue .att-why { color: var(--blue); }
@media (max-width: 700px) { .att a { grid-template-columns: 1fr; } }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.person {
  display: block; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
}
.person:hover { text-decoration: none; border-color: var(--brand); }
.person-head { display: flex; gap: 10px; align-items: center; }
.person-name { font-weight: 650; }
.person-hero { display: flex; gap: 14px; align-items: center; margin: 8px 0 12px; }
.person-hero h1, .person-hero h2 { margin: 0; }

/* ============================================================ task cards & rows */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card-list { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 420px) { .card-grid { grid-template-columns: 1fr; } }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow);
}
.task-card.lvl-red { border-left-color: var(--red); }
.task-card.lvl-amber { border-left-color: var(--amber); }
.task-card.lvl-green { border-left-color: var(--green); }
.task-card.lvl-blue { border-left-color: var(--purple); }
.task-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.task-title { font-weight: 650; color: var(--text); font-size: 1rem; }
.task-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 2px 14px; font-size: .86rem; }
.task-meta .k { margin-right: 4px; }
.task-card-foot { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.task-card-foot .progress { flex: 1; max-width: 240px; }
.task-card-actions { display: flex; gap: 6px; align-items: center; }
.need { display: flex; flex-direction: column; gap: 6px; }
.need-reasons { display: flex; flex-wrap: wrap; gap: 6px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
}
.task-row:hover { text-decoration: none; border-color: var(--brand); }
.task-row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-row-title { font-weight: 650; }
.task-row-sub { font-size: .84rem; }
.task-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; min-width: 170px; }
.task-row-date { font-size: .84rem; color: var(--text-2); }
@media (max-width: 640px) {
  .task-row { flex-direction: column; align-items: stretch; }
  .task-row-side { align-items: stretch; min-width: 0; }
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.filters select, .filters input { width: auto; }
.filters .grow { flex: 1 1 220px; }
@media (max-width: 600px) { .filters select, .filters .inline-label { flex: 1 1 45%; } .filters .inline-label input { flex: 1; } }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.qchip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); padding: 4px 11px; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.qchip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============================================================ task detail */
.task-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.task-head-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.task-head-progress { width: 240px; padding-top: 8px; }
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1280px) { .overview { grid-template-columns: 1fr; } .ov-side { position: static; } }
@media (max-width: 700px) { .task-head-progress { width: 100%; } }
.ov-side { position: sticky; top: 16px; }
.fact { padding: 8px 0; border-bottom: 1px solid var(--border); }
.fact:last-child { border-bottom: 0; }
.fact .v { font-weight: 500; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .76rem; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.removed { opacity: .55; }
.who { display: flex; gap: 8px; align-items: center; }
.copies { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.copies li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.updates { display: flex; flex-direction: column; gap: 10px; }
.update { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 12px 16px; }
.update-blocked { border-left-color: var(--red); }
.update-completion { border-left-color: var(--purple); }
.update header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.update dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: .9rem; }
.update dt { color: var(--text-2); font-weight: 600; font-size: .82rem; padding-top: 1px; }
.update dd { margin: 0; }
.panel .update { box-shadow: none; }
@media (max-width: 520px) { .update dl { grid-template-columns: 1fr; } }

.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 8px 12px; max-width: 680px; }
.comment.mine .bubble { background: var(--brand-soft); border-color: var(--blue-border); }
.comment-head { margin-bottom: 2px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
@media (max-width: 520px) { .comment-form { flex-direction: column; align-items: stretch; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-day { font-weight: 700; font-size: .85rem; color: var(--text-2); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.tl-day:first-child { margin-top: 0; }
.tl { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 8px 0 8px 0; border-left: 2px solid var(--border); margin-left: 6px; padding-left: 14px; position: relative; }
.tl::before { content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--bg); }
.tl-time { color: var(--text-2); font-size: .82rem; padding-top: 2px; white-space: nowrap; }
.tl-body { font-size: .92rem; min-width: 0; word-break: break-word; }
.tl-blocker_reported::before, .tl-task_cancelled::before { background: var(--red); }
.tl-completion_approved::before, .tl-acknowledged::before { background: var(--green); }
.tl-completion_submitted::before { background: var(--purple); }
.tl-task_reopened::before, .tl-deadline_changed::before { background: var(--amber); }
.tl-progress_update::before { background: var(--blue); }
.change { font-size: .85rem; color: var(--text-2); margin-top: 2px; }
.change s { color: var(--text-3); }
.change summary { cursor: pointer; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
@media (max-width: 520px) { .tl { grid-template-columns: 1fr; gap: 0; } .diff { grid-template-columns: 1fr; } }

/* ============================================================ create form */
.create-form { max-width: 860px; }
.type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 700px) { .type-cards { grid-template-columns: 1fr; } }
.type-card { position: relative; cursor: pointer; }
.type-card input { position: absolute; opacity: 0; }
.type-card span { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); height: 100%; }
.type-card small { color: var(--text-2); font-size: .82rem; }
.type-card input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.type-card input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.assignee-search { margin-bottom: 8px; }
.assignee-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; padding: 2px; margin-bottom: 12px; }
.assignee { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.assignee:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.assignee span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.assignee small { font-size: .76rem; }
.sub-row { display: grid; grid-template-columns: 1fr 180px 210px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 700px) { .sub-row { grid-template-columns: 1fr 34px; } .sub-row select, .sub-row input[type=datetime-local] { grid-column: 1; } }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); justify-content: flex-end; }

/* ============================================================ team & org tree */
.tree { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px calc(var(--d) * 26px + 6px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tree-node.inactive > .tree-row { opacity: .55; }
.tree-toggle { width: 24px; height: 24px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); border-radius: 4px; transition: transform .15s; }
.tree-toggle[aria-expanded=true] { transform: rotate(90deg); }
.tree-toggle-sp { width: 24px; flex-shrink: 0; }
.tree-person { display: flex; gap: 8px; align-items: center; color: var(--text); flex: 1 1 220px; min-width: 0; }
.tree-stats { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
@media (max-width: 600px) { .tree-row { padding-left: calc(var(--d) * 14px + 4px); } .tree-stats { padding-left: 32px; } }
.org-log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }

/* ============================================================ notifications, approvals, misc */
.notifs { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.notif a { display: flex; gap: 12px; padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--border); }
.notif:last-child a { border-bottom: 0; }
.notif a:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread a { background: var(--brand-soft); font-weight: 500; }
.n-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; background: transparent; }
.notif.unread .n-dot { background: var(--brand); }
.n-update_overdue.unread .n-dot, .n-task_overdue.unread .n-dot, .n-blocker.unread .n-dot { background: var(--red); }
.approval blockquote { margin: 10px 0; padding: 10px 14px; background: var(--surface-2); border-left: 3px solid var(--purple); border-radius: 6px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .profile-grid { grid-template-columns: 1fr; } }
.settings-form { max-width: 820px; }

/* ============================================================ login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 15% 0%, #16365E 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(59, 122, 137, .25) 0%, transparent 60%), var(--navy);
}
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 4px 0 22px; }
.login-brand img { width: 64px; height: 64px; }
.login-brand .wordmark { font-size: 1.9rem; line-height: 1.1; color: var(--text); }
.login-brand .tagline { color: var(--text-2); font-size: .88rem; }
.demo { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.demo-head { display: flex; flex-direction: column; margin-bottom: 10px; }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 400px) { .demo-users { grid-template-columns: 1fr; } }
.demo-user { display: flex; gap: 8px; align-items: center; text-align: left; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.demo-user:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-user span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; font-size: .86rem; }
.demo-user small { color: var(--text-2); font-size: .74rem; }

/* ============================================================ modal & toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 100; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-sub { margin: 0 0 12px; }
.modal-body { padding: 14px 20px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
@media (max-width: 520px) { .modal-backdrop { place-items: end center; padding: 0; } .modal { border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; } }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); transition: opacity .3s, transform .3s; }
.toast-error { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ============================================================ signup & onboarding */
.login-note { margin: 14px 0 0; }
.signup-cta { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .9rem; text-align: center; }
.signup-title { font-size: 1.25rem; margin-top: 4px; }
.share-text { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.forgot-link { text-align: right; margin-top: 10px; font-size: .88rem; }
.banner-ok { background: var(--green-soft); border-color: var(--green-border); color: var(--text); }
.platform-table td { vertical-align: top; }
