:root {
  --ink: #252422;
  --paper: #fffcf2;
  --line: #ded8ca;
  --accent: #eb5e28;
  --atlas: #4f6d7a;
  --atlas-dark: #2f4858;
  --white: #ffffff;
  --muted: #756f66;
  --ok: #4b7f52;
  --warn: #b46a1f;
  --danger: #b63d2c;
  --shadow: 0 18px 55px rgba(37, 36, 34, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(79, 109, 122, .08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(79, 109, 122, .06), transparent 360px),
    var(--paper);
  background-size: 48px 48px, auto, auto;
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 16px;
  max-width: 1480px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  min-width: 220px;
  text-decoration: none;
}

.brand img {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

.brand strong {
  font-size: 20px;
  line-height: 1;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.tab,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .64);
  color: var(--ink);
  min-height: 40px;
  border-radius: 8px;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.tab {
  padding: 0 14px;
  white-space: nowrap;
}

.tab:hover,
.icon-button:hover,
.case-row:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 109, 122, .5);
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, .78fr) minmax(420px, 1.35fr) minmax(290px, .82fr);
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto;
  min-height: calc(100vh - 96px);
}

.queue-panel,
.record-panel,
.action-panel {
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.queue-panel {
  padding: 16px;
}

.record-panel {
  padding: 24px;
}

.action-panel {
  padding: 20px;
}

.panel-head,
.record-head,
.case-row-top,
.case-row-bottom,
.finance-row,
.document-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  align-items: center;
  margin-bottom: 14px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 42px);
  line-height: .98;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 2.4vw, 38px);
  line-height: 1.05;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--atlas);
  box-shadow: 0 0 0 3px rgba(79, 109, 122, .14);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric,
.context-item {
  border-left: 3px solid var(--atlas);
  background: rgba(255, 252, 242, .8);
  padding: 10px;
  min-width: 0;
}

.metric small,
.context-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.metric strong,
.context-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

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

.case-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, .74);
  color: var(--ink);
  padding: 13px;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.case-row.is-active {
  background: #ffffff;
  border-color: var(--atlas);
  box-shadow: inset 4px 0 0 var(--accent);
}

.case-row strong {
  min-width: 0;
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.case-row-meta,
.case-row-bottom {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.case-row-meta {
  display: block;
  margin: 7px 0 9px;
}

.chip,
.severity {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.status-new,
.severity-critical {
  background: rgba(235, 94, 40, .14);
  color: #973914;
}

.status-triage,
.severity-high {
  background: rgba(180, 106, 31, .16);
  color: var(--warn);
}

.status-plan,
.severity-medium {
  background: rgba(79, 109, 122, .16);
  color: var(--atlas-dark);
}

.status-resolved,
.severity-low {
  background: rgba(75, 127, 82, .14);
  color: var(--ok);
}

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

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 20px 0 22px;
}

.step {
  position: relative;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 252, 242, .64);
  overflow-wrap: anywhere;
  text-align: center;
}

.step.is-done {
  color: var(--paper);
  background: var(--atlas);
  border-color: var(--atlas);
}

.plain-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.plain-section p,
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.note-list,
.document-list,
.finance-list,
.check-list {
  display: grid;
  gap: 10px;
}

.note,
.document-row,
.finance-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, .76);
  padding: 12px;
}

.note span,
.note time,
.document-row span,
.document-row em,
.finance-row span,
.finance-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.note p {
  margin: 6px 0;
  line-height: 1.55;
}

.primary,
.mini-form button,
.create-form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  padding: 0 15px;
  font-weight: 800;
  transition: transform .18s ease, filter .18s ease;
}

.primary:hover,
.mini-form button:hover,
.create-form button:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}

.mini-form,
.create-form {
  display: grid;
  gap: 13px;
}

.mini-form {
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.create-form {
  max-width: 720px;
}

.form-title {
  margin-bottom: 2px;
}

.check-list span {
  border-left: 3px solid var(--accent);
  background: rgba(255, 252, 242, .76);
  padding: 12px;
}

.empty,
.error {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.empty.large {
  min-height: 280px;
  display: grid;
  place-items: center;
}

.error {
  border-color: rgba(182, 61, 44, .35);
  color: var(--danger);
}

.skeleton {
  display: block;
  height: 54px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(222, 216, 202, .5), rgba(255, 255, 255, .9), rgba(222, 216, 202, .5));
  background-size: 200% 100%;
  animation: pulse 1.1s linear infinite;
}

@keyframes pulse {
  from { background-position: 0 0; }
  to { background-position: 200% 0; }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.1fr);
  }

  .action-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .workspace,
  .context-grid,
  .timeline,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .queue-panel,
  .record-panel,
  .action-panel {
    padding: 14px;
  }

  .case-row-top,
  .case-row-bottom,
  .record-head,
  .document-row,
  .finance-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

