:root {
  --ink: #203039;
  --river: #457b9d;
  --deep: #2f3e46;
  --paper: #f1faee;
  --sand: #e9c46a;
  --line: rgba(47, 62, 70, .16);
  --danger: #bc4749;
  --ok: #3a7d44;
  --surface: #fffdfa;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }

body { overflow-x: hidden; }

button, select { font: inherit; }

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background:
    linear-gradient(90deg, rgba(47, 62, 70, .07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(69, 123, 157, .08), transparent 340px),
    var(--paper);
  background-size: 44px 44px, 100% 100%, auto;
}

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

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  font-weight: 800;
}

.brand img { border-radius: 12px; box-shadow: 0 16px 32px rgba(0,0,0,.22); }

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

.tab {
  min-height: 48px;
  border: 1px solid rgba(241, 250, 238, .18);
  background: transparent;
  color: var(--paper);
  text-align: left;
  border-radius: 8px;
  padding: 0 13px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.tab:hover { transform: translateX(2px); border-color: rgba(233, 196, 106, .7); }

.tab.is-active { background: var(--sand); color: var(--deep); border-color: var(--sand); font-weight: 800; }

.rail-note {
  margin-top: auto;
  padding: 14px 0 0;
  border-top: 1px solid rgba(241, 250, 238, .22);
  font-size: 13px;
  line-height: 1.45;
  color: rgba(241, 250, 238, .74);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--sand);
  box-shadow: 0 0 0 7px rgba(233, 196, 106, .12);
}

.workspace { padding: 24px clamp(16px, 3vw, 38px) 48px; min-width: 0; }

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--river);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

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

.sync-button, .import-console button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--deep);
  color: var(--paper);
  font-weight: 800;
  cursor: pointer;
}

.summary-row {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: 0 16px 40px rgba(32, 48, 57, .08);
}

.metric { background: rgba(255, 253, 250, .96); padding: 15px 16px; min-width: 0; }

.metric span {
  display: block;
  color: rgba(32, 48, 57, .68);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.metric.accent strong { color: var(--river); }

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0;
}

.workflow-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 253, 250, .62);
}

.workflow-strip b { color: var(--deep); }

.screen { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin: 22px 0 14px; }

.screen-title h2 { margin-bottom: 5px; font-size: clamp(24px, 3vw, 36px); line-height: 1.08; }

.screen-title p { margin-bottom: 0; max-width: 680px; color: rgba(32, 48, 57, .72); }

.status-line {
  flex: 0 0 auto;
  color: rgba(32, 48, 57, .7);
  font-size: 14px;
  padding-bottom: 3px;
}

.status-line.is-error { color: var(--danger); font-weight: 800; }

.data-surface { min-height: 360px; animation: surfaceIn .22s ease both; }

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

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

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

.resource-table th {
  position: sticky;
  top: 117px;
  z-index: 2;
  background: #e7f0ec;
  color: rgba(32, 48, 57, .76);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  padding: 13px 14px;
}

.resource-table td { border-top: 1px solid var(--line); padding: 14px; vertical-align: middle; }

.resource-table strong { display: block; max-width: 290px; }

.resource-table small { display: block; margin-top: 5px; color: rgba(32, 48, 57, .62); }

code {
  background: rgba(69, 123, 157, .12);
  color: var(--deep);
  border-radius: 6px;
  padding: 4px 7px;
}

.badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.badge-new { background: rgba(188, 71, 73, .12); color: var(--danger); }
.badge-assigned { background: rgba(233, 196, 106, .32); color: #7a5c00; }
.badge-on_site { background: rgba(69, 123, 157, .17); color: var(--river); }
.badge-reported { background: rgba(47, 62, 70, .12); color: var(--deep); }
.badge-closed { background: rgba(58, 125, 68, .14); color: var(--ok); }

select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.panel.wide { grid-column: 1 / -1; }

.panel h3, .import-console h3, .public-item h3 { margin-bottom: 12px; }

.mini-bars { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; }

.mini-bars span {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(69, 123, 157, .14), rgba(233, 196, 106, .18));
}

.mini-bars b { font-size: 14px; }

.dense-list {
  list-style: none;
  display: grid;
  gap: 1px;
  padding: 0;
  margin: 0;
  background: var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.dense-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 12px;
  background: white;
}

.dense-list em {
  grid-column: 1 / -1;
  color: rgba(32, 48, 57, .62);
  font-style: normal;
  font-size: 13px;
}

.import-console {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--deep);
  color: var(--paper);
  padding: clamp(18px, 4vw, 34px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: start;
}

.import-console p { color: rgba(241, 250, 238, .75); max-width: 640px; }

.import-console button { background: var(--sand); color: var(--deep); }

.import-console pre {
  grid-column: 1 / -1;
  margin: 0;
  white-space: pre-wrap;
  min-height: 120px;
  border-radius: 8px;
  padding: 14px;
  background: rgba(0, 0, 0, .22);
  color: #fff7d3;
}

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

.public-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.public-item span { color: var(--river); font-weight: 800; font-size: 13px; text-transform: uppercase; }

.public-item p { color: rgba(32, 48, 57, .72); line-height: 1.45; }

.public-item footer { display: flex; justify-content: space-between; gap: 10px; color: rgba(32, 48, 57, .64); }

.empty-state {
  border: 1px dashed rgba(188, 71, 73, .5);
  border-radius: 8px;
  padding: 22px;
  background: rgba(188, 71, 73, .06);
  color: var(--danger);
  font-weight: 800;
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    padding: 14px;
    gap: 14px;
  }
  .brand span { font-size: 20px; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab { text-align: center; padding: 0 8px; }
  .rail-note { display: none; }
  .topline, .screen { display: grid; }
  .sync-button { width: 100%; }
  .summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-table th { top: 161px; }
  .analytics-grid, .public-board { grid-template-columns: 1fr; }
  .mini-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-console { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .workspace { padding: 16px 10px 32px; }
  .summary-row { position: static; }
  .metric { padding: 12px; }
  .tabs { grid-template-columns: 1fr; }
  .mini-bars { grid-template-columns: 1fr; }
}

