/* console.css — everything the approved mockup (docs/design/sub2-console-mockup.html)
 * ADDS on top of the ported tokens.css / components.css. Nothing in this file
 * duplicates a rule that already lives in either ported file; if a class name
 * looks like it should be there, check components.css first.
 *
 * This is the mockup's own second <style> block ("Mockup-only additions"),
 * carried over as-is — including the KPI strip, table and drawer rules that
 * Task 3 does not yet render — because it is one coherent unit in the source
 * the operator approved, and every rule in it will be consumed by name (not
 * redesigned) as later tasks (5+) wire up the inventory table and drawer.
 * A small number of rules below are NOT in the mockup at all: they are
 * flagged individually, with why.
 */
html,body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:var(--fs-md)}
*{box-sizing:border-box}

/* --ui-scale multiplies the whole shell. The [− +] control itself is exempt (norm). */
.lb-scaled{font-size:calc(1rem * var(--ui-scale,1))}

.lb-shell{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh}
.lb-side{background:var(--sidebar-bg);border-right:1px solid var(--sidebar-border);padding:18px 14px;display:flex;flex-direction:column;gap:22px}
.lb-brand{display:flex;align-items:center;gap:10px;font-weight:var(--fw-semibold);font-size:var(--fs-lg);color:var(--sidebar-heading)}
.lb-brand-mark{width:30px;height:30px;border-radius:var(--r);background:var(--accent);color:var(--accent-fg);display:grid;place-items:center;font-size:15px;font-weight:600;flex:0 0 auto}
.lb-nav{display:flex;flex-direction:column;gap:2px}
.lb-nav a{display:flex;align-items:center;gap:10px;padding:9px 11px;border-radius:var(--r);color:var(--sidebar-text);text-decoration:none;font-size:var(--fs-sm)}
.lb-nav a:hover{background:var(--panel2);color:var(--text)}
.lb-nav a.is-active{background:var(--accent-soft);color:var(--accent);font-weight:var(--fw-medium)}
.lb-nav .dot{width:7px;height:7px;border-radius:50%;background:currentColor;opacity:.75;flex:0 0 auto}
.lb-side-foot{margin-top:auto;font-size:var(--fs-2xs);color:var(--sidebar-text-muted);line-height:1.6}

.lb-main{display:flex;flex-direction:column;min-width:0}
.lb-top{display:flex;align-items:center;gap:16px;padding:14px 22px;border-bottom:1px solid var(--border);background:var(--panel)}
.lb-top h1{margin:0;font-size:var(--fs-xl);font-weight:var(--fw-semibold)}
.lb-kicker{font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.08em}
.lb-top-actions{margin-left:auto;display:flex;align-items:center;gap:10px}
/* NOT in the mockup: the mockup's exit button is an inert <button>. Ours
 * actually POSTs to /logout.php (CSRF-carrying, Global Constraints), so it
 * needs a <form> wrapper — this rule only cancels that form's default block
 * display/margin so it sits in the topbar's icon row identically to the
 * mockup's plain button. */
.lb-top-actions form{margin:0;display:inline-flex}

/* NORM: the scale control is in FIXED px and never scales itself. */
.lb-scale{display:flex;align-items:center;gap:6px;padding:4px;border:1px solid var(--border);border-radius:var(--r-pill);background:var(--panel2)}
.lb-scale button{width:30px;height:30px;font-size:18px;line-height:1;border:0;border-radius:50%;background:transparent;color:var(--text2);cursor:pointer;padding:0}
.lb-scale button:hover:not(:disabled){background:var(--panel);color:var(--text)}
.lb-scale button:disabled{opacity:.3;cursor:not-allowed}
.lb-scale .val{font-family:var(--font-mono);font-size:12px;min-width:42px;text-align:center;color:var(--muted)}
.lb-icon-btn{width:34px;height:34px;border-radius:var(--r);border:1px solid var(--border);background:var(--panel2);color:var(--text2);cursor:pointer;font-size:15px}
.lb-icon-btn:hover{color:var(--text);border-color:var(--accent-border)}

