:root {
  --bg: #ede8e0;
  --bg-2: #e5e0d7;
  --bg-3: #f4efe7;
  --fg: #1a1a1a;
  --fg-muted: #5a5a5a;
  --fg-dim: #8b8b8b;
  --border: #d4cfc7;
  --border-soft: #e2ddd4;
  --terminal-bg: #1a1a1a;
  --terminal-fg: #ede8e0;
  --green: #5a9a6b;
  --red: #9a4d42;
  --blue: #2e6f8e;
  --purple: #7a4d8e;
  --transition: 0.22s ease;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --page-pad: clamp(18px, 4vw, 48px);
  --nav-h: clamp(58px, 6vw, 68px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button { border: 1px solid var(--fg); background: var(--fg); color: var(--bg); min-height: 42px; padding: 0 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition); }
button:hover { transform: translateY(-1px); }
button.secondary, .link-button { background: transparent; color: var(--fg); border-color: var(--border); }
button.secondary:hover, .link-button:hover { background: var(--bg-2); }
button.danger { border-color: var(--red); color: var(--red); background: transparent; }
button.danger:hover { background: rgba(154, 77, 66, 0.1); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
input, textarea, select { width: 100%; border: 1px solid var(--border); background: var(--bg-3); color: var(--fg); padding: 0 12px; outline: none; }
input, select { height: 42px; }
textarea { min-height: 108px; padding: 12px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus, [contenteditable]:focus { border-color: var(--fg); box-shadow: 0 0 0 2px rgba(26,26,26,0.08); }
a { color: inherit; }
.muted { color: var(--fg-muted); line-height: 1.55; }
.kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-dim); }
.stack { display: grid; gap: 12px; }

.loading-shell { min-height: 100dvh; display: grid; place-items: center; padding: var(--page-pad); }
.loading-card { width: min(100%, 360px); display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; border: 1px solid var(--border); background: var(--bg); padding: 20px; box-shadow: 0 28px 70px -48px rgba(0,0,0,0.42); }
.loading-card h1 { margin: 0; font-size: clamp(34px, 8vw, 52px); letter-spacing: -0.045em; line-height: 0.95; }
.loading-card .kicker { margin: 0 0 6px; }
.loading-bar { grid-column: 1 / -1; display: block; height: 2px; overflow: hidden; background: var(--border); }
.loading-bar span { display: block; width: 42%; height: 100%; background: var(--fg); animation: loading-run 1s ease-in-out infinite; }
.route-loading { position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 9; pointer-events: none; background: rgba(237,232,224,0.72); backdrop-filter: blur(3px); }
.route-loading .loading-bar { height: 3px; background: transparent; }
@keyframes loading-run { 0% { transform: translateX(-110%); } 50% { transform: translateX(80%); } 100% { transform: translateX(260%); } }

.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: var(--page-pad); }
.auth-panel { width: min(100%, 420px); border: 1px solid var(--border); padding: clamp(22px, 5vw, 34px); background: var(--bg); box-shadow: 0 28px 70px -48px rgba(0,0,0,0.42); }
.auth-panel h1 { margin: 0 0 10px; font-size: clamp(44px, 10vw, 72px); line-height: 0.95; letter-spacing: -0.04em; }
.auth-panel .muted { margin: 0 0 24px; }
.auth-panel .link-button { width: 100%; margin-top: 12px; }
.auth-notice { margin: 0 0 16px; border: 1px solid rgba(90, 154, 107, 0.35); background: rgba(90, 154, 107, 0.1); color: var(--green); padding: 10px 12px; font-weight: 800; line-height: 1.4; }

