:root {
  --ink: #0d1b2a;
  --paper: #f5ebe0;
  --steel: #778da9;
  --amber: #e0a458;
  --mint: #5ca487;
  --red: #b84a4a;
  --line: rgba(13, 27, 42, 0.16);
  --shadow: 0 18px 50px rgba(13, 27, 42, 0.16);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(13, 27, 42, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(13, 27, 42, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 100vh;
  padding: 22px;
  background: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 0;
  align-self: start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 900;
}

.brand img {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(245, 235, 224, 0.22);
  border-radius: 10px;
}

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

.nav-tab {
  border: 1px solid rgba(245, 235, 224, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(245, 235, 224, 0.78);
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

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

.metric-spine {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.spine-item {
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(245, 235, 224, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(245, 235, 224, 0.08), rgba(245, 235, 224, 0.02));
}

.spine-item span {
  display: block;
  color: rgba(245, 235, 224, 0.68);
  font-size: 12px;
  text-transform: uppercase;
}

.spine-item strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
  color: var(--paper);
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: #58708e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.95;
  letter-spacing: 0;
}

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

h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.searchbox {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  gap: 8px;
  width: min(100%, 460px);
}

.searchbox input,
.quick-panel input,
.quick-panel select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

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

.searchbox button,
.job-card button,
.primary-action {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  padding: 0 14px;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease;
}

.searchbox button:hover,
.job-card button:hover,
.primary-action:hover {
  background: #173252;
  transform: translateY(-1px);
}

.screen {
  display: none;
  animation: enter 220ms ease both;
}

.screen.is-visible {
  display: block;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 298px;
  gap: 18px;
  align-items: start;
}

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

.lane {
  min-width: 188px;
  border-top: 4px solid var(--ink);
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(13, 27, 42, 0.08);
}

.lane-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 84px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.lane-head span {
  display: block;
  margin-top: 6px;
  color: #61728a;
  font-size: 12px;
}

.lane-head strong {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--amber);
}

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

.job-card {
  display: grid;
  gap: 10px;
  min-height: 214px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 6px 18px rgba(13, 27, 42, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.job-card:hover,
.job-card.is-selected {
  border-color: var(--amber);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.job-card p {
  margin: 0;
  color: #56677d;
  font-size: 13px;
}

.card-top,
.trace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #66748a;
  font-size: 12px;
}

.priority {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(119, 141, 169, 0.2);
  color: var(--ink);
  font-weight: 800;
}

.priority-2 {
  background: rgba(224, 164, 88, 0.28);
}

.priority-3 {
  background: rgba(184, 74, 74, 0.18);
  color: #7b2222;
}

.progress,
.detail-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(119, 141, 169, 0.22);
}

.progress i,
.detail-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--amber));
}

.quick-panel,
.detail-main,
.detail-log,
.report-block {
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.quick-panel {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 16px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dial {
  width: 42px;
  height: 42px;
  border: 5px solid var(--ink);
  border-right-color: var(--amber);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px #fffaf4;
}

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

.quick-panel label {
  display: grid;
  gap: 6px;
  color: #526276;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.control-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.control-strip span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: #5b6a7f;
  font-size: 11px;
  font-weight: 800;
}

.control-strip span:last-child {
  border-right: 0;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.detail-main,
.detail-log {
  padding: 22px;
}

.detail-main h2 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  margin-bottom: 20px;
}

.detail-meter {
  height: 14px;
  margin-bottom: 22px;
}

.spec-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 18px;
  background: var(--line);
  border: 1px solid var(--line);
}

.spec-list div {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 12px;
  background: #fffaf4;
}

.spec-list dt {
  color: #61728a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.spec-list dd {
  margin: 0;
  font-weight: 800;
}

.notes {
  margin: 0 0 18px;
  padding-left: 12px;
  border-left: 4px solid var(--amber);
  color: #42536a;
}

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

.timeline li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
}

.timeline li > span {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 3px solid var(--steel);
  border-radius: 50%;
}

.timeline li.is-done > span {
  border-color: var(--mint);
  background: var(--mint);
}

.timeline p {
  margin: 4px 0 0;
  color: #5a697e;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.calendar-event {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 94px;
  padding: 14px;
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: inset 0 0 0 1px var(--line);
}

.calendar-event time {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  text-align: center;
}

.calendar-event p {
  margin: 5px 0 0;
  color: #5c6d82;
}

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

.report-block {
  min-height: 310px;
  padding: 18px;
}

.report-block h2 {
  margin-bottom: 20px;
}

.bar-line {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.bar-line div,
.money-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bar-line i {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--steel), var(--amber));
}

.money-line {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.empty {
  color: #61728a;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .rail {
    position: static;
    min-height: auto;
  }

  .metric-spine {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .board-layout,
  .details-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .quick-panel {
    position: static;
  }
}

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

  .topbar,
  .calendar-event {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .searchbox,
  .spec-list {
    grid-template-columns: 1fr;
  }

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

  .kanban {
    grid-template-columns: repeat(4, 82vw);
  }

  .card-top,
  .trace-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-event {
    display: grid;
  }
}

