:root {
  color-scheme: light;
  --ink: #182128;
  --muted: #65727d;
  --line: #cfd8df;
  --line-strong: #9dafbb;
  --panel: #f8fafb;
  --paper: #ffffff;
  --steel: #263845;
  --navy: #102938;
  --teal: #0d6f72;
  --amber: #a16d17;
  --red: #a43c36;
  --green: #247554;
  --blue: #246a92;
  --shadow: 0 18px 36px rgba(21, 34, 43, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1180px;
  background:
    linear-gradient(180deg, rgba(16, 41, 56, 0.08), transparent 260px),
    #e8eef2;
  color: var(--ink);
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 78px;
  padding: 0 18px;
  color: #f7fbfd;
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #8dd4d1;
}

.brand-word {
  color: var(--amber) !important;
  text-transform: none;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  font-weight: 760;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.aircraft-context {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.aircraft-context span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbfd;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  text-decoration: none;
}

.topbar-button.active {
  background: #f7fbfd;
  color: var(--navy);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.05fr) minmax(390px, 0.95fr);
  gap: 12px;
  height: calc(100vh - 114px);
  margin-top: 12px;
}

.planning-workbench {
  display: grid;
  grid-template-columns: minmax(720px, 1.5fr) minmax(340px, 0.8fr);
  gap: 12px;
  height: calc(100vh - 114px);
  margin-top: 12px;
}

.matrix-pane,
.requirement-pane,
.evidence-pane,
.planning-panel,
.owner-panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(22, 38, 49, 0.08);
}

.pane-toolbar,
.requirement-pane,
.evidence-pane,
.planning-panel,
.owner-panel {
  padding: 14px;
}

.search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search-field input,
.subject-input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

.search-field input,
.subject-input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.filter-button,
.icon-button {
  height: 34px;
  border: 1px solid var(--line-strong);
  background: #edf3f5;
  color: var(--steel);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.filter-button.active,
.icon-button[aria-expanded="true"] {
  background: var(--steel);
  color: #fff;
  border-color: var(--steel);
}

.matrix-header,
.requirement-row {
  display: grid;
  grid-template-columns: 1fr 82px 112px;
  gap: 8px;
  align-items: center;
}

.matrix-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #dae4ea;
  color: #53616d;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.requirement-row {
  width: 100%;
  min-height: 74px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}

.requirement-row:hover,
.requirement-row.active {
  background: #eaf5f5;
}

.row-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 850;
}

.row-subtitle {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.evidence-row {
  min-height: 128px;
}

.status-badge,
.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid currentColor;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-date {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.status-reviewed {
  color: var(--green);
}

.status-found {
  color: var(--blue);
}

.status-partial,
.status-ambiguous {
  color: var(--amber);
}

.status-missing {
  color: var(--red);
}

.pane-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.detail-grid div,
.source-text,
.composer,
.history-panel {
  background: var(--paper);
  border: 1px solid var(--line);
}

.detail-grid div {
  min-height: 74px;
  padding: 10px;
}

dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
}

.source-text,
.composer {
  padding: 13px;
  margin-top: 12px;
}

.source-text p {
  margin-bottom: 0;
  color: #2e3b44;
  line-height: 1.55;
}

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

.composer-header {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.composer-header h3 {
  margin-bottom: 0;
}

.subject-input {
  margin-bottom: 8px;
  font-weight: 780;
}

.evidence-title {
  align-items: center;
}

.evidence-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.evidence-meta span {
  min-height: 36px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--steel);
  font-size: 0.74rem;
  font-weight: 850;
}

.pdf-stack {
  display: grid;
  gap: 12px;
}

.pdf-page {
  position: relative;
  min-height: 560px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid #b8c6cf;
  box-shadow: 0 12px 22px rgba(28, 41, 49, 0.12);
}

.pdf-page::before {
  content: attr(data-label);
  position: absolute;
  top: 18px;
  right: 14px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 30px;
  padding: 0 108px 8px 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.rotation-note {
  min-width: 48px;
  color: var(--muted);
}

.orientation-button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #edf3f5;
  color: var(--steel);
  cursor: pointer;
}

.orientation-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.orientation-button:hover {
  background: #dfeaf0;
}

.pdf-viewport {
  height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #dce6eb;
}

.pdf-viewport.rotated {
  height: 680px;
}

.pdf-rotator {
  width: 100%;
  min-width: 420px;
  height: 520px;
  transform: rotate(var(--page-rotation));
  transform-origin: center center;
}

.pdf-viewport.rotated .pdf-rotator {
  width: 680px;
  margin: 80px auto;
}

.pdf-frame {
  width: 100%;
  height: 520px;
  border: 0;
  background: #eef3f5;
}

.pdf-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
}

.pdf-link:hover {
  text-decoration: underline;
}

.source-warning {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(168, 103, 8, 0.45);
  background: #fff6e5;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.4;
}

.time-confirmation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.confirmed-note {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(36, 117, 84, 0.35);
  background: #eaf6f0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.4;
}

.inline-action {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(168, 103, 8, 0.5);
  background: #fff;
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.inline-action:hover {
  background: #fffaf0;
}

.warning-block {
  border-color: rgba(168, 103, 8, 0.5);
}

.extraction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.extraction-grid div {
  padding: 9px;
  border: 1px solid var(--line);
  background: #f8fafb;
}

.ocr-excerpt {
  margin: 10px 0 0;
  padding: 10px;
  border-left: 3px solid var(--teal);
  background: #edf7f6;
  color: #23313a;
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.45;
}

.history-panel {
  margin-top: 12px;
  padding: 12px;
}

.history-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-item.active {
  background: #eaf5f5;
}

.history-item strong {
  font-size: 0.82rem;
}

.history-item span {
  color: var(--muted);
  font-size: 0.76rem;
}

.decision-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.decision-button {
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  background: #edf3f5;
  color: var(--steel);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.decision-button.active {
  border-color: var(--steel);
  background: var(--steel);
  color: #fff;
}

.planning-warning {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid rgba(168, 103, 8, 0.45);
  background: #fff6e5;
  color: var(--amber);
  font-weight: 850;
}

.planning-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-tile,
.plan-card,
.owner-card {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.summary-tile strong {
  display: block;
  font-size: 1.2rem;
}

.planning-buckets {
  display: grid;
  gap: 12px;
}

.bucket-title {
  margin: 14px 0 8px;
  color: var(--steel);
  font-size: 0.84rem;
  text-transform: uppercase;
}

.plan-card {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr;
  gap: 10px;
  margin-bottom: 8px;
}

.plan-card strong,
.owner-card strong {
  display: block;
  margin-bottom: 4px;
}

.plan-card span,
.owner-card span,
.summary-tile span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.owner-card {
  margin-top: 10px;
}

@media (max-width: 1240px) {
  body {
    min-width: 0;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding: 14px;
  }

  .aircraft-context {
    justify-content: flex-start;
  }

  .workbench {
    grid-template-columns: 1fr;
    height: auto;
  }

  .planning-workbench {
    grid-template-columns: 1fr;
    height: auto;
  }

  .planning-summary,
  .plan-card {
    grid-template-columns: 1fr;
  }

  .matrix-pane,
  .requirement-pane,
  .evidence-pane {
    max-height: none;
  }
}