.site-head { height: var(--nav-h); padding: 0 var(--page-pad); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(237,232,224,0.92); backdrop-filter: blur(14px); z-index: 10; }
.site-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; letter-spacing: -0.02em; }
.mark { width: 28px; height: 28px; display: block; background: var(--fg); object-fit: contain; padding: 3px; }
.nav-links { display: flex; justify-content: center; gap: 4px; }
.nav-links a { text-decoration: none; color: var(--fg-muted); font-weight: 800; font-size: 14px; padding: 10px 12px; border: 1px solid transparent; }
.nav-links a.active { color: var(--fg); border-color: var(--border); background: var(--bg-2); }
.user-chip { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); min-width: 0; }
.user-chip button { width: 36px; min-height: 36px; padding: 0; background: transparent; color: var(--fg); border-color: var(--border); }
.user-chip button[hidden] { display: none; }
.user-chip .profile-chip { width: auto; max-width: 180px; padding: 0 10px; gap: 7px; color: var(--fg-muted); }
#user-color-dot { width: 12px; height: 12px; border: 1px solid var(--fg); display: inline-block; flex: 0 0 auto; }
#user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-shell { width: min(100%, 760px); margin: 0 auto; padding: clamp(24px, 5vw, 48px) var(--page-pad) 80px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
h1 { margin: 0; font-size: clamp(44px, 11vw, 82px); letter-spacing: -0.055em; line-height: 0.95; }
h1.compact-title { font-size: clamp(30px, 7vw, 48px); letter-spacing: -0.035em; }
h2 { margin: 34px 0 14px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font-mono); color: var(--fg-dim); }
.title-row p { margin: 10px 0 0; }
.progress-panel { position: relative; margin: 0 0 28px; border: 1px solid var(--border); background: var(--bg); padding: clamp(14px, 3vw, 18px); }
.progress-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.progress-top h2 { margin: 0; }
.progress-range { display: inline-flex; border: 1px solid var(--border); background: var(--bg-3); }
.progress-range button { min-height: 32px; padding: 0 10px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }
.progress-range button:last-child { border-right: 0; }
.progress-range button.active { background: var(--fg); color: var(--bg); }
.progress-chart { display: grid; gap: 9px; }
.progress-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 48px; align-items: center; gap: 9px; }
.progress-date, .progress-total { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.progress-total { text-align: right; }
.progress-track { height: 20px; border: 1px solid var(--border); background: var(--bg-3); display: flex; overflow: hidden; }
.progress-stack { height: 100%; min-width: 2px; border-right: 1px solid rgba(237,232,224,0.42); cursor: default; }
.progress-stack:hover { filter: contrast(1.18); }
.progress-empty { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(26,26,26,0.045) 9px 10px); }
.progress-tooltip { position: fixed; z-index: 120; pointer-events: none; white-space: pre-line; background: var(--fg); color: var(--bg); border: 1px solid var(--fg); padding: 8px 10px; font-family: var(--font-mono); font-size: 11px; line-height: 1.45; box-shadow: 0 18px 54px -28px rgba(0,0,0,0.6); }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 24px 0 10px; }
.toolbar button.filters-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.search-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--bg-3); padding: 0 12px; }
.search-box:focus-within { border-color: var(--fg); }
.search-box input { border: 0; background: transparent; padding: 0; box-shadow: none; outline: 0; }
.search-box input:focus { border: 0; box-shadow: none; outline: 0; }
.search-box i { color: var(--fg-dim); }

