:root {
  --onyx: #22333b;
  --paper: #f2f4f3;
  --accent: #e63946;
  --mint: #a8dadc;
  --ink: #18242a;
  --line: rgba(34, 51, 59, 0.15);
  --soft: rgba(168, 218, 220, 0.22);
  --shadow: 0 20px 60px rgba(22, 34, 39, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(34, 51, 59, 0.06) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100svh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 22px;
}

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

.brand img {
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(34, 51, 59, 0.2));
}

.brand strong,
h1,
h2,
h3 {
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 1rem;
  text-transform: uppercase;
}

.brand small,
.muted,
.lead,
.metric span,
.panel-label,
.kicker {
  color: rgba(24, 36, 42, 0.66);
}

.brand small {
  display: block;
  max-width: 220px;
  font-size: 0.78rem;
  line-height: 1.25;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.tab {
  min-height: 38px;
  border: 0;
  padding: 0 13px;
  color: rgba(24, 36, 42, 0.68);
  background: transparent;
}

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

main {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.metrics-spine {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 10px;
}

.metric {
  min-height: 92px;
  padding: 12px;
  color: var(--paper);
  background: var(--onyx);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.metric.is-key {
  background: var(--accent);
}

.metric.wide strong {
  font-size: 1.05rem;
}

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

.metric span {
  color: rgba(242, 244, 243, 0.72);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.metric strong {
  font-size: 2.05rem;
  line-height: 1;
}

.metric b {
  font-weight: inherit;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: enter 220ms ease-out;
}

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

.board-panel,
.quick-panel,
.split-layout {
  background: rgba(255, 255, 255, 0.67);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.kicker,
.panel-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--onyx);
  font-size: clamp(1.7rem, 3.8vw, 3.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 12px;
  color: var(--onyx);
  font-size: clamp(1.55rem, 3vw, 2.8rem);
  line-height: 1;
}

h3 {
  margin-bottom: 14px;
  color: var(--onyx);
  font-size: 1.35rem;
  line-height: 1.08;
}

.lead {
  max-width: 500px;
  line-height: 1.55;
}

.search {
  display: grid;
  gap: 6px;
  min-width: min(300px, 100%);
}

.search span,
form span,
.detail dt {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(24, 36, 42, 0.58);
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 11px 12px;
  color: var(--onyx);
  background: rgba(242, 244, 243, 0.82);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.14);
}

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

.lane {
  min-width: 190px;
  border-left: 2px solid var(--onyx);
  padding-left: 10px;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
  margin-bottom: 10px;
  color: var(--onyx);
}

.lane-head span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--paper);
  background: var(--onyx);
  font-weight: 800;
}

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

.item-card {
  width: 100%;
  min-height: 214px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  border: 1px solid var(--line);
  padding: 13px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.item-card:hover,
.item-card.is-selected {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #fff;
}

.card-top,
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.card-top b,
.priority,
.card-foot small {
  white-space: nowrap;
}

.item-card strong {
  display: block;
  min-height: 46px;
  color: var(--onyx);
  line-height: 1.18;
}

.priority {
  padding: 2px 7px;
  color: var(--onyx);
  background: var(--mint);
  font-size: 0.72rem;
}

.priority.critical,
.priority.high {
  color: #fff;
  background: var(--accent);
}

.zone {
  min-height: 34px;
  color: rgba(24, 36, 42, 0.72);
  line-height: 1.25;
}

.progress {
  display: block;
  height: 6px;
  background: rgba(34, 51, 59, 0.12);
  overflow: hidden;
}

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

.quick-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
}

.primary-button,
.action-button {
  min-height: 42px;
  border: 0;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.detail {
  margin: 18px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-code {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  color: var(--paper);
  background: var(--onyx);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail dd {
  margin: 2px 0 0;
  line-height: 1.35;
}

.action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-button {
  color: var(--onyx);
  background: var(--soft);
}

.action-button.primary,
.action-button.final {
  color: var(--paper);
  background: var(--onyx);
}

.action-button.warn {
  color: #fff;
  background: var(--accent);
}

.split-layout {
  min-height: 560px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 26px;
}

.timeline,
.rules,
.team-grid {
  display: grid;
  gap: 10px;
  align-content: start;
}

.timeline-row,
.rule-row,
.crew {
  border-left: 3px solid var(--onyx);
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.64);
}

.timeline-row span,
.timeline-row small,
.crew small {
  color: rgba(24, 36, 42, 0.58);
  font-size: 0.82rem;
}

.timeline-row p,
.rule-row p,
.crew p {
  margin: 6px 0;
  line-height: 1.45;
}

.rule-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 14px;
}

.rule-row > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--paper);
  background: var(--onyx);
  font-weight: 800;
}

.rule-row > b {
  text-align: right;
  color: var(--accent);
}

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

.crew {
  min-height: 150px;
}

.crew-mark {
  display: inline-block;
  margin-bottom: 18px;
  padding: 4px 8px;
  color: var(--onyx);
  background: var(--mint);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  color: var(--paper);
  background: var(--onyx);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.empty {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  color: rgba(24, 36, 42, 0.52);
  text-align: center;
}

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

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

  .metrics-spine {
    position: static;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .workspace,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .quick-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

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

  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

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

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

  .board-panel,
  .quick-panel,
  .split-layout {
    padding: 14px;
  }

  .action-stack,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .rule-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .rule-row > b {
    grid-column: 2;
    text-align: left;
  }
}

