:root {
  --paper: #f7f2e8;
  --raised: #fffdf8;
  --ink: #14201d;
  --text: #1d2b27;
  --text-2: #4c5a55;
  --text-3: #5f6c67;
  --line: #14201d14;
  --line-strong: #14201d24;
  --accent: #0a557f;
  --accent-dark: #073f5e;
  --accent-soft: #8fc3dd;
  --amber: #f3dfb8;
  --amber-line: #d8a75a;
  --amber-ink: #8a5a16;
  --dark: #13201e;
  --dark-raised: #1a2a27;
  --dark-text: #eef2ec;
  --dark-text-2: #b3c0b8;
  --dark-line: #ffffff1f;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body.dashboard-page {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
p, h1, h2, h3 { margin-top: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.skip-link {
  position: absolute;
  top: -56px;
  left: 16px;
  z-index: 20;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  font-size: 13px;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sidebar :focus-visible { outline-color: var(--accent-soft); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: 236px;
  padding: 22px 16px;
  background: var(--dark);
  color: var(--dark-text);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: var(--dark-text);
  font: 600 20px/1 var(--font-display);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 23px;
  height: 23px;
  color: var(--accent-soft);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-it { margin-left: 0.14em; color: var(--accent-soft); }
.workspace-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 40px 8px 14px;
  color: var(--dark-text-2);
  font-size: 12px;
}
.workspace-label span { color: var(--dark-text); font-size: 14px; font-weight: 500; }
.sidebar nav { display: grid; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--dark-text-2);
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link .icon { width: 17px; height: 17px; color: var(--dark-text-2); }
.nav-link:hover { background: #ffffff0d; color: var(--dark-text); }
.nav-link.active { background: #ffffff0d; color: var(--dark-text); box-shadow: inset 2px 0 var(--accent-soft); }
.nav-link.active .icon { color: var(--accent-soft); }
.sidebar-bottom { margin-top: auto; padding: 10px 8px 4px; color: var(--dark-text-2); font-size: 12px; }
.sidebar-bottom a { display: flex; align-items: center; gap: 8px; color: var(--dark-text-2); text-decoration: none; }
.sidebar-bottom a:hover { color: var(--dark-text); }
.sidebar-bottom .icon { width: 15px; height: 15px; }

.main-content {
  margin-left: 236px;
  max-width: 1680px;
  padding: 28px clamp(24px, 4vw, 56px) 28px;
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}
.eyebrow::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: none;
  margin-right: 16px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 6px 0 0 currentColor, 12px 0 0 currentColor, 18px 0 0 currentColor;
  opacity: 0.9;
}
.topbar h1 { margin: 0; color: var(--ink); font: 600 clamp(26px, 2.4vw, 32px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.profile-chip { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.profile-chip b { color: var(--text); font-weight: 500; }
.page-note { max-width: 900px; margin: 0 0 20px; color: var(--text-3); font-size: 13px; line-height: 1.55; }
.page-note strong { color: var(--text-2); font-weight: 500; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 32px; margin-bottom: 24px; }
.metric-card { padding: 16px 0 0; border-top: 1px solid var(--line); }
.metric-label { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 500; }
.metric-card > strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--ink);
  font: 600 32px/1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.metric-note { margin: 0; color: var(--text-3); font-size: 12px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(260px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0 0 4px; color: var(--ink); font: 600 18px/1.2 var(--font-display); letter-spacing: -0.02em; }
.panel-heading p:last-child { margin: 0; color: var(--text-3); font-size: 12px; }
.period-label { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.chart-legend { display: flex; justify-content: flex-end; gap: 16px; margin: 12px 0 0; color: var(--text-3); font-size: 11px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { display: block; width: 7px; height: 7px; border-radius: 50%; }
.legend-good { background: var(--accent); }
.legend-okay { background: var(--text-3); }
.legend-hard { background: var(--amber-ink); }
.chart-scroll { min-width: 0; overflow-x: auto; }
.trend-chart { display: block; width: 100%; min-width: 520px; height: auto; margin-top: 10px; }
.grid-lines { stroke: var(--line); stroke-width: 1; }
.axis-labels { fill: var(--text-3); font: 16px var(--font-ui); font-variant-numeric: tabular-nums; }
.line-good, .line-okay, .line-hard { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line-good { stroke: var(--accent); stroke-width: 3; }
.line-okay { stroke: var(--text-3); stroke-width: 2; }
.line-hard { stroke: var(--amber-ink); stroke-width: 2; }
.points circle { fill: var(--accent); stroke: var(--raised); stroke-width: 2; }

.sentiment-panel { display: flex; flex-direction: column; }
.sentiment-panel .panel-heading { margin-bottom: 16px; }
.sentiment-row { margin-bottom: 16px; }
.sentiment-label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.sentiment-label .icon { width: 18px; height: 18px; color: var(--text-3); }
.sentiment-label b { margin-left: auto; color: var(--ink); font: 600 14px var(--font-display); font-variant-numeric: tabular-nums; }
.track { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fill { display: block; height: 100%; border-radius: 3px; }
.fill-good { background: var(--accent); }
.fill-okay { background: var(--text-3); }
.fill-hard { background: var(--amber-ink); }
.context-note { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; line-height: 1.5; }

.issue-panel, .followup-panel { margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.filter {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: transparent;
  color: var(--text-2);
  font: 500 12px var(--font-ui);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
td:nth-child(2), td:nth-child(3) { font-variant-numeric: tabular-nums; }
.priority { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.priority::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.priority-high::before { background: #a65f1f; }
.priority-medium::before { background: #b8873c; }
.priority-low::before { background: var(--text-3); }

.small-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.small-link .icon { width: 15px; height: 15px; }
.case-list { margin-top: 8px; }
.case-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.case-id { margin: 0 0 2px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.case-main h3 { margin: 0 0 2px; color: var(--ink); font: 600 15px/1.3 var(--font-display); }
.case-main p { margin: 0; color: var(--text-3); font-size: 12px; }
.case-status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.case-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.status-review::before { background: var(--amber-ink); }
.status-open::before { background: var(--accent); }
.view-case {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: transparent;
  color: var(--accent);
  font: 500 12px var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.view-case:hover { border-color: var(--accent); background: var(--paper); }

footer { padding: 8px 0 0; color: var(--text-3); font-size: 12px; }
footer p { margin: 0; }

dialog {
  width: min(520px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--raised);
  color: var(--text);
  box-shadow: 0 24px 60px #00000024;
}
dialog::backdrop { background: #13201ecc; }
dialog h2 { margin: 0 0 10px; color: var(--ink); font: 600 22px/1.2 var(--font-display); letter-spacing: -0.02em; }
dialog > p:not(.eyebrow) { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.dialog-close .icon { width: 16px; height: 16px; }
.dialog-steps { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--text-2); font-size: 13px; }
.dialog-steps b { color: var(--text); font-weight: 500; }
.dialog-steps ol { margin: 8px 0 0; padding-left: 20px; }
.dialog-steps li + li { margin-top: 4px; }
.dialog-note { margin: 14px 0 0; color: var(--text-3); font-size: 12px; }