.dope-list { display: grid; gap: 10px; }
.dope-card { width: 100%; text-align: left; background: var(--bg); color: var(--fg); border: 1px solid var(--border); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; min-height: 72px; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.dope-card.has-accent { border-left: 4px solid var(--accent); padding-left: 15px; }
.dope-card:hover { border-color: var(--fg); box-shadow: 0 18px 44px -34px rgba(0,0,0,0.5); }
.dope-card.has-accent:hover { border-left-color: var(--accent); }
.dope-card.is-review { border-color: #2a6f9e; }
.dope-card.is-review-change { border-color: #9a4d42; background: var(--bg-2); }
.card-main { display: grid; gap: 8px; min-width: 0; }
.card-main h3 { margin: 0; }
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dope-card h3 { margin: 0; font-size: clamp(17px, 3.4vw, 22px); letter-spacing: -0.02em; line-height: 1.2; }
.dope-card.is-blocked h3 { color: var(--fg-dim); }
.category-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-3)); padding: 3px 9px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--fg-muted); font-size: 13px; line-height: 1.4; }
.card-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border-soft); background: var(--bg-3); padding: 4px 8px; color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.saved-pill { border-color: var(--purple); color: var(--purple); }
.review-pill { border-color: #2a6f9e; color: #2a6f9e; }
.compact .dope-card { background: var(--bg-2); }
.empty { border: 1px dashed var(--border); padding: 28px; text-align: center; color: var(--fg-muted); }
.empty.mini { padding: 18px; margin: 0; }

dialog { border: 0; padding: 0; background: var(--bg); width: min(calc(100% - 24px), 680px); }
dialog::backdrop { background: rgba(26,26,26,0.42); backdrop-filter: blur(4px); }
.modal { position: relative; isolation: isolate; background: var(--bg); border: 1px solid var(--border); padding: 0; max-height: min(88dvh, 820px); overflow: auto; box-shadow: 0 32px 100px -44px rgba(0,0,0,0.55); overscroll-behavior: contain; }
.modal::before { content: ""; position: sticky; top: 0; display: block; height: 0; background: var(--bg); z-index: -1; }
#filter-dialog, #profile-dialog, #categories-dialog, #settings-dialog { width: min(calc(100% - 24px), 480px); }
.modal.small { width: 100%; }
#filter-dialog .modal, #profile-dialog .modal, #categories-dialog .modal, #settings-dialog .modal { padding: clamp(20px, 5vw, 32px); }
#dope-dialog .modal > .icon-close { display: none; }
#dope-dialog #modal-title[hidden] { display: none; }
.modal h2 { margin-top: 0; color: var(--fg); font-family: var(--font-sans); font-size: clamp(26px, 6vw, 38px); letter-spacing: -0.04em; text-transform: none; }
.icon-close { position: sticky; top: 0; float: right; width: 36px; min-height: 36px; padding: 0; background: var(--bg); border-color: var(--border); color: var(--fg); z-index: 8; }
.modal label { display: grid; gap: 7px; font-weight: 800; font-size: 13px; color: var(--fg-muted); margin-bottom: 14px; }
.modal label[hidden] { display: none; }
.editor { min-height: 190px; border: 1px solid var(--border); background: var(--bg-3); padding: 13px; outline: none; line-height: 1.6; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--fg-dim); }
.editor img, .description img { max-width: 100%; display: block; margin: 12px 0; border: 1px solid var(--border); }
.description { line-height: 1.7; color: var(--fg); overflow-wrap: anywhere; }
.description p { margin: 0 0 12px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-content { padding: clamp(20px, 5vw, 32px); }
.modal-headline { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 4px 0 14px; }
.modal-headline > div:first-child { display: flex; flex-wrap: wrap; gap: 7px; }
.version-control { flex: 0 0 auto; }
.version-button { min-height: 30px; padding: 0 10px; background: transparent; color: var(--fg); border-color: var(--border); font-family: var(--font-mono); font-size: 11px; }
.version-empty { display: inline-flex; min-height: 30px; align-items: center; color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px; }
.version-picker { margin: 0 0 18px; }
.dependency-picker { display: grid; gap: 10px; margin: 4px 0 18px; }
.dependency-picker > button { justify-self: start; }
.dependency-panel { display: grid; gap: 10px; border: 1px solid var(--border); background: var(--bg-2); padding: 10px; }
.dependency-search { display: flex !important; align-items: center; grid-template-columns: none !important; gap: 8px !important; margin: 0 !important; border: 1px solid var(--border); background: var(--bg-3); padding: 0 10px; }
.dependency-search:focus-within { border-color: var(--fg); }
.dependency-search input { border: 0; background: transparent; padding: 0; box-shadow: none; outline: 0; }
.dependency-search input:focus { border: 0; box-shadow: none; outline: 0; }
.dependency-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.dependency-option { grid-template-columns: auto 1fr; align-items: center; gap: 10px !important; margin: 0 !important; padding: 10px; border: 1px solid var(--border-soft); background: var(--bg); color: var(--fg); cursor: pointer; }
.dependency-option:hover { border-color: var(--fg); }
.dependency-option input { width: 18px; height: 18px; accent-color: var(--fg); }
.dependency-option span { display: grid; gap: 3px; min-width: 0; }
.dependency-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dependency-option small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }
.dependency-links-wrap { margin: 18px 0; }
.dependency-links-wrap h2 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); font-family: var(--font-mono); text-transform: uppercase; }
.dependency-summary { width: 100%; min-height: 44px; display: flex; justify-content: space-between; background: var(--bg-3); color: var(--fg); border-color: var(--border); }
.dependency-summary i { transition: transform var(--transition); }
.dependency-summary.is-open i { transform: rotate(180deg); }
.dependency-links { display: grid; gap: 8px; margin: 8px 0 0; }
.dependency-links[hidden] { display: none; }
.dependency-link { width: 100%; min-height: 46px; display: grid; grid-template-columns: 1fr auto; text-align: left; background: var(--bg-3); color: var(--fg); border-color: var(--border); }
.dependency-link.is-undoped { border-color: var(--fg); background: var(--bg); }
.dependency-link.is-indirect { background: var(--bg-2); }
.dependency-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dependency-link small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }
.modal-topbar { position: sticky; top: 0; z-index: 7; width: 100%; padding: 12px clamp(20px, 5vw, 32px); min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--bg); border-bottom: 1px solid transparent; }
.modal-topbar strong { opacity: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; letter-spacing: -0.01em; }
.modal-topbar.is-visible { border-bottom-color: var(--border); }
.modal-topbar.is-visible strong { opacity: 1; }
.modal-topbar .icon-close { position: static; float: none; flex: 0 0 auto; }
.modal-action-bar { position: sticky; bottom: 0; z-index: 9; width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 20px clamp(20px, 5vw, 32px); background: var(--bg); border-top: 1px solid var(--border); }
.modal-action-row { display: flex; align-items: center; gap: 10px; }
.icon-action { width: 42px; padding: 0; flex: 0 0 auto; }
.action-text { flex: 1 1 auto; white-space: nowrap; }
.modal-action-row .non-cta { flex: 1 1 auto; }
.primary-wide { width: 100%; min-height: 58px; font-size: 17px; }
.modal-action-bar .primary-wide:not([disabled])::after { content: "cmd + enter"; opacity: 0.5; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; margin-left: 8px; white-space: nowrap; }
.non-cta { background: transparent; color: var(--fg); border-color: var(--border); white-space: nowrap; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 10px !important; width: 100%; padding: 12px; border: 1px solid var(--border); background: var(--bg-3); color: var(--fg) !important; margin: 0 0 14px !important; cursor: pointer; }
.filter-check input { width: 18px; height: 18px; accent-color: var(--fg); flex: 0 0 auto; }
.profile-modal h2 { font-size: clamp(34px, 9vw, 58px); margin: 0 0 22px; }
.profile-modal .icon-close { margin: -10px -10px 0 12px; }
.profile-modal label { margin-bottom: 16px; }
.profile-modal .modal-actions { margin-top: 22px; }
.profile-modal .modal-actions button { width: 100%; }
.settings-modal .kicker { margin: 0 0 8px; }
.settings-modal h2 { font-size: clamp(34px, 9vw, 58px); margin: 0 0 22px; }
.settings-modal .icon-close { margin: -10px -10px 0 12px; }
.settings-modal .modal-actions { margin-top: 22px; }
.settings-modal .modal-actions button { width: 100%; }
.reset-countdown-card { display: grid; gap: 5px; margin: 0 0 18px; padding: 16px; border: 1px solid var(--fg); background: var(--bg-3); }
.reset-countdown-card span { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.reset-countdown-card strong { font-family: var(--font-mono); font-size: clamp(27px, 8vw, 40px); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.reset-countdown-card small { color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px; }
.settings-note { margin: 4px 0 0; padding: 12px; border-left: 3px solid var(--fg); background: var(--bg-3); color: var(--fg-muted); font-size: 12px; line-height: 1.55; }
.color-field { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: center; }
.color-field input[type="color"] { width: 58px; height: 50px; padding: 0; border: 1px solid var(--border); background: var(--bg-3); cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; }
.color-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: -4px 0 16px; }
.color-presets button { min-height: 34px; padding: 0; border-color: var(--border); background: var(--swatch); }
.color-presets button.is-selected { border-color: var(--fg); box-shadow: inset 0 0 0 2px var(--bg); }
.color-preview { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--bg-3); padding: 10px; color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }
#profile-color-preview { width: 42px; height: 24px; border: 1px solid var(--fg); display: inline-block; flex: 0 0 auto; }
.api-key-panel { margin: 20px 0 0; border-top: 1px solid var(--border); padding-top: 18px; }
.api-key-panel h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--font-mono); color: var(--fg-dim); }
.api-key-create { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
.api-key-created { display: grid; gap: 8px; border: 1px solid var(--fg); background: var(--bg-3); padding: 10px; margin-bottom: 10px; }
.api-key-created[hidden] { display: none; }
.api-key-created span { color: var(--fg-muted); font-size: 12px; font-weight: 800; }
.api-key-created code { display: block; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; line-height: 1.45; }
.api-key-list { display: grid; gap: 7px; }
.api-key-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--bg-3); padding: 10px; }
.api-key-row strong { display: block; font-size: 14px; }
.api-key-row small { display: block; margin-top: 3px; color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; }
.api-key-row button { min-height: 32px; padding: 0 10px; }
.api-key-row.is-revoked { opacity: 0.58; }
.history-block { margin: 24px 0 0; padding: 12px; border: 1px solid var(--border); background: var(--bg-3); }
.history-block h2 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); font-family: var(--font-mono); text-transform: uppercase; }
.history { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; color: var(--fg-muted); font-size: 13px; line-height: 1.45; }
.completion-notes { margin: 24px 0 0; }
.completion-notes h2 { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); font-family: var(--font-mono); text-transform: uppercase; }
.completion-text { border: 1px solid var(--border); background: var(--bg-3); padding: 14px; color: var(--fg-muted); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.completion-text a { color: var(--blue); font-weight: 800; }
.review-block { margin: 24px 0 0; }
.review-block h2 { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); font-family: var(--font-mono); text-transform: uppercase; }
.review-panel { display: grid; gap: 10px; border: 1px solid var(--border); background: var(--bg-3); padding: 14px; }
.review-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 13px; }
.review-row span { color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }
.review-row strong, .review-row a { min-width: 0; overflow-wrap: anywhere; }
.review-row a { color: var(--blue); font-weight: 800; }
.review-note { border-top: 1px solid var(--border-soft); padding-top: 10px; color: var(--fg-muted); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-note.is-rejection { color: var(--fg); }
.review-outcome { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border-soft); background: var(--bg); padding: 9px 10px; font-size: 13px; font-weight: 800; }
.review-outcome.is-approved { color: #2e8b57; }
.review-outcome.is-rejected { color: #9a4d42; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 100; background: var(--fg); color: var(--bg); padding: 12px 14px; font-weight: 800; box-shadow: 0 18px 54px -28px rgba(0,0,0,0.6); max-width: calc(100% - 24px); }
.undo { margin-left: 10px; min-height: 30px; padding: 0 10px; border-color: var(--bg); color: var(--bg); background: transparent; }
.dope-celebration { position: fixed; inset: 0; z-index: 50; pointer-events: none; display: grid; place-items: center; overflow: hidden; background: rgba(26,26,26,0.08); animation: celebration-fade 1.8s ease forwards; }
.celebration-card { border: 1px solid var(--fg); background: var(--fg); color: var(--bg); min-width: min(320px, calc(100vw - 48px)); padding: 22px; display: grid; justify-items: center; gap: 8px; box-shadow: 0 24px 80px -36px rgba(0,0,0,0.65); animation: celebration-pop 0.7s cubic-bezier(.2,.9,.2,1) both; }
.celebration-card i { font-size: 34px; }
.celebration-card strong { font-size: clamp(36px, 10vw, 74px); line-height: 0.95; letter-spacing: -0.055em; }
.celebration-card span { color: var(--bg-2); font-weight: 800; }
.celebration-piece { position: absolute; top: -40px; color: var(--fg); background: var(--bg-3); border: 1px solid var(--border); padding: 5px 8px; font-family: var(--font-mono); font-size: 11px; font-weight: 800; animation-name: celebration-fall; animation-timing-function: cubic-bezier(.16,.84,.44,1); animation-fill-mode: both; }
@keyframes celebration-pop { 0% { opacity: 0; transform: translateY(18px) scale(0.92); } 70% { opacity: 1; transform: translateY(0) scale(1.02); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes celebration-fall { 0% { opacity: 0; transform: translateY(0) rotate(0deg); } 12% { opacity: 1; } 100% { opacity: 0; transform: translateY(110vh) rotate(24deg); } }
@keyframes celebration-fade { 0%, 72% { opacity: 1; } 100% { opacity: 0; } }

.field-label { font-weight: 800; font-size: 13px; color: var(--fg-muted); margin-bottom: 8px; }
.inline-category { margin: 4px 0 18px; }
.inline-category .category-choices { margin-bottom: 0; }
.category-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.category-choice { min-height: 36px; padding: 0 12px; gap: 7px; background: var(--bg-3); color: var(--fg-muted); border: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.category-choice:hover { transform: none; border-color: var(--accent, var(--fg)); }
.category-choice.is-selected { color: var(--fg); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-3)); box-shadow: inset 0 0 0 1px var(--accent); }
.category-choice-none { gap: 0; }
.category-choice-none.is-selected { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); background: var(--bg-2); }
.category-empty-hint { color: var(--fg-dim); font-size: 12px; font-family: var(--font-mono); line-height: 1.5; }

.comment-pill { position: relative; }
.comment-pill.has-unread { border-color: var(--blue); color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, var(--bg-3)); }
.comment-new { border: 1px solid var(--blue); background: var(--blue); color: var(--bg); padding: 1px 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
.comment-new.is-mention { background: var(--purple); border-color: var(--purple); }
.comments-block { margin: 28px 0 0; }
.comments-block h2 { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); font-family: var(--font-mono); text-transform: uppercase; }
.comment-list { display: grid; gap: 10px; margin-bottom: 12px; max-height: 380px; overflow: auto; }
.comment { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; }
.comment-avatar { width: 34px; height: 34px; display: grid; place-items: center; color: var(--bg); font-weight: 900; font-size: 14px; border: 1px solid var(--fg); }
.comment-body { border: 1px solid var(--border); background: var(--bg-3); padding: 10px 12px; min-width: 0; }
.comment.is-mine .comment-body { background: var(--bg-2); }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.comment-meta strong { font-size: 13px; }
.comment-meta span { color: var(--fg-dim); font-family: var(--font-mono); font-size: 10px; }
.comment-delete { margin-left: auto; width: 26px; min-height: 26px; padding: 0; background: transparent; border: 0; color: var(--fg-dim); }
.comment-delete:hover { color: var(--red); transform: none; }
.comment-text { font-size: 14px; line-height: 1.55; color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-text a { color: var(--blue); font-weight: 800; }
.mention { color: var(--blue); font-weight: 800; background: color-mix(in srgb, var(--blue) 12%, transparent); padding: 0 3px; }
.mention-me { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent); }
.comment-composer { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: end; }
.comment-composer textarea { min-height: 46px; padding: 11px 12px; }
.comment-composer #comment-send { width: 46px; min-height: 46px; padding: 0; }
.composer-box { position: relative; min-width: 0; }
.mention-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; width: min(100%, 320px); max-height: 240px; overflow: auto; border: 1px solid var(--fg); background: var(--bg); box-shadow: 0 18px 54px -28px rgba(0,0,0,0.55); display: grid; }
.mention-menu[hidden] { display: none; }
.mention-item { display: grid; grid-template-columns: 10px auto minmax(0, 1fr); align-items: center; gap: 9px; min-height: 40px; padding: 0 12px; text-align: left; background: var(--bg); color: var(--fg); border: 0; border-bottom: 1px solid var(--border-soft); font-weight: 700; }
.mention-item:last-child { border-bottom: 0; }
.mention-item:hover, .mention-item.is-active { background: var(--bg-2); transform: none; }
.mention-item strong { font-size: 13px; white-space: nowrap; }
.mention-item small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.online-dot.is-online { background: var(--green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 25%, transparent); }

