@font-face { font-family: "Inter"; src: url("/kit/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #14181f;
  --muted: #566070;
  --line: #dde1e7;
  --line-soft: #eceff3;
  --accent: #0f5c63;
  --accent-ink: #fff;
  --accent-soft: #e4f1f1;
  --warn: #9a5b00;
  --bad: #b42318;
  --ok: #187a36;
  --idle: #6b7482;
  --panel-w: 780px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 14px; line-height: 1.45; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.muted { color: var(--muted); }
small, .small { font-size: 12px; color: var(--muted); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { margin: 0; font-size: 15px; font-weight: 650; white-space: nowrap; }
.project { position: relative; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: center; min-width: 0; max-width: 340px; padding: 5px 12px; margin-inline-start: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.project:hover { background: var(--bg); }
.project-name { grid-column: 1; font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-sub { grid-column: 1; font-size: 12px; color: var(--muted); line-height: 1.25; }
.project-chev { grid-column: 2; grid-row: 1 / span 2; width: 16px; height: 16px; color: var(--muted); }
.project select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.project:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; background: #fff3d6; color: #6b4300; font-size: 12px; font-weight: 600; white-space: nowrap; }
.clock { margin-inline-start: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* shell and navigation */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.nav { padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 550; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav .short { display: none; }
.main { padding: 28px 32px 48px; min-width: 0; max-width: 1480px; }
.main h2 { margin: 0 0 18px; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.loading { color: var(--muted); }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { margin-top: 4px; font-size: 28px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--muted); min-height: 18px; }

/* work-item table */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.table-wrap { overflow-x: auto; }
table.items { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items th { padding: 10px 12px; text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
table.items th.num { text-align: end; }
table.items td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.items tbody tr[data-open] { cursor: pointer; }
table.items tbody tr[data-open]:hover { background: #f8fafb; }
table.items tbody tr[data-selected="true"] { background: var(--accent-soft); }
table.items tr:last-child td { border-bottom: 0; }
.id-link { white-space: nowrap; font-weight: 650; text-decoration: none; color: var(--accent); }
.id-link:hover { text-decoration: underline; }
.cell-title { font-weight: 550; }
.status { display: inline-flex; align-items: baseline; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--idle); transform: translateY(-1px); display: inline-block; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.ok { background: var(--ok); }

/* detail panel */
.scrim { position: fixed; inset: 60px 0 0 0; z-index: 25; background: rgba(20, 24, 31, 0.28); }
.panel { position: fixed; z-index: 30; top: 60px; bottom: 0; inset-inline-end: 0; width: min(var(--panel-w), 100vw); background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: -12px 0 32px rgba(20, 24, 31, 0.1); display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 17px; font-weight: 650; min-width: 0; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted); font-weight: 550; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.panel-head .close { margin-inline-start: auto; }
.panel .back { display: none; }
.panel-body { overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 22px; flex: 1; min-height: 0; }
.panel h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; }
.facts div { display: flex; gap: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; }

/* comparison sheet */
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.sheet { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 560px; }
.sheet th, .sheet td { padding: 9px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.sheet thead th { background: #fafbfc; font-weight: 650; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.sheet tbody th { font-weight: 450; position: sticky; inset-inline-start: 0; background: var(--surface); min-width: 170px; z-index: 1; }
.sheet td.num { min-width: 128px; }
.sheet td.txt { min-width: 128px; }
.sheet small { display: block; line-height: 1.3; }
.sheet tr.total th, .sheet tr.total td { font-weight: 650; border-top: 1px solid var(--line); background: #fafbfc; }
.sheet tr.total td { font-size: 14px; }
.sheet tr:last-child th, .sheet tr:last-child td { border-bottom: 0; }
.sheet .rec { background: var(--accent-soft); }
.sheet thead th.rec { box-shadow: inset 0 3px 0 var(--accent); }
.sheet tr.total td.rec { background: #d4e8e8; }
.tag-rec { display: block; font-size: 12px; font-weight: 600; color: var(--accent); }
.bad-text { color: var(--bad); font-weight: 550; }
.warn-text { color: var(--warn); font-weight: 550; }
.ok-text { color: var(--ok); font-weight: 550; }

/* flags, recommendation, buttons */
.flags { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.flags li { display: flex; gap: 8px; align-items: baseline; }
.reco { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; display: grid; gap: 10px; }
.reco-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.reco-head strong { font-size: 16px; }
.note { margin: 0; white-space: pre-wrap; }
textarea, select.field { width: 100%; padding: 10px 12px; border: 1px solid #b9c0ca; border-radius: 8px; background: var(--surface); resize: vertical; }
textarea { min-height: 96px; line-height: 1.45; }
.btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid #b9c0ca; border-radius: 8px; background: var(--surface); font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0c4c52; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 28px; }
.decided { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 600; }
.decided .dot { transform: none; }

/* reply box and result */
.label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.reply-grid { display: grid; gap: 12px; }
.examples { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.result { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 10px; }
.result .source { font-weight: 650; }
.result ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 2px; }
.draft { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; display: grid; gap: 8px; }
.draft p { margin: 0; white-space: pre-wrap; }

/* delivery and invoice */
.meter { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.match .big { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th, table.plain td { padding: 8px 0; text-align: start; border-bottom: 1px solid var(--line-soft); font-weight: 450; }
table.plain td { text-align: end; font-variant-numeric: tabular-nums; }
table.plain tr.strong th, table.plain tr.strong td { font-weight: 650; }

/* suppliers and rules */
.rules { margin: 0; padding: 0; list-style: none; }
.rules li { display: grid; grid-template-columns: 220px 200px 1fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.rules li:last-child { border-bottom: 0; }
.rules .name { font-weight: 600; }
.rules .value { font-weight: 650; color: var(--accent); }

/* tablet */
@media (max-width: 1100px) {
  .main { padding: 24px 20px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules li { grid-template-columns: 1fr; gap: 2px; }
}

/* phone */
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .brand { font-size: 14px; flex: 1 1 auto; }
  .project { order: 3; flex: 1 1 100%; max-width: none; margin: 0; }
  .clock { display: none; }
  .shell { display: block; }
  .nav { position: fixed; z-index: 15; inset: auto 0 0 0; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-inline-end: 0; border-top: 1px solid var(--line); }
  .nav a { flex: 1; flex-direction: column; gap: 2px; min-height: 52px; padding: 6px 2px; justify-content: center; font-size: 11px; text-align: center; }
  .nav .long { display: none; }
  .nav .short { display: inline; }
  .main { padding: 18px 14px 88px; }
  .main h2 { font-size: 19px; margin-bottom: 14px; }
  .kpis { gap: 10px; margin-bottom: 16px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 24px; }
  .scrim { display: none; }
  .panel { top: 0; width: 100vw; border-inline-start: 0; box-shadow: none; z-index: 40; }
  .panel .back { display: inline-flex; }
  .panel .close { display: none; }
  .panel-body { padding: 16px 14px 32px; }
  .match { grid-template-columns: 1fr; }
  /* work items become cards */
  .card.table-card { border: 0; background: transparent; }
  table.items, table.items tbody, table.items tr, table.items td { display: block; }
  table.items thead { display: none; }
  table.items tbody { display: grid; gap: 10px; }
  table.items tr { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  table.items tr[data-selected="true"] { background: var(--surface); }
  table.items td { padding: 0; border: 0; min-width: 0; text-align: start; }
  table.items td.num { text-align: start; }
  table.items td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  table.items td.c-id { grid-column: 1 / -1; }
  table.items td.c-id::before, table.items td.c-next::before, table.items td.c-pkg::before { content: none; }
  table.items td.c-status, table.items td.c-next, table.items td.c-pkg { grid-column: 1 / -1; }
  table.items td.c-pkg { margin-top: -4px; }
  table.items td.empty, table.items td.c-price small, table.items td.c-price br { display: none; }
  .sheet tbody th { min-width: 112px; }
  .sheet td.num, .sheet td.txt { min-width: 104px; }
  table.sheet { min-width: 480px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
