:root {
  --ink: #14213d;
  --paper: #ffffff;
  --line: #d9dee8;
  --muted: #667085;
  --soft: #f4f6f8;
  --action: #fca311;
  --teal: #2a9d8f;
  --danger: #d1495b;
  --shadow: 0 24px 70px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(20, 33, 61, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(20, 33, 61, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.brand small,
.case-row small,
.task small,
.control small,
.evidence-list small,
.timeline-row small {
  color: var(--muted);
  display: block;
  line-height: 1.35;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.nav__item {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.nav__item:hover {
  transform: translateY(-1px);
}

.nav__item.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.field {
  border-right: 1px solid var(--line);
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
}

.field__header {
  margin-bottom: 22px;
}

.kicker {
  color: var(--teal);
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.95;
  margin-bottom: 0;
  max-width: 640px;
}

h2 {
  font-size: clamp(28px, 3.4vw, 56px);
  line-height: 0.96;
  margin-bottom: 18px;
}

h3 {
  font-size: 14px;
  line-height: 1.2;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
  margin-bottom: 18px;
}

.search label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.search input,
.search select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.search input:focus,
.search select:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.18);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.metric {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
}

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

.case-row {
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  transition: border 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.case-row:hover,
.case-row.is-active {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(20, 33, 61, 0.1);
}

.case-row__risk {
  min-height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

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

.case-row__body strong {
  display: block;
  overflow-wrap: anywhere;
}

.case-row__due {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.console {
  padding: 28px;
  min-width: 0;
  animation: rise 260ms ease both;
}

.console.is-hidden {
  display: none;
}

.console__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.case-card {
  min-height: 560px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(20, 33, 61, 0.08), rgba(255, 255, 255, 0) 42%),
    var(--paper);
  padding: clamp(22px, 4vw, 46px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.case-card:after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(20, 33, 61, 0.22);
  border-radius: 50%;
}

.case-card__top,
.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.case-card p {
  color: #344054;
  font-size: 18px;
  line-height: 1.55;
  max-width: 760px;
}

.risk-pill {
  border-radius: 999px;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.risk-critical,
.risk-high {
  background: var(--danger);
}

.risk-medium {
  background: var(--action);
  color: var(--ink);
}

.risk-low {
  background: var(--teal);
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 34px 0;
}

.fact-grid div {
  border-top: 2px solid var(--ink);
  padding-top: 10px;
}

.fact-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.fact-grid dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.primary-action,
.ghost-action {
  border-radius: 8px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 900;
  border: 1px solid var(--ink);
}

.primary-action {
  background: var(--action);
  color: var(--ink);
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(252, 163, 17, 0.25);
}

.ghost-action {
  background: var(--ink);
  color: var(--paper);
}

.lane {
  border-left: 4px solid var(--ink);
  padding-left: 22px;
}

.lane__title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.lane__steps {
  display: grid;
  gap: 14px;
}

.lane-step {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  opacity: 0.56;
  transition: opacity 180ms ease, transform 180ms ease, border 180ms ease;
}

.lane-step span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  font-weight: 900;
}

.lane-step.is-done,
.lane-step.is-current {
  opacity: 1;
}

.lane-step.is-current {
  border-color: var(--action);
  transform: translateX(6px);
}

.lane-step.is-current span {
  background: var(--action);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 20px;
}

.detail-pane,
.evidence-pane,
.report-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 22px;
}

.task-board,
.control-list,
.evidence-list,
.timeline,
.report-grid {
  display: grid;
  gap: 10px;
}

.task,
.control,
.evidence-list div,
.timeline-row,
.report-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
}

.task {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--muted);
  flex: 0 0 auto;
}

.status-blocked,
.status-missing {
  background: var(--danger);
}

.status-queued,
.status-draft {
  background: var(--action);
}

.status-doing,
.status-active {
  background: var(--teal);
}

.status-done,
.status-verified {
  background: var(--ink);
}

.control span {
  color: var(--teal);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.timeline-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.timeline-row time {
  color: var(--ink);
  font-weight: 900;
}

.timeline-row time span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

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

.report-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 10;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .field {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .case-card {
    min-height: auto;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .nav {
    width: 100%;
  }

  .workspace {
    display: block;
  }

  .field,
  .console {
    padding: 16px;
  }

  .search,
  .metrics,
  .fact-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .case-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .case-row__due {
    grid-column: 2;
  }

  .case-card__top,
  .screen-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }
}

