:root {
  --brand: #1f965f; --brand-dark: #157a4c; --brand-deep: #0e5a37; --brand-soft: #e7f5ee;
  --ink: #1b2a24; --muted: #62736b; --line: #dde6e1; --line-strong: #c5d2cb;
  --bg: #f2f5f3; --card: #ffffff;
  --danger: #c62828; --danger-soft: #fdecec; --warn: #a15c00; --warn-soft: #fff4e0; --info: #1565c0; --info-soft: #e8f1fc;
  --repair: #a15c00; --repair-bg: #fff1d9; --raw: #1565c0; --raw-bg: #e3eefb; --consumable: #7b3fa0; --consumable-bg: #f1e6f8;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 4px 14px rgba(16, 40, 30, .06);
  --font: Lato, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; color: var(--ink); background: var(--bg); line-height: 1.45; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Sidebar layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 268px; flex-shrink: 0; background: linear-gradient(180deg, var(--brand-deep) 0%, #0b472c 100%); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 60; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand b { display: block; font-size: 1.05rem; font-weight: 900; letter-spacing: .2px; }
.brand small { display: block; font-size: .68rem; opacity: .8; margin-top: -2px; }
.side-brand { padding: 1.1rem 1.1rem .9rem; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.side-label { font-size: .66rem; letter-spacing: 1.2px; font-weight: 900; text-transform: uppercase; opacity: .55; padding: 1rem .8rem .35rem; }
.side-link, .side-btn { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .62rem .8rem; border-radius: 9px; color: rgba(255, 255, 255, .92); text-decoration: none; background: none; border: 0; cursor: pointer; font-weight: 700; font-size: .93rem; text-align: left; margin-bottom: 2px; }
.side-link:hover, .side-btn:hover { background: rgba(255, 255, 255, .1); }
.side-link.active { background: #fff; color: var(--brand-deep); }
.side-group.has-active > .side-btn { background: rgba(255, 255, 255, .12); }
.side-ico { width: 20px; height: 20px; flex-shrink: 0; opacity: .9; }
.side-btn .caret { margin-left: auto; transition: transform .15s; }
.side-group.open > .side-btn .caret { transform: rotate(180deg); }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.side-sub { display: none; padding: .1rem 0 .4rem 1.55rem; margin-left: 1.05rem; border-left: 1px solid rgba(255, 255, 255, .18); }
.side-group.open > .side-sub { display: block; }
.side-sub a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 8px; color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 700; font-size: .88rem; margin: 1px 0; }
.side-sub a small { display: block; font-weight: 400; font-size: .72rem; opacity: .7; }
.side-sub a:hover { background: rgba(255, 255, 255, .1); }
.side-sub a.active { background: #fff; color: var(--brand-deep); }
.side-sub a.active small { opacity: .8; }
.side-sub hr { border: 0; border-top: 1px solid rgba(255, 255, 255, .15); margin: .3rem 0; }
.side-sub .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.side-user { border-top: 1px solid rgba(255, 255, 255, .12); padding: .8rem; display: flex; align-items: center; gap: .65rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--brand-deep); display: grid; place-items: center; font-weight: 900; font-size: .88rem; flex-shrink: 0; }
.user-meta { line-height: 1.15; min-width: 0; flex: 1; font-weight: 700; font-size: .88rem; }
.user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; text-transform: capitalize; }
.side-user .icon-btn { background: rgba(255, 255, 255, .1); border: 0; color: #fff; border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.side-user .icon-btn:hover { background: rgba(255, 255, 255, .22); }
.side-user .icon-btn svg { width: 17px; height: 17px; }
.mobilebar { display: none; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 50; padding: 0 1rem; min-height: 54px; align-items: center; gap: .8rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.mobilebar .brand img { width: 34px; height: 34px; }
.hamburger { background: none; border: 0; color: #fff; cursor: pointer; padding: .3rem; display: grid; }
.hamburger svg { width: 26px; height: 26px; }
.scrim { display: none; }


/* ---------- Layout ---------- */
.page { max-width: 1400px; width: 100%; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 900; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.1rem 1.2rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.2rem; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1rem; font-weight: 900; }
.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); padding: .5rem .95rem; border-radius: 8px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: .92rem; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: #f4f8f6; border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: #fff; color: var(--danger); border-color: #e6b4b4; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .25rem .6rem; font-size: .82rem; border-radius: 6px; }
.btn-icon { padding: .3rem .45rem; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-dark); font-weight: 700; cursor: pointer; text-decoration: underline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: .9rem 1rem; }
.col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; position: relative; }
.field > label, .lbl { font-size: .8rem; font-weight: 700; color: #3c4d45; }
.req::after { content: " *"; color: var(--danger); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: .55rem .7rem; background: #fff; min-height: 40px; transition: border-color .12s, box-shadow .12s; }
textarea.input { resize: vertical; min-height: 70px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 150, 95, .18); }
.input:disabled { background: #eef2f0; color: #8a9a92; }
.input.invalid { border-color: var(--danger); background: #fffafa; }
.err { color: var(--danger); font-size: .78rem; font-weight: 700; min-height: 0; }
.hint { color: var(--muted); font-size: .78rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 700; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.switch-box { display: flex; align-items: center; min-height: 40px; padding: 0 .75rem; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fafcfb; }
.switch-box.on { background: var(--warn-soft); border-color: #e6c27a; border-style: solid; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-prefix .input { padding-left: 1.6rem; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; padding-top: .5rem; }
.form-error { background: var(--danger-soft); border: 1px solid #efbcbc; color: #8c1c1c; border-radius: 8px; padding: .6rem .8rem; font-weight: 700; font-size: .9rem; }

/* combobox */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 3px); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); max-height: 260px; overflow: auto; z-index: 70; min-width: 220px; }
.combo-opt { padding: .5rem .7rem; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.combo-opt small { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.combo-opt.hl, .combo-opt:hover { background: var(--brand-soft); }
.combo-opt.create { color: var(--brand-deep); font-weight: 700; border-top: 1px solid var(--line); }
.combo-empty { padding: .6rem .75rem; color: var(--muted); font-size: .88rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; background: #f6f9f7; color: #46574f; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; padding: .6rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: .6rem .75rem; border-bottom: 1px solid #edf2ef; vertical-align: top; }
.tbl tbody tr:hover { background: #f8fbf9; }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 900; background: #f6f9f7; border-top: 2px solid var(--line-strong); }
.tbl .inactive td { opacity: .55; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .2rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 900; letter-spacing: .2px; white-space: nowrap; }
.badge.repair { background: var(--repair-bg); color: var(--repair); }
.badge.raw { background: var(--raw-bg); color: var(--raw); }
.badge.consumable { background: var(--consumable-bg); color: var(--consumable); }
.badge.ok { background: var(--brand-soft); color: var(--brand-deep); }
.badge.off { background: #eceff0; color: #5d6b72; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.admin { background: #e5e8fb; color: #3949ab; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); background: #fbfdfc; border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 140px; }
.filters .field.grow { flex: 1; min-width: 200px; }
.filters .input { min-height: 36px; padding: .4rem .6rem; }
.tabs { display: flex; gap: .25rem; padding: .5rem 1.1rem 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: 0; padding: .6rem .9rem; font-weight: 700; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-deep); border-bottom-color: var(--brand); }

/* ---------- Stat tiles / dashboard ---------- */
.stat { padding: 1rem 1.2rem; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand); }
.stat.repair::before { background: var(--repair); } .stat.raw::before { background: var(--raw); } .stat.consumable::before { background: var(--consumable); }
.stat.link { display: block; color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.stat.link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 40, 30, .12); }
.bar-row.link { color: inherit; text-decoration: none; border-radius: 6px; }
.bar-row.link:hover { background: #f4f8f6; }
.stat .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 900; }
.stat .v { font-size: 1.6rem; font-weight: 900; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: .82rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; }
.chart svg { width: 100%; height: auto; display: block; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .55rem 0; border-bottom: 1px solid #edf2ef; }
.bar-row:last-child { border-bottom: 0; }
.bar-track { grid-column: 1 / -1; height: 6px; background: #edf2ef; border-radius: 3px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: .6rem 1.2rem; border-bottom: 1px solid #edf2ef; font-size: .88rem; }
.feed li:last-child { border-bottom: 0; }
.feed small { color: var(--muted); display: block; }

/* ---------- Entry form ---------- */
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: #46574f; padding: .5rem .4rem; white-space: nowrap; }
.lines-table td { padding: .3rem .3rem; vertical-align: top; }
.lines-table .input { min-height: 38px; }
.lines-table .idx { width: 30px; color: var(--muted); font-weight: 700; padding-top: .8rem; text-align: center; }
.lines-table .unit-cell { width: 64px; padding-top: .75rem; color: var(--muted); font-weight: 700; }
.lines-table .amt { text-align: right; font-weight: 900; padding-top: .7rem; width: 120px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines-table td.del { width: 36px; }
.lines-table .err { display: block; margin-top: 2px; }
.totals-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.2rem; background: var(--brand-soft); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.totals-bar .t { display: flex; gap: 1.8rem; flex-wrap: wrap; }
.totals-bar .t div { font-size: .78rem; color: #3c5a4c; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.totals-bar .t b { display: block; font-size: 1.25rem; color: var(--brand-deep); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.cat-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.cat-pill { text-decoration: none; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem; border: 1px solid var(--line-strong); color: var(--ink); background: #fff; }
.cat-pill.active { color: #fff; border-color: transparent; }
.cat-pill.active.repair { background: var(--repair); } .cat-pill.active.raw { background: var(--raw); } .cat-pill.active.consumable { background: var(--consumable); }
.hero-strip { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.2rem; border-radius: var(--radius) var(--radius) 0 0; color: #fff; }
.hero-strip.repair { background: var(--repair); } .hero-strip.raw { background: var(--raw); } .hero-strip.consumable { background: var(--consumable); }
.hero-strip h2 { font-size: 1.05rem; font-weight: 900; } .hero-strip small { opacity: .9; }

/* ---------- Modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 30, 24, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: pop .14s ease-out; }
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.1rem; font-weight: 900; }
.modal-body { padding: 1.1rem 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: #fafcfb; border-radius: 0 0 12px 12px; }
.x { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 .3rem; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: #17302a; color: #fff; padding: .7rem 1rem; border-radius: 9px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-weight: 700; font-size: .9rem; animation: pop .15s ease-out; border-left: 5px solid var(--brand); }
.toast.error { border-left-color: #ff6b6b; background: #4a1717; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1.2rem; margin-bottom: 1rem; }
.detail-grid .k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 900; }
.detail-grid .v { font-weight: 700; }
pre.json { background: #f3f7f5; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; overflow: auto; max-height: 320px; font-size: .78rem; margin: .4rem 0 0; }
.diff { width: 100%; border-collapse: collapse; font-size: .84rem; margin-top: .4rem; }
.diff th, .diff td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; vertical-align: top; }
.diff th { background: #f6f9f7; } .diff .old { background: #fff1f1; } .diff .new { background: #effaf3; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(155deg, var(--brand) 0%, var(--brand-deep) 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 340px; height: 340px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.auth-side::before { content: ""; position: absolute; right: 120px; bottom: 150px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.auth-side .brand img { width: 60px; height: 60px; }
.auth-side .brand b { font-size: 1.25rem; }
.auth-side h1 { font-size: 2.2rem; font-weight: 900; margin-bottom: .75rem; }
.auth-side p { max-width: 430px; opacity: .92; font-size: 1.02rem; }
.auth-side ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .5rem; }
.auth-side li::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .2); margin-right: .6rem; font-size: .75rem; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; background: #fff; }
.auth-box { width: 100%; max-width: 390px; }
.auth-logo { display: none; align-items: center; gap: .7rem; margin-bottom: 1.6rem; }
.auth-logo img { width: 46px; height: 46px; }
.auth-logo b { display: block; font-size: 1.1rem; font-weight: 900; color: var(--brand-deep); }
.auth-logo small { display: block; font-size: .72rem; color: var(--muted); }
.auth-box h2 { font-size: 1.6rem; font-weight: 900; }
.auth-box > p { color: var(--muted); margin: .3rem 0 1.4rem; }
.auth-box .field { margin-bottom: .95rem; }
.pw-wrap { position: relative; } .pw-wrap .input { padding-right: 3.4rem; }
.pw-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--brand-dark); font-weight: 700; cursor: pointer; font-size: .8rem; padding: .3rem; }
.auth-foot { margin-top: 1.5rem; font-size: .78rem; color: var(--muted); text-align: center; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* print-only company header */
.print-head { display: none; align-items: center; gap: .8rem; padding: 0 0 .8rem; margin-bottom: .8rem; border-bottom: 2px solid var(--brand); }
.print-head img { width: 46px; height: 46px; }
.print-head b { display: block; font-size: 1.1rem; }
.print-head span { font-size: .78rem; color: #444; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%); transition: transform .2s ease; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(10, 25, 18, .5); z-index: 55; }
  .mobilebar { display: flex; }
  .page { padding: 1.1rem 1rem 3rem; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-logo { display: flex; }
  .form-grid { grid-template-columns: repeat(6, 1fr); }
  .col-2, .col-3 { grid-column: span 3; } .col-4, .col-5, .col-6, .col-8, .col-12 { grid-column: span 6; }
  .lines-table, .lines-table tbody, .lines-table tr, .lines-table td { display: block; }
  .lines-table thead { display: none; }
  .lines-table tr { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; margin-bottom: .7rem; background: #fcfefd; position: relative; }
  .lines-table td { padding: .25rem 0; } .lines-table .idx { text-align: left; padding: 0 0 .2rem; } .lines-table .amt { text-align: left; width: auto; padding-top: .3rem; }
  .lines-table .unit-cell { width: auto; padding-top: .2rem; } .lines-table td.del { position: absolute; right: .4rem; top: .4rem; width: auto; }
}
@media (max-width: 560px) {
  .cols-4, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: .5rem; }
  .col-2, .col-3 { grid-column: span 6; }
  .page { padding: 1rem .75rem 3rem; }
}
@media print {
  .print-head { display: flex !important; }
  .sidebar, .mobilebar, .scrim, .toasts, .filters, .actions, .pager, .tabs, .no-print { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #bbb; }
  .overlay { position: static; background: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-width: none; animation: none; }
  .modal-foot, .x { display: none !important; }
  body.printing-modal #app { display: none; }
  .tbl th { position: static; }
}
