:root {
  --ink: #252422;
  --paper: #fffcf2;
  --line: #dfd8c8;
  --muted: #756f66;
  --accent: #eb5e28;
  --blue: #4f6d7a;
  --blue-soft: #dbe6ed;
  --green: #3f7d5a;
  --danger: #a43d2f;
  --panel: #fffef8;
  --shadow: 0 18px 50px rgba(37, 36, 34, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(79, 109, 122, 0.08) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(0deg, rgba(37, 36, 34, 0.05) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 14px 20px;
  background: rgba(255, 252, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand img {
  flex: 0 0 auto;
}

.brand strong,
.brand em {
  display: block;
  white-space: nowrap;
}

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

.brand em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-transform: uppercase;
}

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

.tab {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

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

.topbar__metric {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.topbar__metric span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__metric strong {
  font-size: 24px;
}

main {
  padding: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.workspace {
  display: none;
  grid-template-columns: minmax(280px, 360px) minmax(360px, 1fr) minmax(260px, 330px);
  gap: 14px;
  min-height: calc(100vh - 112px);
}

.workspace.is-active {
  display: grid;
}

.pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 248, 0.94);
  box-shadow: var(--shadow);
}

.queue,
.next-actions {
  padding: 14px;
}

.record {
  padding: 18px;
}

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

.pane__head.compact {
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(26px, 3vw, 42px);
}

h2 {
  font-size: 23px;
}

h3 {
  font-size: 18px;
}

p {
  line-height: 1.65;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

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

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(235, 94, 40, 0.28);
  outline-offset: 1px;
}

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

.metric-row span {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.metric-row strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

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

.queue-item,
.action-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.queue-item {
  padding: 12px;
}

.queue-item:hover,
.queue-item.is-selected,
.action-item:hover {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(79, 109, 122, 0.16);
  transform: translateY(-1px);
}

.queue-item__top,
.record-title,
.doc-row,
.deadline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.queue-item h3 {
  margin: 7px 0 9px;
}

.queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #233843;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.chip.accent {
  background: rgba(235, 94, 40, 0.15);
  color: #893815;
}

.chip.green {
  background: rgba(63, 125, 90, 0.14);
  color: #29543d;
}

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

.chip.danger {
  background: rgba(164, 61, 47, 0.14);
  color: var(--danger);
}

.record-grid {
  display: grid;
  gap: 18px;
}

.record-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.record-hero p {
  margin: 12px 0 0;
  color: var(--muted);
}

.budget-block {
  min-width: 150px;
  padding: 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.budget-block span {
  display: block;
  color: rgba(255, 252, 242, 0.7);
  font-size: 12px;
  text-transform: uppercase;
}

.budget-block strong {
  display: block;
  margin-top: 5px;
  font-size: 28px;
}

.lane {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.lane button {
  min-height: 74px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: left;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.lane button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.lane span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.data-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.data-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-block h3 {
  margin-bottom: 10px;
}

.doc-list,
.deadline-list,
.note-list {
  display: grid;
  gap: 8px;
}

.doc-row,
.deadline-row {
  padding: 9px 0;
  border-bottom: 1px solid #eee8da;
}

.doc-row:last-child,
.deadline-row:last-child {
  border-bottom: 0;
}

.doc-row span,
.deadline-row span {
  min-width: 0;
}

.note {
  padding: 10px;
  border-left: 3px solid var(--blue);
  background: #fbf7ed;
}

.note strong {
  display: block;
  margin-bottom: 4px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  text-align: center;
}

.empty-state p {
  max-width: 360px;
  margin: 10px auto 0;
  color: var(--muted);
}

.shield-mark {
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, transparent 0 50%, rgba(235, 94, 40, 0.9) 50% 64%, transparent 64%),
    var(--blue);
  box-shadow: inset 0 0 0 12px var(--ink);
}

.action-item {
  display: block;
  padding: 11px;
}

.action-item strong,
.action-item span {
  display: block;
}

.action-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-head {
  max-width: 880px;
  margin: 10px auto 18px;
}

.form-view,
.split-view {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 0 32px;
}

.request-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 880px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.request-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.form-message {
  align-self: center;
  margin: 0;
  color: var(--muted);
}

.document-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-column {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.document-column h2 {
  margin-bottom: 12px;
}

.document-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.document-card + .document-card {
  margin-top: 8px;
}

.document-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.4;
}

.finance-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 16px;
  align-items: stretch;
}

.finance-total,
.finance-copy {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.finance-total {
  display: grid;
  align-content: center;
  min-height: 240px;
  padding: 22px;
  color: var(--paper);
  background: linear-gradient(145deg, var(--ink), #39484d);
}

.finance-total span {
  color: rgba(255, 252, 242, 0.68);
  text-transform: uppercase;
}

.finance-total strong {
  margin-top: 8px;
  font-size: clamp(38px, 7vw, 72px);
}

.finance-copy {
  padding: 24px;
}

.finance-copy p {
  color: var(--muted);
  font-size: 18px;
}

.loading,
.error {
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.error {
  border: 1px solid rgba(164, 61, 47, 0.24);
  color: var(--danger);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar__metric {
    justify-items: start;
  }

  .workspace,
  .workspace.is-active {
    grid-template-columns: 1fr;
  }

  .record {
    order: 2;
  }

  .next-actions {
    order: 3;
  }

  .queue {
    order: 1;
  }
}

@media (max-width: 720px) {
  main {
    padding: 10px;
  }

  .topbar {
    padding: 12px;
  }

  .record-hero,
  .data-columns,
  .request-form,
  .document-board,
  .finance-grid {
    grid-template-columns: 1fr;
  }

  .lane {
    grid-template-columns: 1fr 1fr;
  }

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

  h1 {
    font-size: 30px;
  }
}

