:root {
  --ink: #2f3e46;
  --paper: #f1faee;
  --line: rgba(47, 62, 70, 0.18);
  --accent: #e9c46a;
  --blue: #457b9d;
  --danger: #c94f4f;
  --ok: #2a9d8f;
  --white: #fffdf7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(69, 123, 157, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 62, 70, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100svh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(241, 250, 238, 0.94);
  backdrop-filter: blur(16px);
}

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

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.05;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: rgba(47, 62, 70, 0.68);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab,
.ghost-button,
.primary-button,
.row-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.72);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.tab {
  padding: 0 13px;
  white-space: nowrap;
}

.tab:hover,
.ghost-button:hover,
.row-action:hover {
  transform: translateY(-1px);
  border-color: rgba(69, 123, 157, 0.42);
}

.tab.is-active,
.primary-button {
  border-color: rgba(47, 62, 70, 0.9);
  background: var(--ink);
  color: var(--paper);
}

main {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 28px);
}

.summary-strip {
  position: sticky;
  top: 69px;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
}

.summary-strip > div {
  min-height: 78px;
  padding: 12px;
  background: var(--white);
}

.metric-label,
.eyebrow,
.muted {
  color: rgba(47, 62, 70, 0.66);
}

.metric-label,
.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(24px, 6vw, 38px);
  line-height: 0.95;
}

.risk-cell strong {
  color: var(--danger);
}

.screen {
  display: none;
  padding-top: 22px;
  animation: rise 220ms ease both;
}

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

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

.workspace-head {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

h1,
h2 {
  max-width: 760px;
  font-size: clamp(28px, 6vw, 56px);
  line-height: 0.96;
}

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

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filters input,
.filters select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
}

.filters input {
  width: min(340px, 42vw);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 148px;
  z-index: 10;
  background: #e6f0e4;
  font-size: 12px;
  text-transform: uppercase;
}

.route-row {
  transition: background 160ms ease;
}

.route-row:hover {
  background: rgba(233, 196, 106, 0.13);
}

.route-title {
  max-width: 280px;
  font-weight: 850;
  font-size: 18px;
}

.muted {
  margin-top: 4px;
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  margin-top: 9px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-risk {
  background: rgba(201, 79, 79, 0.14);
  color: var(--danger);
}

.status-active {
  background: rgba(69, 123, 157, 0.14);
  color: var(--blue);
}

.status-done {
  background: rgba(42, 157, 143, 0.14);
  color: var(--ok);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 6px;
  min-width: 328px;
}

.step {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(47, 62, 70, 0.04);
  font-size: 12px;
  font-weight: 800;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.step.is-done {
  border-color: rgba(42, 157, 143, 0.32);
  background: rgba(42, 157, 143, 0.16);
}

.step.is-active {
  border-color: rgba(47, 62, 70, 0.7);
  background: var(--accent);
  transform: translateY(-1px);
}

.load-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 160px;
  font-size: 14px;
}

.load-input {
  width: 100%;
  min-width: 160px;
  accent-color: var(--blue);
}

.row-action {
  display: block;
  width: 150px;
  margin: 0 0 6px;
  padding: 0 10px;
  font-weight: 800;
}

.row-action.secondary {
  background: rgba(233, 196, 106, 0.18);
}

.analytics-grid,
.public-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.plain-panel,
.import-panel,
.public-status {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  padding: clamp(16px, 3vw, 24px);
}

.bar-row {
  display: grid;
  grid-template-columns: 82px 1fr 34px;
  gap: 10px;
  align-items: center;
  margin-bottom: 13px;
}

.bar-row div {
  height: 18px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(47, 62, 70, 0.09);
}

.bar-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--accent));
  transition: width 320ms ease;
}

.feedback-list article {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.feedback-list article:first-child {
  border-top: 0;
}

.feedback-list article span {
  float: right;
  font-weight: 900;
  color: var(--blue);
}

.feedback-list p,
.import-panel p,
.public-layout p {
  margin-top: 8px;
  line-height: 1.45;
}

.primary-button,
.ghost-button {
  padding: 0 16px;
  font-weight: 850;
}

.import-panel {
  max-width: 760px;
}

.import-panel pre {
  overflow-x: auto;
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: #26333a;
  color: var(--paper);
  white-space: pre-wrap;
}

.public-status strong {
  display: block;
  font-size: 24px;
}

.public-status .timeline {
  margin-top: 14px;
}

@media (max-width: 820px) {
  .topbar,
  .workspace-head,
  .filters,
  .public-layout {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

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

  .filters input,
  .filters select {
    width: 100%;
  }

  .table-wrap {
    border: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    border: 1px solid var(--ink);
    border-radius: 8px;
    background: var(--white);
  }

  td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
  }

  td::before {
    content: attr(data-label);
    color: rgba(47, 62, 70, 0.62);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td:last-child {
    border-bottom: 0;
  }

  .route-title {
    max-width: none;
  }

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

  .row-action {
    width: 100%;
  }

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

@media (max-width: 520px) {
  main {
    padding: 10px;
  }

  .brand small {
    display: none;
  }

  .summary-strip > div {
    min-height: 68px;
    padding: 10px;
  }

  h1,
  h2 {
    font-size: 30px;
  }

  td {
    grid-template-columns: 1fr;
  }
}

