:root {
  color-scheme: dark;
  --ink: #eef8f8;
  --muted: #93a7ad;
  --faint: #657980;
  --line: rgba(170, 213, 214, 0.13);
  --line-strong: rgba(170, 213, 214, 0.22);
  --canvas: #080d12;
  --surface: #0d151b;
  --surface-raised: #111c23;
  --signal: #71e5cf;
  --signal-dim: rgba(113, 229, 207, 0.12);
  --warm: #f4bd7b;
  --nav-width: 252px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { width: 100%; min-width: 0; max-width: 100%; overflow-x: clip; background: var(--canvas); }
body { width: 100%; min-width: 0; max-width: 100%; min-height: 100vh; margin: 0; overflow-x: clip; background: var(--canvas); color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-panel { position: relative; width: min(430px, 100%); padding: 34px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(13, 21, 27, .92); box-shadow: 0 28px 80px rgba(0,0,0,.35); }
.login-panel .brand { margin-bottom: 34px; }
.login-kicker { margin: 0 0 10px; color: var(--signal); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.login-panel h1 { margin: 0; font-size: clamp(2rem, 8vw, 3rem); letter-spacing: -.05em; }
.login-intro { margin: 12px 0 25px; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.login-form input { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 12px 13px; outline: none; background: #091116; color: var(--ink); font: inherit; }
.login-form input:focus { border-color: rgba(113,229,207,.65); box-shadow: 0 0 0 3px rgba(113,229,207,.08); }
.login-submit { min-height: 44px; margin-top: 4px; border: 1px solid rgba(113,229,207,.55); border-radius: 9px; background: var(--signal-dim); color: var(--signal); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-submit:hover { background: rgba(113,229,207,.18); }
.login-submit:disabled { cursor: wait; opacity: .55; }
.login-error { min-height: 20px; margin: 0; color: #f4a797; font-size: 13px; line-height: 1.45; }

.editor-page { min-height: 100vh; padding: 28px; }
.editor-shell { position: relative; width: min(1120px, 100%); margin: 0 auto; }
.editor-header { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.editor-header .brand { margin-right: auto; }
.editor-back { color: var(--muted); font-size: 13px; text-decoration: none; }
.editor-back:hover { color: var(--signal); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-card { border: 1px solid var(--line-strong); border-radius: 15px; background: rgba(13, 21, 27, .92); box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.editor-main { padding: 28px; }
.editor-grid > *, .editor-card, .editor-main, .editor-aside, .editor-main form { min-width: 0; max-width: 100%; }
.editor-kicker { margin: 0 0 10px; color: var(--signal); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.editor-main h1 { min-width: 0; max-width: 100%; margin: 0; overflow-wrap: anywhere; hyphens: auto; font-size: clamp(2rem, 5vw, 3.35rem); letter-spacing: -.05em; }
.editor-intro { max-width: 720px; margin: 12px 0 22px; color: var(--muted); line-height: 1.55; }
.editor-label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; }
.editor-json { width: 100%; min-width: 0; max-width: 100%; min-height: 470px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 10px; padding: 15px; outline: none; background: #071016; color: #d7e6e7; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.editor-json:focus { border-color: rgba(113,229,207,.6); box-shadow: 0 0 0 3px rgba(113,229,207,.07); }
.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.editor-button { min-height: 42px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 14px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.editor-button.primary { border-color: rgba(113,229,207,.55); background: var(--signal-dim); color: var(--signal); }
.editor-button:hover { border-color: var(--signal); }
.editor-button:disabled { cursor: wait; opacity: .5; }
.editor-status { min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.editor-status.error { color: #f4a797; }
.editor-status.success { color: var(--signal); }
.editor-aside { display: grid; gap: 13px; }
.editor-aside .side-card { background: rgba(13, 21, 27, .92); }
.editor-preview { display: grid; gap: 10px; }
.editor-preview strong { font-size: 18px; line-height: 1.3; }
.editor-preview span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.editor-checklist { margin: 0; padding-left: 0; color: var(--muted); font-size: 13px; line-height: 1.7; list-style-position: inside; overflow-wrap: anywhere; }

.site-ambient {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 76% -10%, rgba(59, 167, 158, .13), transparent 31rem), radial-gradient(circle at 9% 85%, rgba(49, 86, 110, .16), transparent 26rem);
}
.app-frame { position: relative; min-height: 100vh; }
.topbar {
  height: 72px; display: flex; align-items: center; gap: 18px; padding: 0 28px;
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 18, .9); backdrop-filter: blur(18px);
}
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 10px; text-decoration: none; letter-spacing: .08em; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(113,229,207,.5); border-radius: 9px;
  color: var(--signal); font: 700 17px/1 Georgia, serif; box-shadow: inset 0 0 15px rgba(113,229,207,.09);
}
.brand b { display: block; font-size: 12px; letter-spacing: .18em; }
.brand em { display: block; margin-top: 2px; font-size: 8px; font-style: normal; color: var(--muted); letter-spacing: .14em; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 15px; }
.connection { font-size: 12px; color: var(--muted); }
.connection i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 6px; box-shadow: 0 0 8px var(--signal); }
.connection.offline i { background: var(--warm); box-shadow: 0 0 8px var(--warm); }
.install-button, .quiet-button {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px;
}
.install-button:hover, .quiet-button:hover { border-color: var(--signal); color: var(--signal); }
.menu-button { display: none; }
.icon-button { border: 0; background: transparent; color: var(--ink); cursor: pointer; }

.workspace { display: grid; min-width: 0; max-width: 100%; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: rgba(9, 15, 20, .55); }
.primary-nav { padding: 22px 14px 13px; border-bottom: 1px solid var(--line); }
.nav-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; text-decoration: none; cursor: pointer; font-size: 14px; }
.nav-item:hover, .nav-item.active { background: rgba(113,229,207,.075); color: var(--ink); }
.nav-item.active { box-shadow: inset 2px 0 0 var(--signal); }
.nav-icon { width: 16px; color: var(--signal); font-size: 17px; }
.sidebar-section { padding: 22px 14px; overflow-y: auto; }
.sidebar-section p { margin: 0 12px 10px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.briefing-list { display: grid; gap: 3px; }
.briefing-choice { width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.briefing-choice:hover, .briefing-choice.active { border-color: var(--line); background: rgba(255,255,255,.018); color: var(--ink); }
.briefing-choice time { display: block; margin-bottom: 3px; color: var(--faint); font-size: 11px; }
.briefing-choice span { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sidebar-bottom { margin-top: auto; padding: 16px 25px 20px; border-top: 1px solid var(--line); }
.sidebar-bottom .quiet-button { width: 100%; margin-bottom: 15px; color: var(--muted); }
.sidebar-bottom span { display: block; color: #53656b; font-size: 9px; letter-spacing: .1em; }

.main-content { width: 100%; min-width: 0; max-width: 1420px; margin: 0 auto; padding: 48px clamp(22px, 5vw, 76px) 80px; }
.loading-state { min-height: 42vh; display: grid; place-content: center; justify-items: center; gap: 15px; color: var(--muted); font-size: 14px; }
.loading-orbit { width: 30px; height: 30px; border: 1px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.view-kicker { display: flex; align-items: center; gap: 9px; color: var(--signal); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.view-kicker::before { width: 18px; height: 1px; background: var(--signal); content: ""; }
.briefing-heading { margin: 15px 0 9px; max-width: 850px; font-size: clamp(2rem, 4.1vw, 4.05rem); line-height: 1.03; letter-spacing: -.055em; }
.briefing-meta { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.dashboard-grid { display: grid; min-width: 0; max-width: 100%; grid-template-columns: minmax(0, 1fr) 278px; gap: clamp(30px, 5vw, 74px); align-items: start; margin-top: 46px; }
.dashboard-grid > *, .stories, .story, .story-main, .executive-summary { min-width: 0; max-width: 100%; }
.executive-summary { position: relative; margin: 0 0 34px; padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg, rgba(113,229,207,.075), rgba(16,31,38,.45)); }
.executive-summary::before { position: absolute; top: -1px; left: 25px; width: 64px; height: 2px; background: var(--signal); content: ""; }
.executive-summary p { margin: 0; color: #d2e1e2; font-size: clamp(1rem, 1.3vw, 1.13rem); line-height: 1.62; }
.story-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.story-section-heading h2, .side-panel h2 { margin: 0; color: #cfe1e2; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.story-section-heading span { color: var(--faint); font-size: 12px; }
.category-filter { display: flex; width: 100%; max-width: 100%; gap: 7px; overflow-x: auto; margin: 0 0 20px; padding-bottom: 2px; scrollbar-width: none; }
.category-filter::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; background: rgba(255,255,255,.018); color: var(--muted); cursor: pointer; font-size: 12px; }
.filter-chip.active, .filter-chip:hover { border-color: rgba(113,229,207,.45); background: var(--signal-dim); color: var(--signal); }
.stories { display: grid; gap: 12px; }
.story { border: 1px solid var(--line); border-radius: 12px; background: rgba(12,21,27,.78); transition: border-color .2s, transform .2s; }
.story:hover { border-color: rgba(113,229,207,.28); transform: translateY(-1px); }
.story-main { padding: 21px 22px 17px; }
.story-topline { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.category-label { font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.priority { margin-left: auto; color: var(--faint); font-size: 10px; letter-spacing: .08em; }
.story h3 { margin: 0; font-size: clamp(1.08rem, 1.65vw, 1.35rem); line-height: 1.25; letter-spacing: -.025em; }
.story-summary { margin: 10px 0 0; color: #aebfc2; font-size: 15px; line-height: 1.58; }
.briefing-heading, .briefing-meta, .executive-summary p, .story h3, .story-summary, .why span { max-width: 100%; overflow-wrap: anywhere; word-break: normal; hyphens: auto; }
.why { display: flex; gap: 9px; margin: 16px 0 0; padding: 11px 12px; border-left: 2px solid var(--warm); background: rgba(244,189,123,.055); color: #d8c4a8; font-size: 13px; line-height: 1.5; }
.why b { flex: 0 0 auto; color: var(--warm); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.story-footer { display: flex; align-items: center; gap: 10px; min-height: 51px; padding: 9px 15px 9px 22px; border-top: 1px solid var(--line); }
.sources { display: flex; min-width: 0; flex: 1; gap: 8px; overflow: hidden; }
.source-link { overflow: hidden; color: var(--muted); font-size: 12px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.source-link:hover { color: var(--signal); text-decoration: underline; }
.source-link:not(:last-child)::after { margin-left: 8px; color: #4f6268; content: "·"; }
.feedback { display: flex; flex: 0 0 auto; gap: 5px; }
.feedback button { min-height: 30px; border: 1px solid transparent; border-radius: 7px; padding: 5px 8px; background: transparent; color: var(--faint); cursor: pointer; font-size: 12px; }
.feedback button:hover { border-color: var(--line-strong); color: var(--ink); }
.feedback button[data-signal="more"]:hover { color: var(--signal); border-color: rgba(113,229,207,.38); }
.feedback button[data-signal="less"]:hover { color: #f4a797; border-color: rgba(244,167,151,.38); }

.side-panel { display: grid; gap: 13px; }
.side-card { padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: rgba(11,19,25,.68); }
.side-card h2 { margin-bottom: 15px; }
.signal-list { display: grid; gap: 12px; }
.signal-row { display: grid; grid-template-columns: 7px minmax(0,1fr) auto; gap: 9px; align-items: center; color: var(--muted); font-size: 13px; }
.signal-row i { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 8px rgba(113,229,207,.5); }
.signal-row small { color: var(--faint); font-size: 11px; }
.side-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.side-note b { color: var(--ink); font-weight: 600; }
.archive-intro { max-width: 610px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.archive-list { display: grid; gap: 10px; margin-top: 31px; }
.archive-card { display: grid; grid-template-columns: 125px minmax(0,1fr) auto; gap: 19px; align-items: center; width: 100%; padding: 19px 20px; border: 1px solid var(--line); border-radius: 11px; background: rgba(12,21,27,.65); color: inherit; text-align: left; cursor: pointer; }
.archive-card:hover { border-color: rgba(113,229,207,.35); }
.archive-card time { color: var(--signal); font-size: 12px; font-weight: 700; }
.archive-card h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.archive-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.archive-card span { color: var(--faint); font-size: 12px; white-space: nowrap; }
.empty-state { margin-top: 30px; padding: 32px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); line-height: 1.6; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; max-width: min(360px, calc(100vw - 44px)); padding: 12px 15px; border: 1px solid rgba(113,229,207,.35); border-radius: 9px; background: #112229; color: #d8f7f1; box-shadow: 0 15px 45px rgba(0,0,0,.28); font-size: 13px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 72px auto 0 0; z-index: 19; width: min(310px, 88vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 30px 0 55px rgba(0,0,0,.24); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: grid; gap: 5px; width: 34px; height: 34px; place-content: center; }
  .menu-button span { display: block; width: 17px; height: 1px; background: var(--ink); }
  .main-content { padding-top: 36px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .editor-page { padding: 18px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-json { min-height: 390px; }
  .editor-actions { flex-wrap: wrap; }
  .editor-main h1 { font-size: 1.8rem; }
}
@media (max-width: 610px) {
  .topbar { height: 64px; padding: 0 16px; gap: 10px; }
  .sidebar { inset-top: 64px; top: 64px; }
  .brand { gap: 8px; }
  .brand b { font-size: 10px; letter-spacing: .14em; }
  .brand em { display: block; font-size: 7px; letter-spacing: .11em; }
  .topbar-meta { gap: 8px; }
  .connection { font-size: 0; }
  .connection i { margin: 0; }
  .install-button { padding: 7px 9px; font-size: 11px; }
  .workspace { min-height: calc(100vh - 64px); }
  .main-content { overflow-x: hidden; padding: 29px 16px 48px; }
  .briefing-heading { font-size: 2.25rem; }
  .dashboard-grid { margin-top: 30px; }
  .executive-summary { margin-bottom: 27px; padding: 19px; }
  .story-main { padding: 18px 17px 15px; }
  .story-topline { flex-wrap: wrap; }
  .story-footer { align-items: flex-start; flex-direction: column; padding: 11px 17px; }
  .category-filter { flex-wrap: wrap; overflow-x: visible; }
  .sources { width: 100%; flex-wrap: wrap; overflow: visible; }
  .source-link { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .feedback { align-self: flex-end; }
  .side-panel { grid-template-columns: 1fr; }
  .archive-card { grid-template-columns: 1fr; gap: 7px; }
  .archive-card span { position: absolute; right: 20px; }
}
