:root {
  --ink: #263238;
  --paper: #f0f4f8;
  --line: #cfd8dc;
  --muted: #607d8b;
  --green: #00a676;
  --yellow: #ffcf56;
  --red: #db4d3f;
  --blue: #315c72;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(38, 50, 56, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(38, 50, 56, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(38, 50, 56, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: 0;
}

.brand small,
.db-badge {
  color: rgba(240, 244, 248, 0.72);
}

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

.tab,
.icon-button,
.primary-button,
.note-form button,
.reservation,
.calendar-row {
  border: 0;
}

.tab {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  color: rgba(240, 244, 248, 0.78);
  background: transparent;
  text-align: left;
}

.tab.is-active,
.tab:hover {
  color: var(--ink);
  background: var(--yellow);
}

.db-badge {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(240, 244, 248, 0.18);
}

.db-badge strong {
  display: block;
  color: var(--white);
  word-break: break-word;
}

.mono,
.eyebrow {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 2px solid rgba(38, 50, 56, 0.16);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
}

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

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

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.toolbar,
.filters,
.section-head,
.wall-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-button,
.note-form button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  color: var(--ink);
  background: var(--white);
  box-shadow: inset 0 0 0 1px rgba(38, 50, 56, 0.14);
}

.primary-button,
.note-form button {
  padding: 0 16px;
  color: var(--ink);
  background: var(--green);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 22px;
}

.metric {
  min-width: 0;
  padding: 16px;
  border-left: 4px solid var(--green);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(38, 50, 56, 0.1);
}

.metric:nth-child(2) {
  border-left-color: var(--yellow);
}

.metric:nth-child(3) {
  border-left-color: var(--blue);
}

.metric strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 28px;
}

.metric small,
.wall-head p,
.lane-meta span,
.lane-meta small,
.selectedText,
.timeline-item small,
.report-row small {
  color: var(--muted);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: enter 180ms ease-out;
}

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

.filters {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search {
  flex: 1 1 320px;
  min-width: 220px;
  display: grid;
  gap: 5px;
}

.search input,
.filters select,
.note-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(38, 50, 56, 0.2);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

.filters select {
  flex: 0 1 210px;
}

.wall-head {
  justify-content: space-between;
  align-items: end;
  margin-bottom: 12px;
}

.time-scale {
  display: grid;
  grid-template-columns: repeat(6, 42px);
  gap: 9px;
  color: var(--muted);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.reservation-wall,
.calendar-board,
.report-layout,
.timeline-panel,
.inspector {
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(38, 50, 56, 0.1);
}

.reservation-wall {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.lane {
  display: grid;
  grid-template-columns: 190px minmax(520px, 1fr);
  min-height: 112px;
  background: rgba(255, 255, 255, 0.5);
}

.lane-meta {
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 6px;
  border-right: 1px solid rgba(38, 50, 56, 0.12);
}

.lane-meta meter {
  width: 100%;
  height: 8px;
}

.lane-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(54px, 1fr));
  gap: 8px;
  padding: 16px;
  background-image: linear-gradient(90deg, rgba(38, 50, 56, 0.1) 1px, transparent 1px);
  background-size: 12.5% 100%;
}

.reservation {
  grid-column: var(--start) / span var(--span);
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(38, 50, 56, 0.14);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.reservation:hover,
.reservation.is-selected {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(38, 50, 56, 0.18), inset 0 0 0 2px var(--green);
}

.reservation.status-risk {
  background: #fff7df;
  box-shadow: inset 0 0 0 2px var(--yellow);
}

.reservation.status-conflict {
  background: #fff0ed;
  box-shadow: inset 0 0 0 2px var(--red);
}

.chip-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.chip-top em {
  font-style: normal;
  color: var(--green);
}

.reservation span,
.reservation small {
  display: block;
  overflow-wrap: anywhere;
}

.reservation small {
  margin-top: 5px;
  color: var(--muted);
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(320px, 1.3fr);
  gap: 14px;
}

.inspector,
.timeline-panel,
.calendar-board,
.report-layout {
  border-radius: 8px;
  padding: 18px;
}

.inspector dl {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.inspector dl div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(38, 50, 56, 0.12);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.note-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 12px 0 12px 16px;
  border-left: 4px solid var(--green);
}

.timeline-item:nth-child(2n) {
  border-left-color: var(--yellow);
}

.timeline-item p {
  margin: 4px 0;
}

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

.stage-lane {
  min-height: 360px;
  padding: 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 42px, rgba(38, 50, 56, 0.08) 43px),
    rgba(240, 244, 248, 0.75);
}

.stage-lane header {
  margin-bottom: 14px;
}

.stage-lane header strong {
  display: block;
  font-size: 20px;
}

.calendar-row {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-bottom: 10px;
  padding: 11px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(38, 50, 56, 0.12);
}

.calendar-row.status-risk {
  background: #fff7df;
}

.calendar-row.status-conflict {
  background: #fff0ed;
}

.calendar-row em {
  color: var(--muted);
  font-style: normal;
}

.report-grid {
  display: grid;
  gap: 10px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(140px, 1.4fr) 72px 120px;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(38, 50, 56, 0.12);
}

.bar {
  height: 14px;
  overflow: hidden;
  background: rgba(38, 50, 56, 0.12);
}

.bar span {
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
}

.empty,
.empty-lane,
.empty-stage {
  color: var(--muted);
}

.empty {
  padding: 22px;
}

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

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

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

  .tab {
    text-align: center;
  }

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

  .lane {
    grid-template-columns: 1fr;
  }

  .lane-meta {
    border-right: 0;
    border-bottom: 1px solid rgba(38, 50, 56, 0.12);
  }

  .lane-track {
    overflow-x: auto;
  }
}

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

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

  .toolbar {
    justify-content: flex-start;
  }

  .metrics,
  .details-grid,
  .calendar-grid,
  .report-row,
  .tabs {
    grid-template-columns: 1fr;
  }

  .lane-track {
    grid-template-columns: repeat(8, 74px);
  }

  .reservation {
    padding: 10px;
  }

  .inspector dl div,
  .note-form {
    grid-template-columns: 1fr;
  }

  .time-scale {
    display: none;
  }
}
