:root {
  --bg: #f5f1e8;
  --panel: #f1ece2;
  --panel-strong: #ffffff;
  --border: rgba(90, 74, 53, 0.16);
  --text: #2e241a;
  --muted: #756351;
  --accent: #9d4424;
  --accent-soft: rgba(157, 68, 36, 0.12);
  --shadow: 0 18px 50px rgba(62, 45, 27, 0.09);
  --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-reading: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(157, 68, 36, 0.08), transparent 30%),
    linear-gradient(180deg, #f8f4eb 0%, #f1ece2 100%);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
}

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

.sidebar,
.reader {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.05;
}

.sidebar-copy,
.case-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-label {
  font-size: 0.92rem;
  color: var(--muted);
}

.case-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  font: inherit;
  color: var(--text);
}

.file-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.file-groups section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-groups h2 {
  font-size: 0.95rem;
  color: var(--muted);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 0;
  font: inherit;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.file-button:hover {
  background: rgba(255, 255, 255, 0.56);
  border-color: var(--border);
  transform: translateX(2px);
}

.file-button.is-active {
  background: var(--accent-soft);
  border-color: rgba(157, 68, 36, 0.3);
  color: var(--accent);
  font-weight: 600;
}

.reader {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

.reader-header {
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--border);
}

.reader-header h2 {
  font-size: 1.5rem;
  margin-top: 6px;
}

.reader-content {
  padding: 32px;
  overflow-wrap: anywhere;
  font-family: var(--font-reading);
  font-size: 1.08rem;
  line-height: 1.7;
}

.reader-content h1,
.reader-content h2,
.reader-content h3 {
  font-family: var(--font-ui);
  line-height: 1.2;
  margin-top: 1.8em;
  margin-bottom: 0.7em;
}

.reader-content h1:first-child,
.reader-content h2:first-child,
.reader-content h3:first-child {
  margin-top: 0;
}

.reader-content p,
.reader-content li {
  margin-top: 0;
  margin-bottom: 0.9em;
}

.reader-content ul,
.reader-content ol {
  padding-left: 1.3em;
}

.reader-content pre,
.plain-text {
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 18px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94rem;
  line-height: 1.55;
}

.reader-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  min-width: 760px;
}

.reader-content th,
.reader-content td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.reader-content blockquote {
  margin: 1.2em 0;
  padding: 0.2em 1em;
  border-left: 4px solid rgba(157, 68, 36, 0.35);
  background: #faf7f2;
}

.status-message {
  color: var(--muted);
  font-family: var(--font-ui);
}

.table-wrap {
  overflow-x: auto;
}

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

  .sidebar {
    padding: 20px 16px;
  }

  .reader-header,
  .reader-content {
    padding-left: 20px;
    padding-right: 20px;
  }
}
