:root {
  --ink: #1a1a2e;
  --paper: #f2e9e4;
  --muted: #9a8c98;
  --clay: #c9ada7;
  --cream: #fffaf3;
  --line: rgba(26, 26, 46, 0.22);
  --amber: #d36f32;
  --green: #2f6f5e;
  --shadow: 0 18px 46px rgba(26, 26, 46, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(26, 26, 46, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(26, 26, 46, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.left-rail,
.inspector {
  background: rgba(255, 250, 243, 0.72);
  backdrop-filter: blur(12px);
}

.left-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 2px solid var(--ink);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.rail-nav {
  display: grid;
  gap: 7px;
}

.nav-button,
.status-tab,
.icon-command,
.action-form button,
.workflow-item button {
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  min-height: 42px;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav-button {
  width: 100%;
  padding: 11px 12px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active,
.status-tab:hover,
.status-tab.active,
.action-form button:hover,
.workflow-item button:hover {
  color: var(--cream);
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--clay);
  transform: translate(-1px, -1px);
}

.rail-note {
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}

.rail-note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.rail-note strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 74px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 26px;
  line-height: 1.05;
}

.search-line {
  width: min(320px, 100%);
}

.search-line label,
.action-form label,
.workflow-item label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-line input,
.action-form textarea,
.action-form select,
.workflow-item textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--cream);
  color: var(--ink);
  outline: none;
}

.search-line input,
.action-form select {
  height: 44px;
  padding: 0 12px;
}

.action-form textarea,
.workflow-item textarea {
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.45;
}

.metrics-strip {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr);
  border-bottom: 2px solid var(--ink);
  margin-bottom: 18px;
}

.metric-block {
  min-height: 112px;
  padding: 18px 16px;
  border-right: 2px solid var(--ink);
  background: rgba(255, 250, 243, 0.54);
}

.metric-block.wide {
  border-right: 0;
}

.metric-block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-block strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 0.98;
}

.metric-block.wide strong {
  font-size: clamp(20px, 2.5vw, 34px);
}

.screen {
  display: none;
  animation: riseIn 240ms ease both;
}

.screen.active {
  display: block;
}

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

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-tab {
  padding: 0 12px;
}

.icon-command {
  width: 44px;
  flex: 0 0 auto;
  background: var(--cream);
  font-size: 21px;
}

.portfolio-wall {
  display: grid;
  gap: 8px;
}

.case-row {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(180px, 1fr) 126px 126px 74px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 82px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: rgba(255, 250, 243, 0.78);
  color: var(--ink);
  text-align: left;
  padding: 0 15px 0 0;
  box-shadow: 0 0 0 transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.case-row:hover,
.case-row.active {
  background: var(--cream);
  box-shadow: 7px 7px 0 var(--clay);
  transform: translate(-2px, -2px);
}

.case-gridline {
  align-self: stretch;
  background: repeating-linear-gradient(0deg, var(--ink), var(--ink) 5px, var(--amber) 5px, var(--amber) 10px);
}

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

.case-main strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.case-main small,
.case-status,
.case-date {
  color: var(--muted);
  font-size: 13px;
}

.case-status {
  font-weight: 800;
  text-transform: uppercase;
}

.case-risk b {
  display: block;
  margin-bottom: 7px;
  font-size: 18px;
}

.case-risk i,
.risk-bar i,
.load-line i {
  display: block;
  height: 7px;
  background: var(--amber);
}

.case-risk,
.risk-bar,
.load-line {
  background: rgba(154, 140, 152, 0.24);
}

.section-heading {
  max-width: 720px;
  margin-bottom: 18px;
}

.section-heading p {
  color: var(--muted);
  line-height: 1.5;
}

.history-list,
.workflow-list,
.team-list {
  display: grid;
  gap: 10px;
}

.history-item,
.workflow-item,
.team-person {
  border-top: 2px solid var(--ink);
  padding: 15px 0;
}

.history-item time,
.history-item span,
.team-person span,
.team-person small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-item strong,
.team-person strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.history-item p,
.team-person p {
  margin: 8px 0;
  line-height: 1.45;
}

.workflow-item {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) 120px;
  align-items: start;
  gap: 12px;
}

.team-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.load-line {
  margin: 12px 0 8px;
}

.load-line i {
  background: var(--green);
}

.inspector {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-left: 2px solid var(--ink);
  padding: 24px 20px;
}

.hidden {
  display: none !important;
}

.empty-inspector {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flag-mark {
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  border-left: 6px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background:
    linear-gradient(var(--ink), var(--ink)) 10px 8px / 44px 20px no-repeat,
    linear-gradient(var(--clay), var(--clay)) 10px 31px / 32px 17px no-repeat;
}

.empty-inspector p {
  color: var(--muted);
  line-height: 1.5;
}

.case-inspector {
  animation: slideIn 220ms ease both;
}

.case-inspector h2 {
  font-size: 30px;
}

.inspector-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
}

.inspector-meta span {
  border-bottom: 2px solid var(--clay);
  padding-bottom: 3px;
}

.risk-panel {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 16px 0;
  margin-bottom: 18px;
}

.risk-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.risk-panel strong {
  display: block;
  margin: 7px 0 12px;
  font-size: 58px;
  line-height: 0.9;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.detail-grid div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.action-form {
  display: grid;
  gap: 10px;
}

.action-form button {
  background: var(--amber);
  color: var(--ink);
  font-weight: 900;
}

.empty-state {
  border: 2px solid var(--ink);
  background: var(--cream);
  padding: 24px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 14px;
  box-shadow: 5px 5px 0 var(--clay);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    position: static;
    height: auto;
    min-height: 0;
    border-left: 0;
    border-top: 2px solid var(--ink);
  }

  .empty-inspector {
    min-height: 220px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .left-rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

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

  .workspace {
    padding: 18px;
  }

  .topbar {
    display: block;
  }

  .search-line {
    margin-top: 16px;
  }

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

  .metric-block {
    min-height: 92px;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .metric-block:last-child {
    border-bottom: 0;
  }

  .canvas-head {
    align-items: stretch;
  }

  .status-tabs {
    flex: 1;
  }

  .status-tab {
    flex: 1 1 130px;
  }

  .case-row {
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 10px;
    padding: 0 12px 0 0;
  }

  .case-status,
  .case-risk,
  .case-date {
    grid-column: 2;
  }

  .workflow-item,
  .team-list {
    grid-template-columns: 1fr;
  }
}

