:root {
  --ink: #1d3557;
  --paper: #fff8f0;
  --line: rgba(29, 53, 87, 0.16);
  --muted: #667085;
  --teal: #2a9d8f;
  --coral: #e76f51;
  --white: #ffffff;
  --shadow: 0 20px 60px rgba(29, 53, 87, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(42, 157, 143, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(29, 53, 87, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
}

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

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

.nav-button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 248, 240, 0.18);
  border-radius: 8px;
  color: rgba(255, 248, 240, 0.78);
  text-align: left;
  background: transparent;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.nav-button.is-active {
  color: var(--paper);
  background: rgba(42, 157, 143, 0.22);
  transform: translateX(2px);
}

.rail-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 248, 240, 0.18);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: rgba(255, 248, 240, 0.68);
}

.rail-foot strong {
  display: block;
  margin-top: 5px;
  color: var(--paper);
}

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

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

.eyebrow,
.sheet-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

h2 {
  margin-bottom: 16px;
  font-size: 22px;
  line-height: 1.15;
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.control-strip input {
  width: min(320px, 100%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.ghost-button,
.accent-button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
}

.accent-button {
  border: 1px solid var(--teal);
  color: var(--white);
  background: var(--teal);
}

.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.is-hidden {
  display: none !important;
}

.main-board {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.metric span,
.metric em {
  display: block;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 30px;
  line-height: 1;
}

.metric-good strong {
  color: var(--teal);
}

.metric-watch strong {
  color: #b85a3f;
}

.metric-alert strong {
  color: var(--coral);
}

.lane-board {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  min-height: 540px;
}

.lane {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.72), rgba(255, 255, 255, 0.64));
}

.lane:last-child {
  border-right: 0;
}

.lane header {
  display: flex;
  justify-content: space-between;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.resource-chip {
  width: 100%;
  min-height: 146px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: var(--white);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.resource-chip:hover,
.resource-chip.is-selected {
  transform: translateY(-2px);
  border-color: rgba(42, 157, 143, 0.55);
  box-shadow: 0 16px 34px rgba(29, 53, 87, 0.14);
}

.resource-chip.level-watch {
  border-left-color: #d49b2a;
}

.resource-chip.level-conflict {
  border-left-color: var(--coral);
  background: linear-gradient(135deg, #fff, rgba(231, 111, 81, 0.08));
}

.chip-date,
.chip-meta,
.chip-foot {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.chip-date {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.resource-chip strong {
  display: block;
  margin: 9px 0;
  line-height: 1.2;
}

.chip-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.chip-foot em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-foot b {
  color: var(--ink);
}

.inspector {
  position: sticky;
  top: 26px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.inspector dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 0;
}

.inspector dt {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.inspector dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.resource-bar {
  position: relative;
  height: 36px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(29, 53, 87, 0.1);
}

.resource-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  transition: width 260ms ease;
}

.resource-bar strong {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.timeline,
.workflow-lane,
.team-grid {
  display: grid;
  gap: 10px;
}

.event,
.workflow-step,
.team-row {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.event {
  grid-template-columns: 150px minmax(0, 1fr) 150px;
  align-items: center;
  border-left: 5px solid var(--teal);
}

.event-policy {
  border-left-color: var(--coral);
}

.event time,
.event span {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.note-form,
.setting-list {
  display: grid;
  gap: 12px;
}

.note-form label,
.setting-list label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.note-form input,
.note-form select {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.setting-list label {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  color: var(--ink);
  font-weight: 600;
}

.workflow-step {
  grid-template-columns: 54px minmax(0, 0.7fr) minmax(0, 1.4fr) 90px;
  align-items: center;
}

.workflow-step span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
}

.workflow-step h3,
.workflow-step p {
  margin: 0;
}

.workflow-step p {
  color: var(--muted);
}

.workflow-step b {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.state-conflict {
  border-left: 5px solid var(--coral);
}

.state-watch {
  border-left: 5px solid #d49b2a;
}

.state-stable,
.state-active {
  border-left: 5px solid var(--teal);
}

.team-row {
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1fr) 180px 48px;
  align-items: center;
}

.team-row strong,
.team-row span {
  display: block;
}

.team-row span,
.team-row p {
  margin: 0;
  color: var(--muted);
}

.team-row meter {
  width: 100%;
}

.sheet-copy {
  color: var(--muted);
  line-height: 1.5;
}

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

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

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

  .inspector {
    position: static;
  }

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

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

  .rail {
    position: static;
    height: auto;
    padding: 14px;
  }

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

  .nav-button {
    padding: 0 8px;
    text-align: center;
  }

  .workspace {
    padding: 16px;
  }

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

  .control-strip {
    justify-content: stretch;
  }

  .control-strip input,
  .ghost-button,
  .accent-button {
    width: 100%;
  }

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

  .event,
  .workflow-step,
  .team-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .rail-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .inspector dl {
    grid-template-columns: 1fr;
  }
}
