:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #202024;
  --line: #2c2c31;
  --line-strong: #3f3f46;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --subtle: #71717a;
  --brand: #0055bb;
  --brand-hover: #1468ca;
  --brand-tint: rgba(0, 85, 187, 0.16);
  --success: #1188aa;
  --warning: #bbaa00;
  --danger: #bb0000;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f1f1f3;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #18181b;
  --muted: #52525b;
  --subtle: #71717a;
  --brand-tint: rgba(0, 85, 187, 0.09);
  --shadow: 0 18px 50px rgba(24, 24, 27, 0.12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.top-line { position: fixed; inset: 0 0 auto; height: 3px; background: var(--brand); z-index: 1000; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(circle at 50% 0%, var(--brand-tint), transparent 40%); }
.login-card { width: min(420px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin: 16px 0 8px; font-size: 28px; letter-spacing: -.04em; }
.login-copy, .setup-note { color: var(--muted); line-height: 1.7; }
.google-login { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.google-login svg { width: 18px; height: 18px; fill: currentColor; }
.break-glass { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); }
.break-glass summary { cursor: pointer; font-size: 13px; }
.break-glass form { display: grid; gap: 10px; margin-top: 14px; }
.menu-account { max-width: 240px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.setup-note { margin: 22px 0 0; font-size: 12px; }
.legal-links { display: flex; justify-content: center; gap: 16px; margin-top: 20px; font-size: 11px; }
.legal-links a, .statusbar a { color: var(--muted); text-decoration: none; }
.legal-links a:hover, .statusbar a:hover { color: var(--text); text-decoration: underline; }
code { padding: 2px 5px; border-radius: 4px; background: var(--surface-3); font-family: "JetBrains Mono", "SFMono-Regular", monospace; }

.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 21px; font-weight: 800; }
.brand-mark.small { width: 32px; height: 32px; font-size: 16px; border-radius: 6px; }
.eyebrow { margin: 0 0 6px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.field-label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: var(--surface-2); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input { height: 40px; padding: 0 12px; }
textarea { padding: 11px 12px; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.form-error { min-height: 18px; margin: 8px 0 0; color: #e66; font-size: 12px; }

.app-shell { min-height: 100vh; padding-top: 3px; }
.header { position: sticky; top: 0; z-index: 200; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
.header-main { position: relative; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .08em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.sync-status { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent); }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: var(--surface-3); }
.icon-button svg, .search-box svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar-button { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-3); font-size: 10px; font-weight: 800; cursor: pointer; }
.account-menu { position: absolute; top: 50px; right: 20px; width: 250px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.menu-heading { margin: 2px 4px 8px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 6px; background: var(--surface-3); }
.theme-switch button { height: 28px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.16); }
.menu-action { width: 100%; margin-top: 10px; height: 34px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.header-tabs { height: 44px; display: flex; align-items: stretch; justify-content: space-between; padding: 0 22px; }
.tabs { display: flex; gap: 24px; }
.tab { position: relative; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.tab span { margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: var(--surface-3); font-size: 10px; }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--brand); }
.search-box { width: 300px; align-self: center; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--subtle); }
.search-box input { height: auto; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 12px; }
kbd { margin-left: auto; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--subtle); font-size: 9px; }
.preview-banner { padding: 6px 20px; background: #5b4600; color: #fff3b0; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .08em; }

.workspace { max-width: 1600px; min-height: calc(100vh - 126px); margin: 0 auto; display: grid; grid-template-columns: minmax(360px, 42%) 1fr; }
.inbox-pane { min-width: 0; border-right: 1px solid var(--line); background: var(--surface); }
.detail-pane { min-width: 0; background: var(--bg); }
.pane-heading { height: 75px; display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.pane-heading h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.count-label { color: var(--subtle); font-size: 11px; }
.inbox-list { padding-bottom: 48px; }
.inbox-item { width: 100%; display: grid; grid-template-columns: 4px 1fr; gap: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.inbox-item:hover, .inbox-item.selected { background: var(--surface-2); }
.priority-line { background: transparent; }
.inbox-item.priority-high .priority-line { background: var(--danger); }
.inbox-item.priority-medium .priority-line { background: var(--warning); }
.item-body { min-width: 0; padding: 15px 18px 14px 14px; }
.item-head, .item-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.repo { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.time { flex: none; color: var(--subtle); font-size: 10px; }
.item-title { margin: 7px 0 10px; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 700; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.item-foot { justify-content: flex-start; }
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.badge.urgent { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 12%, transparent); color: #e87a7a; }
.badge.info { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-tint); color: #6ea6e7; }
.badge.success { border-color: color-mix(in srgb, var(--success) 45%, var(--line)); color: var(--success); }
.skeleton-list { padding: 10px 18px; }
.skeleton-list span { display: block; height: 74px; margin: 10px 0; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state, .detail-empty { display: grid; place-items: center; align-content: center; min-height: 380px; padding: 40px; color: var(--muted); text-align: center; }
.empty-state h2, .detail-empty h2 { margin: 12px 0 5px; color: var(--text); font-size: 18px; }
.empty-state p, .detail-empty p { max-width: 440px; line-height: 1.7; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--success); }

#detailContent { max-width: 860px; margin: 0 auto; padding: 26px 32px 80px; }
.detail-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.text-button { border: 0; background: transparent; color: #4f8fdc; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; }
.repo-label { margin: 30px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
#detailTitle { max-width: 760px; margin: 0; font-size: clamp(22px, 2.6vw, 34px); line-height: 1.2; letter-spacing: -.04em; }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; margin: 25px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); }
.meta-grid div { padding: 12px 14px; background: var(--surface); }
.meta-grid dt { color: var(--subtle); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.meta-grid dd { margin: 5px 0 0; font-size: 12px; font-weight: 700; }
.decision-card { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h3 { margin: 0; font-size: 14px; }
.shortcut-label { color: var(--subtle); font-size: 10px; }
.form-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; }
.form-row .field-label { margin-top: 12px; }
.button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 800; cursor: pointer; transition: background .15s, border-color .15s; }
.button:hover { border-color: var(--muted); }
.button.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-hover); }
.button.success { border-color: var(--success); color: var(--success); }
.button.ghost { color: var(--muted); }
.button.wide { width: 100%; margin-top: 16px; }
.state-actions { display: flex; gap: 8px; margin-top: 14px; }
.timeline-section { margin-top: 36px; }
.timeline { margin: 14px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.timeline li { position: relative; padding: 16px 0 16px 24px; border-bottom: 1px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.log-title { margin: 0; font-size: 12px; font-weight: 700; }
.log-copy { margin: 5px 0; color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.log-meta { color: var(--subtle); font-size: 10px; }
.statusbar { position: fixed; inset: auto 0 0; z-index: 180; height: 26px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-top: 1px solid var(--line); background: var(--surface); color: var(--subtle); font-size: 9px; }
.statusbar span { display: flex; align-items: center; gap: 6px; }
.help-drawer { position: fixed; z-index: 500; top: 3px; right: 0; bottom: 0; width: min(390px, 90vw); padding: 24px; border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transform: translateX(105%); transition: transform .2s ease; }
.help-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-size: 18px; }
.help-drawer > p { color: var(--muted); line-height: 1.7; }
.help-drawer h3 { margin-top: 28px; font-size: 12px; }
.shortcut-list div { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.shortcut-list dt { min-width: 70px; color: var(--text); font-family: "JetBrains Mono", monospace; }
.shortcut-list dd { margin: 0; color: var(--muted); }
.scrim { position: fixed; inset: 0; z-index: 450; background: rgba(0,0,0,.5); }
.toast { position: fixed; z-index: 600; right: 20px; bottom: 42px; max-width: 340px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); font-size: 12px; }
.mobile-only { display: none; }

@media (max-width: 800px) {
  .header-main, .header-tabs { padding-inline: 14px; }
  .sync-status span:last-child { display: none; }
  .search-box { width: 38px; padding: 0 9px; }
  .search-box input, .search-box kbd { display: none; }
  .search-box:focus-within { position: absolute; left: 12px; right: 12px; z-index: 10; width: auto; }
  .search-box:focus-within input { display: block; }
  .tabs { gap: 15px; }
  .tab { font-size: 11px; }
  .workspace { display: block; }
  .inbox-pane { min-height: calc(100vh - 126px); border-right: 0; }
  .detail-pane { display: none; position: fixed; z-index: 190; inset: 103px 0 26px; overflow: auto; }
  body.detail-open .detail-pane { display: block; }
  body.detail-open .inbox-pane { visibility: hidden; }
  #detailContent { padding: 20px 18px 70px; }
  .detail-topbar { align-items: flex-start; }
  .mobile-only { display: inline-block; }
  .desktop-only { display: none !important; }
  .meta-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .state-actions { flex-wrap: wrap; }
  .state-actions .button { flex: 1 1 130px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
