:root {
  --bg: #101314;
  --side: #15181a;
  --card: #26272f;
  --card-2: #1e2026;
  --line: #33353d;
  --line-2: #44464f;
  --text: #dedfe6;
  --muted: #9a9ca6;
  --white: #ffffff;
  --green: #5fa567;
  --green-l: #8fd991;
  --green-b: #9dc7a3;
  --green-bg: #1d3527;
  --blue: #9cc8f0;
  --blue-bg: #1e2c3d;
  --amber: #e8b04a;
  --amber-bg: #2e2717;
  --amber-b: #5c4a24;
  --red: #f0a0a0;
  --red-b: #6b3434;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Josefin Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--green-l); }
a:hover { color: #b5ebb6; }
h1 { margin: 0; font-size: 34px; font-weight: 600; color: var(--white); line-height: 1.15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 22px; font-weight: 600; color: var(--white); }
.h2 { font-size: 26px; font-weight: 600; color: var(--white); }
.h3 { font-size: 21px; font-weight: 600; color: var(--white); }
.h4 { font-size: 18px; font-weight: 600; color: var(--white); margin: 0; }
small { font-size: 0.55em; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.sm { font-size: 14px; }
.strong { color: var(--white); font-weight: 600; }
strong { color: var(--white); font-weight: 600; }
.normal { font-weight: 400; }
.amber { color: var(--amber); }
.blue { color: var(--blue); }
.struck { text-decoration: line-through; color: var(--muted); }
.struck a { color: var(--muted); }
.plain { color: inherit; text-decoration: none; }
.plain:hover { color: var(--white); text-decoration: underline; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.minw0 { min-width: 0; }
.nw { white-space: nowrap; }
.ic { flex: none; }
.ic.xs { width: 14px; height: 14px; }
.ic.muted { color: var(--muted); }
.ic.warn { color: var(--amber); }
.ic.info { color: #6aa9e8; }

/* layout */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; background: var(--side); border-right: 1px solid var(--card); padding: 28px 16px; display: flex; flex-direction: column; gap: 32px; }
.main { flex: 999 1 560px; min-width: 0; padding: 36px 40px 64px; }
.content { max-width: 1120px; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; flex-direction: column; gap: 10px; padding: 0 10px; text-decoration: none; }
.brand img { width: 136px; height: auto; }
.brand span, .eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.eyebrow { color: var(--green-l); letter-spacing: 0.08em; }
.eyebrow a { color: var(--green-l); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 12px; text-decoration: none; font-size: 16px; font-weight: 500; color: var(--text); }
.nav-item:hover { background: #1f2227; color: var(--white); }
.nav-item.is-active { background: var(--card); color: var(--white); }
.nav-item.is-active .ic { color: var(--green-l); }
.side-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.logout { margin-top: auto; padding: 0 4px; }
.linklike { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; padding: 8px 10px; min-height: 44px; }
.linklike:hover { color: var(--white); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 0; font-size: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.stack-0 { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.row.baseline { align-items: baseline; gap: 12px; }
.grow { flex: 1 1 320px; }
.grow-0 { flex: 0 1 320px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cards2 { grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); }
.cards2.start { align-items: start; }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px 24px; }
.card.flush { padding: 0; overflow: hidden; }
.scroll-x { overflow-x: auto; }
.pad { padding: 18px 22px; margin: 0; }
.pad-top { padding-top: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-v { font-size: 34px; font-weight: 600; color: var(--white); line-height: 1.1; }
.kpi-soft { font-size: 24px; font-weight: 500; }
.more { align-self: flex-start; font-weight: 500; text-decoration: none; }
.more:hover { text-decoration: underline; }
.tag { white-space: nowrap; display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px; background: var(--card); font-size: 14px; color: var(--text); }
.tag-green { background: var(--green-bg); color: var(--green-l); padding: 3px 10px; font-size: 13px; }
.tag-blue { background: var(--blue-bg); color: var(--blue); padding: 3px 10px; font-size: 13px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 20px; border-radius: 999px; border: 1.5px solid transparent; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--green); color: #101314; }
.btn-primary:hover { background: #6fb877; color: #101314; }
.btn-outline { border-color: var(--green-b); color: var(--green-l); background: transparent; font-weight: 500; }
.btn-outline:hover { background: #1f2a22; color: #b5ebb6; }
.btn-ghost { border-color: var(--line-2); color: var(--text); background: transparent; font-weight: 500; }
.btn-ghost:hover { border-color: var(--green-b); color: var(--white); }
.btn-amber { background: var(--amber); color: #101314; align-self: flex-start; }
.btn-danger { border-color: var(--red-b); color: var(--red); background: transparent; font-weight: 500; }
.btn-danger:hover { background: #2b1a1a; }
.btn-sm { min-height: 40px; padding: 6px 16px; font-size: 14px; }
.btn-xs { min-height: 36px; padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn[aria-pressed="true"] { pointer-events: none; }

/* link box */
.linkbox { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 8px 8px 8px 14px; }
.linkbox-url { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; color: var(--white); font: inherit; font-size: 16px; text-overflow: ellipsis; padding: 0; }
.linkbox-url:focus { outline: none; }

/* pills */
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; letter-spacing: 0; }
.pill-green { background: var(--green-bg); color: var(--green-l); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-grey { background: var(--line); color: var(--text); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-outline { border: 1px solid var(--line-2); color: var(--muted); }
h1 .pill { font-size: 14px; }

/* progress */
.bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar span { display: block; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #2c9972, #3daf76); }
.timeline { display: flex; gap: 3px; }
.seg { flex: 1 1 0; height: 30px; border-radius: 4px; min-width: 2px; }
.seg-past { opacity: 0.35; }
.seg-live { box-shadow: 0 0 0 2px var(--white); }
.legend { display: inline-flex; align-items: center; gap: 8px; }
.legend i, .dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.minibar { display: inline-block; width: 140px; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.minibar i { display: block; height: 8px; background: var(--green); }

/* alerts */
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 18px 22px; }
.alert-warn { border: 1px solid var(--amber-b); }
.flash { background: var(--green-bg); color: var(--green-l); border-radius: 12px; padding: 12px 18px; font-weight: 500; }
.error { color: var(--amber); margin: 0; }
.error-box { background: var(--amber-bg); border: 1px solid var(--amber-b); color: var(--amber); border-radius: 12px; padding: 4px 16px; }
.error-box p { margin: 10px 0; }

/* tables */
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; padding: 16px 12px; }
.table td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.end { justify-self: end; text-align: right; }
.push-end { margin-left: auto; }

.qtable, .htable { min-width: 780px; }
.qrow { display: grid; grid-template-columns: 48px minmax(240px, 2fr) minmax(150px, 1.2fr) 150px 140px; align-items: center; gap: 8px; padding: 14px 22px; font-size: 15px; }
.hrow { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1.1fr) 80px minmax(200px, 1.8fr) 90px 120px; align-items: center; gap: 8px; padding: 14px 22px; font-size: 15px; }
.qhead { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.qitem { border-top: 1px solid var(--line); }
.qitem > summary { list-style: none; cursor: pointer; }
.qitem > summary::-webkit-details-marker { display: none; }
.qitem > summary:hover { background: #2b2c35; }
.qitem[open] > summary .end { color: var(--green-l); }
.qtools { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 22px 12px; align-items: center; }
.qtools form { margin: 0; }
.qsub { background: var(--card-2); padding: 4px 0 10px; }
.qrow.sub, .hrow.sub { padding-top: 8px; padding-bottom: 8px; font-size: 14px; border-bottom: 1px solid #2c2e36; }
.qrow.sub form { margin: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.label { font-size: 14px; color: var(--text); padding: 0; }
.input { min-height: 48px; width: 100%; padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--bg); color: var(--white); font: inherit; font-size: 15px; }
.input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.input.area { min-height: 180px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.5; resize: vertical; }
.input-num { width: 110px; flex: none; }
.input-unit { width: auto; flex: none; }
.prefix { display: flex; align-items: center; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--bg); padding-left: 16px; }
.prefix span { color: var(--muted); white-space: nowrap; font-size: 15px; }
.prefix .input { border: 0; padding-left: 2px; min-width: 0; }
.prefix .input:focus { outline: none; }
.prefix:focus-within { outline: 2px solid var(--green); outline-offset: 1px; }
.check, .radio { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input, .radio input { width: 20px; height: 20px; accent-color: var(--green); margin: 0; }
.seg-toggle .radio { border: 1.5px solid var(--line-2); border-radius: 999px; padding: 4px 18px 4px 14px; }
.seg-toggle .radio:has(input:checked) { border-color: var(--green); background: var(--green-bg); color: var(--white); }
.calc-msg:empty { display: none; }
.calc-msg { border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.calc-msg.ok { background: var(--green-bg); }
.calc-msg.warn { background: var(--amber-bg); border: 1px solid var(--amber-b); }
.calc-msg .t { font-weight: 600; }
.calc-msg.ok .t { color: var(--green-l); }
.calc-msg.warn .t { color: var(--amber); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.steps li { padding-left: 4px; }
.steps li span { display: block; margin-bottom: 10px; }
.bookmarklet { cursor: grab; }
.danger-zone > summary { cursor: pointer; color: var(--muted); min-height: 28px; }
.danger-zone > summary:hover { color: var(--red); }

/* login */
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(400px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login img { width: 170px; height: auto; }
.login form, .login .card { width: 100%; margin-top: 10px; }

@media (max-width: 720px) {
  .main { padding: 24px 16px 48px; }
  .side { padding: 20px 16px; gap: 20px; }
  h1 { font-size: 28px; }
  .three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 18px; }
}
