:root {
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --rose: #c9ada7;
  --green: #4a7c59;
  --line: rgba(15, 31, 28, 0.16);
  --muted: rgba(15, 31, 28, 0.62);
  --panel: #ffffff;
  --wash: #eef2ef;
  --warn: #9b594a;
  --shadow: 0 22px 70px rgba(15, 31, 28, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.nav-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small,
.case-main strong,
.case-main small {
  display: block;
}

.brand strong {
  font-size: 1.28rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: rgba(248, 249, 250, 0.68);
  line-height: 1.35;
}

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

.tab,
.stage,
.case-row,
.registry-row,
.icon-button,
.primary-button,
.vote-actions button,
.dialog-actions button {
  border: 0;
  border-radius: 8px;
}

.tab {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  color: rgba(248, 249, 250, 0.72);
  background: transparent;
  letter-spacing: 0;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
  color: var(--paper);
  background: rgba(248, 249, 250, 0.11);
  transform: translateX(2px);
}

.source-box {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(248, 249, 250, 0.18);
}

.label,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-panel .label {
  color: rgba(248, 249, 250, 0.52);
}

.source-box strong {
  display: block;
  margin-top: 7px;
  color: var(--rose);
  overflow-wrap: anywhere;
}

.workspace {
  min-width: 0;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(201, 173, 167, 0.24), transparent 36%),
    radial-gradient(circle at 90% 0%, rgba(74, 124, 89, 0.2), transparent 28%),
    var(--paper);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search input {
  width: min(34vw, 320px);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-transform: none;
}

.icon-button,
.primary-button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(15, 31, 28, 0.16);
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  background: #203831;
}

.primary-button.wide {
  width: 100%;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  background: var(--line);
  border: 1px solid var(--line);
}

.metrics article {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: rise 220ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.timeline-panel,
.detail-sheet,
.registry-table,
.audit-panel,
.calendar-item,
.report-main,
.report-list {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.timeline-panel,
.detail-sheet,
.registry-table,
.audit-panel,
.report-main,
.report-list {
  border-radius: 8px;
  padding: 18px;
}

.section-head {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head.compact {
  align-items: center;
}

.section-head p {
  margin-bottom: 0;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.stage {
  min-height: 74px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: var(--wash);
  transition: background 160ms ease, transform 160ms ease;
}

.stage span,
.stage small {
  display: block;
}

.stage small {
  margin-top: 8px;
  color: var(--muted);
}

.stage.is-current {
  color: var(--paper);
  background: var(--green);
  transform: translateY(-2px);
}

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

.case-row,
.registry-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: rgba(248, 249, 250, 0.92);
  border: 1px solid transparent;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.case-row:hover,
.case-row.is-selected,
.registry-row:hover {
  border-color: var(--green);
  background: #fff;
  transform: translateX(2px);
}

.case-main {
  min-width: 0;
}

.case-main strong,
.registry-row strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.case-main small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.case-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  white-space: nowrap;
}

.case-meta b {
  color: var(--green);
  font-size: 1.2rem;
}

.detail-sheet {
  position: sticky;
  top: 28px;
}

.detail-sheet h2 {
  margin-top: 8px;
  font-size: 1.85rem;
}

.facts {
  display: grid;
  gap: 1px;
  margin: 18px 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.facts div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.72);
}

.facts dt {
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  padding-right: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.vote-block {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--wash);
}

.vote-block strong {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
}

.vote-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vote-actions button {
  min-height: 40px;
  color: var(--paper);
  background: var(--green);
}

.vote-actions button:last-child {
  background: var(--warn);
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.36fr);
  gap: 18px;
}

.registry-row {
  grid-template-columns: minmax(220px, 1.2fr) minmax(120px, 0.8fr) minmax(96px, 0.6fr) 64px;
  margin-bottom: 8px;
}

.registry-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 13px;
  border-left: 3px solid var(--rose);
  background: rgba(248, 249, 250, 0.88);
}

.timeline-item time,
.timeline-item small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.timeline-item p {
  margin: 6px 0 4px;
}

.calendar-grid {
  display: grid;
  gap: 10px;
}

.calendar-item {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: center;
  min-height: 92px;
  padding: 16px;
  border-radius: 8px;
}

.calendar-item time {
  color: var(--green);
  font-weight: 700;
}

.calendar-item p {
  margin-bottom: 0;
}

.calendar-item span {
  justify-self: end;
  color: var(--muted);
}

.report-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.75fr 0.9fr;
  gap: 18px;
}

.report-main {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.score-ring {
  width: 138px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 56%, transparent 57%),
    conic-gradient(var(--green) calc(var(--score) * 1%), rgba(15, 31, 28, 0.12) 0);
}

.score-ring span {
  font-size: 2rem;
  font-weight: 800;
}

.report-list article {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.report-list p {
  padding: 10px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 31, 28, 0.42);
}

.dialog-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.dialog-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  min-height: 40px;
  padding: 0 14px;
}

.dialog-actions button:not(.primary-button) {
  background: var(--wash);
  color: var(--ink);
}

.empty {
  padding: 16px;
  color: var(--warn);
  background: rgba(155, 89, 74, 0.1);
  border-radius: 8px;
}

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

  .nav-panel {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

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

  .source-box {
    margin-top: 0;
  }

  .split,
  .details-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .detail-sheet {
    position: relative;
    top: auto;
  }
}

@media (max-width: 720px) {
  .workspace,
  .nav-panel {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
  }

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

  .case-row,
  .registry-row,
  .calendar-item,
  .report-main {
    grid-template-columns: 1fr;
  }

  .case-meta,
  .calendar-item span {
    justify-items: start;
    justify-self: start;
    white-space: normal;
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .facts dt,
  .facts dd {
    padding: 0 10px;
  }
}

@media (max-width: 440px) {
  .tabs,
  .metrics,
  .workflow-strip,
  .vote-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }
}
