:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #60706b;
  --line: #d9e2de;
  --paper: #f3f7f5;
  --panel: #fff;
  --accent: #147b57;
  --accent-dark: #0c5e41;
  --navy: #193b62;
  --gold: #9c6c10;
  --red: #a43b3b;
  --shadow: 0 14px 36px rgba(18, 48, 38, .08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.app { min-height: 100vh; padding: 24px; }
.topbar, .metrics, .controls, .workspace, .status { margin-left: auto; margin-right: auto; max-width: 1500px; }
.topbar { align-items: center; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 18px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .08em; margin: 0 0 5px; text-transform: uppercase; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 31px; line-height: 1.08; margin: 0; }
.dek { color: var(--muted); margin: 7px 0 0; }
.actions, .links, .writer-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
button, .button {
  align-items: center; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px;
  color: #fff; cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 750;
  height: 38px; justify-content: center; min-width: 78px; padding: 0 14px; text-decoration: none;
}
button, .button { touch-action: manipulation; }
button:hover, .button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.secondary:hover { background: #edf3f0; border-color: #c4d2cc; }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 12px; }
.metrics div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.metrics span { display: block; font-size: 23px; font-weight: 850; line-height: 1.1; }
.metrics label { color: var(--muted); display: block; font-size: 12px; font-weight: 700; margin-top: 6px; }
.controls { display: grid; gap: 9px; grid-template-columns: minmax(270px, 1.25fr) 150px 170px 210px 140px 140px; margin-bottom: 14px; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: inherit; }
input, select { height: 40px; min-width: 0; padding: 0 11px; }
textarea { line-height: 1.45; min-height: 105px; padding: 12px; resize: vertical; width: 100%; }
.workspace { display: grid; gap: 16px; grid-template-columns: minmax(420px, .9fr) minmax(520px, 1.1fr); }
.list, .detail { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-height: 640px; }
.list { max-height: calc(100vh - 232px); overflow: auto; }
.date-group {
  background: #eaf1ee; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line);
  color: #40534c; font-size: 12px; font-weight: 850; padding: 9px 16px; position: sticky; top: 0; z-index: 1;
}
.row {
  background: #fff; border: 0; border-bottom: 1px solid var(--line); border-left: 4px solid transparent;
  color: var(--ink); display: grid; gap: 7px; height: auto; justify-content: stretch; min-width: 0;
  padding: 14px 16px; text-align: left; width: 100%;
}
.row:hover, .row.active { background: #f1f8f5; }
.row.active { border-left-color: var(--accent); padding-left: 12px; }
.qno, .detail .date { color: var(--accent); font-size: 12px; font-weight: 850; margin: 0; text-transform: uppercase; }
.row-title { font-size: 15px; font-weight: 820; line-height: 1.35; }
.meta, .detail-tags { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 12px; gap: 8px; }
.pill { background: #e8f5ef; border: 1px solid #c8e8da; border-radius: 999px; color: var(--accent-dark); font-size: 11px; font-weight: 800; padding: 3px 8px; }
.preview { color: #405049; font-size: 13px; line-height: 1.45; }
.score { border-radius: 999px; font-size: 11px; font-weight: 850; justify-self: start; padding: 4px 9px; }
.score.high { background: #fae9e9; color: var(--red); }
.score.watch { background: #fff4d9; color: var(--gold); }
.score.routine { background: #edf1f4; color: #53616c; }
.detail { max-height: calc(100vh - 232px); overflow: auto; padding: 24px; }
.detail-top { align-items: center; display: flex; justify-content: space-between; gap: 12px; }
.detail h2 { font-family: Georgia, "Times New Roman", serif; font-size: 26px; line-height: 1.2; margin: 9px 0 14px; }
.detail h3 { border-top: 1px solid var(--line); font-size: 12px; font-weight: 850; margin: 22px 0 10px; padding-top: 16px; text-transform: uppercase; }
.detail ul { margin: 0; padding-left: 20px; }
.detail li { line-height: 1.55; margin-bottom: 11px; }
dl { display: grid; gap: 8px; margin: 18px 0 0; }
dl div { display: grid; gap: 10px; grid-template-columns: 90px 1fr; }
dt { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
dd { font-size: 13px; margin: 0; }
details { border-top: 1px solid #edf1ef; margin-top: 14px; padding-top: 12px; }
summary { color: var(--navy); cursor: pointer; font-size: 13px; font-weight: 800; }
details p { color: #3d4b46; font-size: 13px; line-height: 1.55; }
.writer { border-top: 1px solid var(--line); margin-top: 24px; }
.writer-option { align-items: center; color: var(--muted); display: flex; font-size: 13px; font-weight: 700; gap: 8px; margin: 10px 0; }
.writer-option input { accent-color: var(--accent); height: 16px; min-width: 16px; width: 16px; }
.writer-status { color: var(--muted); font-size: 12px; font-weight: 700; }
.story-output { background: #f9fbfa; border: 1px solid var(--line); border-radius: 8px; margin-top: 14px; padding: 16px; }
.story-output:empty, .hidden { display: none; }
.story-output h2 { font-size: 22px; margin: 4px 0 14px; }
.story-label { color: var(--accent); font-size: 11px; font-weight: 850; margin: 14px 0 4px; text-transform: uppercase; }
.story-label:first-child { margin-top: 0; }
.strap { color: #31453d; font-size: 15px; font-weight: 750; line-height: 1.5; margin: 0; }
.body-copy p { line-height: 1.62; margin: 0 0 12px; }
.empty, .status { color: var(--muted); }
.pad { padding: 18px; }
.status { font-size: 12px; margin-top: 12px; }
@media (max-width: 1050px) {
  .app { padding: 16px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .controls input { grid-column: 1 / -1; }
  .workspace { grid-template-columns: 1fr; }
  .list { max-height: 52vh; min-height: 320px; }
  .detail { max-height: none; min-height: 340px; scroll-margin-top: 12px; }
}
@media (max-width: 650px) {
  .app { padding: 12px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar { gap: 14px; }
  h1 { font-size: 27px; }
  .dek { font-size: 14px; line-height: 1.45; }
  .actions { display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; }
  .actions button, .actions .button { height: 44px; min-width: 0; padding: 0 8px; width: 100%; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div { padding: 12px; }
  .metrics div:last-child { grid-column: 1 / -1; }
  .metrics span { font-size: 20px; }
  .controls { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  input, select { height: 46px; }
  .list { max-height: 56vh; min-height: 280px; }
  .row { padding: 15px 14px; }
  .detail { padding: 17px 14px; }
  .detail h2 { font-size: 23px; overflow-wrap: anywhere; }
  .detail-top { align-items: flex-start; }
  dl div { grid-template-columns: 76px minmax(0, 1fr); }
  .links { display: grid; grid-template-columns: 1fr; }
  .links .button { height: 44px; width: 100%; }
  .writer-actions { align-items: stretch; flex-direction: column; }
  .writer-actions button { height: 44px; width: 100%; }
  .story-output { padding: 13px; }
  .story-output h2 { font-size: 21px; overflow-wrap: anywhere; }
  .body-copy p { font-size: 16px; line-height: 1.68; }
}