.lb-body{padding:22px;display:flex;flex-direction:column;gap:18px}
.lb-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.lb-kpi{background:var(--panel);border:1px solid var(--border);border-radius:var(--r-lg);padding:14px 16px}
.lb-kpi .n{font-size:var(--fs-2xl);font-weight:var(--fw-semibold);line-height:1.1}
.lb-kpi .l{font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.07em;margin-top:4px}
.lb-kpi.ok .n{color:var(--ok)} .lb-kpi.warn .n{color:var(--warn)} .lb-kpi.err .n{color:var(--err)}

.lb-panel{background:var(--panel);border:1px solid var(--border);border-radius:var(--r-lg);overflow:hidden}
.lb-panel-head{display:flex;align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid var(--border-subtle);flex-wrap:wrap}
.lb-panel-head h2{margin:0;font-size:var(--fs-lg);font-weight:var(--fw-semibold)}
.lb-tools{margin-left:auto;display:flex;gap:8px;align-items:center}
.lb-search{padding:7px 11px;border:1px solid var(--border);border-radius:var(--r);background:var(--bg);color:var(--text);font-size:var(--fs-sm);min-width:210px;font-family:inherit}

/* NOT in the mockup — no approved mockup markup exists for the register
 * form (Task 11), which is the first page to put a <form> inside .lb-panel
 * rather than a table. */
.lb-panel-body{padding:16px}
.form-section-title{font-size:var(--fs-xs);font-weight:var(--fw-medium);text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:20px 0 12px}
.form-section-title:first-child{margin-top:0}
/* NORM: action buttons at the FOOT, primary right, Cancel to its left — the
 * same right-wrapper-with-margin-left:auto shape the detail drawer's own
 * .ff-d-foot .right already uses (this file, below), reused here so the
 * two "actions at the foot" surfaces on this console look like one system. */
.form-foot{display:flex;align-items:center;gap:9px;padding-top:16px;margin-top:6px;border-top:1px solid var(--border-subtle)}
.form-foot .right{margin-left:auto;display:flex;gap:9px}

.lb-wrap{overflow-x:auto}
table.lb{width:100%;border-collapse:separate;border-spacing:0;font-size:var(--fs-md)}
table.lb th{font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:var(--fw-medium);
  padding:10px 12px;text-align:center;white-space:nowrap;border-bottom:1px solid var(--border);background:var(--panel2);cursor:pointer;user-select:none}
table.lb th .ar{opacity:.45;font-size:10px;margin-left:3px}
table.lb td{padding:10px 12px;text-align:center;border-bottom:1px solid var(--border-subtle);white-space:nowrap}
table.lb tbody tr:hover td{background:var(--panel2)}
/* NORM: left anchor = sticky "Ver" + row number that scrolls with the table. */
th.col-view,td.col-view{position:sticky;left:0;z-index:2;background:var(--panel);padding-left:14px}
table.lb th.col-view{background:var(--panel2)}
tbody tr:hover td.col-view{background:var(--panel2)}
td.col-num{color:var(--faint);font-family:var(--font-mono);font-size:var(--fs-2xs);width:1%}
/* NORM: names left, amounts right (tabular), everything else centred. */
td.t-name{text-align:left;font-weight:var(--fw-medium)}
td.t-sub{text-align:left;color:var(--muted);font-family:var(--font-mono);font-size:var(--fs-xs)}
td.t-num,th.t-num,tfoot td.t-num{text-align:right;font-variant-numeric:tabular-nums}
.lb-view{border:1px solid var(--border);background:var(--panel2);color:var(--text2);border-radius:var(--r-sm);
  padding:4px 11px;font-size:var(--fs-2xs);cursor:pointer;font-family:inherit;font-weight:var(--fw-medium)}
