/* =====================================================================
   Panouri sandwich — interfață
   Paletă derivată din culorile RAL folosite la panouri:
   antracit RAL 7016 (structură), albastru RAL 5010 (perete),
   roșu oxid RAL 3009 (acoperiș), galben spumă PIR (resturi).
   ===================================================================== */

/* ---------- Fonts (self-hosted, latin + latin-ext for ă â î ș ț) ---------- */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---------- Tokens ---------- */
:root {
  --steel-950: #23282b;
  --steel-900: #2e3438;
  --steel-800: #383e42;   /* RAL 7016 */
  --steel-700: #4a5257;
  --steel-600: #5e676d;
  --steel-400: #8d969c;
  --steel-300: #b9c0c5;
  --steel-200: #d6dbde;
  --steel-100: #e9ecee;
  --zinc: #f1f3f4;
  --paper: #ffffff;
  --wall: #1f5a93;  --wall-700: #17476f; --wall-100: #e3ecf6; --wall-50: #f2f6fb;   /* RAL 5010 */
  --roof: #8e3b2f;  --roof-700: #6f2c22; --roof-100: #f6e6e2; --roof-50: #fbf4f2;   /* RAL 3009 */
  --foam: #e3b53c;  --foam-700: #8a6510; --foam-100: #fbf1d6;                      /* miez PIR */
  --ok: #2e7d4f;    --ok-100: #e2f2e8;
  --warn: #9a6200;  --warn-100: #fcefd2;
  --danger: #b42318; --danger-100: #fde6e3;
  --text: #1d2225;
  --muted: #5e676d;
  --radius: 4px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-cond: 'Barlow Condensed', 'Barlow', 'Arial Narrow', system-ui, sans-serif;

  --bs-body-font-family: var(--font);
  --bs-body-font-size: 0.9375rem;
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--zinc);
  --bs-border-color: var(--steel-200);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: 3px;
  --bs-border-radius-lg: 6px;
  --bs-link-color: var(--wall);
  --bs-link-color-rgb: 31, 90, 147;
  --bs-link-hover-color: var(--wall-700);
  --bs-link-hover-color-rgb: 23, 71, 111;
  --bs-secondary-color: var(--muted);
  --bs-focus-ring-color: rgba(31, 90, 147, .35);
  --bs-emphasis-color: var(--text);
}

html { -webkit-text-size-adjust: 100%; }
body { font-feature-settings: "liga" 1; }
.num, .table-data td.num, .tabular { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { text-align: right; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--font-cond); font-weight: 600; letter-spacing: .005em; color: var(--steel-950); }
a { text-underline-offset: 2px; }
code { color: var(--steel-800); }
:focus-visible { outline: 2px solid var(--wall); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 2000; background: var(--paper); padding: .5rem 1rem; }
.skip-link:focus { left: 1rem; top: 1rem; }
.text-muted, .muted { color: var(--muted) !important; }
.small-note { font-size: .8125rem; color: var(--muted); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.25rem 1.5rem 3rem; max-width: 1480px; width: 100%; }
.content:focus { outline: none; }