/* ---- Diagnostics page ---- */
.diag-shell { display: grid; gap: 14px; }
.diag-shell[hidden] { display: none; }
.diag-title-row { margin-bottom: 6px; align-items: flex-end; }
.diag-title-row .kicker { margin: 0 0 6px; }
.diag-title-side { display: flex; align-items: center; gap: 12px; }
.diag-updated { color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
#diag-refresh { min-height: 38px; }
#diagnostics-body { display: grid; gap: 14px; }
#diagnostics-open.is-current { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.diag-card { border: 1px solid var(--border); background: var(--bg); padding: clamp(16px, 3.4vw, 22px); box-shadow: 0 22px 60px -52px rgba(0,0,0,0.45); }
.diag-card-label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--fg-dim); }
.diag-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.diag-card-head small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }

.diag-hero-card { display: grid; gap: 16px; }
.diag-hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.diag-hero-main { display: grid; gap: 4px; }
.diag-hero-value { font-size: clamp(48px, 9vw, 64px); font-weight: 900; letter-spacing: -0.05em; line-height: 0.95; }
.diag-hero-sub { color: var(--fg-muted); font-size: 14px; }
.diag-hero-aside { display: flex; gap: 28px; padding-top: 6px; }
.diag-mini-stat { display: grid; gap: 3px; }
.diag-mini-stat strong { font-size: 22px; letter-spacing: -0.03em; line-height: 1.1; }
.diag-delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); }
.diag-delta.is-up { color: #2e8b57; }
.diag-delta.is-down { color: #9a4d42; }
.diag-delta.is-flat { color: var(--fg-dim); }

.diag-split-track { display: flex; gap: 2px; height: 18px; background: var(--bg-3); border: 1px solid var(--border); padding: 2px; }
.diag-seg { height: 100%; min-width: 3px; cursor: default; }
.diag-seg:hover { filter: contrast(1.18); }
.diag-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.diag-legend-item { display: inline-flex; align-items: baseline; gap: 7px; font-size: 13px; color: var(--fg-muted); }
.diag-legend-item strong { color: var(--fg); font-size: 14px; }
.diag-legend-item small { font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim); }
.diag-key { width: 10px; height: 10px; display: inline-block; flex: 0 0 auto; align-self: center; }

.diag-grid { display: grid; gap: 14px; }
.diag-bars { display: grid; gap: 9px; }
.diag-bar-row { display: grid; grid-template-columns: minmax(96px, 148px) minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.diag-bar-label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-bar-track { display: block; height: 16px; background: var(--bg-3); border: 1px solid var(--border-soft); }
.diag-bar { display: block; height: 100%; min-width: 3px; cursor: default; }
.diag-bar:hover { filter: contrast(1.18); }
.diag-bar-value { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); white-space: nowrap; text-align: right; min-width: 74px; font-variant-numeric: tabular-nums; }

.diag-range button { min-width: 44px; }
.diag-carrying { margin-top: 16px; display: grid; gap: 8px; }
.diag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.diag-chip { min-height: 32px; padding: 0 11px; gap: 7px; background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); font-weight: 700; font-size: 12px; cursor: default; }
.diag-chip:hover { transform: none; border-color: var(--fg); }
.diag-chip small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 10px; }
.diag-details { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.diag-details summary { cursor: pointer; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-dim); }
.diag-details summary:hover { color: var(--fg); }
.diag-person-metas { display: grid; gap: 6px; margin-top: 10px; }
.diag-person-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; }
.diag-person-meta small { color: var(--fg-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 400; text-align: right; }

.diag-timeline { display: grid; gap: 16px; max-height: 520px; overflow: auto; overscroll-behavior: contain; }
.diag-day { display: grid; gap: 8px; }
.diag-day-label { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 2px 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--fg-dim); }
.diag-feed { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.diag-feed-row { width: 100%; min-height: 44px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left; background: var(--bg-3); color: var(--fg); border: 1px solid var(--border-soft); padding: 9px 12px; font-weight: 400; }
.diag-feed-row:hover { border-color: var(--fg); transform: none; }
.diag-feed-icon { font-size: 15px; color: var(--fg-muted); }
.diag-feed-icon.is-completed { color: #2e8b57; }
.diag-feed-icon.is-unassigned, .diag-feed-icon.is-archived { color: #9a4d42; }
.diag-feed-icon.is-commented { color: #2a6f9e; }
.diag-feed-body { display: grid; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.45; }
.diag-feed-body strong { font-weight: 800; }
.diag-feed-detail { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-feed-time { color: var(--fg-dim); font-family: var(--font-mono); font-size: 10px; white-space: nowrap; }

.filter-group { margin-bottom: 18px; }
.filter-group .grid-two { margin: 0; }
.filter-group .grid-two label, #completed-filters label { margin-bottom: 12px; }
.filter-group .grid-two label:last-child { margin-bottom: 0; }
.filter-label { display: block; font-weight: 800; font-size: 12px; letter-spacing: 0.04em; color: var(--fg-muted); margin-bottom: 9px; }
.category-filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
#completed-filters .filter-group { margin-bottom: 0; }

.categories-intro { margin: 0 0 20px; font-size: 13px; }
.category-manage-list { display: grid; gap: 8px; margin-bottom: 22px; }
.category-manage-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 42px 42px; gap: 8px; align-items: center; }
.category-row-color { height: 42px; padding: 0; border: 1px solid var(--border); background: var(--bg-3); cursor: pointer; }
.category-row-color::-webkit-color-swatch-wrapper { padding: 3px; }
.category-row-color::-webkit-color-swatch { border: 0; }
.category-manage-row .category-row-save, .category-manage-row .category-row-delete { width: 42px; padding: 0; }
.category-create { border-top: 1px solid var(--border); padding-top: 18px; }
.category-create .filter-label { margin-bottom: 10px; }
.category-create-row { display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 8px; margin-bottom: 12px; }
.category-create-row input[type="color"] { height: 42px; padding: 0; border: 1px solid var(--border); background: var(--bg-3); cursor: pointer; }
.category-create-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.category-create-row input[type="color"]::-webkit-color-swatch { border: 0; }
.category-create #category-add { width: 100%; margin-top: 6px; }
.user-chip #categories-open { color: var(--fg-muted); }
.user-chip #categories-open:hover { color: var(--fg); }

@media (max-width: 720px) {
  .site-head { grid-template-columns: 1fr auto; height: auto; min-height: var(--nav-h); padding-top: 10px; padding-bottom: 10px; }
  .nav-links { grid-column: 1 / -1; order: 3; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .user-chip #user-name { display: none; }
  .title-row { align-items: stretch; flex-direction: column; }
  .title-row button { width: 100%; }
  .progress-top { align-items: stretch; flex-direction: column; }
  .progress-range { display: grid; grid-template-columns: repeat(3, 1fr); }
  .progress-range button { width: 100%; }
  .progress-row { grid-template-columns: 50px minmax(0, 1fr) 44px; gap: 7px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar button { width: 100%; }
  .dope-card { grid-template-columns: 1fr; }
  .dope-card .pill { justify-self: start; }
  .card-pills { justify-content: flex-start; }
  .grid-two { grid-template-columns: 1fr; }
  .api-key-create, .api-key-row { grid-template-columns: 1fr; }
  .diag-hero-aside { gap: 18px; width: 100%; }
  .diag-title-row { flex-direction: column; align-items: stretch; }
  .diag-title-side { justify-content: space-between; }
  .diag-bar-row { grid-template-columns: minmax(72px, 96px) minmax(0, 1fr) auto; gap: 8px; }
  .diag-bar-value { min-width: 0; }
  .diag-feed-row { grid-template-columns: 20px minmax(0, 1fr); }
  .diag-feed-time { grid-column: 2; justify-self: start; }
  .modal-headline { flex-direction: column; }
  .modal-action-row { flex-wrap: wrap; }
  .modal-action-row .non-cta { flex: 1 1 100%; }
}
