:root {
  --ink: #102a43;
  --paper: #f5f7fa;
  --line: #d7dee8;
  --accent: #d64545;
  --teal: #56a3a6;
  --birch: #fcfbf6;
  --muted: #627386;
  --shadow: 0 18px 50px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 42, 67, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 42, 67, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 24px 18px;
  background: var(--ink);
  color: var(--birch);
  position: sticky;
  top: 0;
  min-height: 100vh;
}

.brand {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

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

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

.tab {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-left: 3px solid transparent;
  padding: 10px 12px;
  background: transparent;
  color: rgba(252, 251, 246, 0.72);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.tab:hover,
.tab.is-active {
  color: var(--birch);
  background: rgba(245, 247, 250, 0.08);
  border-color: var(--teal);
}

.rail-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(245, 247, 250, 0.16);
  line-height: 1.55;
}

.rail-note span,
.eyebrow,
.tool-row span,
.section-head span,
.metric span,
.metric em,
.drawer-index,
.drawer small,
.drawer em,
.sheet-top,
.facts dt,
.action-box span,
.timeline-row time,
.timeline-row em,
.person span,
.person em {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.rail-note span {
  color: rgba(252, 251, 246, 0.5);
}

.rail-note strong {
  display: block;
  margin-top: 6px;
  color: var(--birch);
  font-size: 14px;
}

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

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

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

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

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

.topline.compact {
  align-items: start;
}

.eyebrow {
  margin: 0 0 8px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 62px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.search,
.select,
.settings-panel label,
.action-box label {
  display: grid;
  gap: 7px;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--birch);
  color: var(--ink);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  background: var(--line);
  border: 1px solid var(--line);
}

.metric {
  min-height: 112px;
  padding: 17px;
  background: rgba(252, 251, 246, 0.78);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.metric em {
  font-style: normal;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.drawer-wall,
.detail-sheet,
.settings-panel,
.timeline,
.team-grid {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.drawers {
  display: grid;
  gap: 9px;
}

.drawer {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  border-left: 7px solid rgba(86, 163, 166, 0.5);
  border-radius: 8px;
  padding: 15px;
  background: rgba(252, 251, 246, 0.86);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.drawer:hover,
.drawer.is-active {
  transform: translateX(3px);
  border-left-color: var(--accent);
  background: #fffefa;
  box-shadow: var(--shadow);
}

.drawer strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.drawer small,
.drawer em {
  grid-column: 2 / 3;
  font-style: normal;
  overflow-wrap: anywhere;
}

.drawer-index {
  align-self: start;
  color: var(--accent);
}

.status {
  justify-self: end;
  min-width: 92px;
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(16, 42, 67, 0.08);
  color: var(--ink);
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
}

.status-effect,
.status-done {
  background: rgba(86, 163, 166, 0.16);
}

.status-point {
  background: rgba(214, 69, 69, 0.13);
}

.quality {
  grid-column: 1 / 4;
  display: block;
  height: 7px;
  background: rgba(16, 42, 67, 0.11);
  overflow: hidden;
}

.quality i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--accent));
}

.detail-sheet {
  position: sticky;
  top: 28px;
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.detail-empty,
.detail-content {
  min-height: 520px;
  padding: 24px;
  background: #fffefa;
  box-shadow: var(--shadow);
}

.detail-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.detail-content h2 {
  margin-bottom: 10px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1;
}

.detail-content p {
  color: var(--muted);
  line-height: 1.7;
}

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

.facts div {
  min-height: 78px;
  padding: 12px;
  background: var(--birch);
}

.facts dt,
.facts dd {
  margin: 0;
}

.facts dd {
  margin-top: 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.action-box {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  transition: transform 150ms ease, filter 150ms ease;
}

.primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.mini-log {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-log article {
  display: grid;
  gap: 3px;
}

.mini-log span {
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 10px;
  max-width: 980px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 94px;
  gap: 18px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

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

.timeline-row span {
  margin-top: 5px;
  color: var(--muted);
}

.timeline-row em {
  text-align: right;
  font-style: normal;
}

.settings-panel {
  display: grid;
  gap: 18px;
  max-width: 660px;
  padding: 24px;
  background: #fffefa;
  box-shadow: var(--shadow);
}

.settings-panel label {
  max-width: 480px;
}

.settings-panel input[type="range"] {
  padding: 0;
}

.checkline {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
}

.checkline input {
  min-height: auto;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-width: 1040px;
  background: var(--line);
  border: 1px solid var(--line);
}

.person {
  min-height: 190px;
  padding: 20px;
  background: #fffefa;
}

.person strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1;
}

.person p {
  min-height: 58px;
  color: var(--muted);
  line-height: 1.55;
}

.person em {
  font-style: normal;
  color: var(--accent);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  background: rgba(252, 251, 246, 0.7);
  color: var(--muted);
}

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

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

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

  .rail {
    position: static;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

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

  .rail-note {
    display: none;
  }

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

  .detail-sheet {
    position: static;
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

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

  .tool-row {
    justify-content: stretch;
  }

  .tool-row label {
    flex: 1 1 100%;
  }

  .metric-strip,
  .facts,
  .team-grid {
    grid-template-columns: 1fr;
  }

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

  .drawer small,
  .drawer em,
  .quality {
    grid-column: 1;
  }

  .status {
    justify-self: start;
  }

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

  .timeline-row em {
    text-align: left;
  }

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