.lb-view:hover{border-color:var(--accent-border);color:var(--accent);background:var(--accent-soft)}
tfoot td{padding:11px 12px;border-top:1px solid var(--border);font-weight:var(--fw-semibold);background:var(--panel2);font-size:var(--fs-sm)}

.pill{display:inline-block;padding:2px 9px;border-radius:var(--r-pill);font-size:var(--fs-2xs);font-weight:var(--fw-medium);border:1px solid}
.p-ok{background:var(--ok-soft);color:var(--ok);border-color:var(--ok-border)}
.p-warn{background:var(--warn-soft);color:var(--warn);border-color:var(--warn-border)}
.p-err{background:var(--err-soft);color:var(--err);border-color:var(--err-border)}
.p-mut{background:var(--panel2);color:var(--muted);border-color:var(--border)}
.p-acc{background:var(--accent-soft);color:var(--accent);border-color:var(--accent-border)}
.copies{display:inline-flex;gap:4px}
.copies i{font-style:normal;font-size:var(--fs-2xs);padding:1px 6px;border-radius:var(--r-sm);background:var(--panel2);border:1px solid var(--border);color:var(--muted)}
.copies i.on{background:var(--ok-soft);border-color:var(--ok-border);color:var(--ok)}

.lb-foot{display:flex;align-items:center;padding:11px 16px;border-top:1px solid var(--border-subtle);font-size:var(--fs-2xs);color:var(--muted)}
.lb-pager{margin-left:auto;display:flex;gap:6px;align-items:center}
.lb-pager button{border:1px solid var(--border);background:var(--panel2);color:var(--text2);border-radius:var(--r-sm);padding:4px 10px;cursor:pointer;font-size:var(--fs-2xs)}
.lb-pager button:disabled{opacity:.35;cursor:not-allowed}

/* ---- drawer:begin ----
 * Task 6 review round 1: this used to style a parallel `.dw`/`.dw-scrim`/
 * `.open` contract copied verbatim from the mockup's OWN inline demo script
 * (docs/design/sub2-console-mockup.html:509,512 add/remove `.open` by hand).
 * Nothing in this project ever adds that class — api/assets/js/drawer.js
 * (ported verbatim, never edited — tests/portage_test.sh) implements a
 * DIFFERENT, already-real toggle: it flips `body.drawer-open`, and
 * components.css's OWN `body.drawer-open .ff-drawer{display:flex}` /
 * `body.drawer-open .ff-drawer-scrim{display:block}` rules are what actually
 * show it (both `display:none` by default). The result was a drawer that
 * fetched and populated correctly and was never once visible on screen — a
 * runtime `skinDrawer()` in console.js used to paper over the class-name gap
 * by adding `.dw`/`.dw-scrim`/etc to drawer.js's real elements, but never
 * toggled `.open` either, so the panel stayed permanently
 * `transform:translateX(100%)` off-viewport regardless. Removed; see
 * console.js's own history for why patching that reskin in place was
 * rejected in favor of styling drawer.js's REAL selectors directly (same
 * ruling as Task 4's fetch-patch removal) — this block IS that fix.
 *
 * Below, every rule targets a class `.ff-drawer-*` element drawer.js itself
 * creates (`.ff-drawer-scrim`, `.ff-drawer`, `.ff-drawer-head`,
 * `.ff-drawer-close`, `.ff-drawer-body`, `.ff-drawer-foot`) — this file only
 * overrides their VISUAL properties (the approved mockup's wider layout,
 * spacing, colors); the show/hide toggle itself is untouched, inherited
 * as-is from components.css, and this stylesheet never re-declares it.
 * tests/drawer_css_test.php is the mechanical gate: it extracts every real
 * class name from drawer.js's own source and fails loudly if any
 * `.ff-drawer-*` selector below ever names one that file does not actually
 * produce — the same class of bug this comment describes, caught before a
 * human has to notice an invisible panel again.
 */
