:root {
  --bg: #F2F4F6; --surface: #FFFFFF; --sunk: #E9EDF0; --ink: #16202B; --muted: #5A6774; --line: #D3DAE0;
  --accent: #A85F00; --lamp: #F2A20C; --lamp-ink: #1B1300;
  --good: #1D7A4C; --warn: #9A5B00; --crit: #B3261E;
  --f-head: "IBM Plex Sans Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #10151B; --surface: #18202A; --sunk: #212B36; --ink: #E6EBF0; --muted: #94A1AE; --line: #2D3945;
  --accent: #F5B13D; --lamp: #F2A20C; --lamp-ink: #1B1300;
  --good: #5CC38D; --warn: #F0A848; --crit: #F2857D; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #10151B; --surface: #18202A; --sunk: #212B36; --ink: #E6EBF0; --muted: #94A1AE; --line: #2D3945;
  --accent: #F5B13D; --lamp: #F2A20C; --lamp-ink: #1B1300;
  --good: #5CC38D; --warn: #F0A848; --crit: #F2857D; color-scheme: dark }

* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45 }
h1, h2, h3 { font-family: var(--f-head); font-weight: 600; margin: 0; text-wrap: balance }
h1 { font-size: 19px; letter-spacing: .01em }
h2 { font-size: 22px }
h3 { font-size: 16px }
p { margin: 0 }
.mono { font-family: var(--f-mono); font-size: 12.5px }
.muted { color: var(--muted) }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line) }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px }
.brand { display: flex; align-items: center; gap: 9px; padding-bottom: 10px }
.brand i { width: 10px; height: 18px; border-radius: 2px; background: var(--lamp); display: block }
.tabs { display: flex; gap: 2px; overflow-x: auto; min-width: 0 }
.tabs a { padding: 8px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lamp) }
.tabs a:hover { color: var(--ink) }
.tabs .count { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); margin-left: 4px }

main { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 56px; display: flex; flex-direction: column; gap: 16px }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px }
.head p { max-width: 68ch; color: var(--muted); margin-top: 4px }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0 }
.panel > h3 + p { margin-top: -8px }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px }
.grow { flex: 1 1 auto; min-width: 0 }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px }
@media (max-width: 800px) { .two { grid-template-columns: minmax(0, 1fr) } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0 }
input, select, textarea, button { font: inherit; color: inherit }
input[type=text], input[type=number], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; color: var(--ink) }
textarea { resize: vertical; min-height: 60px }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px }
button, .btn { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 12px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap }
button:hover, .btn:hover { border-color: var(--muted) }
button.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink) }
button.danger { color: var(--crit) }
button.small { padding: 3px 8px; font-size: 12.5px }
button:disabled { opacity: .5; cursor: default }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500 }

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px }
table { border-collapse: collapse; width: 100%; font-size: 13px }
th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--sunk); padding: 7px 9px; white-space: nowrap }
td { padding: 7px 9px; border-top: 1px solid var(--line); vertical-align: top }
td.wrap { min-width: 180px }
tr.click { cursor: pointer }
tr.click:hover td { background: var(--sunk) }
td input[type=text], td input[type=number], td select { padding: 4px 6px; font-size: 12.5px }
td input.mono { font-family: var(--f-mono) }
td input[data-price], td input[data-reprice], td input[data-pcrate] { width: 110px; text-align: right }
.w-s { width: 64px } .w-m { min-width: 96px } .w-l { min-width: 170px }

