/* KamonE Inventory — navy-and-brass look shared with KamonE */
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/source-sans-3-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/source-sans-3-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/source-sans-3-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/source-sans-3-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url(../fonts/barlow-semi-condensed-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url(../fonts/barlow-semi-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --bg: #f3f5f7; --surface: #ffffff; --surface-2: #f6f8f9; --surface-3: #eef2f4;
  --ink: #17252f; --ink-2: #3a4d5a; --ink-3: #667985; --line: #d6dee4; --line-2: #e6ebef;
  --steel: #1d3a4c; --steel-2: #2b5068; --steel-3: #3d6a86; --steel-ink: #eef4f7; --steel-muted: #a9bfcc;
  --brass: #b5852a; --brass-2: #8f6716; --brass-soft: #f7efdc; --brass-line: #e6cf9c;
  --ok: #2f7a57; --ok-soft: #e2f1e8; --bad: #ae3a3a; --bad-soft: #fbebe9; --warn: #9a6410; --warn-soft: #fff3da;
  --info: #2a6688; --info-soft: #e3eef5; --mute-soft: #eceff2;
  --r: 8px; --r-sm: 5px;
  --shadow: 0 1px 2px rgba(23, 37, 47, .06), 0 1px 3px rgba(23, 37, 47, .05);
  --shadow-lg: 0 14px 40px rgba(24, 52, 70, .22);
  --font: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --side-w: 236px; --link: #22597a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e171e; --surface: #15222c; --surface-2: #1a2933; --surface-3: #20313c;
    --ink: #e4ecf1; --ink-2: #c1d0d9; --ink-3: #93a9b7; --line: #2c3d49; --line-2: #233440;
    --steel: #0b1821; --steel-2: #2f5873; --steel-3: #5b8bab; --steel-ink: #eef3f6; --steel-muted: #93a9b7;
    --brass: #e0b04f; --brass-2: #f2cf7c; --brass-soft: #33290f; --brass-line: #6b5420;
    --ok: #7fd1a8; --ok-soft: #12352a; --bad: #f19a9a; --bad-soft: #3d1c1c; --warn: #f4d891; --warn-soft: #3a2c0d;
    --info: #8cc4e6; --info-soft: #14303f; --mute-soft: #22323d; --link: #8cc4e6;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e171e; --surface: #15222c; --surface-2: #1a2933; --surface-3: #20313c;
  --ink: #e4ecf1; --ink-2: #c1d0d9; --ink-3: #93a9b7; --line: #2c3d49; --line-2: #233440;
  --steel: #0b1821; --steel-2: #2f5873; --steel-3: #5b8bab; --steel-ink: #eef3f6; --steel-muted: #93a9b7;
  --brass: #e0b04f; --brass-2: #f2cf7c; --brass-soft: #33290f; --brass-line: #6b5420;
  --ok: #7fd1a8; --ok-soft: #12352a; --bad: #f19a9a; --bad-soft: #3d1c1c; --warn: #f4d891; --warn-soft: #3a2c0d;
  --info: #8cc4e6; --info-soft: #14303f; --mute-soft: #22323d; --link: #8cc4e6;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-cond); font-weight: 600; line-height: 1.2; margin: 0 0 .6rem; color: var(--ink); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .7rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--ink-3); }
.mono, .num { font-family: var(--mono); font-size: .92em; }
.num, td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.hide { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 1rem 0; }
kbd { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font: 600 .74rem/1.45 var(--font); color: var(--ink-2); text-align: center; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--steel); color: var(--steel-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #36566b transparent; z-index: 40; }
.side .brand { display: flex; align-items: center; gap: .6rem; padding: .95rem 1rem .85rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 7px; background: var(--brass); display: grid; place-items: center; font: 700 1.05rem/1 var(--font-cond); color: #1d1405; flex: none; }
.brand .bt { font: 600 1.12rem/1.05 var(--font-cond); letter-spacing: .01em; }
.brand .bt small { display: block; font: 500 .72rem/1.2 var(--font); color: var(--steel-muted); letter-spacing: .02em; margin-top: 2px; }
.nav { padding: .5rem 0 1.5rem; flex: 1; }
.side .nav a, .nav summary { display: flex; align-items: center; gap: .65rem; padding: .44rem 1rem .44rem .95rem; color: #d5e2ea; font-size: .93rem; text-decoration: none; border-left: 3px solid transparent; cursor: pointer; }
.side .nav a:hover, .nav summary:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side .nav a.on { background: rgba(181,133,42,.18); border-left-color: var(--brass); color: #fff; font-weight: 600; }
.nav details > summary { list-style: none; }
.nav details > summary::-webkit-details-marker { display: none; }
.nav details > summary .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; opacity: .7; }
.nav details[open] > summary .chev { transform: rotate(180deg); }
.side .nav details .sub a { padding-left: 2.85rem; font-size: .9rem; color: #c3d3dd; }
.side .nav details .sub a.on { color: #fff; }
.nav .grp-label { font: 600 .7rem/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--steel-muted); padding: 1rem 1rem .35rem; }
.side-foot { padding: .7rem 1rem 1rem; font-size: .75rem; color: var(--steel-muted); border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .burger { display: none; }
.gsearch { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.gsearch input[type=search] { width: 100%; padding: .48rem .9rem .48rem 2.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font: inherit; color: var(--ink); }
.gsearch input[type=search]:focus { background: var(--surface); border-color: var(--steel-3); outline: 2px solid rgba(181,133,42,.35); }
.gsearch .ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.gsearch kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); }
.gs-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 70vh; overflow-y: auto; z-index: 60; }
.gs-panel h4 { font: 600 .75rem var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: .6rem .9rem .25rem; }
.gs-panel a { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem .9rem; color: var(--ink); border-left: 3px solid transparent; }
.gs-panel a:hover, .gs-panel a.on { background: var(--brass-soft); border-left-color: var(--brass); text-decoration: none; }
.gs-panel a small { color: var(--ink-3); }
.gs-panel .empty { padding: .8rem .9rem; color: var(--ink-3); }
.top-actions { display: flex; align-items: center; gap: .35rem; }
.tb-btn { position: relative; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--ink-2); background: none; border: 0; cursor: pointer; }
.tb-btn:hover { background: var(--surface-3); text-decoration: none; }
.tb-btn b { position: absolute; top: 0; right: -2px; min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem; border-radius: 999px; background: var(--brass); color: #fff; font: 600 .66rem/1.1rem var(--font); text-align: center; }
.qc > summary { list-style: none; }
.qc > summary::-webkit-details-marker { display: none; }
.qc-menu { position: absolute; right: 0; top: calc(100% + 8px); width: min(640px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: .9rem 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem 1.2rem; z-index: 70; }
.qc-menu h4 { font: 600 .72rem var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: .2rem 0 .3rem; }
.qc-menu a { display: block; padding: .22rem 0; color: var(--ink); font-size: .92rem; }
.qc-menu a::before { content: "+ "; color: var(--brass); font-weight: 700; }
.org-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; color: var(--ink-2); background: var(--surface-2); max-width: 220px; }
.org-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: .3rem 0; z-index: 70; }
.dd-menu.left { right: auto; left: 0; }
.dd-menu a, .dd-menu button { display: flex; width: 100%; align-items: center; gap: .55rem; padding: .45rem .9rem; color: var(--ink); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dd-menu .sep { border-top: 1px solid var(--line-2); margin: .3rem 0; }
.dd-menu .hd { padding: .35rem .9rem .2rem; font: 600 .72rem var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.dd-menu .danger { color: var(--bad); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--steel-2); color: #fff; display: grid; place-items: center; font: 600 .95rem/1 var(--font-cond); }

.page { padding: 1.25rem 1.5rem 3rem; max-width: 1480px; width: 100%; }
.page.narrow { max-width: 980px; }
.ph { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.ph h1 { margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ph .sub { color: var(--ink-3); font-size: .9rem; margin-top: .15rem; }
.ph .acts { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: .3rem; }
.crumbs a { color: var(--ink-3); }

/* ---------------------------------------------------------------- flash & notes */
.flash { padding: .65rem .9rem; border-radius: var(--r); margin-bottom: .8rem; border: 1px solid; display: flex; gap: .6rem; align-items: flex-start; }
.flash.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.flash.error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.flash.warn, .note.warn { background: var(--warn-soft); border-color: var(--brass-line); color: var(--warn); }
.flash.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.note { padding: .6rem .85rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); font-size: .9rem; margin-bottom: .8rem; }
.note.brass { background: var(--brass-soft); border-color: var(--brass-line); color: var(--ink); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .45rem .9rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .9rem/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 2.15rem; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--steel-2); border-color: var(--steel-2); color: #fff; }
:root:not([data-theme="dark"]) .btn.primary { background: var(--steel); border-color: var(--steel); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.brass { background: var(--brass); border-color: var(--brass); color: #1d1405; }
.btn.brass:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: .25rem .6rem; font-size: .82rem; min-height: 1.8rem; }
.btn.icon { padding: .35rem; min-width: 2.15rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child), .btn-group > details > summary.btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.linkbtn { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--bad); }

/* ---------------------------------------------------------------- forms */
label { font-weight: 600; font-size: .86rem; color: var(--ink-2); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: .42rem .6rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 .93rem/1.35 var(--font); min-height: 2.15rem; }
input[type=file] { padding: .3rem; }
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--steel-3); outline: 2px solid rgba(181,133,42,.3); outline-offset: 0; }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input.num { text-align: right; font-family: var(--mono); font-size: .88rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--steel-2); width: 1rem; height: 1rem; vertical-align: -2px; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; min-width: 0; }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.field.req > label::after { content: " *"; color: var(--bad); }
.field.err input, .field.err select { border-color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 400; font-size: .92rem; color: var(--ink); cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.25rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1.25rem; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline > .field { margin-bottom: 0; }
.form-actions { display: flex; gap: .5rem; align-items: center; padding: .9rem 0 0; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: .7rem 1.25rem; margin: 1rem -1.25rem -1.25rem; display: flex; gap: .5rem; align-items: center; z-index: 5; border-radius: 0 0 var(--r) var(--r); flex-wrap: wrap; }
.input-group { display: flex; }
.input-group > * { border-radius: 0 !important; }
.input-group > :first-child { border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }
.input-group > :last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; }
.input-group > :not(:first-child) { margin-left: -1px; }
.input-group > select { width: auto; flex: none; }
fieldset { border: 1px solid var(--line-2); border-radius: var(--r); padding: .8rem 1rem .3rem; margin: 0 0 1rem; min-width: 0; }
legend { font: 600 .95rem var(--font-cond); color: var(--ink-2); padding: 0 .35rem; }

/* ---------------------------------------------------------------- cards, tabs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1rem; min-width: 0; }
.card.flush { padding: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin: -.2rem 0 .7rem; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; }
.card.flush > .card-h { padding: .85rem 1.1rem 0; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .55rem .9rem; color: var(--ink-2); border: 0; background: none; border-bottom: 2px solid transparent; font: 600 .92rem var(--font); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs a.on, .tabs button.on { color: var(--ink); border-bottom-color: var(--brass); }
.tabs .count { font-weight: 400; color: var(--ink-3); margin-left: .25rem; }
.tab-panel { display: none; } .tab-panel.on { display: block; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.layout-2r { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }

/* ---------------------------------------------------------------- tables */
.tbl-wrap, .table-wrap { overflow-x: auto; position: relative; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font: 600 .78rem/1.25 var(--font); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: .55rem .7rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl th a { color: inherit; }
.tbl th a.on::after { content: " ▾"; } .tbl th a.on.asc::after { content: " ▴"; }
.tbl td { padding: .55rem .7rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tbody tr:hover > td { background: var(--surface-2); }
.tbl tr.sel > td { background: var(--brass-soft) !important; }
.tbl td.chk, .tbl th.chk { width: 2rem; padding-right: 0; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl .sub { display: block; font-size: .8rem; color: var(--ink-3); }
.tbl.compact td, .tbl.compact th { padding: .35rem .55rem; }
.tbl tr.grp > td { background: var(--surface-3); font-weight: 600; }
.tbl a.rowlink { color: var(--ink); font-weight: 600; }
.card.flush .tbl th:first-child, .card.flush .tbl td:first-child { padding-left: 1.1rem; }
.card.flush .tbl th:last-child, .card.flush .tbl td:last-child { padding-right: 1.1rem; }
.empty { text-align: center; padding: 2.6rem 1rem; color: var(--ink-3); }
.empty .ic { width: 38px; height: 38px; color: var(--line); stroke-width: 1.3; margin-bottom: .4rem; }
.empty h3 { color: var(--ink-2); }
.pager { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .7rem 1.1rem; font-size: .88rem; }
.pager .muted { margin-right: auto; }
.pager .pg { padding: .2rem .55rem; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink-2); }
.pager .pg.on { background: var(--steel-2); color: #fff; border-color: var(--steel-2); }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.toolbar .grow { flex: 1; }
.bulkbar { display: none; align-items: center; gap: .5rem; padding: .55rem 1.1rem; background: var(--brass-soft); border-bottom: 1px solid var(--brass-line); }
.bulkbar.on { display: flex; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font: 600 .74rem/1.4 var(--font); letter-spacing: .02em; white-space: nowrap; border: 1px solid transparent; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-mute { background: var(--mute-soft); color: var(--ink-3); }
.b-brass { background: var(--brass-soft); color: var(--brass-2); border-color: var(--brass-line); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; background: var(--surface-3); font-size: .8rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- KPI & dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; box-shadow: var(--shadow); color: var(--ink); display: block; }
a.kpi:hover { border-color: var(--brass-line); text-decoration: none; }
.kpi b { display: block; font: 600 1.55rem/1.15 var(--font-cond); color: var(--steel-2); }
:root:not([data-theme="dark"]) .kpi b { color: var(--steel); }
.kpi span { display: block; font-size: .8rem; color: var(--ink-3); margin-top: .15rem; }
.kpi.warn b { color: var(--bad); }
.kpi.brass { box-shadow: inset 3px 0 0 var(--brass), var(--shadow); }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.dash > .card { margin: 0; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; } .c3 { grid-column: span 3; }
.activity { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.activity a { padding: .6rem .3rem; color: var(--ink); border-right: 1px solid var(--line-2); }
.activity a:last-child { border-right: 0; }
.activity a:hover { background: var(--surface-2); text-decoration: none; }
.activity b { display: block; font: 600 2rem/1.1 var(--font-cond); }
.activity .q-pack b { color: #2a6688; } .activity .q-ship b { color: #b5852a; } .activity .q-deliv b { color: #2f7a57; } .activity .q-inv b { color: #ae3a3a; }
.activity small { color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; font-weight: 600; }
.statline { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--line-2); }
.statline:last-child { border-bottom: 0; }
.statline b { font-family: var(--mono); font-weight: 500; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--steel-3); border-radius: 999px; }
.bar.brass > i { background: var(--brass); }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--ink-3); font: 11px var(--font); }
.chart .tip { font-weight: 600; fill: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .82rem; color: var(--ink-2); margin-top: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* ---------------------------------------------------------------- detail view */
.dv-head { display: flex; flex-wrap: wrap; gap: 1rem 2rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.dv-head .kv { min-width: 130px; }
.kv { font-size: .9rem; }
.kv dt, .kv .k { color: var(--ink-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kv dd, .kv .v { margin: .1rem 0 0; }
dl.props { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem 1rem; margin: 0; font-size: .92rem; }
dl.props dt { color: var(--ink-3); }
dl.props dd { margin: 0; word-break: break-word; }
.preview { background: var(--surface-3); padding: 1.2rem; border-radius: var(--r); overflow-x: auto; }
.preview .paper { background: #fff; color: #17252f; max-width: 820px; margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.12); padding: 0; }
.ribbon { display: inline-block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: .3rem; top: .45rem; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.timeline li::after { content: ""; position: absolute; left: .52rem; top: 1rem; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--ink-3); font-size: .78rem; }
.comment { padding: .6rem .8rem; background: var(--surface-2); border-radius: var(--r); margin-bottom: .6rem; font-size: .92rem; }
.comment .who { font-weight: 600; font-size: .85rem; }
.comment .when { color: var(--ink-3); font-size: .78rem; margin-left: .4rem; }
.related { display: flex; flex-wrap: wrap; gap: .4rem; }
.flow { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.flow > div { flex: 1; min-width: 120px; padding: .55rem .8rem; border-right: 1px solid var(--line-2); font-size: .85rem; }
.flow > div:last-child { border-right: 0; }
.flow b { display: block; font-family: var(--font-cond); font-size: 1rem; }
.flow .done { background: var(--ok-soft); } .flow .part { background: var(--warn-soft); }

/* ---------------------------------------------------------------- line editor */
.lines-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; position: relative; }
table.lines { width: 100%; border-collapse: collapse; min-width: 760px; }
.lines th { font: 600 .75rem var(--font); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.lines td { padding: .4rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lines td input, .lines td select { min-height: 2rem; padding: .32rem .45rem; font-size: .9rem; }
.lines td.item { min-width: 240px; }
.lines td.qty { width: 110px; } .lines td.qty input { min-width: 80px; }
.lines td.rate { width: 110px; } .lines td.rate input { min-width: 80px; }
.lines td.disc { width: 140px; } .lines td.disc .input-group input { width: 70px; min-width: 0; } .lines td.disc .input-group select { width: 52px; padding: .3rem .2rem; }
.lines td.tax { width: 125px; } .lines td.tax select { min-width: 110px; }
.lines td.amt { width: 110px; text-align: right; font-family: var(--mono); padding-top: .75rem; white-space: nowrap; }
.lines td.act { width: 2rem; padding-top: .55rem; }
.lines .ln-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .8rem; color: var(--ink-3); margin-top: .3rem; }
.lines .ln-meta a, .lines .ln-meta button { font-size: .8rem; }
.lines textarea.ln-desc { min-height: 2rem; margin-top: .3rem; font-size: .85rem; }
.lines .stockinfo { font-size: .78rem; color: var(--ink-3); }
.lines .stockinfo.low { color: var(--bad); }
.lines tr.drag { opacity: .4; }
.addline { display: flex; gap: .5rem; padding: .6rem 0; flex-wrap: wrap; }
.totals { width: 100%; max-width: 440px; margin-left: auto; border-collapse: collapse; font-size: .93rem; }
.totals td { padding: .35rem .5rem; }
.totals td:last-child { text-align: right; font-family: var(--mono); }
.totals tr.grand td { font: 600 1.1rem var(--font-cond); border-top: 1px solid var(--line); padding-top: .55rem; }
.totals tr.grand td:last-child { font-family: var(--mono); font-size: 1rem; }
.totals input { max-width: 120px; text-align: right; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; z-index: 80; min-width: 300px; }
.ac-list div { padding: .4rem .65rem; cursor: pointer; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.ac-list div:last-child { border-bottom: 0; }
.ac-list div.on, .ac-list div:hover { background: var(--brass-soft); }
.ac-list small { display: block; color: var(--ink-3); font-size: .78rem; }
.ac-list .ac-new { color: var(--link); font-weight: 600; }

/* ---------------------------------------------------------------- modal & toast */
dialog.modal { border: 0; padding: 0; border-radius: var(--r); box-shadow: var(--shadow-lg); width: min(640px, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); max-height: calc(100vh - 2rem); }
dialog.modal.wide { width: min(920px, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(10, 22, 30, .45); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; }
.modal-b { padding: 1rem 1.1rem; overflow-y: auto; max-height: calc(100vh - 10rem); }
.modal-f { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--steel); color: #fff; padding: .6rem 1.1rem; border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 100; font-size: .92rem; max-width: calc(100vw - 2rem); }
.toast.err { background: #8d2f2f; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(1200px 600px at 10% 0%, #24475e 0%, #1d3a4c 45%, #142a38 100%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 1.8rem 1.8rem 1.4rem; }
.auth-card.wide { max-width: 680px; }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; }
.auth-brand .mark { width: 40px; height: 40px; border-radius: 9px; background: var(--brass); display: grid; place-items: center; font: 700 1.25rem/1 var(--font-cond); color: #1d1405; }
.auth-brand b { font: 600 1.35rem/1.1 var(--font-cond); }
.auth-brand small { display: block; color: var(--ink-3); font-size: .8rem; }
.auth-foot { text-align: center; color: #b9cad5; font-size: .8rem; margin-top: 1rem; }

/* ---------------------------------------------------------------- misc */
.pill-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.pill-tabs a { padding: .3rem .8rem; color: var(--ink-2); font-size: .86rem; font-weight: 600; }
.pill-tabs a.on { background: var(--steel-2); color: #fff; }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--line-2); display: inline-grid; place-items: center; color: var(--ink-3); vertical-align: middle; }
.thumb.lg { width: 160px; height: 160px; }
.stock-good { color: var(--ok); } .stock-low { color: var(--bad); font-weight: 600; }
.split { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.stack > * + * { margin-top: .6rem; }
.gap-s { gap: .35rem; }
.tag-input { display: flex; flex-wrap: wrap; gap: .3rem; }
.settings-nav a { display: block; padding: .38rem .8rem; color: var(--ink-2); border-left: 3px solid transparent; font-size: .92rem; }
.settings-nav a.on { border-left-color: var(--brass); background: var(--brass-soft); color: var(--ink); font-weight: 600; }
.settings-nav h4 { margin: .9rem .8rem .3rem; font: 600 .72rem var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.code { font-family: var(--mono); font-size: .85rem; background: var(--surface-3); padding: .1rem .35rem; border-radius: 4px; word-break: break-all; }
pre.code { padding: .7rem .9rem; white-space: pre-wrap; }
.perm-grid td, .perm-grid th { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.label { border: 1px dashed var(--line); padding: 6px 8px; text-align: center; background: #fff; color: #000; border-radius: 4px; break-inside: avoid; }
.label .ln { font: 600 11px/1.2 var(--font); }
.label svg { width: 100%; height: 46px; }
.label .lp { font: 600 12px var(--font); }

@media (max-width: 1100px) {
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
  .c4, .c5, .c6, .c7, .c8, .c3 { grid-column: span 12; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .top { padding: .5rem 1rem; flex-wrap: wrap; }
  .top .burger { display: inline-grid; }
  .gsearch { order: 10; flex: 1 0 100%; max-width: none; }
  .gsearch kbd { display: none; }
  .org-pill { display: none; }
  .page { padding: 1rem 1rem 3rem; }
  .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .layout-2r { grid-template-columns: minmax(0, 1fr); }
  .qc-menu { grid-template-columns: repeat(2, 1fr); position: fixed; left: 1rem; right: 1rem; top: 3.5rem; width: auto; }
  .activity { grid-template-columns: repeat(2, 1fr); }
  .activity a:nth-child(2) { border-right: 0; }
  .toolbar input[type=search] { max-width: none; flex: 1 0 100%; }
  .sticky-actions { margin: 1rem -1rem -1rem; padding: .7rem 1rem; }
  .lines-wrap { margin: 0 -1rem; padding: 0 1rem; }
  .card.flush { overflow-x: auto; position: relative; }
  .card:has(> table.tbl) { overflow-x: auto; }
}
@media print {
  .side, .top, .ph .acts, .no-print, .tabs, .toolbar, .pager, .sticky-actions { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .page { padding: 0; max-width: none; }
  .label { border: 0; }
}

/* ---------------------------------------------------------------- import */
b.req { color: var(--bad); font-weight: 600; }
ul.cols3 { columns: 3 12rem; padding-left: 1.1rem; margin: .4rem 0; }
iframe.webtab { width: 100%; height: calc(100vh - 200px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.field.span2 { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- portal */
body.portal { background: var(--bg); }
.ptop { background: var(--steel); color: #fff; }
.ptop .pin { max-width: 1100px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.pbrand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.pbrand:hover { text-decoration: none; }
.pbrand b { font-size: 1.05rem; }
img.plogo { max-height: 36px; max-width: 140px; border-radius: 4px; background: #fff; padding: 2px; }
.pnav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.pnav a { color: rgba(255,255,255,.82); padding: .35rem .7rem; border-radius: 6px; text-decoration: none; font-size: .92rem; }
.pnav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.pnav a.on { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 -2px 0 var(--brass); }
.pwho { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.pwho .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.page.pmain { max-width: 1100px; margin: 0 auto; padding: 1.2rem 16px 2rem; }
.pfoot { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 2rem; color: var(--ink-3); font-size: .85rem; }
.doc-preview { overflow-x: auto; }
@media (max-width: 720px) { .pnav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; } .pnav a { white-space: nowrap; } }
.auth-title { font-size: 1.3rem; margin: 0 0 .8rem; }
.btn.block { width: 100%; justify-content: center; }
.ptop .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brass); display: grid; place-items: center; font: 700 1.1rem/1 var(--font-cond); color: #1d1405; }