.sidebar {
  --bs-offcanvas-width: 260px;
  --bs-offcanvas-bg: var(--steel-800);
  background: var(--steel-800);
  color: #dfe3e6;
  width: 248px;
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
}
/* Bootstrap makes .offcanvas-lg transparent on desktop; keep the anthracite panel. */
.sidebar.offcanvas-lg { background-color: var(--steel-800) !important; }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem .9rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 42px; height: 25px; color: #e9ecee; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-family: var(--font-cond); font-size: 1.15rem; font-weight: 600; }
.brand-text small { color: var(--steel-300); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.sidebar-nav { padding: .6rem .6rem 1rem; flex: 1 1 auto; }
.nav-section { color: var(--steel-400); font-size: .78rem; font-weight: 600; padding: 1rem .7rem .3rem; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: .7rem;
  color: #d9dee1; padding: .48rem .7rem; border-radius: var(--radius);
  font-weight: 500; text-decoration: none; position: relative;
}
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; width: 1.1rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--paper); color: var(--steel-950); }
.sidebar .nav-link.active i { opacity: 1; }
.nav-dot { width: 8px; height: 8px; border-radius: 1px; margin-left: auto; }
.dot-wall { background: #6fa3d6; }
.dot-roof { background: #d07a6c; }
.nav-link.active .dot-wall { background: var(--wall); }
.nav-link.active .dot-roof { background: var(--roof); }

.sidebar-user { border-top: 1px solid rgba(255,255,255,.08); padding: .9rem 1.1rem 1.1rem; font-size: .875rem; }
.sidebar-user .who { display: flex; gap: .6rem; align-items: center; margin-bottom: .55rem; }
.sidebar-user .who i { font-size: 1.6rem; color: var(--steel-300); }
.sidebar-user .who strong { display: block; color: #fff; font-weight: 600; line-height: 1.2; }
.sidebar-user .who small { color: var(--steel-300); }
.user-actions { display: flex; gap: 1rem; align-items: center; }
.user-actions a, .user-actions .linklike { color: #cfd6db; font-size: .85rem; }
.user-actions form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1.5rem; background: var(--paper); border-bottom: 1px solid var(--steel-200);
  position: sticky; top: 0; z-index: 1010;
}
.topbar-title { flex: 1 1 auto; min-width: 0; }
.topbar h1 { font-size: 1.6rem; margin: 0; line-height: 1.15; }
.topbar .subtitle { color: var(--muted); font-size: .875rem; margin-top: .1rem; }
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-icon { border: 1px solid var(--steel-200); padding: .3rem .55rem; font-size: 1.2rem; line-height: 1; }

@media (max-width: 991.98px) {
  .content { padding: 1rem .85rem 3rem; }
  .topbar { padding: .7rem .85rem; }
  .topbar h1 { font-size: 1.35rem; }
  .sidebar { width: auto; }
}

/* ---------- Buttons & forms ---------- */
.btn { font-weight: 600; --bs-btn-border-radius: var(--radius); }
.btn-primary { --bs-btn-bg: var(--steel-800); --bs-btn-border-color: var(--steel-800); --bs-btn-hover-bg: var(--steel-950); --bs-btn-hover-border-color: var(--steel-950); --bs-btn-active-bg: var(--steel-950); --bs-btn-active-border-color: var(--steel-950); --bs-btn-disabled-bg: var(--steel-600); --bs-btn-disabled-border-color: var(--steel-600); }
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: #256641; --bs-btn-hover-border-color: #256641; --bs-btn-active-bg: #256641; --bs-btn-disabled-bg: var(--ok); --bs-btn-disabled-border-color: var(--ok); }
.btn-cut { --bs-btn-color: var(--steel-950); --bs-btn-bg: var(--foam); --bs-btn-border-color: #cf9f22; --bs-btn-hover-color: var(--steel-950); --bs-btn-hover-bg: #d9a92c; --bs-btn-hover-border-color: #b98c17; --bs-btn-active-bg: #cf9f22; --bs-btn-active-color: var(--steel-950); --bs-btn-disabled-bg: var(--foam-100); --bs-btn-disabled-color: var(--steel-600); }
.btn-outline-secondary { --bs-btn-color: var(--steel-800); --bs-btn-border-color: var(--steel-300); --bs-btn-hover-bg: var(--steel-100); --bs-btn-hover-color: var(--steel-950); --bs-btn-hover-border-color: var(--steel-400); --bs-btn-active-bg: var(--steel-200); --bs-btn-active-color: var(--steel-950); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #e5a29b; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); }
.btn.is-busy::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: .5em; vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-label { font-weight: 600; font-size: .875rem; margin-bottom: .3rem; color: var(--steel-900); }
.form-control, .form-select { border-color: var(--steel-300); background-color: #fff; }
.form-control:disabled, .form-control[readonly] { background-color: var(--steel-100); }
.form-control:focus, .form-select:focus { border-color: var(--wall); box-shadow: 0 0 0 .2rem rgba(31,90,147,.18); }
.form-text { color: var(--muted); }
.req::after { content: " *"; color: var(--danger); }
.invalid-feedback { font-size: .82rem; }
.input-group-text { background: var(--steel-100); border-color: var(--steel-300); color: var(--steel-700); }

/* ---------- Panels (sections) ---------- */
.panel { background: var(--paper); border: 1px solid var(--steel-200); border-radius: var(--radius); margin-bottom: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .8rem 1.1rem; border-bottom: 1px solid var(--steel-200); }
.panel-head h2 { font-size: 1.2rem; margin: 0; }
.panel-head .hint { color: var(--muted); font-size: .85rem; }
.panel-body { padding: 1rem 1.1rem; }
.panel-foot { padding: .7rem 1.1rem; border-top: 1px solid var(--steel-200); background: #fafbfb; }
.panel.cat-wall { border-top: 4px solid var(--wall); }
.panel.cat-roof { border-top: 4px solid var(--roof); }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: .6rem .8rem; align-items: flex-end; padding: .85rem 1.1rem; border-bottom: 1px solid var(--steel-200); background: #fafbfb; }
.filters .form-label { font-size: .78rem; margin-bottom: .2rem; color: var(--muted); }
.filters .form-control, .filters .form-select { font-size: .875rem; padding-top: .3rem; padding-bottom: .3rem; }
.filters .f-grow { flex: 1 1 200px; }
.period-custom[hidden] { display: none !important; }

/* ---------- Tables ---------- */
.table-data { margin: 0; font-size: .875rem; --bs-table-bg: transparent; }
.table-data > :not(caption) > * > * { padding: .5rem .75rem; border-bottom-color: var(--steel-100); }
.table-data thead th { font-weight: 600; font-size: .8rem; color: var(--steel-600); background: #fafbfb; border-bottom: 1px solid var(--steel-200); white-space: nowrap; vertical-align: bottom; }
.table-data tbody tr:hover > * { background: #f7f9fa; }
.table-data tfoot td { font-weight: 600; background: #fafbfb; border-top: 1px solid var(--steel-200); }
.table-data .code { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-data a.code { text-decoration: none; }
.table-data a.code:hover { text-decoration: underline; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--steel-950); text-decoration: underline; }
.table-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.row-muted > * { color: var(--steel-400) !important; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Status vocabulary ---------- */
.st { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; flex: 0 0 auto; }
.st-available::before { background: var(--ok); }
.st-reserved::before  { background: var(--warn); border-radius: 1px; }
.st-consumed::before  { background: var(--steel-400); }
.st-scrapped::before  { background: var(--danger); border-radius: 0; transform: rotate(45deg) scale(.85); }
.st-available { color: #1f5d39; }
.st-reserved { color: #7a4d00; }
.st-consumed { color: var(--steel-600); }
.st-scrapped { color: var(--danger); }

.ost { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .5rem; border-radius: 3px; border: 1px solid; white-space: nowrap; }
.ost-draft { color: var(--steel-700); border-color: var(--steel-300); background: var(--paper); }
.ost-confirmed { color: var(--wall-700); border-color: #a9c3de; background: var(--wall-50); }
.ost-in_preparation { color: #6d4600; border-color: #e8c77c; background: var(--foam-100); }
.ost-completed { color: #1f5d39; border-color: #a6d3b6; background: var(--ok-100); }
.ost-cancelled { color: var(--danger); border-color: #efb5ae; background: var(--danger-100); text-decoration: line-through; text-decoration-thickness: 1px; }

.cat-tag { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .82rem; white-space: nowrap; }
.cat-tag::before { content: ""; width: .65rem; height: .65rem; border-radius: 1px; }
.cat-tag.cat-wall { color: var(--wall-700); }
.cat-tag.cat-wall::before { background: var(--wall); }
.cat-tag.cat-roof { color: var(--roof-700); }
.cat-tag.cat-roof::before { background: var(--roof); }

.type-tag { font-size: .8rem; color: var(--steel-700); white-space: nowrap; }
.type-tag.t-remnant { color: var(--foam-700); font-weight: 600; }
.flag-short { color: var(--danger); font-size: .78rem; font-weight: 600; }

/* ---------- Length gauge: piece length against the 13.5 m standard panel ---------- */
.gauge { display: inline-block; position: relative; width: 92px; height: 8px; background: var(--steel-100); border-radius: 1px; vertical-align: middle; overflow: hidden; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; display: block; }
.g-wall { background: var(--wall); }
.g-roof { background: var(--roof); }
.gauge-fill.waste { background: repeating-linear-gradient(-45deg, var(--danger) 0 3px, #f3b8b1 3px 6px); }
.gauge.over::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--steel-950); }
.len-cell { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }

/* ---------- Dashboard ---------- */
.period-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: 1rem; }
.period-bar .period-label { color: var(--muted); font-size: .9rem; }
.seg-nav { display: inline-flex; border: 1px solid var(--steel-300); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.seg-nav a { padding: .32rem .75rem; font-size: .85rem; font-weight: 600; color: var(--steel-700); text-decoration: none; border-right: 1px solid var(--steel-200); }
.seg-nav a:last-child { border-right: 0; }
.seg-nav a:hover { background: var(--steel-100); }
.seg-nav a.active { background: var(--steel-800); color: #fff; }

.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .9rem 1.1rem .4rem; }
.cat-head h2 { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.cat-wall .cat-head h2 i { color: var(--wall); }
.cat-roof .cat-head h2 i { color: var(--roof); }
.stock-figure { padding: 0 1.1rem .9rem; display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: baseline; }
.stock-figure .big { font-family: var(--font-cond); font-weight: 700; font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--steel-950); }
.stock-figure .big small { font-size: 1.2rem; font-weight: 600; color: var(--steel-600); margin-left: .15rem; }
.stock-figure .desc { color: var(--steel-700); font-size: .9rem; }

/* Stock rack: one bar per distinct length, scaled to the standard panel */
.rack { padding: .2rem 1.1rem 1rem; }
.rack-row { display: grid; grid-template-columns: 4.6rem 1fr 3.4rem 5.6rem; gap: .6rem; align-items: center; padding: .2rem 0; font-size: .86rem; font-variant-numeric: tabular-nums; }
.rack-len { text-align: right; font-weight: 600; }
.rack.with-th .rack-row { grid-template-columns: 7.4rem 1fr 3.4rem 5.6rem; }
.rack-track { height: 12px; background: repeating-linear-gradient(90deg, var(--steel-100) 0 calc(100%/13.5 - 1px), #fff calc(100%/13.5 - 1px) calc(100%/13.5)); border: 1px solid var(--steel-200); position: relative; }
.rack-fill { position: absolute; inset: 0 auto 0 0; }
.rack-fill.f-wall { background: var(--wall); }
.rack-fill.f-roof { background: var(--roof); }
.rack-fill.f-rest { background: var(--foam); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.rack-fill.f-reserved { background: repeating-linear-gradient(-45deg, var(--warn) 0 4px, #f6d48e 4px 8px); }
.rack-count { color: var(--steel-700); }
.rack-total { text-align: right; color: var(--steel-700); }
.rack-more { font-size: .82rem; color: var(--muted); padding-top: .35rem; }
.rack-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .78rem; color: var(--muted); padding: 0 1.1rem .8rem; }
.rack-legend span::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; vertical-align: -.05rem; }
.lg-wall::before { background: var(--wall); }
.lg-roof::before { background: var(--roof); }
.lg-rest::before { background: var(--foam); }
.lg-reserved::before { background: repeating-linear-gradient(-45deg, var(--warn) 0 3px, #f6d48e 3px 6px); }

.figures { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--steel-200); }
.figures > div { padding: .75rem 1.1rem; border-bottom: 1px solid var(--steel-100); }
.figures > div:nth-child(odd) { border-right: 1px solid var(--steel-100); }
.figures dt { font-size: .8rem; font-weight: 600; color: var(--steel-600); }
.figures dd { margin: .1rem 0 0; font-family: var(--font-cond); font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--steel-950); }
.figures dd small { font-family: var(--font); font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: .25rem; }
.figures .fg-title { grid-column: 1 / -1; background: #fafbfb; padding: .45rem 1.1rem; font-size: .8rem; font-weight: 600; color: var(--steel-700); border-right: 0 !important; }

.alert-list { padding: .4rem 1.1rem 1rem; display: grid; gap: .45rem; }
.alert-line { display: flex; gap: .55rem; align-items: flex-start; font-size: .875rem; padding: .5rem .7rem; border-radius: var(--radius); border-left: 4px solid; }
.alert-line.a-danger { background: var(--danger-100); border-color: var(--danger); color: #7d1a11; }
.alert-line.a-warn { background: var(--warn-100); border-color: var(--warn); color: #6b4400; }
.alert-line.a-info { background: var(--steel-100); border-color: var(--steel-400); color: var(--steel-800); }
.alert-line.a-ok { background: var(--ok-100); border-color: var(--ok); color: #1f5d39; }

.check-ok { color: var(--ok); }
.check-bad { color: var(--danger); }

/* ---------- Cutting diagram ---------- */
.cutplan { display: grid; gap: .9rem; }
.cutrow { border: 1px solid var(--steel-200); border-radius: var(--radius); padding: .7rem .8rem .75rem; background: var(--paper); }
.cutrow-head { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; margin-bottom: .5rem; font-size: .875rem; }
.cutrow-head .src { font-weight: 700; font-size: .95rem; }
.cutrow-head .meta { color: var(--steel-600); }
.cutrow-head .result { margin-left: auto; font-weight: 600; }
.result.r-rest { color: var(--foam-700); }
.result.r-waste { color: var(--danger); }
.result.r-none { color: var(--ok); }
.cutbar { display: flex; height: 36px; border: 1px solid var(--steel-400); border-radius: 2px; overflow: hidden; background: var(--steel-100); }
.seg { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; white-space: nowrap; font-family: var(--font-cond); font-weight: 600; font-size: .9rem; font-variant-numeric: tabular-nums; border-right: 1px solid rgba(255,255,255,.55); }
.seg:last-child { border-right: 0; }
.seg-cut.c-wall { background: var(--wall); color: #fff; }
.seg-cut.c-roof { background: var(--roof); color: #fff; }
.seg-cut.alt.c-wall { background: #2b6aa6; }
.seg-cut.alt.c-roof { background: #a14638; }
.seg-kerf { flex: 0 0 3px !important; background: var(--steel-950); border: 0; }
.seg-rest { background: var(--foam); color: var(--steel-950); }
.seg-waste { background: repeating-linear-gradient(-45deg, #f4c2bb 0 5px, #fbe2de 5px 10px); color: var(--danger); }
.seg .lbl { padding: 0 .3rem; overflow: hidden; text-overflow: ellipsis; }
.seg.narrow .lbl { display: none; }
.cutrow-pieces { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .45rem; font-size: .82rem; color: var(--steel-700); }
.cutrow-pieces a { font-weight: 600; text-decoration: none; }
.plan-summary { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; font-size: .875rem; color: var(--steel-700); margin-bottom: .8rem; }
.plan-summary strong { color: var(--steel-950); font-variant-numeric: tabular-nums; }
.shortage { border: 1px solid #efb5ae; background: var(--danger-100); border-radius: var(--radius); padding: .75rem .9rem; margin-bottom: .8rem; color: #7d1a11; }
.shortage h3 { font-size: 1.05rem; color: var(--danger); margin: 0 0 .35rem; }
.shortage ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Order page ---------- */
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
@media (max-width: 1199.98px) { .order-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: .35rem .75rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--steel-600); font-weight: 600; font-size: .82rem; padding-top: .1rem; }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.timeline li { position: relative; padding: 0 0 .8rem 1.3rem; }
.timeline li::before { content: ""; position: absolute; left: .25rem; top: .45rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--steel-300); }
.timeline li::after { content: ""; position: absolute; left: .49rem; top: 1.05rem; bottom: .05rem; width: 1px; background: var(--steel-200); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--steel-800); }
.timeline li.cancel::before { background: var(--danger); }
.timeline .when { color: var(--muted); font-size: .8rem; }
.action-stack { display: grid; gap: .5rem; }
.action-stack form { margin: 0; }
.action-stack .btn { width: 100%; text-align: left; display: flex; align-items: center; gap: .5rem; }
.next-step { font-size: .85rem; color: var(--steel-700); background: var(--steel-100); border-radius: var(--radius); padding: .55rem .7rem; }

/* ---------- Order form ---------- */
.lines-table td { vertical-align: top; }
.lines-table .form-control, .lines-table .form-select { font-size: .9rem; }
.lines-table .c-no { width: 2.4rem; color: var(--muted); padding-top: .9rem !important; font-variant-numeric: tabular-nums; }
.lines-table .c-cat { width: 13.5rem; }
.lines-table .c-qty { width: 6.5rem; }
.lines-table .c-len { width: 8.5rem; }
.lines-table .c-total { width: 7.5rem; padding-top: .85rem !important; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lines-table .c-del { width: 3rem; }
.lines-table tr.has-error td { background: var(--danger-100); }
.line-error { font-size: .8rem; color: var(--danger); }
.totals-bar { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; align-items: baseline; padding: .8rem 1.1rem; border-top: 1px solid var(--steel-200); background: #fafbfb; font-variant-numeric: tabular-nums; }
.totals-bar .t-grand { margin-left: auto; font-family: var(--font-cond); font-size: 1.4rem; font-weight: 700; }
.quick-add { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem 1.1rem; border-bottom: 1px solid var(--steel-200); background: #fafbfb; }
.quick-add .form-control { max-width: 320px; }
.quick-add .hint { font-size: .8rem; color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: rgba(241,243,244,.96); border-top: 1px solid var(--steel-200); padding: .75rem 0; display: flex; gap: .5rem; flex-wrap: wrap; }

/* Receipt category picker */
.catpick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.catpick input { position: absolute; opacity: 0; pointer-events: none; }
.catpick label { display: flex; align-items: center; gap: .7rem; border: 2px solid var(--steel-200); border-radius: var(--radius); padding: .7rem .85rem; cursor: pointer; background: var(--paper); font-weight: 600; }
.catpick label i { font-size: 1.4rem; }
.catpick .opt-wall i { color: var(--wall); }
.catpick .opt-roof i { color: var(--roof); }
.catpick input:checked + label.opt-wall { border-color: var(--wall); background: var(--wall-50); }
.catpick input:checked + label.opt-roof { border-color: var(--roof); background: var(--roof-50); }
.catpick input:focus-visible + label { outline: 2px solid var(--wall); outline-offset: 2px; }
.catpick small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.calc-out { font-family: var(--font-cond); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Login */
.auth-body { background: var(--steel-800); }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { color: #e9ecee; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand-mark { width: 64px; height: 38px; }
.auth-art h1 { color: #fff; font-size: 2.6rem; max-width: 14ch; line-height: 1.05; margin: 1.6rem 0 .8rem; }
.auth-art p { color: var(--steel-300); max-width: 42ch; }
.auth-section { width: 100%; max-width: 560px; height: auto; }
.auth-form { background: var(--paper); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 1.7rem; margin-bottom: 1.2rem; }
@media (max-width: 767.98px) { .auth { grid-template-columns: 1fr; } .auth-art { padding: 1.6rem; } .auth-art h1 { font-size: 1.9rem; } .auth-section { display: none; } }

/* Misc */
.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--steel-700); }
.empty-state i { font-size: 2rem; color: var(--steel-300); display: block; margin-bottom: .4rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.codes { font-size: .82rem; color: var(--steel-700); max-width: 30rem; }
.nowrap, .table-data td a[href^="order.php"], .table-data td a[href^="receipts.php?id"] { white-space: nowrap; }
.mov-in { color: var(--ok); }
.mov-out { color: var(--danger); }
.mov-zero { color: var(--steel-400); }
.bar-cell { position: relative; min-width: 110px; }
.bar-cell .bar { height: 8px; background: var(--steel-700); border-radius: 1px; }
.bar-cell .bar.b-wall { background: var(--wall); }
.bar-cell .bar.b-roof { background: var(--roof); }
.report-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.report-nav a { padding: .38rem .8rem; border: 1px solid var(--steel-300); border-radius: var(--radius); background: var(--paper); color: var(--steel-800); font-weight: 600; font-size: .875rem; text-decoration: none; }
.report-nav a:hover { background: var(--steel-100); }
.report-nav a.active { background: var(--steel-800); border-color: var(--steel-800); color: #fff; }
.modal-content { border-radius: 6px; border: 0; }
.modal-header { border-bottom-color: var(--steel-200); }
.modal-footer { border-top-color: var(--steel-200); }
.confirm-message { white-space: pre-line; }
.alert { border-radius: var(--radius); font-size: .9rem; }
.alert-info { --bs-alert-bg: var(--steel-100); --bs-alert-border-color: var(--steel-200); --bs-alert-color: var(--steel-900); }
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print (cutting sheet, reports) ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar-actions, .btn, .filters, .no-print, .skip-link, .alert-dismissible .btn-close, .pagination, .sticky-actions, form.inline-action { display: none !important; }
  .shell, .main { display: block; }
  .topbar { position: static; border: 0; padding: 0 0 6mm; }
  .content { padding: 0; max-width: none; }
  .panel { border: 1px solid #999; break-inside: avoid; }
  .order-grid { display: block; }
  .print-only { display: block; }
  .cutbar, .seg, .gauge-fill, .rack-fill, .st::before, .cat-tag::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