.chip { display: inline-block; font-family: var(--f-mono); font-size: 11.5px; padding: 1px 6px; border-radius: 3px; background: var(--sunk); color: var(--ink); white-space: nowrap }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap }
.pill.good { color: var(--good) } .pill.warn { color: var(--warn) } .pill.crit { color: var(--crit) } .pill.plain { color: var(--muted) }
.note { border-left: 3px solid var(--lamp); background: var(--sunk); padding: 9px 12px; border-radius: 0 4px 4px 0 }
.note.crit { border-left-color: var(--crit) }
.empty { border: 1px dashed var(--line); border-radius: 6px; padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center }
.empty b { color: var(--ink); font-family: var(--f-head); font-size: 17px; font-weight: 600 }
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px }
.stat b { display: block; font-family: var(--f-head); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums }
.stat span { font-size: 12px; color: var(--muted) }
.drop { border: 1.5px dashed var(--line); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; color: var(--muted) }
.drop.over { border-color: var(--lamp); background: var(--sunk) }
tr.pick td { background: var(--sunk) } .rtabs { display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 52px; z-index: 4; background: var(--bg); padding: 6px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px } table.mini td { border: 0; padding: 1px 0 1px 10px; text-align: right; white-space: nowrap } table.mini td:first-child { text-align: left; padding-left: 0; white-space: normal } table.mini tr.sum td { border-top: 1px solid var(--line); padding-top: 4px }
th.sec, td.sec { background: var(--sunk); font-size: 12.5px }
tr.tot td { border-top: 2px solid var(--line); font-weight: 600 }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--lamp); border-radius: 50%; animation: sp 1s linear infinite; flex: none }
@keyframes sp { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none } }
.lcats { display: flex; flex-direction: column; gap: 10px }
.lgrp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px }
.lgl { width: 130px; flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted) }
@media (max-width: 560px) { .lgl { width: 100% } }
button.lc { padding: 4px 10px; font-size: 13px; border-radius: 99px; background: var(--surface) }
button.lc span { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted) }
button.lc.on { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink) } button.lc.on span { color: var(--lamp-ink) }
.lflags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
button.lflag { flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; min-width: 120px; white-space: normal; text-align: left }
button.lflag b { font-family: var(--f-head); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums } button.lflag span { font-size: 12px; color: var(--muted) }
button.lflag.on { border-color: var(--lamp); box-shadow: inset 0 0 0 1px var(--lamp) }
button.lsort { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer }
table.ltbl td { white-space: nowrap } table.ltbl td.lsd { white-space: normal; min-width: 220px; font-size: 12.5px }
tr.libx > td { background: var(--bg); padding: 12px }
.libd { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 22px; white-space: normal }
.libd h4 { font-family: var(--f-head); font-size: 14px; font-weight: 600; margin: 0 0 6px } .libd h4 + * { margin-bottom: 10px } .libd > div { min-width: 0; display: flex; flex-direction: column }
.libd .lsrc { font-size: 12px; margin-top: 6px; word-break: break-word }
.lsrc2 { font-family: var(--f-body); font-size: 11px; color: var(--muted); white-space: nowrap }
td.lq { font-size: 12px; min-width: 130px; white-space: normal }
.libd .lsrc a { color: var(--accent) }
.lul { margin: 0 0 10px; padding-left: 16px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px }
#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 4px; max-width: calc(100% - 32px); z-index: 9 }

/* parts app additions */
body { margin: 0 }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; padding-bottom: 10px; font-size: 13px }
.who .chip { font-family: var(--f-body) }
.auth { max-width: 420px; margin: 40px auto 0; width: 100% }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px }
.fgrid .wide { grid-column: 1 / -1 }
label.f .err { color: var(--crit); font-weight: 500 }
label.f.bad input, label.f.bad select, label.f.bad textarea { border-color: var(--crit) }
label.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink) }
.ticks { display: flex; flex-wrap: wrap; gap: 6px 16px }
.crumb { font-size: 13px } .crumb a { color: var(--accent); text-decoration: none; font-weight: 500 }
.phead { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between }
.phead h2 { font-family: var(--f-mono); font-size: 20px; font-weight: 500; word-break: break-all }
.pills { display: flex; flex-wrap: wrap; gap: 6px }
.price-now b { font-family: var(--f-head); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums }
.keybox { font-family: var(--f-mono); font-size: 13px; background: var(--sunk); padding: 10px 12px; border-radius: 4px; word-break: break-all; user-select: all }
.hist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px }
.hist li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px } .hist li span:first-child { color: var(--muted) }
@media (max-width: 560px) { .hist li { grid-template-columns: 1fr } }
pre.code { font-family: var(--f-mono); font-size: 12px; background: var(--sunk); padding: 10px 12px; border-radius: 4px; overflow-x: auto; margin: 0; white-space: pre }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px } @media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr) } }
td.act { white-space: nowrap; text-align: right }
tr.off td { color: var(--muted) }
.res-ok { border-left: 3px solid var(--good) } .res-no { border-left: 3px solid var(--crit) }
input[type=password], input[type=date], input[type=file] { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; color: var(--ink) }
input[type=file] { padding: 5px }
a.btn { color: var(--ink) }
.who a { color: var(--ink); text-decoration: none; font-weight: 500 } .who a:hover { text-decoration: underline }
td a { color: var(--accent) }
.libd table.mini td { white-space: normal; overflow-wrap: anywhere } .libd table.mini td:last-child { padding-left: 12px }
details summary { cursor: pointer }
.libd table.mini td:first-child { overflow-wrap: normal; word-break: normal; white-space: nowrap; padding-right: 8px }
td.mono { white-space: nowrap }
