:root {
  --ink: #252422;
  --paper: #fffcf2;
  --paper-deep: #f1eadb;
  --line: #d8d0c1;
  --accent: #eb5e28;
  --blue: #4f6d7a;
  --green: #2f7d5a;
  --yellow: #d7a545;
  --muted: #6e685f;
  --white: #fffef9;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(79, 109, 122, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 36, 34, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

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

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

.brand strong {
  font-size: 21px;
  letter-spacing: 0;
}

.brand small,
.eyebrow {
  color: rgba(255, 252, 242, 0.68);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
}

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

.nav-tab {
  border: 1px solid rgba(255, 252, 242, 0.16);
  color: var(--paper);
  background: transparent;
  min-height: 42px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 7px;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.nav-tab:hover,
.nav-tab.active {
  background: rgba(235, 94, 40, 0.18);
  border-color: rgba(235, 94, 40, 0.74);
  transform: translateX(2px);
}

.rail-note {
  margin-top: auto;
  display: flex;
  gap: 10px;
  color: rgba(255, 252, 242, 0.72);
  line-height: 1.5;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(235, 94, 40, 0.16);
}

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

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

.topbar .eyebrow,
.section-head .eyebrow,
.panel .eyebrow {
  color: var(--muted);
  margin: 0 0 5px;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.08;
  letter-spacing: 0;
}

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

.search-box {
  min-width: min(420px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.search-box input,
.create-form input,
.create-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.search-box input:focus,
.create-form input:focus,
.create-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 109, 122, 0.16);
}

.icon-btn,
.primary-btn,
.secondary-btn {
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.icon-btn {
  background: var(--ink);
  color: var(--paper);
}

.primary-btn {
  background: var(--accent);
  color: var(--paper);
  padding: 11px 16px;
  border-color: #ca4c1d;
}

.secondary-btn {
  background: transparent;
  color: var(--ink);
  padding: 11px 16px;
  border-color: var(--line);
}

.icon-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 36, 34, 0.12);
}

.screen {
  display: none;
}

.active-screen {
  display: block;
  animation: liftIn 220ms ease both;
}

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

.metric {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 249, 0.78);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span,
.record-grid span,
.progress-block span,
.finance-line span,
.queue-meta,
.action-item em,
.mini-lists span,
.note-line span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.metric strong {
  font-size: 28px;
  line-height: 1;
}

.metric-accent {
  border-top: 4px solid var(--accent);
}

.metric-blue {
  border-top: 4px solid var(--blue);
}

.metric-dark {
  border-top: 4px solid var(--ink);
}

.metric-green {
  border-top: 4px solid var(--green);
}

.triage-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(360px, 1.4fr) minmax(250px, 0.88fr);
  gap: 12px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.86);
}

.panel-head,
.record-top,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head {
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 18px;
}

.count-chip,
.status-chip,
.severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.count-chip {
  background: var(--ink);
  color: var(--paper);
}

.queue-list,
.action-list {
  display: grid;
}

.queue-item,
.action-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  transition: background 160ms ease;
}

.queue-item:last-child,
.action-item:last-child {
  border-bottom: 0;
}

.queue-item:hover,
.queue-item.active,
.action-item:hover {
  background: rgba(79, 109, 122, 0.11);
}

.queue-title {
  font-weight: 700;
  line-height: 1.2;
}

.queue-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.queue-row i {
  color: var(--accent);
  font-style: normal;
}

.record-view {
  padding: 0 16px 16px;
}

.record-top {
  margin-left: -16px;
  margin-right: -16px;
}

.status-active,
.status-approved {
  background: rgba(47, 125, 90, 0.14);
  color: #1f6548;
}

.status-watch,
.status-review {
  background: rgba(215, 165, 69, 0.2);
  color: #7c5a10;
}

.status-new {
  background: rgba(79, 109, 122, 0.18);
  color: #314b57;
}

.status-done {
  background: rgba(37, 36, 34, 0.11);
  color: var(--ink);
}

.objective {
  margin: 16px 0;
  color: #3f3b36;
  line-height: 1.65;
}

.stage-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0;
}

.stage-rail span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}

.stage-rail .done {
  background: rgba(47, 125, 90, 0.13);
  color: var(--green);
}

.stage-rail .current {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.progress-block {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.progress-block > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  height: 8px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--accent));
  border-radius: inherit;
  transition: width 220ms ease;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.record-grid div,
.notebook,
.mini-lists > div,
.finance-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.54);
  padding: 12px;
}

.record-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.note-line {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.note-line p {
  margin-bottom: 10px;
  line-height: 1.55;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.mini-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-lists p {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  line-height: 1.3;
}

.action-item {
  gap: 8px;
}

.action-item strong {
  line-height: 1.25;
}

.severity {
  width: fit-content;
  background: rgba(37, 36, 34, 0.08);
}

.severity-high {
  background: rgba(235, 94, 40, 0.16);
  color: #a33c13;
}

.severity-medium {
  background: rgba(215, 165, 69, 0.2);
  color: #77550e;
}

.severity-low {
  background: rgba(79, 109, 122, 0.16);
  color: #314b57;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.create-form {
  max-width: 980px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.create-form .wide,
.create-form .primary-btn,
.form-status {
  grid-column: 1 / -1;
}

.form-status {
  min-height: 20px;
  color: var(--blue);
}

.data-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 254, 249, 0.86);
}

.table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(100px, 0.6fr) minmax(80px, 0.4fr) minmax(120px, 0.6fr);
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-head {
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  text-transform: uppercase;
}

.finance-board {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

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

.finance-line .progress-track {
  grid-column: 1 / -1;
}

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

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

  .queue-panel,
  .action-panel {
    max-height: none;
  }
}

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

  .side-rail {
    position: static;
    height: auto;
    padding: 14px;
  }

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

  .nav-tab {
    text-align: center;
    padding: 9px 6px;
    font-size: 13px;
  }

  .rail-note {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .search-box,
  .metric-strip,
  .record-grid,
  .mini-lists,
  .create-form {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 460px) {
  .nav-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 30px;
  }

  .panel-head,
  .record-top,
  .section-head {
    display: grid;
  }
}

