@import url('https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,600;7..72,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #14213d;
  --paper: #ffffff;
  --line: #d7dbe3;
  --muted: #6f7684;
  --action: #fca311;
  --mint: #2a9d8f;
  --soft: #f4f6f8;
  --dark-soft: #1f2c4d;
  --danger: #b7412d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(20, 33, 61, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 33, 61, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: Inter, Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: var(--paper);
  background: var(--ink);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  color: var(--paper);
  text-decoration: none;
  font-family: Literata, Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

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

.nav {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  width: 100%;
  min-height: 50px;
  margin: 6px 0;
  padding: 8px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav span {
  font-size: 12px;
  color: var(--action);
}

.nav strong {
  font-size: 14px;
  font-weight: 600;
}

.nav.is-active,
.nav:hover {
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.workspace {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  font-family: Literata, Georgia, serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(31px, 4vw, 62px);
  line-height: 0.95;
}

h2 {
  font-size: clamp(25px, 2.6vw, 38px);
  line-height: 1;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-action,
.ghost-action {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  font-weight: 800;
}

.icon-button {
  width: 44px;
  color: var(--ink);
  background: var(--paper);
  font-size: 21px;
}

.primary-action {
  padding: 0 18px;
  color: var(--ink);
  background: var(--action);
}

.ghost-action {
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
}

.metric {
  min-height: 88px;
  padding: 14px;
  background: var(--paper);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: Literata, Georgia, serif;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1;
}

.metric.error strong {
  color: var(--danger);
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
}

.screen {
  display: none;
}

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

.filters {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.filters label {
  display: grid;
  gap: 6px;
}

.filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filters select,
.filters input,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 8px;
}

.command-grid,
.record-layout,
.calendar-layout,
.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.board {
  min-width: 0;
}

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

.stage-step {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  text-align: left;
}

.stage-step:hover {
  background: #fff8ed;
}

.stage-step span,
.stage-step em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.stage-step strong {
  font-size: 14px;
}

.lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.lane {
  min-width: 160px;
  border-left: 3px solid var(--ink);
}

.lane header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0 9px 10px;
  font-weight: 800;
}

.lane-items {
  display: grid;
  gap: 10px;
}

.sample-card {
  padding: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 33, 61, 0.06);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.sample-card:hover,
.sample-card:focus,
.sample-card.is-selected {
  outline: none;
  transform: translateY(-2px);
  border-color: var(--ink);
  box-shadow: 0 14px 32px rgba(20, 33, 61, 0.12);
}

.code-row,
.sample-card footer,
.calendar-row,
.report-row,
.check-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.code-row {
  align-items: center;
  margin-bottom: 12px;
}

.code-row span {
  padding: 3px 7px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.code-row em {
  color: var(--mint);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.sample-card p,
.muted,
.notes {
  color: var(--muted);
}

.sample-card p {
  min-height: 38px;
  margin: 8px 0 14px;
  font-size: 13px;
  line-height: 1.45;
}

.sample-card footer {
  align-items: center;
  font-size: 12px;
}

.sample-card footer strong {
  color: var(--action);
  font-size: 17px;
}

.inspector,
.comment-panel,
.mobile-mirror,
.certificate-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 8px;
}

.inspector h2,
.comment-panel h2,
.mobile-mirror h2,
.certificate-panel h2 {
  color: var(--paper);
}

.art-strip {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.7fr 1fr;
  gap: 5px;
  height: 92px;
  margin: 16px 0;
}

.art-strip span {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(42, 157, 143, 0.22));
}

.art-strip span:nth-child(2) {
  background: linear-gradient(180deg, var(--action), rgba(255, 255, 255, 0.88));
}

.art-strip span:nth-child(3) {
  background: var(--mint);
}

.info-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  margin: 0;
  font-size: 13px;
}

.info-grid dt {
  color: rgba(255, 255, 255, 0.58);
}

.info-grid dd {
  margin: 0;
  font-weight: 800;
}

.notes {
  margin: 16px 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

.decision-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-row .ghost-action {
  color: var(--paper);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}

.empty {
  padding: 16px;
  color: var(--muted);
  background: var(--soft);
  border-radius: 8px;
}

.record-main,
.calendar-layout > section,
.report-layout > section {
  min-width: 0;
}

.record-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  border: 1px solid var(--ink);
  background: var(--ink);
}

.record-hero div {
  min-height: 96px;
  padding: 14px;
  background: var(--paper);
}

.record-hero span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.record-hero strong {
  display: block;
  margin-top: 13px;
  font-family: Literata, Georgia, serif;
  font-size: 26px;
  line-height: 1;
}

.check-list,
.calendar-list,
.report-list,
#comments,
#certificates {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.check-row,
.calendar-row,
.report-row,
.comment,
.certificate {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-row.blocked,
.check-row.changes {
  border-color: var(--danger);
}

.check-row p,
.calendar-row p,
.report-row p,
.comment p,
.certificate p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.check-row span,
.calendar-row span,
.report-row span,
.comment span,
.certificate span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.comment-panel textarea {
  margin-top: 16px;
  color: var(--paper);
  background: var(--dark-soft);
  border-color: rgba(255, 255, 255, 0.25);
  resize: vertical;
}

.comment-panel .primary-action {
  width: 100%;
  margin-top: 8px;
}

.phone-shell {
  max-width: 240px;
  min-height: 390px;
  margin: 18px auto 0;
  padding: 22px 16px;
  color: var(--ink);
  background: var(--paper);
  border: 8px solid var(--dark-soft);
  border-radius: 28px;
}

.phone-shell span {
  display: inline-block;
  padding: 4px 8px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.phone-shell h3 {
  margin: 44px 0 12px;
  font-family: Literata, Georgia, serif;
  font-size: 27px;
}

.phone-shell p {
  color: var(--muted);
  line-height: 1.45;
}

.report-number {
  min-width: 96px;
  text-align: right;
}

.report-number strong {
  display: block;
  font-family: Literata, Georgia, serif;
  font-size: 27px;
}

#certificates .certificate {
  color: var(--paper);
  background: var(--dark-soft);
  border-color: rgba(255, 255, 255, 0.16);
}

#certificates .certificate p,
#certificates .certificate span {
  color: rgba(255, 255, 255, 0.72);
}

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

  .brand span,
  .nav strong {
    display: none;
  }

  .nav {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .command-grid,
  .record-layout,
  .calendar-layout,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .inspector,
  .comment-panel,
  .mobile-mirror,
  .certificate-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    display: block;
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    height: auto;
    padding: 10px;
  }

  .brand {
    margin: 0;
  }

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

  .nav {
    min-height: 42px;
    margin: 0;
    padding: 5px;
  }

  .workspace {
    padding: 16px 12px 26px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: start;
  }

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

  .filters,
  .workflow-line,
  .record-hero {
    grid-template-columns: 1fr;
  }

  .lanes {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .lane {
    min-width: 0;
  }

  .calendar-row,
  .report-row,
  .check-row {
    display: grid;
  }
}
