:root {
  --ink: #0d1b2a;
  --paper: #f5ebe0;
  --steel: #778da9;
  --amber: #e0a458;
  --line: rgba(13, 27, 42, 0.18);
  --muted: rgba(13, 27, 42, 0.68);
  --panel: #fffaf3;
  --green: #28745a;
  --red: #a4473c;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  min-height: 100vh;
  padding: 22px 16px;
  color: var(--paper);
  background: var(--ink);
  border-right: 4px solid var(--amber);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--paper);
  text-decoration: none;
  font-weight: 860;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand span {
  overflow-wrap: anywhere;
}

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

.tab,
.action-pad button,
.create-form button {
  border: 0;
  color: var(--ink);
  background: var(--amber);
  min-height: 42px;
  border-radius: 7px;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(13, 27, 42, 0.24);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.tab {
  color: var(--paper);
  background: rgba(245, 235, 224, 0.09);
  text-align: left;
  padding: 0 12px;
  border: 1px solid rgba(245, 235, 224, 0.12);
}

.tab.is-active,
.tab:hover {
  color: var(--ink);
  background: var(--amber);
  transform: translateX(2px);
}

.metrics-spine {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.metric {
  padding: 12px;
  border: 1px solid rgba(245, 235, 224, 0.16);
  background: rgba(245, 235, 224, 0.08);
  border-radius: 7px;
}

.metric span,
.metric small,
.eyebrow,
.card-top,
.ticket-card footer,
.panel-note,
.calendar-row p,
.timeline-row time,
.timeline-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rail .metric span,
.rail .metric small {
  color: rgba(245, 235, 224, 0.72);
}

.metric strong {
  display: block;
  margin: 2px 0;
  font-size: 32px;
  line-height: 1;
}

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

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--steel);
  font-weight: 900;
  text-transform: uppercase;
}

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

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

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.2;
}

.search {
  display: grid;
  gap: 6px;
  min-width: min(280px, 100%);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--steel);
}

.search input,
.create-form input,
.create-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 250, 243, 0.88);
  outline: 0;
}

.search input:focus,
.create-form input:focus,
.create-form select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(224, 164, 88, 0.22);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: enter 220ms ease both;
}

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

.lane {
  min-width: 0;
  border-left: 2px solid var(--ink);
  background: rgba(255, 250, 243, 0.54);
}

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

.lane header span {
  min-width: 30px;
  min-height: 30px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

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

.ticket-card {
  min-height: 174px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.ticket-card:hover,
.ticket-card.is-selected {
  transform: translateY(-2px);
  border-color: var(--amber);
  box-shadow: 0 10px 0 rgba(13, 27, 42, 0.08);
}

.card-top,
.ticket-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-card h3,
.ticket-card p {
  overflow-wrap: anywhere;
}

.ticket-card p {
  color: var(--muted);
}

.priority {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(119, 141, 169, 0.22);
  font-weight: 900;
}

.priority-critical {
  color: var(--paper);
  background: var(--red);
}

.priority-high {
  background: var(--amber);
}

.progress,
.case-progress {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: rgba(13, 27, 42, 0.1);
  border-radius: 999px;
}

.progress span,
.case-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--steel), var(--amber));
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 16px;
}

.active-case,
.timeline,
.report-panel,
.quick-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.86);
}

.active-case {
  padding: 18px;
}

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

.case-head h2 {
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.02;
}

.stage {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 6px;
  font-weight: 900;
}

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

.case-facts div {
  padding: 10px;
  border-top: 3px solid var(--steel);
  background: rgba(245, 235, 224, 0.72);
}

.case-facts dt {
  color: var(--steel);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.case-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 760;
}

.case-progress {
  height: 26px;
}

.case-progress b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 12px;
}

.timeline {
  padding: 16px;
}

.timeline h2 {
  margin-bottom: 12px;
}

.timeline-row {
  position: relative;
  padding: 0 0 14px 18px;
  border-left: 2px solid var(--steel);
}

.timeline-row:last-child {
  padding-bottom: 0;
}

.timeline-row p {
  margin: 5px 0;
  line-height: 1.35;
}

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

.calendar-strip {
  display: grid;
  gap: 10px;
}

.calendar-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 110px;
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 12px;
  border-left: 5px solid var(--amber);
  background: rgba(255, 250, 243, 0.88);
}

.calendar-row time,
.calendar-row span {
  font-weight: 900;
}

.calendar-row h3,
.calendar-row p {
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-panel {
  padding: 16px;
}

.report-panel h2 {
  margin-bottom: 12px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 90px;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

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

.report-row span {
  overflow-wrap: anywhere;
}

.report-row strong,
.report-row em {
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.quick-panel {
  min-height: 100vh;
  padding: 22px 16px;
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(224, 164, 88, 0.18), transparent 280px),
    var(--panel);
}

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

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

.create-form label {
  display: grid;
  gap: 6px;
  color: var(--steel);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.create-form button,
.action-pad button {
  width: 100%;
}

.create-form button:hover,
.action-pad button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 -2px 0 rgba(13, 27, 42, 0.24), 0 8px 0 rgba(13, 27, 42, 0.08);
}

.action-pad {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

.action-pad button:nth-child(2) {
  color: var(--paper);
  background: var(--steel);
}

.panel-note {
  min-height: 42px;
  margin: 14px 0 0;
  padding: 10px;
  border-left: 4px solid var(--steel);
  background: rgba(119, 141, 169, 0.12);
}

.panel-note[data-tone="good"] {
  border-color: var(--green);
}

.panel-note[data-tone="bad"] {
  border-color: var(--red);
}

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

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

  .quick-panel {
    grid-column: 1 / -1;
    min-height: auto;
    border-left: 0;
    border-top: 4px solid var(--amber);
  }

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

  .create-form button {
    align-self: end;
  }
}

@media (max-width: 860px) {
  .shell,
  .detail-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .rail {
    min-height: auto;
    border-right: 0;
    border-bottom: 4px solid var(--amber);
  }

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

  .tab {
    min-width: 0;
    padding: 0 8px;
    text-align: center;
    overflow-wrap: anywhere;
  }

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

  .workspace {
    padding: 16px;
  }

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

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

@media (max-width: 560px) {
  .tabs,
  .metrics-spine,
  .board,
  .case-facts,
  .create-form {
    grid-template-columns: 1fr;
  }

  .calendar-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .case-head {
    flex-direction: column;
  }

  .stage {
    align-self: flex-start;
  }
}

