:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #637181;
  --line: #d9e0e7;
  --paper: #f7f8fb;
  --panel: #ffffff;
  --accent: #0d5c7f;
  --accent-strong: #093f59;
  --shadow: 0 12px 34px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.app {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1440px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  margin: 6px 0 0;
}

.actions,
.links,
.writer-actions {
  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;
  touch-action: manipulation;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.secondary:hover {
  background: #eef2f6;
  border-color: #c8d1db;
}

.metrics,
.controls,
.workspace,
.status {
  margin-left: auto;
  margin-right: auto;
  max-width: 1440px;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, 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: 22px;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metrics label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.controls {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr) 240px 180px 190px;
  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 12px;
}

textarea {
  line-height: 1.45;
  min-height: 104px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(13, 92, 127, 0.24);
  outline-offset: 2px;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 0.95fr) minmax(480px, 1.05fr);
}

.list,
.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 620px;
}

.list {
  max-height: calc(100vh - 206px);
  overflow: auto;
}

.date-group {
  background: #eef2f6;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: #49586a;
  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);
  cursor: pointer;
  display: grid;
  gap: 8px;
  height: auto;
  justify-content: stretch;
  min-width: 0;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.row:hover,
.row.active {
  background: #f4f8fb;
  border-left-color: var(--accent);
}

.row-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.meta,
.detail-tags {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
}

.preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.detail {
  overflow: auto;
  padding: 24px;
}

.detail .date {
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  margin: 0 0 8px;
}

.detail h2 {
  font-size: 26px;
  line-height: 1.16;
  margin: 0 0 10px;
}

.detail h3 {
  font-size: 15px;
  margin: 22px 0 10px;
}

.detail li {
  line-height: 1.45;
  margin-bottom: 8px;
}

.writer {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 10px;
}

.writer-status,
.status {
  color: var(--muted);
  font-size: 13px;
}

.story-output {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 16px;
}

.story-output:empty {
  display: none;
}

.story-output h4 {
  font-size: 22px;
  line-height: 1.18;
  margin: 0 0 8px;
}

.strap {
  color: var(--muted);
  font-weight: 750;
}

.word-count {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.empty {
  color: var(--muted);
  padding: 18px;
}

@media (max-width: 920px) {
  .app {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls,
  .workspace {
    grid-template-columns: 1fr;
  }

  input,
  select,
  button,
  .button {
    min-height: 44px;
  }

  .list,
  .detail {
    min-height: auto;
  }

  .list {
    max-height: none;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 24px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .detail {
    padding: 18px;
  }

  .app {
    padding: 10px;
  }

  .metrics div {
    padding: 12px;
  }

  .row {
    padding: 13px 14px;
  }

  .row-title {
    font-size: 14px;
  }

  .detail h2 {
    font-size: 22px;
  }

  .story-output h4 {
    font-size: 19px;
  }
}
