:root {
  --ink: #121520;
  --ink-2: #2A2F3A;
  --muted: #586070;
  --ground: #F6F7F9;
  --surface: #FFFFFF;
  --line: #E6E8EC;
  --line-soft: #F0F1F4;
  --control: #D5D9E0;
  --seg: #ECEEF2;
  --side: #14171F;
  --side-active: #262B37;
  --side-text: #C9CED8;
  --side-muted: #9AA3B2;
  --accent: #3347C9;
  --accent-ink: #1F2E8F;
  --strong: #23339A;
  --partial-bg: #DDE3FB;
  --partial-line: #B7C3F4;
  --partial-ink: #1D2A80;
  --partial-bar: #9FB0F2;
  --gap-ink: #9A3F06;
  --gap-line: #C2661F;
  --gap-bar: #F3C49E;
  --posted: #2F8F5B;
  --eco: #1B6B43;
  --eco-bg: #E3F1E8;
  --estimate: #AEB5C1;
  --ok: #2F7A50;
  --bad: #A3291C;
  --warn: #F0A766;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--side); }
body { color: var(--ink); font: 15px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
button, input, select { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; flex-wrap: wrap; min-height: 100vh; }

/* Sidebar */
.side { flex: 1 1 200px; max-width: 100%; padding: 24px 14px; display: flex; flex-direction: column; gap: 28px; color: var(--side-text); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: #fff; font-weight: 600; font-size: 16px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--side-text); font-size: 15px; font-weight: 500; cursor: pointer; text-align: left; }
.nav-item:hover { background: #1D212B; }
.nav-item[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav-count { font-size: 12px; color: var(--side-muted); }
.nav-count.new { color: #8EA0F0; }
.nav-count.warn { color: var(--warn); }
.side-foot { margin-top: auto; padding: 0 12px; font-size: 12px; color: var(--side-muted); display: flex; flex-direction: column; gap: 2px; }

/* Main */
.main { flex: 999 1 560px; min-width: 0; background: var(--ground); min-height: 100vh; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 28px 72px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head h1 { font-size: 26px; letter-spacing: -0.01em; }
.page-head p { margin: 2px 0 0; font-size: 14px; }
#view { display: flex; flex-direction: column; gap: 16px; }

.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { color: var(--ink); border-color: #B9BFCA; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }
.btn.icon { width: 40px; padding: 0; justify-content: center; color: var(--muted); }
.btn.icon[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card.pad { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; flex-direction: column; gap: 2px; }
.card-head h2 { font-size: 16px; }
.card-head span { font-size: 13px; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; }
.kpi .label, .kpi .note { font-size: 13px; color: var(--muted); }
.kpi .note { font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 14px; }
.search:focus-within { border-color: var(--accent); }
.seg { display: flex; padding: 3px; gap: 2px; background: var(--seg); border-radius: 8px; }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 21, 32, .12); }

/* Jobs table */
.table { overflow-x: auto; }
.table-inner { min-width: 760px; }
.cols { display: grid; grid-template-columns: 64px minmax(0, 2.6fr) minmax(0, 1.2fr) minmax(0, 1.5fr) 90px; gap: 16px; padding: 12px 20px; }
.thead { border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); }
.row { border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: 0; }
.row-btn { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 64px minmax(0, 2.6fr) minmax(0, 1.2fr) minmax(0, 1.5fr) 90px; gap: 16px; width: 100%; cursor: pointer; padding: 16px 20px; align-items: start; }
.row-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-btn:hover, .row.open .row-btn { background: #FBFBFC; }
.row.closed { opacity: .6; }
.match { font-family: var(--mono); font-size: 17px; font-weight: 500; color: var(--muted); }
.match.good { color: var(--strong); }
.role { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.role-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.eco { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--eco-bg); color: var(--eco); font-size: 12px; font-weight: 500; vertical-align: 1px; }
.seg-eco { display: inline-flex; margin-right: 5px; color: var(--eco); vertical-align: -1px; }
.new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.meta { font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; font-size: 14px; }
.sal { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sal-bar { position: relative; display: block; height: 4px; background: #EEF0F3; border-radius: 2px; }
.sal-bar span { position: absolute; top: 0; height: 4px; border-radius: 2px; background: var(--estimate); }
.sal-bar span.posted { background: var(--posted); }
.small { font-size: 12px; color: var(--muted); }
.posted-col { font-size: 13px; color: var(--muted); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.footnote { margin: 0; font-size: 12px; color: var(--muted); }

.detail { padding: 4px 20px 20px 100px; display: flex; flex-direction: column; gap: 18px; background: #FBFBFC; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 28px; }
.detail h3 { font-size: 14px; }
.block { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.sw.strong { background: var(--strong); }
.sw.partial { background: var(--partial-bg); border: 1px solid var(--partial-line); }
.sw.gap { border: 1px dashed var(--gap-line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 6px; font-size: 13px; border: 1px solid transparent; }
.chip.strong { background: var(--strong); color: #fff; border-color: var(--strong); }
.chip.partial { background: var(--partial-bg); color: var(--partial-ink); border-color: var(--partial-line); }
.chip.gap { background: var(--surface); color: var(--gap-ink); border: 1px dashed var(--gap-line); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 14px; border-top: 1px solid var(--seg); }
.actions label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.actions select { min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-size: 14px; }
.thumbs { margin-left: auto; display: inline-flex; gap: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; }

/* Skills */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.learn { display: flex; gap: 14px; align-items: baseline; }
.learn .n { flex: none; width: 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.learn strong { font-weight: 500; font-size: 14px; }
.learn div { display: flex; flex-direction: column; min-width: 0; }
.learn small { font-size: 13px; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 44px; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 8px; background: #EEF0F3; border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 8px; border-radius: 4px; }
.bar-row .pct { font-size: 13px; color: var(--muted); text-align: right; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggles svg { transition: transform .15s; }
.toggles [aria-expanded="true"] svg { transform: rotate(90deg); }
.matrix { overflow-x: auto; }
.matrix-inner { display: flex; flex-direction: column; gap: 3px; }
.mrow { display: grid; gap: 3px; align-items: center; font-size: 13px; }
.mhead { font-size: 12px; color: var(--muted); }
.mhead span { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell { height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; background: var(--ground); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 20px; }
.profile-grid h3 { font-size: 13px; margin-bottom: 8px; }

/* Tracker */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.col-head { display: flex; gap: 8px; align-items: baseline; padding: 0 2px; }
.col-head h2 { font-size: 14px; }
.col-head span { font-size: 13px; color: var(--muted); }
.tcard { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tcard:hover { border-color: #C9CED8; }
.tcard:focus-visible { outline: 2px solid var(--accent); }
.tcard strong { font-size: 14px; font-weight: 600; }
.col-empty { border: 1px dashed var(--control); border-radius: 10px; padding: 14px; font-size: 13px; color: var(--muted); }

/* Simple tables */
.grid-table { overflow-x: auto; }
.grid-table .inner { min-width: 680px; }
.grow { display: grid; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); font-size: 14px; align-items: center; }
.grow.head { padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); }
.grow:last-child { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

/* Settings */
.field { display: flex; flex-direction: column; gap: 6px; max-width: 360px; font-size: 14px; }
.field input { min-height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

@media (max-width: 720px) {
  .wrap { padding: 24px 16px 56px; }
  /* Jobs become stacked cards: match on the left, everything else under the title. */
  .table-inner { min-width: 0; }
  .thead { display: none; }
  .row-btn { grid-template-columns: 48px minmax(0, 1fr); gap: 6px 12px; padding: 14px 16px; }
  .row-btn > :nth-child(n+3) { grid-column: 2; }
  .row-btn .stack { flex-direction: row; gap: 8px; }
  .sal-bar { max-width: 220px; }
  .detail { padding: 4px 16px 16px; }
  .thumbs { margin-left: 0; }
  .grid-table .inner { min-width: 560px; }
}
