/* ==========================================================================
   OKR Tracker — "Refined & Warm" design system
   Editorial, premium, calm. Light + dark, theme-aware.
   ========================================================================== */

:root {
  --bg: #f4f2ec;
  --bg-tint: #ece8de;
  --surface: #fffefb;
  --surface-2: #faf8f2;
  --surface-hover: #f6f3ec;
  --border: #e7e2d6;
  --border-strong: #d8d1c1;
  --track: #e6e1d4;
  --ink: #23262f;
  --ink-2: #5a616f;
  --ink-3: #8b8f9c;
  --brand: #3f49bf;
  --brand-hover: #333ca6;
  --brand-050: #eef0fb;
  --brand-100: #e2e5f7;
  --on-brand: #ffffff;
  --ok: #1f7a54;      --ok-bg: #e7f3ec;   --ok-border: #c2e2d0;
  --warn: #a5680f;    --warn-bg: #f9efd8;  --warn-border: #ecd3a0;
  --risk: #b23a30;    --risk-bg: #f8e7e3;  --risk-border: #eec3bb;
  --danger: #b23a30;  --danger-hover: #98322a;
  --shadow-sm: 0 1px 2px rgba(46, 38, 22, .05);
  --shadow: 0 1px 3px rgba(46, 38, 22, .07), 0 1px 2px rgba(46, 38, 22, .04);
  --shadow-md: 0 6px 16px -8px rgba(46, 38, 22, .18), 0 2px 6px -2px rgba(46, 38, 22, .10);
  --shadow-lg: 0 24px 48px -24px rgba(46, 38, 22, .30);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --sidebar-w: 254px;
  --font-ui: "Poppins", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: "Poppins", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Dark palette — applied on an explicit choice, or by OS when no choice is forced. */
:root[data-theme="dark"] {
  --bg: #14151a;
  --bg-tint: #191a20;
  --surface: #1d1f27;
  --surface-2: #23252e;
  --surface-hover: #262935;
  --border: #2f323d;
  --border-strong: #3b3f4c;
  --track: #2b2e39;
  --ink: #eef0f5;
  --ink-2: #aab0be;
  --ink-3: #7b8290;
  --brand: #8b93ff;
  --brand-hover: #a1a8ff;
  --brand-050: rgba(139, 147, 255, .12);
  --brand-100: rgba(139, 147, 255, .20);
  --on-brand: #14151a;
  --ok: #57cf92;      --ok-bg: rgba(87, 207, 146, .13);  --ok-border: rgba(87, 207, 146, .30);
  --warn: #e2ad57;    --warn-bg: rgba(226, 173, 87, .13); --warn-border: rgba(226, 173, 87, .30);
  --risk: #f08b7f;    --risk-bg: rgba(240, 139, 127, .13); --risk-border: rgba(240, 139, 127, .30);
  --danger: #f08b7f;  --danger-hover: #f4a094;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 20px -10px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, .8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #14151a;
    --bg-tint: #191a20;
    --surface: #1d1f27;
    --surface-2: #23252e;
    --surface-hover: #262935;
    --border: #2f323d;
    --border-strong: #3b3f4c;
    --track: #2b2e39;
    --ink: #eef0f5;
    --ink-2: #aab0be;
    --ink-3: #7b8290;
    --brand: #8b93ff;
    --brand-hover: #a1a8ff;
    --brand-050: rgba(139, 147, 255, .12);
    --brand-100: rgba(139, 147, 255, .20);
    --on-brand: #14151a;
    --ok: #57cf92;      --ok-bg: rgba(87, 207, 146, .13);  --ok-border: rgba(87, 207, 146, .30);
    --warn: #e2ad57;    --warn-bg: rgba(226, 173, 87, .13); --warn-border: rgba(226, 173, 87, .30);
    --risk: #f08b7f;    --risk-bg: rgba(240, 139, 127, .13); --risk-border: rgba(240, 139, 127, .30);
    --danger: #f08b7f;  --danger-hover: #f4a094;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 20px -10px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 100% -5%, var(--bg-tint), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-tint), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
p { margin: 0; }

::selection { background: var(--brand-100); color: var(--ink); }

/* ------------------------------------------------------------------ shell */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-right: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 20px;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600; font-size: 21px; letter-spacing: -.02em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand .mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, var(--brand), color-mix(in oklab, var(--brand), #000 22%));
  color: #fff; box-shadow: var(--shadow-sm);
}
.brand .mark svg { width: 18px; height: 18px; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav__label {
  padding: 6px 10px 4px; font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 14.5px;
  transition: background .14s ease, color .14s ease;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface-hover); color: var(--ink); }
.nav a.is-active { background: var(--brand-050); color: var(--brand); }
.nav a.is-active svg { opacity: 1; }

.sidebar__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.userbox { display: flex; align-items: center; gap: 10px; padding: 6px 6px 10px; }
.userbox .who { min-width: 0; }
.userbox .who .email { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who .role { font-size: 11.5px; color: var(--ink-3); }

.content { min-width: 0; padding: 34px clamp(20px, 3.2vw, 44px) 72px; }
.content__inner { max-width: 1500px; margin: 0; }

/* ------------------------------------------------------------- page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.page-title { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 600; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.08; letter-spacing: -.025em; }
.page-head .sub { color: var(--ink-2); margin-top: 7px; font-size: 14.5px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section-title { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 30px 0 12px; }

/* -------------------------------------------------------------------- card */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card--pad-lg { padding: 26px 26px; }
a.card, .card--link { display: block; color: inherit; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
a.card:hover, .card--link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); color: inherit; }

.stack > * + * { margin-top: 14px; }
.muted { color: var(--ink-3); }
.empty { color: var(--ink-3); font-style: italic; padding: 6px 0; }
.card.empty, .card .empty { font-style: italic; }

/* ------------------------------------------------------------------ pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--on_track { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.pill--at_risk  { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.pill--off_track{ color: var(--risk); background: var(--risk-bg); border-color: var(--risk-border); }
.pill--not_started { color: var(--ink-3); background: var(--surface-2); border-color: var(--border); }
.pill--role { color: var(--ink-2); background: var(--surface-2); border-color: var(--border); }
.pill--brand { color: var(--brand); background: var(--brand-050); border-color: var(--brand-100); }

/* --------------------------------------------------------------- progress */
.progress { display: flex; align-items: center; gap: 12px; }
.progress .track { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--track); overflow: hidden; }
.progress .fill {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, color-mix(in oklab, var(--brand), #fff 12%), var(--brand));
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}
.progress .fill--ok   { background: linear-gradient(90deg, color-mix(in oklab, var(--ok), #fff 14%), var(--ok)); }
.progress .fill--warn { background: linear-gradient(90deg, color-mix(in oklab, var(--warn), #fff 14%), var(--warn)); }
.progress .fill--risk { background: linear-gradient(90deg, color-mix(in oklab, var(--risk), #fff 14%), var(--risk)); }
.metric { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); font-size: 14px; min-width: 42px; text-align: right; }
.metric--lg { font-family: var(--font-display); font-optical-sizing: auto; font-size: 30px; font-weight: 600; letter-spacing: -.02em; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 14px; font-weight: 600; line-height: 1;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, color .14s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-hover); color: var(--on-brand); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in oklab, var(--danger), transparent 62%); }
.btn--danger:hover { background: var(--risk-bg); color: var(--danger-hover); }
.btn--sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 7px; border: 1px solid transparent; background: transparent;
  color: var(--ink-3); cursor: pointer; transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--risk-bg); color: var(--danger); }
.icon-btn svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ forms */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color .14s ease, box-shadow .14s ease;
  appearance: none;
}
textarea { min-height: 84px; resize: vertical; }
select[multiple] { min-height: 130px; padding: 6px; }
select[multiple] option { padding: 6px 8px; border-radius: 6px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-050);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select:not([multiple]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8f9c' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}
.help, .helptext, .form .helptext { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
ul.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--risk); font-size: 13px; font-weight: 500; }

/* Django form.as_p normalization */
.form-body p { margin: 0 0 16px; }
.form-body p label { display: block; }
.form-body p:last-child { margin-bottom: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

.inline-add { display: flex; gap: 9px; align-items: center; margin-top: 4px; }
.inline-add input { flex: 1; }

.filterbar {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  padding: 16px 18px; margin-bottom: 20px;
}
.filterbar .field { margin: 0; min-width: 170px; }
.filterbar label { margin-bottom: 5px; }
.filterbar .filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* --------------------------------------------------------------- avatars */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--brand); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  text-transform: uppercase; letter-spacing: .01em;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar--c1 { background: #4f57c4; } .avatar--c2 { background: #2c8a6b; }
.avatar--c3 { background: #b06a1f; } .avatar--c4 { background: #a4485f; }
.avatar--c5 { background: #3a7ca5; } .avatar--c6 { background: #7a5bbd; }
.avatar-group { display: inline-flex; align-items: center; }
.avatar-group .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-group .avatar:first-child { margin-left: 0; }
.owner-row { display: inline-flex; align-items: center; gap: 8px; }
.owner-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); font-size: 13px; font-weight: 500; }

/* --------------------------------------------------------- meta / dividers */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--ink-2); font-size: 13.5px; }
.meta .sep { color: var(--border-strong); }
.meta b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------ objective / KR rows */
.obj-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 6px; border-bottom: 1px solid var(--border);
}
.obj-row:last-child { border-bottom: 0; }
.obj-row .obj-title { font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.obj-row .obj-title a { color: inherit; }
.obj-row .obj-title a:hover { color: var(--brand); }
.obj-row .progress { width: 190px; max-width: 40%; }

.kr {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 12px; overflow: hidden;
}
.kr__head { display: flex; align-items: center; gap: 14px; padding: 15px 18px; }
.kr__title { font-weight: 600; flex: 1; min-width: 0; }
.kr__head .progress { width: 150px; }
.kr__body { padding: 4px 18px 16px; }

.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 6px; border-top: 1px solid var(--border);
}
.task__title { flex: 1; min-width: 0; color: var(--ink); }
.task input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.task .check {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.6px solid var(--border-strong); background: var(--surface);
  cursor: pointer; transition: background .14s, border-color .14s;
}
.task .check svg { width: 13px; height: 13px; color: #fff; opacity: 0; transform: scale(.6); transition: opacity .14s, transform .14s; }
.task input:checked + .check { background: var(--ok); border-color: var(--ok); }
.task input:checked + .check svg { opacity: 1; transform: scale(1); }
.task input:focus-visible + .check { box-shadow: 0 0 0 3px var(--brand-050); }
.task input:disabled + .check { cursor: default; opacity: .6; }
.task input:checked ~ .task__title { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* ------------------------------------------------------------- data table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.email { font-weight: 600; }

/* -------------------------------------------------------------- comments */
.comment { display: flex; gap: 12px; padding: 14px 2px; border-top: 1px solid var(--border); }
.comment:first-of-type { border-top: 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .byline { font-size: 13px; margin-bottom: 3px; }
.comment .byline b { color: var(--ink); font-weight: 600; }
.comment .byline time, .comment .byline .when { color: var(--ink-3); font-size: 12.5px; }
.comment .text { color: var(--ink); }

/* ----------------------------------------------------------------- chart */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: var(--brand-050); }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }

/* ------------------------------------------------------------------ login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; padding: 40px 34px; }
.auth-card .mark { width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 20px; display: grid; place-items: center; background: linear-gradient(150deg, var(--brand), color-mix(in oklab, var(--brand), #000 22%)); color: #fff; box-shadow: var(--shadow-md); }
.auth-card .mark svg { width: 26px; height: 26px; }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 27px; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-card p { color: var(--ink-2); margin-bottom: 24px; }
.btn-google { display: inline-flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }

/* -------------------------------------------------------------- messages */
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--brand-050); border: 1px solid var(--brand-100); color: var(--ink); margin-bottom: 16px; font-weight: 500; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row;
    align-items: center; gap: 6px; padding: 10px 14px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 12px 0 4px; font-size: 18px; }
  .brand .tag { display: none; }
  .nav { flex-direction: row; margin-top: 0; gap: 2px; }
  .nav__label { display: none; }
  .nav a span.lbl { display: none; }
  .nav a { padding: 9px; }
  .sidebar__foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .userbox { padding: 0; }
  .userbox .who { display: none; }
  .content { padding: 24px 18px 56px; }
}
@media (max-width: 560px) {
  .obj-row { flex-wrap: wrap; }
  .obj-row .progress { width: 100%; max-width: 100%; }
  .head-actions { width: 100%; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* staggered entrance for cards on a page */
.reveal > * { animation: rise .5s cubic-bezier(.22,.61,.36,1) both; }
.reveal > *:nth-child(2) { animation-delay: .04s; }
.reveal > *:nth-child(3) { animation-delay: .08s; }
.reveal > *:nth-child(4) { animation-delay: .12s; }
.reveal > *:nth-child(5) { animation-delay: .16s; }
.reveal > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------- theme switch */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-bottom: 12px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.theme-switch button { display: grid; place-items: center; padding: 6px; border: 0; background: transparent; color: var(--ink-3); border-radius: 7px; cursor: pointer; transition: background .14s, color .14s; }
.theme-switch button svg { width: 16px; height: 16px; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ------------------------------------------- checkbox multi-select (owners) */
/* Django renders CheckboxSelectMultiple as <div id="id_owners"><div><label>…</label></div>…> */
#id_owners { padding: 7px; display: grid; gap: 3px; max-height: 240px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
#id_owners > div { margin: 0; }
#id_owners label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0; border-radius: 8px; font-weight: 500; font-size: 14px; color: var(--ink); cursor: pointer; }
#id_owners label:hover { background: var(--surface-hover); }
#id_owners input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); flex: none; margin: 0; }

/* ------------------------------------------- selected-owner chips (form) */
.owners-selected { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 10px; min-height: 34px; }
.owners-selected .lbl { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }
.owners-selected .none { font-size: 13px; color: var(--ink-3); font-style: italic; }
.owners-selected .owner-chip { animation: rise .18s ease both; }
.owner-chip .chip-x { display: inline-grid; place-items: center; width: 17px; height: 17px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 50%; padding: 0; margin-left: 1px; }
.owner-chip .chip-x:hover { background: var(--risk-bg); color: var(--danger); }
.owner-chip .chip-x svg { width: 11px; height: 11px; }

/* ---------------------------------------- initiative grouping (dashboard) */
.init-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.init-head { display: flex; align-items: center; gap: 14px; padding: 17px 22px; background: color-mix(in oklab, var(--brand-050), var(--surface) 30%); border-bottom: 1px solid var(--border); }
.init-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none; background: linear-gradient(150deg, var(--brand), color-mix(in oklab, var(--brand), #000 22%)); color: #fff; box-shadow: var(--shadow-sm); }
.init-icon svg { width: 20px; height: 20px; }
.init-headings { flex: 1; min-width: 0; }
.init-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.init-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 18.5px; letter-spacing: -.01em; color: var(--ink); line-height: 1.25; }
a.init-title:hover { color: var(--brand); }
.init-head .progress { width: 200px; max-width: 40%; }
.init-objs { padding: 6px 22px 12px; }
.obj-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px 12px 22px; border-bottom: 1px solid var(--border); position: relative; color: inherit; }
.obj-item:last-child { border-bottom: 0; }
.obj-item::before { content: ""; position: absolute; left: 5px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); transition: border-color .14s ease; }
.obj-item:hover::before { border-color: var(--brand); }
.obj-name { flex: 1; min-width: 0; font-weight: 500; color: var(--ink); font-size: 14.5px; }
.obj-item:hover .obj-name { color: var(--brand); }
.obj-item .progress { width: 160px; }
.obj-empty { padding: 12px 4px 12px 22px; color: var(--ink-3); font-style: italic; }
@media (max-width: 620px) {
  .init-head { flex-wrap: wrap; }
  .init-head .progress { width: 100%; max-width: 100%; order: 3; }
  .obj-item { flex-wrap: wrap; }
  .obj-item .progress { width: 100%; }
}

/* ------------------------------------------------------------- KR ETD */
.kr--overdue { border-color: var(--risk-border); }
.kr__etd { display:flex; align-items:center; gap:10px; margin-bottom:12px; flex-wrap:wrap; }
.kr__etd-label { font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-3); }
input[type=date].kr__etd-input { width:auto; padding:6px 10px; font-size:13px; }
.etd-view { font-size:13px; font-weight:500; color:var(--ink-2); }
.etd-flag { color: var(--risk); font-weight:600; font-size:12px; }

/* ------------------------------------- objective status: the chip IS the menu */
.status-form { display:inline-flex; }
.status-chip.is-not_started { --chip: var(--ink-3);  --chip-bg: var(--surface-2); --chip-bd: var(--border); }
.status-chip.is-on_track    { --chip: var(--ok);     --chip-bg: var(--ok-bg);     --chip-bd: var(--ok-border); }
.status-chip.is-at_risk     { --chip: var(--warn);   --chip-bg: var(--warn-bg);   --chip-bd: var(--warn-border); }
.status-chip.is-off_track   { --chip: var(--risk);   --chip-bg: var(--risk-bg);   --chip-bd: var(--risk-border); }
select.status-chip {
  width:auto; color: var(--chip); background-color: var(--chip-bg); border-color: var(--chip-bd);
  padding: 4px 30px 4px 12px; border-radius: var(--radius-pill);
  font-size:12px; font-weight:600; line-height:1.5; cursor:pointer;
  background-position: right 10px center;
}
select.status-chip:hover { border-color: color-mix(in oklab, var(--chip), transparent 45%); }
select.status-chip:focus { border-color: var(--chip); box-shadow: 0 0 0 3px color-mix(in oklab, var(--chip), transparent 80%); }

/* ---------------------------------------------------------------- why box */
.why-box { border-left: 3px solid var(--brand); background: var(--brand-050); padding: 11px 14px; border-radius: 0 8px 8px 0; margin-bottom: 16px; }
.why-box__label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); margin-bottom: 3px; }
.why-box p { color: var(--ink-2); margin: 0; line-height: 1.55; white-space: pre-wrap; }

/* --------------------------------------------------------------- form layout */
.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- avatar image */
.avatar { overflow: hidden; }
.avatar__img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---------------------------------- objective detail: content + right pane */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.detail-main { min-width: 0; }
.detail-main .page-head { margin-bottom: 18px; }
.detail-aside { position: sticky; top: 24px; }

.comments-pane { display: flex; flex-direction: column; max-height: calc(100vh - 48px);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.comments-pane__head { flex: none; display: flex; align-items: center; gap: 9px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--ink);
  background: color-mix(in oklab, var(--surface-2), var(--brand) 6%); }
.comments-pane__head svg { width: 17px; height: 17px; color: var(--brand); }
.comments-pane__head .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }
.comments-pane__body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 1000px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { position: static; }
  .comments-pane { max-height: none; }
}