.ff-drawer-scrim{background:rgba(0,0,0,.55);backdrop-filter:blur(3px)}
.ff-drawer{width:min(1100px,92vw);box-shadow:var(--shadow);border-left:1px solid var(--border)}
.ff-drawer:focus{outline:none}
.ff-drawer-head{padding:16px 20px;gap:14px;background:var(--panel)}
.ff-drawer-head .lbl{font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.08em}
.ff-drawer-head h3{margin:3px 0 0;font-size:var(--fs-2xl);font-weight:var(--fw-semibold);font-family:var(--font);letter-spacing:normal;color:var(--text)}
.dw-badges{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.ff-drawer-close{width:34px;height:34px;border-radius:var(--r);background:var(--panel2);color:var(--text2);font-size:16px}
.ff-drawer-body{padding:20px;display:flex;flex-direction:column;gap:20px}
.dw-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.dw-kpi{background:var(--panel2);border:1px solid var(--border-subtle);border-radius:var(--r);padding:11px 13px}
.dw-kpi .n{font-size:var(--fs-lg);font-weight:var(--fw-semibold);font-variant-numeric:tabular-nums}
.dw-kpi .l{font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-top:3px}
.dw-sec{border:1px solid var(--border-subtle);border-radius:var(--r);overflow:hidden}
.dw-sec>summary{padding:11px 14px;background:var(--panel2);cursor:pointer;font-size:var(--fs-sm);font-weight:var(--fw-medium);list-style:none;display:flex;align-items:center;gap:8px}
.dw-sec>summary::-webkit-details-marker{display:none}
.dw-sec>summary::before{content:"▸";color:var(--muted);font-size:11px}
.dw-sec[open]>summary::before{content:"▾"}
.dw-grid{padding:14px;display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:13px}
.f .k{font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.f .v{font-size:var(--fs-sm);margin-top:3px;word-break:break-word}
.f .v.mono{font-family:var(--font-mono);font-size:var(--fs-xs)}
.dw-hist{width:100%;border-collapse:collapse;font-size:var(--fs-sm)}
.dw-hist th{text-align:center;text-transform:uppercase;font-size:var(--fs-2xs);color:var(--muted);padding:8px 12px;letter-spacing:.06em;font-weight:var(--fw-medium)}
.dw-hist td{padding:8px 12px;text-align:center;border-top:1px solid var(--border-subtle)}
.dw-hist td.t-num{text-align:right;font-variant-numeric:tabular-nums}
.note{background:var(--warn-soft);border:1px solid var(--warn-border);color:var(--text);padding:11px 14px;border-radius:var(--r);font-size:var(--fs-sm)}
/* NORM: actions at the FOOT, primary right; unavailable = visible, disabled, dimmed. */
.ff-drawer-foot{padding:14px 20px;gap:9px;background:var(--panel)}
.ff-drawer-foot .right{margin-left:auto;display:flex;gap:9px}
.b{border:1px solid var(--border);background:var(--panel2);color:var(--text);border-radius:var(--r);padding:8px 15px;font-size:var(--fs-sm);cursor:pointer;font-family:inherit;font-weight:var(--fw-medium)}
.b:hover:not(:disabled){border-color:var(--accent-border)}
.b-primary{background:var(--accent);border-color:var(--accent);color:var(--accent-fg)}
.b-primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.b-danger{color:var(--err);border-color:var(--err-border)}
.b:disabled{opacity:.4;cursor:not-allowed;pointer-events:none}
.b-wrap{display:inline-block}

@media (max-width:860px){
  .ff-drawer-foot{flex-direction:column-reverse;align-items:stretch}
  .ff-drawer-foot .right{margin-left:0;flex-direction:column-reverse}
  .ff-drawer-foot .b{width:100%}
}
/* ---- drawer:end ---- */

/* NORM: responsive from the first commit — wide tables become cards, never h-scroll. */
@media (max-width:860px){
  .lb-shell{grid-template-columns:1fr}
  .lb-side{display:none}
  .lb-body{padding:14px}
  .lb-wrap{overflow-x:visible}
  table.lb,table.lb tbody,table.lb tr,table.lb td{display:block;width:100%}
  table.lb thead,table.lb tfoot{display:none}
  table.lb tr{border:1px solid var(--border);border-radius:var(--r-lg);margin-bottom:11px;background:var(--panel);padding:6px 4px}
  table.lb td{border:0;text-align:right;padding:7px 13px;display:flex;justify-content:space-between;gap:14px;align-items:center;white-space:normal}
  table.lb td::before{content:attr(data-label);font-size:var(--fs-2xs);color:var(--muted);text-transform:uppercase;letter-spacing:.06em;text-align:left}
  table.lb td.col-view,table.lb td.col-num{position:static;justify-content:flex-start}
  /* No content override here on purpose: this cell inherits the generic
   * `content:attr(data-label)` rule above, like every other column. The mockup
   * hardcoded "FILA" at this spot; carrying that literal over would have been a
   * user-facing Spanish string outside lang/*, which is a merge blocker. */
  table.lb td.col-view::before{content:""}
  table.lb td.t-name{text-align:right}
}

/* ---- login page ----
 * NOT in the mockup — the approved mockup only depicts the authenticated
 * shell, never a login screen. This reuses the SAME tokens (--bg/--panel/
 * --border/--r-lg/--shadow/--accent) and the SAME form primitives ported
 * from components.css (.field/.input/.field-error/.btn) rather than
 * inventing a parallel set, so the login page reads as the same product
 * instead of a bolted-on screen. Only the centering layout below is new. */
.lb-login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--bg)}
.lb-login-card{width:100%;max-width:360px;background:var(--panel);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--shadow);padding:28px 26px}
.lb-login-brand{display:flex;align-items:center;gap:10px;font-weight:var(--fw-semibold);font-size:var(--fs-lg);color:var(--text);margin-bottom:20px}
.lb-login-brand .lb-brand-mark{width:30px;height:30px;border-radius:var(--r);background:var(--accent);color:var(--accent-fg);display:grid;place-items:center;font-size:15px;font-weight:600;flex:0 0 auto}
.lb-login-card h1{margin:0 0 18px;font-size:var(--fs-xl);font-weight:var(--fw-semibold)}
.lb-login-alert{background:var(--err-soft);border:1px solid var(--err-border);color:var(--err);padding:10px 13px;border-radius:var(--r);font-size:var(--fs-sm);margin-bottom:16px}
.lb-login-card .btn{width:100%;margin-top:6px}

