:root {
  --ink: #2d3142;
  --paper: #f7fff7;
  --accent: #ff9f1c;
  --mint: #2ec4b6;
  --line: rgba(45, 49, 66, 0.18);
  --muted: rgba(45, 49, 66, 0.68);
  --danger: #a83232;
  --white: #ffffff;
  --shadow: 0 18px 38px rgba(45, 49, 66, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) auto minmax(280px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 32px);
  background: rgba(247, 255, 247, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
}

.brand strong,
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand small {
  display: block;
  color: var(--muted);
  white-space: nowrap;
}

.screen-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 3px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink);
  min-height: 36px;
  padding: 0 14px;
}

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

.command-actions {
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.search-box {
  width: min(360px, 100%);
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.search-box input,
select,
textarea,
.request-form input {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  padding: 8px 10px;
}

.icon-button,
.primary-button {
  border: 0;
  min-height: 40px;
  background: var(--ink);
  color: var(--paper);
  padding: 0 14px;
}

.icon-button {
  width: 42px;
  font-size: 1.1rem;
}

.primary-button {
  background: var(--accent);
  color: #151515;
  font-weight: 750;
}

.workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 32px) 18px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow);
}

.status-strip article,
.source-pill {
  background: var(--white);
  padding: 14px;
  min-width: 0;
}

.status-strip strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1;
  margin: 6px 0;
}

.status-strip small {
  color: var(--muted);
}

.status-strip .accent {
  background: var(--mint);
  color: #09221f;
}

.source-pill {
  align-self: stretch;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-pill[data-source="mysql"] {
  color: #0a665c;
  font-weight: 800;
}

.view {
  display: none;
  padding: 20px 0 0;
}

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

.board-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin: 0 0 14px;
}

.board-header h1,
.split-panel h1 {
  margin: 4px 0 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.04;
}

.kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.lane {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.lane:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.lane-label {
  color: rgba(247, 255, 247, 0.75);
}

.lane strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.1rem;
  line-height: 0.9;
}

.lane em {
  color: var(--accent);
  font-style: normal;
  font-size: 0.78rem;
}

.registry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 14px;
  align-items: start;
}

.registry-table,
.inspector,
.split-panel,
.doc-card,
.finance-line,
.finance-total {
  border: 1px solid var(--line);
  background: var(--white);
}

.table-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(120px, 0.6fr) minmax(90px, 0.4fr) minmax(100px, 0.45fr);
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 11px 14px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.item-row {
  width: 100%;
  min-height: 74px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background 140ms ease;
}

.item-row:hover,
.item-row.is-selected {
  background: rgba(46, 196, 182, 0.13);
}

.item-row strong,
.item-row small {
  display: block;
}

.item-row small {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.margin {
  font-weight: 850;
}

.status-badge {
  justify-self: start;
  border: 1px solid var(--line);
  padding: 6px 9px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.public {
  background: rgba(46, 196, 182, 0.18);
}

.status-badge.blocked {
  background: rgba(168, 50, 50, 0.12);
  color: var(--danger);
}

.inspector {
  position: sticky;
  top: 90px;
  padding: 16px;
}

.inspector h2 {
  margin: 6px 0 8px;
  font-size: 1.45rem;
  line-height: 1.08;
}

.inspector p {
  color: var(--muted);
  margin: 0 0 14px;
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 12px;
}

.note-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.note-form label,
.request-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

textarea {
  resize: vertical;
  min-height: 82px;
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(280px, 1fr);
  gap: clamp(18px, 5vw, 70px);
  padding: clamp(18px, 4vw, 42px);
  min-height: 440px;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(45,49,66,0.94), rgba(45,49,66,0.76)),
    repeating-linear-gradient(0deg, rgba(247,255,247,0.08), rgba(247,255,247,0.08) 1px, transparent 1px, transparent 28px);
  color: var(--paper);
}

.split-panel p {
  max-width: 520px;
  color: rgba(247, 255, 247, 0.78);
}

.request-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--mint);
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
}

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

.doc-card {
  padding: 16px;
  min-height: 190px;
  display: grid;
  align-content: space-between;
  border-top: 6px solid var(--mint);
}

.doc-card.needs_fix {
  border-top-color: var(--danger);
}

.doc-card.draft {
  border-top-color: var(--accent);
}

.doc-card h2 {
  margin: 8px 0;
  font-size: 1.45rem;
  line-height: 1.08;
}

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

.doc-card footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.finance-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 90px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-left: 6px solid var(--mint);
}

.finance-line.watch {
  border-left-color: var(--accent);
}

.finance-line.risk {
  border-left-color: var(--danger);
}

.finance-line h2 {
  margin: 4px 0;
  font-size: 1.2rem;
}

.finance-line p {
  margin: 0;
  color: var(--muted);
}

.finance-line strong,
.finance-line em,
.finance-total strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-style: normal;
}

.finance-total {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
}

.event-stream {
  border-top: 1px solid var(--line);
  background: #222636;
  color: var(--paper);
  padding: 12px clamp(14px, 3vw, 32px) 16px;
}

.stream-head {
  width: min(1480px, 100%);
  margin: 0 auto 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(247, 255, 247, 0.82);
}

#eventStream {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
}

.event-line {
  min-height: 118px;
  padding: 12px;
  border: 1px solid rgba(247, 255, 247, 0.18);
  background: rgba(247, 255, 247, 0.06);
}

.event-line time {
  color: var(--mint);
  font-size: 0.78rem;
}

.event-line strong {
  display: block;
  margin: 8px 0 5px;
}

.event-line p {
  margin: 0;
  color: rgba(247, 255, 247, 0.78);
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .command-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .screen-tabs,
  .command-actions {
    justify-content: flex-start;
  }

  .status-strip,
  .lane-board,
  .doc-grid,
  #eventStream {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .inspector {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding-top: 14px;
  }

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

  .tab {
    padding: 0 8px;
  }

  .command-actions,
  .board-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .status-strip,
  .lane-board,
  .doc-grid,
  #eventStream {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .item-row {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
  }

  .finance-line {
    grid-template-columns: 1fr;
  }

  .finance-total {
    justify-content: space-between;
  }
}

