:root {
  --bg: #f7f7f3;
  --panel: #ffffff;
  --ink: #222421;
  --muted: #6d716a;
  --line: #deded6;
  --accent: #226f68;
  --accent-strong: #164f4a;
  --warn: #a05a18;
  --danger: #a33a35;
  --mark: #fff1a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-screen {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  max-width: 360px;
  padding: 24px;
  width: 100%;
}

.login-box h1 {
  font-size: 24px;
  line-height: 1.1;
  margin: 0 0 6px;
}

.login-box p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfbf8;
  padding: 18px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
  margin: 0;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.import-box {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.import-box input,
.login-box input,
.note-input,
.highlight-note {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.import-actions {
  display: flex;
  gap: 8px;
}

.status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.article-list {
  display: grid;
  gap: 8px;
}

.article-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel);
  cursor: pointer;
}

.article-item.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.article-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  margin-bottom: 6px;
}

.article-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
}

.badge.failed,
.badge.needs_review {
  border-color: #e0b889;
  color: var(--warn);
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 100vh;
}

.reader {
  padding: 34px min(6vw, 72px);
  overflow: auto;
}

.empty {
  max-width: 560px;
  margin: 18vh auto;
  color: var(--muted);
  line-height: 1.65;
}

.reader-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  padding-bottom: 18px;
}

.reader-header h2 {
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: 0;
}

.source-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.content {
  max-width: 780px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.highlighted {
  background: var(--mark);
  border-radius: 3px;
  padding: 0 2px;
}

.side-panel {
  border-left: 1px solid var(--line);
  background: #fbfbf8;
  padding: 18px;
  overflow: auto;
}

.panel-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.panel-section h3 {
  font-size: 13px;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.selection-card,
.highlight-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  margin-bottom: 10px;
}

.quote {
  font-size: 14px;
  line-height: 1.45;
}

.small {
  color: var(--muted);
  font-size: 12px;
}

.note-input,
.highlight-note {
  min-height: 80px;
  resize: vertical;
}

.stack {
  display: grid;
  gap: 8px;
}

.settings-page {
  max-width: 760px;
  line-height: 1.65;
}

.settings-section {
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  padding-bottom: 18px;
}

.settings-section h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.copy-box,
pre {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

code {
  background: #ecece5;
  border-radius: 4px;
  padding: 2px 4px;
}

@media (max-width: 980px) {
  .shell,
  .main {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .side-panel {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader {
    padding: 24px;
  }
}
