:root {
  --ink: #0d1b2a;
  --paper: #f5ebe0;
  --steel: #778da9;
  --amber: #e0a458;
  --line: rgba(13, 27, 42, 0.18);
  --panel: #fffaf2;
  --danger: #b54a3a;
  --ok: #3f725d;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(13, 27, 42, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 27, 42, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.spine {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  color: var(--paper);
  background: var(--ink);
  border-right: 6px solid var(--amber);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.brand img {
  width: 48px;
  height: 48px;
}

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

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

.brand span,
.metric small,
.eyebrow {
  color: rgba(245, 235, 224, 0.7);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric {
  padding: 14px;
  border: 1px solid rgba(245, 235, 224, 0.22);
  background: rgba(245, 235, 224, 0.05);
}

.metric.live {
  background: var(--amber);
  color: var(--ink);
}

.metric.live small,
.metric.live span {
  color: rgba(13, 27, 42, 0.72);
}

.metric span,
.metric strong,
.metric small {
  display: block;
}

.metric strong {
  margin: 8px 0 4px;
  font-size: 34px;
  line-height: 1;
}

.tabs {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.tab {
  min-height: 42px;
  color: var(--paper);
  text-align: left;
  border: 1px solid rgba(245, 235, 224, 0.2);
  background: transparent;
  padding: 0 12px;
  transition: background 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
  background: rgba(245, 235, 224, 0.12);
  transform: translateX(3px);
}

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

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

.topbar h1,
.case-detail h2,
.report-panel h2 {
  margin: 0;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--steel);
  font-weight: 800;
}

.search {
  display: grid;
  gap: 6px;
  width: min(360px, 100%);
  color: rgba(13, 27, 42, 0.72);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.search input,
.quick-create input {
  min-height: 42px;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.search input:focus,
.quick-create input:focus {
  border-color: var(--amber);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: lift 220ms ease both;
}

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

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.lane {
  min-width: 210px;
  background: rgba(255, 250, 242, 0.72);
  border-top: 5px solid var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.lane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.lane header span {
  font-weight: 900;
  text-transform: uppercase;
}

.lane header small {
  color: var(--steel);
  font-weight: 800;
}

.lane-items {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.case-card {
  display: grid;
  gap: 9px;
  width: 100%;
  min-height: 168px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(13, 27, 42, 0.18);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.case-card:hover,
.case-card.is-selected {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(13, 27, 42, 0.22);
  background: #ffffff;
}

.case-top,
.case-meta,
.deadline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.case-top b {
  overflow-wrap: anywhere;
}

.case-top i,
.case-meta em,
.deadline {
  color: rgba(13, 27, 42, 0.68);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.client {
  color: var(--steel);
  font-weight: 900;
}

.progress {
  display: block;
  width: 100%;
  height: 10px;
  background: rgba(119, 141, 169, 0.2);
  border: 1px solid var(--ink);
}

.progress span {
  display: block;
  height: 100%;
  background: var(--amber);
}

.deadline.is-late {
  color: var(--danger);
}

.empty-lane,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: rgba(13, 27, 42, 0.55);
  border: 1px dashed var(--line);
  text-align: center;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.case-detail,
.quick-create,
.day,
.report-panel {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}

.case-detail {
  min-height: 520px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 2px solid var(--ink);
}

.detail-head h2 {
  font-size: clamp(24px, 3vw, 40px);
}

.detail-head button,
.quick-create button {
  align-self: start;
  min-height: 44px;
  border: 0;
  background: var(--amber);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.detail-stats span {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.detail-stats span:last-child {
  border-right: 0;
}

.detail-stats b {
  overflow-wrap: anywhere;
}

.detail-stats small {
  color: var(--steel);
  font-weight: 900;
  text-transform: uppercase;
}

.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.timeline time {
  color: var(--steel);
  font-weight: 900;
  text-transform: uppercase;
}

.timeline strong,
.timeline span {
  overflow-wrap: anywhere;
}

.timeline span {
  grid-column: 2;
  color: rgba(13, 27, 42, 0.68);
}

.invoice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
}

.invoice {
  display: grid;
  gap: 4px;
  min-width: 180px;
  border: 2px solid var(--ink);
  background: #ffffff;
  padding: 10px;
  text-align: left;
}

.invoice.paid {
  border-color: var(--ok);
}

.quick-create {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.rail-label {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 26px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-create form {
  display: grid;
  gap: 12px;
}

.quick-create label {
  display: grid;
  gap: 6px;
  color: rgba(13, 27, 42, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-create p {
  min-height: 22px;
  margin: 0;
  color: var(--ok);
  font-weight: 800;
}

.calendar-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.day header {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 2px solid var(--ink);
}

.day button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.day button:hover {
  background: rgba(224, 164, 88, 0.2);
}

.day small,
.day span {
  color: var(--steel);
  font-weight: 800;
}

.report-panel {
  min-height: 260px;
  padding: 18px;
}

.report-panel h2 {
  margin-bottom: 20px;
  font-size: 28px;
}

.bar,
.load-line {
  display: grid;
  grid-template-columns: 100px minmax(80px, 1fr) 32px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  font-weight: 900;
}

.bar i {
  display: block;
  height: 12px;
  background: rgba(119, 141, 169, 0.18);
  border: 1px solid var(--ink);
}

.bar b {
  display: block;
  height: 100%;
  background: var(--steel);
}

.load-line {
  grid-template-columns: minmax(0, 1fr) 40px;
  border-bottom: 1px solid var(--line);
}

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

.accent p {
  color: rgba(245, 235, 224, 0.78);
  line-height: 1.6;
}

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

  .spine {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 6px solid var(--amber);
  }

  .brand,
  .tabs {
    grid-column: 1 / -1;
  }

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

  .tab {
    text-align: center;
  }

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

  .quick-create {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace,
  .spine {
    padding: 14px;
  }

  .topbar {
    display: grid;
    align-items: stretch;
  }

  .topbar h1 {
    font-size: 32px;
  }

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

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

  .board {
    grid-template-columns: repeat(5, 82vw);
  }

  .detail-head {
    display: grid;
  }

  .detail-stats,
  .calendar-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

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

  .timeline span {
    grid-column: 1;
  }
}