/* ---- user manual (api/pages/manual.php) ----
 * One .lb-panel per section, stacked. The command blocks scroll inside their
 * own container on narrow screens (overflow-x on the <pre>, never the page —
 * responsive Global Constraint), and everything inherits --ui-scale through
 * the shell's rem-based sizing like the rest of the console. */
.lb-manual{display:flex;flex-direction:column;gap:14px;max-width:860px}
.lb-manual-intro{margin:0;color:var(--text2);font-size:var(--fs-md)}
.lb-manual-section .lb-panel-body p{margin:0 0 10px;color:var(--text2);line-height:1.55}
.lb-manual-section .lb-panel-body p:last-child{margin-bottom:0}
.lb-cmd{margin:0 0 12px;padding:11px 13px;background:var(--panel2);border:1px solid var(--border-subtle);border-radius:var(--r);overflow-x:auto}
.lb-cmd code{font-family:var(--font-mono);font-size:var(--fs-sm);color:var(--text);white-space:pre}
.lb-manual-status-row{display:flex;align-items:baseline;gap:10px;margin:0 0 8px}
.lb-manual-status-row .pill{flex:0 0 auto}
.lb-manual-status-row span:last-child{color:var(--text2);font-size:var(--fs-sm);line-height:1.5}
.lb-manual-steps{margin:0 0 10px;padding-left:22px;color:var(--text2);line-height:1.6}
.lb-manual-steps li{margin-bottom:6px}
@media (max-width:860px){
  .lb-manual-status-row{flex-direction:column;gap:4px;margin-bottom:11px}
}
