:root{--bg:#f4f5f7;--panel:#fff;--text:#17191c;--muted:#6b7078;--line:#e5e7eb;--accent:#d71920;--dark:#1b1d20;--soft:#eef0f2;--ok:#198754;--warn:#d97706;--shadow:0 8px 30px rgba(20,25,30,.07)}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,select{font:inherit}button{cursor:pointer;border:0}.shell{display:flex;min-height:100vh}.side{width:238px;background:var(--dark);color:#fff;padding:20px 14px;position:fixed;inset:0 auto 0 0}.brand{display:flex;align-items:center;gap:10px;padding:4px 10px 26px}.brand img{width:34px;height:34px;object-fit:contain;background:#fff;border-radius:8px}.brand b{font-size:18px}.nav button{display:flex;width:100%;gap:11px;align-items:center;background:transparent;color:#cbd0d6;padding:12px;border-radius:10px;text-align:left;margin:3px 0}.nav button:hover,.nav button.active{background:#2a2d31;color:#fff}.main{margin-left:238px;flex:1;padding:24px 30px;max-width:1500px}.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:26px}.top h1{margin:0;font-size:27px}.sub{color:var(--muted);margin-top:5px}.actions{display:flex;gap:10px}.btn{padding:10px 15px;border-radius:9px;background:var(--soft);color:var(--text);font-weight:600}.btn.primary{background:var(--accent);color:#fff}.btn.dark{background:var(--dark);color:#fff}.grid{display:grid;gap:16px}.stats{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:22px}.card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;box-shadow:var(--shadow)}.stat .label{color:var(--muted)}.stat .num{font-size:30px;font-weight:750;margin-top:8px}.two{grid-template-columns:1.4fr 1fr}.section-title{font-weight:750;font-size:17px;margin-bottom:14px}.tablewrap{overflow:auto}.table{width:100%;border-collapse:collapse}.table th{font-size:12px;color:var(--muted);font-weight:650;text-align:left;padding:11px 10px;border-bottom:1px solid var(--line);white-space:nowrap}.table td{padding:12px 10px;border-bottom:1px solid var(--line);vertical-align:middle}.table tr:hover td{background:#fafafa}.badge{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:750}.b-open{background:#fff4df;color:#9a5a00}.b-stock{background:#e8f7ef;color:#167045}.b-bought{background:#eaf1ff;color:#2857a7}.b-request{background:#f0f1f3;color:#565c64}.search{border:1px solid var(--line);background:#fff;border-radius:9px;padding:10px 12px;min-width:250px}.toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:14px}.toolbar-left,.toolbar-right{display:flex;gap:10px;align-items:center}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.field label{display:block;font-size:12px;color:var(--muted);font-weight:650;margin-bottom:6px}.field input,.field select,.field textarea{width:100%;padding:10px 11px;border:1px solid var(--line);border-radius:9px;background:#fff;outline:none}.field textarea{min-height:90px;resize:vertical}.span2{grid-column:span 2}.orderhead{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.order-meta{display:flex;gap:22px;flex-wrap:wrap}.meta label{font-size:11px;color:var(--muted);display:block}.meta b{font-size:15px}.total{text-align:right}.total .big{font-size:29px;font-weight:800}.empty{padding:35px;text-align:center;color:var(--muted)}.login{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#1b1d20,#30343a)}.loginbox{width:min(420px,92vw);background:#fff;border-radius:18px;padding:32px;box-shadow:0 25px 80px rgba(0,0,0,.25)}.loginbrand{display:flex;align-items:center;gap:12px;margin-bottom:26px}.loginbrand img{width:45px;height:45px;object-fit:contain;border-radius:10px}.modalbg{position:fixed;inset:0;background:rgba(10,12,15,.48);display:grid;place-items:center;padding:20px;z-index:20}.modal{background:#fff;border-radius:16px;width:min(620px,96vw);padding:22px;box-shadow:0 25px 80px rgba(0,0,0,.25)}.modalhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.close{background:transparent;font-size:22px;color:var(--muted)}.toast{position:fixed;right:22px;bottom:22px;background:var(--dark);color:#fff;padding:12px 16px;border-radius:10px;z-index:30}.row-actions{display:flex;gap:7px}.muted{color:var(--muted)}@media(max-width:900px){.side{width:72px}.brand b,.nav span{display:none}.main{margin-left:72px;padding:20px}.stats{grid-template-columns:repeat(2,1fr)}.two{grid-template-columns:1fr}}@media(max-width:600px){.side{display:none}.main{margin-left:0;padding:15px}.stats{grid-template-columns:1fr 1fr}.formgrid{grid-template-columns:1fr}.span2{grid-column:auto}.toolbar,.top{align-items:flex-start;flex-direction:column}.search{min-width:0;width:100%}}
.brand{display:flex;flex-direction:column;align-items:flex-start;gap:7px;padding:6px 10px 25px}.brand img{width:190px;height:auto;max-height:62px;object-fit:contain;background:#fff;border-radius:5px;padding:4px}.brand b{font-size:13px;letter-spacing:.08em;color:#cbd0d6}.navgroup{font-size:10px;letter-spacing:.12em;color:#9298a1;font-weight:700;padding:16px 12px 5px}.iconbtn{width:36px;height:36px;border-radius:8px;background:var(--soft);color:var(--text);font-size:17px}.iconbtn.danger{color:#b4232c}.iconbtn:hover{background:#e5e7eb}.row-actions{align-items:center}.table th:last-child{min-width:180px}.field textarea{font:inherit}.empty{padding:30px;text-align:center;color:var(--muted)}@media(max-width:900px){.brand img{width:42px;height:42px;padding:2px}.brand{align-items:center}.navgroup{display:none}}
.brand img{background:transparent;border-radius:0;padding:0}.iconbtn{width:42px;height:42px;display:inline-grid;place-items:center;background:transparent;color:#202124;border:1px solid #c8cbd0;border-radius:9px}.iconbtn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.iconbtn:hover{background:#eceef0}.iconbtn.danger{color:#202124}.iconbtn.danger:hover{background:#f1e9e9}.loginbrand img{width:220px;height:auto;max-height:48px;object-fit:contain;flex:0 0 auto}.loginbrand{align-items:center;gap:16px}.brand b{font-size:12px}@media(max-width:900px){.brand img{width:42px;height:42px;object-fit:cover;border-radius:50%}}
@media(max-width:900px){.brand img{content:url("icon_metalstore.jpeg");width:42px;height:42px;object-fit:cover;border-radius:50%;background:transparent;padding:0}}
.nav button svg{width:21px;height:21px;flex:0 0 21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.nav .logout-link{margin-top:4px;color:#cbd0d6}.nav .logout-link:hover{background:#2a2d31;color:#fff}.profilecard{display:flex;gap:52px;flex-wrap:wrap}.profileitem{display:grid;gap:7px;min-width:160px}.profileitem b{font-size:16px}
.breakdown-toolbar{display:flex;align-items:end;gap:18px;flex-wrap:wrap;margin-bottom:18px}.model-picker{min-width:250px}.model-picker select{min-width:250px}.breakdown-date{display:grid;gap:5px;margin-right:auto}.breakdown-totals{display:flex;gap:14px;flex-wrap:wrap;margin:0 0 18px}.breakdown-totals>div{display:grid;gap:5px;min-width:235px;padding:13px 16px;background:#eef3f8;border:1px solid #d6e0eb;border-radius:8px}.breakdown-totals span{font-size:12px;color:var(--muted);font-weight:650}.breakdown-totals b{font-size:19px}.breakdown-table{min-width:1280px;border:1px solid #c9d3df;font-size:13px}.breakdown-table th{background:#4e80bc;color:#fff;border:1px solid #d5dce5;padding:9px 8px;white-space:normal}.breakdown-table td{border:1px solid #d8dee6;padding:8px;white-space:nowrap}.breakdown-table td:nth-child(1),.breakdown-table td:nth-child(4){white-space:normal;min-width:190px}.breakdown-table td.numeric{text-align:right;font-variant-numeric:tabular-nums}.breakdown-table td.editable{cursor:pointer}.breakdown-table td.editable:hover{outline:2px solid #4e80bc;outline-offset:-2px;background:#f5f8fc}.cell-editor{width:100%;min-width:78px;padding:6px 7px;border:1px solid #4e80bc;border-radius:4px;font:inherit}.breakdown-table td .iconbtn{width:34px;height:34px}@media(max-width:700px){.breakdown-toolbar{align-items:stretch;flex-direction:column}.model-picker,.model-picker select{width:100%;min-width:0}.breakdown-date{margin:0}}

.sort-button{display:inline-flex;align-items:center;gap:8px;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;cursor:pointer;padding:0}.sort-button span{font-size:18px;line-height:1}
/* MetalFlow refined tables, dialogs, and persistent light/dark theme */
:root{--bg:#f4f6f8;--panel:#fff;--text:#202833;--muted:#718096;--line:#e3e8ee;--accent:#d71920;--dark:#171b20;--soft:#eef2f6;--shadow:0 5px 18px rgba(25,39,52,.055);--table-head:#f1f4f7;--table-hover:#f8fafc;--field-bg:#fff;--head-text:#536273;--link:#1769aa}
html[data-theme="dark"]{color-scheme:dark;--bg:#12171d;--panel:#1b222b;--text:#e5ebf2;--muted:#9aa8b7;--line:#303b47;--accent:#ed343a;--dark:#0d1116;--soft:#27313c;--shadow:0 6px 20px rgba(0,0,0,.22);--table-head:#252e38;--table-hover:#222b35;--field-bg:#141a21;--head-text:#d2dae3;--link:#75baff}
html[data-theme="dark"] .table td,html[data-theme="dark"] .table th{border-color:var(--line)}
html[data-theme="dark"] .table tr:hover td{background:var(--table-hover)}
html[data-theme="dark"] .search,html[data-theme="dark"] .field input,html[data-theme="dark"] .field select,html[data-theme="dark"] .field textarea,html[data-theme="dark"] .cell-editor{background:var(--field-bg);color:var(--text);border-color:var(--line)}
html[data-theme="dark"] .modal{background:var(--panel);color:var(--text)}
html[data-theme="dark"] .breakdown-totals>div{background:#202b36;border-color:#344353}
html[data-theme="dark"] .breakdown-table td.editable:hover{background:#263748;outline-color:#6aa9df}
html[data-theme="dark"] .iconbtn{color:var(--text);border-color:var(--line)}
.theme-toggle{display:inline-flex;align-items:center;gap:7px;padding:8px 11px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--text);font-size:13px;font-weight:600}
.theme-toggle:hover{background:var(--soft)}
.table tr:hover td{background:var(--table-hover)}
.breakdown-table{border-color:var(--line);border-radius:9px;overflow:hidden;font-size:13px}
.breakdown-table th{background:var(--table-head);color:var(--head-text);border-color:var(--line);padding:9px 11px;font-size:12px;font-weight:650}
.breakdown-table td{border-color:var(--line);padding:6px 11px;height:35px}
.sort-button{gap:9px;color:var(--head-text)}
.sort-arrows{display:inline-grid;grid-template-rows:6px 6px;gap:1px;color:#aab4bf;font-size:9px;line-height:6px;vertical-align:middle}
.sort-arrows i{font-style:normal}
.sort-arrows.order-asc i:first-child,.sort-arrows.order-desc i:last-child{color:#2188d8}
.modalbg{backdrop-filter:blur(2px)}
.modal{border:1px solid var(--line)}
html[data-theme="dark"] .loginbox{background:var(--panel);color:var(--text)}
html[data-theme="dark"] .btn:not(.primary){background:var(--soft);color:var(--text)}
html[data-theme="dark"] .badge{filter:brightness(.82)}
html[data-theme="dark"] .b-open,html[data-theme="dark"] .b-stock,html[data-theme="dark"] .b-bought,html[data-theme="dark"] .b-request{color:#e5ebf2}
.theme-menu svg{width:21px;height:21px;flex:0 0 21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
/* Spreadsheet-like fixed and resizable columns for the model breakdown */
.breakdown-table{table-layout:fixed;width:max-content;min-width:1280px}
.breakdown-table th,.breakdown-table td{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.breakdown-table th:last-child{min-width:0}
.breakdown-table td:nth-child(1),.breakdown-table td:nth-child(4){min-width:0;white-space:nowrap}
.breakdown-table tr:focus-within td{background:var(--table-hover)}
.col-resizer{position:absolute;z-index:2;right:-3px;top:0;bottom:0;width:8px;cursor:col-resize;touch-action:none;user-select:none}
.col-resizer:hover:after,.col-resizer:active:after{content:"";position:absolute;left:3px;top:0;bottom:0;width:2px;background:#2386d5}
body.resizing-column{cursor:col-resize!important;user-select:none!important}
.sort-button .sort-arrows{font-size:8px;line-height:5px;grid-template-rows:5px 5px;gap:0;vertical-align:middle}
.sort-arrows i{font-size:8px;line-height:5px}
.breakdown-table{min-width:0}
/* Shared high-contrast table system */
:root{--grid-head:#e7edf4;--grid-head-text:#26384b;--grid-border:#cbd6e2;--grid-row:#ffffff;--grid-alt:#f4f7fa;--grid-hover:#e8f1f9;--side-bg:#f8fafc;--side-text:#354456;--side-muted:#718096;--side-active:#e8eef5;--side-border:#d6dfe8}
html[data-theme="dark"]{--grid-head:#303d4b;--grid-head-text:#f2f5f8;--grid-border:#465564;--grid-row:#1b242d;--grid-alt:#222d38;--grid-hover:#2a3948;--side-bg:#10171e;--side-text:#dce4ec;--side-muted:#9aa8b6;--side-active:#293642;--side-border:#303b46}
.side{background:var(--side-bg);color:var(--side-text);border-right:1px solid var(--side-border);transition:background .2s ease,color .2s ease}
.brand b{color:var(--side-text)}
.navgroup{color:var(--side-muted)}
.nav button{color:var(--side-text);transition:background .15s ease,color .15s ease}
.nav button:hover,.nav button.active{background:var(--side-active);color:var(--text)}
.nav .logout-link{color:var(--side-muted)}
.nav .logout-link:hover{background:var(--side-active);color:var(--text)}
/* Keep every application grid visually consistent with Desgloses */
.table{width:100%;border:1px solid var(--grid-border);border-collapse:separate;border-spacing:0;border-radius:10px;overflow:hidden;background:var(--grid-row);color:var(--text)}
.table th{background:var(--grid-head);color:var(--grid-head-text);font-size:12px;font-weight:700;padding:11px 12px;border-right:1px solid var(--grid-border);border-bottom:1px solid var(--grid-border);white-space:nowrap}
.table td{background:var(--grid-row);color:var(--text);padding:9px 12px;height:40px;vertical-align:middle;border-right:1px solid var(--grid-border);border-bottom:1px solid var(--grid-border)}
.table th:last-child,.table td:last-child{border-right:0}
.table tbody tr:nth-child(even) td{background:var(--grid-alt)}
.table tbody tr:hover td{background:var(--grid-hover)}
.table tbody tr:last-child td{border-bottom:0}
html[data-theme="dark"] .table th,html[data-theme="dark"] .table td{border-color:var(--grid-border)}
html[data-theme="dark"] .table tbody tr:nth-child(even) td{background:var(--grid-alt)}
html[data-theme="dark"] .table tbody tr:hover td{background:var(--grid-hover)}
html[data-theme="dark"] .table .empty{color:#c2ccd6}
/* Consistent red actions with a clear outlined hover state */
.btn.primary,.btn.danger{background:#d71920;color:#fff;border:2px solid #d71920;transition:background-color .16s ease,color .16s ease,border-color .16s ease}
.btn.primary:hover,.btn.danger:hover{background:transparent;color:#111820;border:2px solid #d71920}
.btn.primary:focus-visible,.btn.danger:focus-visible{outline:3px solid rgba(215,25,32,.24);outline-offset:2px}
/* A calmer, more spacious profile layout */
.profile-card{max-width:980px;padding:30px 32px}
.profile-card-head{display:flex;align-items:center;gap:16px;padding-bottom:22px;margin-bottom:24px;border-bottom:1px solid var(--line)}
.profile-avatar{width:54px;height:54px;flex:0 0 54px;display:grid;place-items:center;border-radius:15px;background:var(--soft);color:var(--accent);font-size:23px;font-weight:750}
.profile-card-head h2{margin:0 0 5px;font-size:18px;color:var(--text)}
.profile-card-head p{margin:0;color:var(--muted);line-height:1.5}
.profile-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px;row-gap:23px}
.profile-form-grid .field label{font-size:13px;color:var(--text);margin-bottom:8px}
.profile-form-grid .field input{min-height:45px;background:var(--field-bg);color:var(--text);border:1px solid var(--grid-border);border-radius:8px}
.profile-form-grid .field input:focus{border-color:#4c8ac0;box-shadow:0 0 0 3px rgba(76,138,192,.16)}
.profile-form-grid .field small{display:block;margin-top:7px;color:var(--muted);font-size:12px;line-height:1.45}
.profile-form-grid .field input:disabled{background:var(--soft);color:var(--muted)}
.profile-card-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:28px;padding-top:20px;border-top:1px solid var(--line)}
.profile-card-actions .btn{min-width:150px}
html[data-theme="dark"] .profile-form-grid .field input:disabled{background:#293541}
@media(max-width:700px){.profile-card{padding:22px}.profile-form-grid{grid-template-columns:1fr;row-gap:18px}.profile-card-actions{align-items:stretch;flex-direction:column-reverse}.profile-card-actions .btn{width:100%}}
/* Shared color transition across the entire interface */
body,.side,.main,.card,.table,.table th,.table td,.btn,.iconbtn,.theme-menu,.field input,.field select,.field textarea,.search,.modal,.breakdown-totals>div{transition:background-color .24s ease,color .24s ease,border-color .24s ease,box-shadow .24s ease}
/* Same red action style for every icon action inside every grid */
.table .iconbtn{width:30px;height:30px;padding:0;display:inline-grid;place-items:center;border:2px solid #d71920;border-radius:7px;background:#d71920;color:#fff}
.table .iconbtn svg{width:17px;height:17px;stroke:currentColor}
.table .iconbtn:hover,.table .iconbtn:focus-visible{background:transparent;color:#111820;border:2px solid #d71920}
html[data-theme="dark"] .table .iconbtn:hover,html[data-theme="dark"] .table .iconbtn:focus-visible{color:#111820;background:transparent}
.table th{user-select:none}
.profile-card-head{gap:0}
/* Theme-aware hover states requested for action buttons and grid icons */
.btn:not(.primary):not(.danger){border:1px solid transparent}
.btn:not(.primary):not(.danger):hover,.btn:not(.primary):not(.danger):focus-visible{border:1px solid #d71920}
.btn.primary:hover,.btn.danger:hover{background:transparent;color:#111820;border:2px solid #d71920}
html[data-theme="dark"] .btn.primary:hover,html[data-theme="dark"] .btn.danger:hover{color:#fff}
html[data-theme="dark"] .table .iconbtn:hover,html[data-theme="dark"] .table .iconbtn:focus-visible{background:transparent;color:#fff;border-color:#d71920}
/* Desgloses bottom action and in-app destructive confirmation */
.breakdown-bottom-add{display:flex;justify-content:flex-end;padding-top:14px}
.confirm-dialog{width:min(460px,96vw)}
.confirm-dialog>p{margin:8px 0 24px;color:var(--text);line-height:1.55}
.confirm-actions{justify-content:flex-end}
/* Keep the destructive confirmation action red in both themes */
.confirm-dialog .btn.danger{background:#d71920;color:#fff;border:2px solid #d71920}
.confirm-dialog .btn.danger:hover,.confirm-dialog .btn.danger:focus-visible{background:transparent;color:#111820;border:2px solid #d71920}
html[data-theme="dark"] .confirm-dialog .btn.danger:hover,html[data-theme="dark"] .confirm-dialog .btn.danger:focus-visible{color:#fff}/* Dark theme: destructive confirmation button uses the requested red/outline hover */
html[data-theme="dark"] .confirm-dialog .btn.danger{background:#d71920;color:#fff;border:2px solid #d71920}
html[data-theme="dark"] .confirm-dialog .btn.danger:hover,html[data-theme="dark"] .confirm-dialog .btn.danger:focus-visible{background:transparent;color:#fff;border:2px solid #d71920}/* Keep the requested catalog and order grids inside the available viewport */
.table.fit-grid{width:100%!important;table-layout:fixed}
.table.fit-grid th,.table.fit-grid td{white-space:normal;overflow-wrap:anywhere;word-break:normal}
.table.fit-grid .row-actions{white-space:normal;flex-wrap:wrap;gap:4px}
.table.fit-grid .col-resizer{right:-2px}
/* Manufacturing order component state colors */
.order-items-table .order-item-row>td{transition:background-color .2s ease,color .2s ease}
.table.order-items-table tbody tr.order-status-pendiente>td{background:#fee2e2;color:#571a1a}
.table.order-items-table tbody tr.order-status-solicitado>td{background:#ffedd5;color:#63330b}
.table.order-items-table tbody tr.order-status-pagado>td{background:#fef3c7;color:#5b4300}
.table.order-items-table tbody tr.order-status-en_stock>td{background:#dcfce7;color:#14532d}
.order-state-selector{min-width:112px;padding:6px 8px;border:1px solid var(--grid-border);border-radius:7px;background:var(--panel);color:var(--text);font-weight:650}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-pendiente>td{background:#54282b;color:#ffe4e6}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-solicitado>td{background:#56391f;color:#ffedd5}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-pagado>td{background:#55491f;color:#fef3c7}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-en_stock>td{background:#21452f;color:#dcfce7}
/* High contrast status badges in the manufacturing orders grid */
.orders-table .badge.b-open{background:#fff0c2;color:#713f00;border:1px solid #d89a18;filter:none;font-weight:750}
.orders-table .badge.b-stock{background:#dcfce7;color:#14532d;border:1px solid #49a66b;filter:none;font-weight:750}
html[data-theme="dark"] .orders-table .badge.b-open{background:#623a11;color:#ffe1a8;border-color:#d89a18;filter:none}
html[data-theme="dark"] .orders-table .badge.b-stock{background:#17452c;color:#c1f2d0;border-color:#49a66b;filter:none}
/* High-visibility status palette for workshop lighting, in both themes */
.order-costs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:22px}
.order-cost{display:flex;flex-direction:column;justify-content:center;gap:8px;min-height:82px;padding:13px 16px;border-radius:8px;border:1px solid var(--grid-border);background:var(--panel)}
.order-cost span{font-size:11px;font-weight:800;letter-spacing:.045em}
.order-cost b{font-size:22px;font-weight:850;font-variant-numeric:tabular-nums}
.order-cost.net{border-left:5px solid #1976d2}
.order-cost.gross{border-left:5px solid #6a1b9a}
.order-cost.purchased{border-left:5px solid #008c6a}
.order-cost.pending{border-left:5px solid #ef6c00}
.order-items-table .order-item-row>td{transition:background-color .18s ease,color .18s ease}
.table.order-items-table tbody tr.order-status-pendiente>td{background:#c62828;color:#fff}
.table.order-items-table tbody tr.order-status-solicitado>td{background:#ef6c00;color:#fff}
.table.order-items-table tbody tr.order-status-pagado>td{background:#ffd600;color:#171717}
.table.order-items-table tbody tr.order-status-en_stock>td{background:#2e7d32;color:#fff}
.order-state-selector{min-width:112px;padding:6px 8px;border:2px solid currentColor;border-radius:6px;background:rgba(0,0,0,.18);color:inherit;font-weight:800}
.order-state-selector option{background:var(--panel);color:var(--text)}
html[data-theme="dark"] .order-cost{background:#202a34;border-color:#536273;color:#fff}
html[data-theme="dark"] .order-cost.net{border-left-color:#42a5f5}
html[data-theme="dark"] .order-cost.gross{border-left-color:#ce93d8}
html[data-theme="dark"] .order-cost.purchased{border-left-color:#00c896}
html[data-theme="dark"] .order-cost.pending{border-left-color:#ff9800}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-pendiente>td{background:#c62828;color:#fff}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-solicitado>td{background:#ef6c00;color:#fff}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-pagado>td{background:#ffd600;color:#171717}
html[data-theme="dark"] .table.order-items-table tbody tr.order-status-en_stock>td{background:#2e7d32;color:#fff}
@media(max-width:900px){.order-costs{grid-template-columns:1fr 1fr}}
@media(max-width:600px){.order-costs{grid-template-columns:1fr}}
/* Clear row tracking on the vivid order-state backgrounds */
.table.order-items-table tbody tr.order-item-row:hover>td{background:#626b75!important;color:#fff!important}
html[data-theme="dark"] .table.order-items-table tbody tr.order-item-row:hover>td{background:#7b858f!important;color:#fff!important}
.table.order-items-table tbody tr.order-item-row:hover .order-state-selector{background:#454d56;color:#fff;border-color:#fff}
/* Compact, neutral financial summary above the order grid */
.order-cost{border:1px solid var(--grid-border)!important;border-left:1px solid var(--grid-border)!important;background:#eef2f5;color:#24313d;min-height:70px;padding:11px 14px}
.order-cost span{font-size:10px;letter-spacing:.035em;color:#536273}
.order-cost b{font-size:18px;font-weight:750}
html[data-theme="dark"] .order-cost{background:#252f39;color:#f1f4f7;border-color:#52606c!important}
html[data-theme="dark"] .order-cost span{color:#bdc8d2}
/* Filter and column autosize tools for the order detail grid */
.order-grid-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 12px}
.order-grid-tools .search{flex:1;min-width:180px;max-width:460px}
.order-grid-tools .btn{white-space:nowrap}
.table.order-items-table{font-variant-numeric:tabular-nums}
.table.order-items-table.fit-grid th,.table.order-items-table.fit-grid td{white-space:nowrap;overflow-wrap:normal}
.table.order-items-table:not(.fit-grid){width:max-content;min-width:100%}
@media(max-width:650px){.order-grid-tools{align-items:stretch;flex-direction:column}.order-grid-tools .search{width:100%;max-width:none}.order-grid-tools .btn{align-self:flex-end}}

/* Expandable navigation rail */
.side{z-index:15;transition:width .24s ease,padding .24s ease,background-color .24s ease,color .24s ease}
.main{transition:margin-left .24s ease,padding .24s ease}
.brand{align-items:stretch;gap:7px;padding:6px 0 25px}
.brand-top{display:flex;align-items:center;justify-content:space-between;gap:7px;min-width:0}
.brand img{flex:1 1 auto;width:156px;min-width:0;max-height:34px;object-fit:contain;background:transparent;border-radius:0;padding:0}
.sidebar-toggle{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;padding:0;border:1px solid var(--side-border);border-radius:8px;background:transparent;color:var(--side-text);cursor:pointer;transition:background-color .2s ease,color .2s ease,border-color .2s ease}
.sidebar-toggle:hover{background:var(--side-active);color:var(--text)}
.sidebar-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.shell.sidebar-collapsed .side{width:72px;padding:16px 10px}
.shell.sidebar-collapsed .main{margin-left:72px}
.shell.sidebar-collapsed .brand{align-items:center;padding:4px 0 22px}
.shell.sidebar-collapsed .brand-top{flex-direction:column;gap:8px}
.shell.sidebar-collapsed .brand img{width:36px;height:36px;min-width:36px;max-height:36px;flex:0 0 36px;object-fit:cover;border-radius:50%}
.shell.sidebar-collapsed .brand b,.shell.sidebar-collapsed .nav span,.shell.sidebar-collapsed .navgroup{display:none}
.shell.sidebar-collapsed .nav button{justify-content:center;gap:0;padding:12px 8px}
@media(max-width:900px){
  .side{width:238px;padding:20px 14px}
  .brand{align-items:stretch}
  .brand img{width:156px;height:auto;max-height:34px;object-fit:contain;border-radius:0;content:initial!important}
  .brand b,.nav span{display:block}
  .navgroup{display:block}
  .shell.sidebar-collapsed .side{width:72px;padding:16px 10px}
  .shell.sidebar-collapsed .brand{align-items:center}
  .shell.sidebar-collapsed .brand b,.shell.sidebar-collapsed .nav span,.shell.sidebar-collapsed .navgroup{display:none}
  .shell.sidebar-collapsed .main{margin-left:72px}
}
@media(max-width:600px){
  .side{display:block;box-shadow:0 8px 24px rgba(0,0,0,.14)}
  .main{margin-left:72px;padding:15px}
  .shell:not(.sidebar-collapsed) .side{width:238px}
  .shell:not(.sidebar-collapsed) .main{margin-left:72px}
}

/* Use the available horizontal space across every application section */
.main{max-width:none;min-width:0}
.shell.sidebar-collapsed .order-items-table{min-width:100%}

/* Orders list: visible status chips and row-based open action */
.orders-table tbody tr.order-row{cursor:pointer}
.orders-table tbody tr.order-row:hover>td{background:#edf2f7;color:#17212b}
.orders-table tbody tr.order-row:focus-visible>td{outline:2px solid var(--accent);outline-offset:-2px}
.order-status-badge{display:inline-flex;align-items:center;justify-content:center;min-width:98px;padding:5px 11px;border:1px solid transparent;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.045em;line-height:1.2}
.order-status-badge.order-open{background:#fff0c2;color:#684100;border-color:#d99500}
.order-status-badge.order-finished{background:#d9f4e4;color:#115b35;border-color:#20834c}
html[data-theme="dark"] .orders-table tbody tr.order-row:hover>td{background:#2b3845;color:#f4f7fa}
html[data-theme="dark"] .order-status-badge.order-open{background:#60440d;color:#ffe29b;border-color:#f2b629}
html[data-theme="dark"] .order-status-badge.order-finished{background:#174b34;color:#c6f6d7;border-color:#36a269}

/* Orders list status is plain text; the table uses its full width without horizontal scrolling. */
.order-status-text{border:0!important;background:none!important;padding:0!important;border-radius:0!important;letter-spacing:0}
.order-status-text.order-open{font-weight:800}
.order-status-text.order-closed{font-weight:400}
.orders-table.fit-grid{width:100%!important}
.orders-table.fit-grid th,.orders-table.fit-grid td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Keep order detail cells inside their manually resizable columns. */
.table.order-items-table th,.table.order-items-table td{box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal}
.table.order-items-table:not(.fit-grid){table-layout:fixed}

.order-item-status-readonly{font-weight:750;cursor:default}

/* Dashboard: compact manufacturing overview */
.dashboard-hero{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:4px 0 22px;padding:26px 30px;border:1px solid #303e4a;border-left:4px solid #d71920;border-radius:14px;background:#202a34;color:#fff}
.dashboard-eyebrow{color:#f0787d;font-size:11px;font-weight:800;letter-spacing:.12em}
.dashboard-hero-labels{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.dashboard-current-date{color:#d2dae2;font-size:12px;font-weight:600}
.brand b{max-width:100%;font-size:10px;line-height:1.35;letter-spacing:.035em;overflow-wrap:anywhere}
.dashboard-hero h2{margin:10px 0 6px;color:#fff;font-size:26px;letter-spacing:-.02em}
.dashboard-hero p{margin:0;color:#c3ccd5;font-size:14px}
.dashboard-actions{display:flex;align-items:center;gap:10px;flex-shrink:0}
.dashboard-hero .btn:not(.primary){background:transparent;color:#f4f6f8;border:1px solid #64717d}
.dashboard-hero .btn:not(.primary):hover{border-color:#d71920;color:#fff}
.dashboard-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:22px}
.dashboard-metric{display:flex;min-width:0;min-height:156px;flex-direction:column;align-items:flex-start;justify-content:center;gap:12px;padding:20px 22px;border:1px solid var(--line);border-left:4px solid #d71920;border-radius:13px;background:var(--panel);box-shadow:var(--shadow)}
.dashboard-metric.metric-items{border-left-color:#d97706}.dashboard-metric.metric-amount{border-left-color:#16836b}
.metric-top{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px}
.metric-icon{display:grid;width:32px;height:32px;place-items:center;border-radius:9px;background:#fce8e8;color:#c41620;font-size:18px;font-weight:800}
.metric-items .metric-icon{background:#fff0dc;color:#a65b00}.metric-amount .metric-icon{background:#e1f4ef;color:#08735d}
.metric-label{color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.09em}
.dashboard-metric>strong{font-size:35px;line-height:1.05;font-weight:760;letter-spacing:-.035em;font-variant-numeric:tabular-nums}
.dashboard-metric.metric-amount>strong{font-size:30px}
.metric-note{color:var(--muted);font-size:12px;line-height:1.4}
.dashboard-hide-switch{position:relative;display:flex;align-items:center;gap:8px;color:var(--muted);font-size:12px;font-weight:600;cursor:pointer;user-select:none}
.dashboard-hide-switch input{position:absolute;width:1px;height:1px;opacity:0}
.dashboard-hide-switch i{position:relative;width:34px;height:19px;border:1px solid #a8b1ba;border-radius:20px;background:#e1e5e9;transition:background .18s,border-color .18s}
.dashboard-hide-switch i:after{position:absolute;top:2px;left:2px;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;content:"";transition:transform .18s}
.dashboard-hide-switch input:checked+i{border-color:#d71920;background:#d71920}
.dashboard-hide-switch input:checked+i:after{transform:translateX(15px)}
.dashboard-hide-switch input:focus-visible+i{outline:3px solid #d7192055;outline-offset:2px}
.dashboard-recent{padding:22px 24px}
.dashboard-section-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.dashboard-section-head h2{margin:0;font-size:19px;letter-spacing:-.02em}
.dashboard-section-head p{margin:5px 0 0;color:var(--muted);font-size:13px}
.dashboard-recent .tablewrap{overflow-x:hidden}
.dashboard-orders-table{width:100%;min-width:0;table-layout:fixed}
.dashboard-orders-table th,.dashboard-orders-table td{padding:14px 12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dashboard-orders-table th:nth-child(1),.dashboard-orders-table td:nth-child(1){width:17%}
.dashboard-orders-table th:nth-child(2),.dashboard-orders-table td:nth-child(2){width:25%}
.dashboard-orders-table th:nth-child(3),.dashboard-orders-table td:nth-child(3){width:12%}
.dashboard-orders-table th:nth-child(4),.dashboard-orders-table td:nth-child(4){width:15%}
.dashboard-orders-table th:nth-child(5),.dashboard-orders-table td:nth-child(5){width:21%}
.dashboard-orders-table th:nth-child(6),.dashboard-orders-table td:nth-child(6){width:5%;padding-right:8px;padding-left:4px}
.dashboard-order-row{cursor:pointer;transition:background-color .15s ease}
.dashboard-order-row:hover td{background:#f1f4f6!important}
.dashboard-order-row:focus-visible td{outline:2px solid #d71920;outline-offset:-2px}
.dashboard-order-row td:first-child strong{color:#b91720}
.dashboard-open{text-align:right;color:var(--muted);font-size:19px}
.dashboard-order-state{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:700}
.dashboard-order-state:before{width:7px;height:7px;border-radius:50%;background:#d97706;content:""}
.dashboard-order-state.is-closed:before{background:#218652}
.dashboard-empty{display:flex;align-items:center;gap:16px;padding:28px 4px}
.dashboard-empty-mark{display:grid;width:42px;height:42px;flex:0 0 auto;place-items:center;border-radius:12px;background:#fce8e8;color:#bd1820;font-size:24px}
.dashboard-empty strong{font-size:15px}.dashboard-empty p{margin:5px 0 0;color:var(--muted);font-size:13px}
.dashboard-empty .btn{margin-left:auto;flex:0 0 auto}
html[data-theme="dark"] .dashboard-metric{background:var(--panel);border-color:#34414d}
html[data-theme="dark"] .metric-icon{background:#4a2b30;color:#ffb8bd}
html[data-theme="dark"] .metric-items .metric-icon{background:#4b3824;color:#ffd39b}
html[data-theme="dark"] .metric-amount .metric-icon{background:#1f443b;color:#9be1cf}
html[data-theme="dark"] .dashboard-hide-switch i{background:#38434d;border-color:#71808d}
html[data-theme="dark"] .dashboard-hide-switch input:checked+i{background:#d71920;border-color:#d71920}
html[data-theme="dark"] .dashboard-order-row:hover td{background:#2b3845!important;color:#f4f7fa}
html[data-theme="dark"] .dashboard-order-row td:first-child strong{color:#ff777d}
html[data-theme="dark"] .dashboard-empty-mark{background:#4a2b30;color:#ffb8bd}
@media(max-width:900px){.dashboard-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-metric.metric-amount{grid-column:1/-1}}
@media(max-width:600px){.dashboard-hero,.dashboard-section-head{align-items:flex-start;flex-direction:column}.dashboard-hero{padding:22px}.dashboard-actions{width:100%;flex-wrap:wrap}.dashboard-metrics{grid-template-columns:1fr}.dashboard-metric.metric-amount{grid-column:auto}.dashboard-section-head{gap:12px}.dashboard-empty{align-items:flex-start;flex-wrap:wrap}.dashboard-empty .btn{margin-left:58px}}

/* Dashboard brand and theme-aware presentation */
.dashboard-brand{color:#fff;font-size:26px;line-height:1.2;font-weight:760;letter-spacing:-.02em}
.dashboard-current-date{margin-top:8px;color:#fff;font-size:14px;font-weight:600}
.dashboard-hero p{margin-top:12px}
html[data-theme="light"] .dashboard-hero{background:#d71920;border-color:#bd151b;color:#fff}
html[data-theme="light"] .dashboard-hero .btn.primary{background:#fff;border-color:#fff;color:#b9161d}
html[data-theme="light"] .dashboard-hero .btn.primary:hover{background:transparent;border-color:#fff;color:#fff}
html[data-theme="dark"] .dashboard-hero{background:#202a34;border-color:#303e4a;color:#fff}
.metric-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .dashboard-metric.metric-orders{border-left-color:#d71920}
html[data-theme="dark"] .dashboard-metric.metric-items{border-left-color:#d97706}
html[data-theme="dark"] .dashboard-metric.metric-amount{border-left-color:#16836b}
.dashboard-orders-table th:nth-child(1),.dashboard-orders-table td:nth-child(1){width:18%}
.dashboard-orders-table th:nth-child(2),.dashboard-orders-table td:nth-child(2){width:28%}
.dashboard-orders-table th:nth-child(3),.dashboard-orders-table td:nth-child(3){width:13%}
.dashboard-orders-table th:nth-child(4),.dashboard-orders-table td:nth-child(4){width:17%}
.dashboard-orders-table th:nth-child(5),.dashboard-orders-table td:nth-child(5){width:24%}

/* Dashboard KPI icons: monochrome, without colored tiles */
.dashboard-metric .metric-icon{width:26px;height:26px;padding:0;border:0;border-radius:0;background:transparent;color:#17191c;font-size:20px}
html[data-theme="dark"] .dashboard-metric .metric-icon{background:transparent;color:#fff}

/* Polished MetalFlow sign-in screen */
.loginbox{width:min(440px,92vw);padding:38px 36px 32px;border:1px solid #ffffffa8;border-radius:20px}
.loginbrand{display:flex;flex-direction:column;align-items:center;gap:16px;margin:0 0 30px}
.loginbrand img{display:block;width:min(270px,100%);height:auto;max-height:64px;object-fit:contain;border-radius:0}
.loginbrand strong{color:#202a34;text-align:center;font-size:15px;line-height:1.35;font-weight:780;letter-spacing:.045em}
.loginbox .field label{margin-bottom:7px;color:#4d5965}
.loginbox .field input{min-height:44px;border-color:#d7dde3;background:#fbfcfd}
.loginbox .field input:focus{border-color:#d71920;box-shadow:0 0 0 3px #d719201c}
.loginbox .btn.primary{min-height:46px;border-radius:9px;letter-spacing:.01em}
.loginbox #le{min-height:18px}
html[data-theme="dark"] .loginbrand strong{color:#f4f6f8}
html[data-theme="dark"] .loginbrand img{mix-blend-mode:lighten}
@media(max-width:480px){.loginbox{padding:30px 24px}.loginbrand img{width:min(240px,100%)}}
.order-editable{cursor:pointer;text-decoration:underline;text-decoration-style:dotted;text-decoration-color:transparent;text-underline-offset:3px}
.order-editable:hover{ text-decoration-color:currentColor }
.order-inline-editor{width:100%;min-width:58px;padding:3px 5px;border:1px solid var(--accent);border-radius:5px;background:var(--field-bg);color:var(--text);font:inherit;text-align:inherit;outline:none}
.order-inline-editor:focus{box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 22%,transparent)}
.breakdown-grid-filter{display:flex;justify-content:flex-start;margin:0 0 10px}
.breakdown-grid-filter .search{width:min(100%,420px)}

/* App release label pinned to the sidebar bottom */
.side{display:flex;flex-direction:column}.nav{flex:1;min-height:0;overflow-y:auto}.sidebar-version{flex:0 0 auto;margin-top:auto;padding:12px 10px 2px;border-top:1px solid rgba(203,208,214,.18);color:#9298a1;font-size:11px;font-weight:650;letter-spacing:.04em;text-align:center}

.app-version-inline{font-size:11px;font-weight:650;letter-spacing:.04em}.login-brand-name{display:flex;align-items:baseline;justify-content:center;gap:8px;flex-wrap:wrap}.loginbrand .app-version-inline{color:var(--muted)}.dashboard-brand .app-version-inline{color:rgba(255,255,255,.82)}

/* Números de serie: tabla adaptable sin desplazamiento horizontal */
.serial-numbers-table{width:100%;max-width:100%;min-width:0;table-layout:fixed}
.serial-numbers-table th:last-child,.serial-numbers-table td:last-child{min-width:0}
.serial-numbers-table th,.serial-numbers-table td{white-space:normal;overflow-wrap:anywhere;word-break:normal}
.serial-numbers-table th:nth-child(1),.serial-numbers-table td:nth-child(1){width:19%}
.serial-numbers-table th:nth-child(2),.serial-numbers-table td:nth-child(2){width:19%}
.serial-numbers-table th:nth-child(3),.serial-numbers-table td:nth-child(3){width:25%}
.serial-numbers-table th:nth-child(4),.serial-numbers-table td:nth-child(4){width:13%}
.serial-numbers-table th:nth-child(5),.serial-numbers-table td:nth-child(5){width:24%}

/* Global tables fit their container; grid columns wrap to avoid horizontal scrolling. */
.tablewrap{max-width:100%;overflow-x:hidden!important}
table.table{width:100%;max-width:100%;table-layout:fixed}
table.table th,table.table td{white-space:normal;overflow-wrap:anywhere;word-break:normal}
table.table th{line-height:1.25}


/* Tema claro: contraste reforzado para lectura cómoda en taller. */
html[data-theme="light"]{color-scheme:light;--bg:#e3e8ed;--panel:#ffffff;--text:#111b25;--muted:#354453;--line:#aab6c2;--accent:#d71920;--dark:#18222c;--soft:#e0e6eb;--shadow:0 5px 18px rgba(24,38,52,.10);--table-head:#40566d;--table-hover:#cbd5df;--field-bg:#fff;--head-text:#fff;--link:#005b9a;--grid-head:#40566d;--grid-head-text:#fff;--grid-border:#8291a0;--grid-row:#fff;--grid-alt:#e4e9ee;--grid-hover:#c9d4de;--side-bg:#e3e8ed;--side-text:#162331;--side-muted:#374756;--side-active:#c5d0db;--side-border:#9caab7}
html[data-theme="light"] .card,html[data-theme="light"] .modal{border-color:#aab6c2}
html[data-theme="light"] .field input,html[data-theme="light"] .field select,html[data-theme="light"] .field textarea,html[data-theme="light"] .search,html[data-theme="light"] .cell-editor{border-color:#8f9eac;color:#111b25;background:#fff}
html[data-theme="light"] .field input:focus,html[data-theme="light"] .field select:focus,html[data-theme="light"] .field textarea:focus,html[data-theme="light"] .search:focus{border-color:#b9151b;box-shadow:0 0 0 2px #d7192030}
html[data-theme="light"] .table .empty{color:#354453}
.breakdown-select-prompt{padding:34px 14px;text-align:center;color:var(--muted);border-top:1px solid var(--line);margin-top:12px}
html[data-theme="light"] .btn:not(.primary):not(.danger){border:1px solid #aab6c2}

/* Botones neutros e iconos: realce rojo al pasar el mouse en tema claro. */
html[data-theme="light"] .btn:not(.primary):not(.danger):not(.dark):hover,html[data-theme="light"] .btn:not(.primary):not(.danger):not(.dark):focus-visible{background:transparent!important;color:#c41620!important;border:2px solid #d71920!important}
html[data-theme="light"] .iconbtn:hover,html[data-theme="light"] .iconbtn:focus-visible,html[data-theme="light"] .table .iconbtn:hover,html[data-theme="light"] .table .iconbtn:focus-visible{background:transparent!important;color:#c41620!important;border:2px solid #d71920!important}
/* El valor actualmente seleccionado queda destacado en Familia y Modelo. */
.breakdown-toolbar .field select{font-weight:700}
.breakdown-toolbar .field select option{font-weight:400}
.breakdown-toolbar .field select option:checked{font-weight:700}

/* Acciones del Dashboard fuera del banner principal. */
.dashboard-page-actions{justify-content:flex-end;margin:-8px 0 18px}
@media(max-width:600px){.dashboard-page-actions{justify-content:flex-start;margin:0 0 16px}}


/* Order-level actions grouped above the component grid. */
.order-header-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px}
@media(max-width:760px){.order-header-actions{width:100%;justify-content:flex-start}}
/* Blend the white JPG canvas into the light sidebar. */
html[data-theme="light"] .side .brand img{background:transparent;mix-blend-mode:multiply}

/* Copias de seguridad */
.backup-settings-head,.backup-history .section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.backup-settings h2,.backup-history h2{margin:0 0 6px;font-size:18px}
.backup-settings p,.backup-history .section-head p{margin:0;color:var(--muted)}
.backup-form{display:flex;align-items:flex-end;flex-wrap:wrap;gap:18px;margin-top:24px}
.backup-form .field{min-width:170px}
.backup-toggle{display:flex;align-items:center;gap:10px;min-height:42px;font-weight:700;cursor:pointer}
.backup-toggle input{width:18px;height:18px;accent-color:#e31b23}
.backup-next{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.backup-status{font-weight:700}.backup-status.is-ok{color:#16845b}.backup-status.is-error{color:#d62828}
.backup-error{display:block;max-width:360px;color:#d62828;margin-top:4px;white-space:normal}
.backup-download{display:inline-flex;text-decoration:none}
.backup-note{margin:14px 0 0;font-size:13px}
@media(max-width:700px){.backup-settings-head{flex-direction:column}.backup-form{align-items:stretch}.backup-form .field{width:100%}}
html[data-theme="dark"] .backup-status.is-ok{color:#53d69b}
html[data-theme="dark"] .backup-status.is-error{color:#ff7070}

.backup-settings{margin-bottom:22px}

.backup-next{display:flex;align-items:center;flex-wrap:wrap;gap:12px}.backup-mode{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border-radius:7px;font-size:14px}.backup-mode.is-on{color:#126b49;background:#e2f4eb}.backup-mode.is-off{color:#8a4a00;background:#fff1d6}.backup-next-run{color:var(--muted)}.backup-history .section-head{margin-bottom:12px}
html[data-theme="dark"] .backup-mode.is-on{color:#75e0ae;background:#123b2d}html[data-theme="dark"] .backup-mode.is-off{color:#ffd17a;background:#493514}
.backup-location-field{display:flex;flex-direction:column;gap:7px;margin-top:20px;max-width:720px}.backup-location-field label{font-weight:700}.backup-location-field input{width:100%;min-width:0}.backup-location-field small{color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.backup-location-field{display:flex;flex-direction:column;gap:9px;margin-top:20px;max-width:760px}.backup-location-field>label{font-size:13px;color:var(--muted);font-weight:700}.backup-location-current{display:grid;gap:6px;padding:12px 14px;background:var(--soft);border:1px solid var(--line);border-radius:10px}.backup-location-current span{font-size:12px;color:var(--muted);font-weight:700}.backup-location-current code{display:block;max-width:100%;padding:9px 11px;overflow-wrap:anywhere;color:var(--text);background:var(--field-bg);border:1px solid var(--line);border-radius:7px;font:13px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}.backup-location-field input{width:100%;min-width:0;min-height:42px;padding:10px 12px;color:var(--text);background:var(--field-bg);border:1px solid var(--line);border-radius:9px;outline:0;transition:border-color .18s,box-shadow .18s}.backup-location-field input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent)}.backup-location-field small{color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.backup-location-current{padding:0;background:transparent;border:0;border-radius:0}.backup-location-current code{padding:0;background:transparent;border:0;border-radius:0;overflow-wrap:anywhere}.backup-settings-head{justify-content:flex-start}
.backup-location-current{margin-bottom:12px}
.serial-numbers-table th:nth-child(1),.serial-numbers-table td:nth-child(1){width:16%}.serial-numbers-table th:nth-child(2),.serial-numbers-table td:nth-child(2){width:16%}.serial-numbers-table th:nth-child(3),.serial-numbers-table td:nth-child(3){width:22%}.serial-numbers-table th:nth-child(4),.serial-numbers-table td:nth-child(4){width:12%}.serial-numbers-table th:nth-child(5),.serial-numbers-table td:nth-child(5){width:18%}.serial-numbers-table th:nth-child(6),.serial-numbers-table td:nth-child(6){width:16%;min-width:110px}.serial-numbers-table .row-actions{gap:5px}.serial-numbers-table .iconbtn{width:34px;height:34px}
.record-view-row{cursor:pointer}.readonly-record-modal{width:min(680px,96vw);max-height:min(88vh,760px);overflow:auto}.readonly-record-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.readonly-record-field{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0;padding:10px 12px;background:var(--soft);border:1px solid var(--line);border-radius:9px}.readonly-record-value{display:grid;gap:5px;min-width:0}.readonly-record-value span{font-size:11px;color:var(--muted);font-weight:650}.readonly-record-value strong{overflow-wrap:anywhere;font-weight:600}.readonly-copy{flex:0 0 auto}.readonly-record-actions{justify-content:flex-end;margin-top:18px}@media(max-width:600px){.readonly-record-fields{grid-template-columns:1fr}}
/* Approved consultation modal: flat rows, clear dividers and theme-safe copy icons */
.readonly-record-fields{column-gap:24px;row-gap:0}.readonly-record-field{padding:13px 2px;background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0;min-height:68px}.readonly-record-field.wide{grid-column:1/-1}.readonly-record-value span{font-size:11px;letter-spacing:.045em;text-transform:uppercase}.readonly-record-value strong{font-size:15px}.readonly-copy{width:30px;height:30px;padding:0;display:inline-grid;place-items:center;flex:0 0 auto;background:#d71920!important;color:#fff!important;border:2px solid #d71920!important;border-radius:7px}.readonly-copy svg{width:17px;height:17px;fill:none!important;stroke:currentColor!important;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.readonly-copy:hover,.readonly-copy:focus-visible{background:transparent!important;color:#c41620!important;border:2px solid #d71920!important}html[data-theme="dark"] .readonly-copy:hover,html[data-theme="dark"] .readonly-copy:focus-visible{background:transparent!important;color:#fff!important;border-color:#d71920!important}html[data-theme="dark"] .readonly-copy:hover svg,html[data-theme="dark"] .readonly-copy:focus-visible svg{fill:none!important;stroke:#fff!important}.table .iconbtn svg{fill:none!important}.table .iconbtn:hover svg,.table .iconbtn:focus-visible svg{fill:none!important}html[data-theme="dark"] .table .iconbtn:hover,html[data-theme="dark"] .table .iconbtn:focus-visible{background:transparent!important;color:#fff!important;border:2px solid #d71920!important}html[data-theme="dark"] .table .iconbtn:hover svg,html[data-theme="dark"] .table .iconbtn:focus-visible svg{fill:none!important;stroke:#fff!important}

/* Backup controls use the shared MetalFLOW theme tokens and component styles. */
.backup-form{align-items:flex-end;gap:14px 18px}
.backup-auto-toggle{position:relative;display:inline-flex;align-items:center;gap:11px;min-height:44px;cursor:pointer;user-select:none}
.backup-auto-toggle input{position:absolute;width:1px;height:1px;opacity:0}
.backup-switch-track{position:relative;flex:0 0 auto;width:42px;height:24px;border:1px solid var(--line);border-radius:999px;background:var(--soft);transition:background .18s,border-color .18s,box-shadow .18s}
.backup-switch-track:after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.24);transition:transform .18s}
.backup-auto-toggle input:checked+.backup-switch-track{background:var(--accent);border-color:var(--accent)}
.backup-auto-toggle input:checked+.backup-switch-track:after{transform:translateX(18px)}
.backup-auto-toggle input:focus-visible+.backup-switch-track{outline:3px solid color-mix(in srgb,var(--accent) 28%,transparent);outline-offset:2px}
.backup-auto-copy{display:grid;gap:2px;color:var(--text)}
.backup-auto-copy strong{font-size:13px}
.backup-auto-copy small{font-size:12px;color:var(--muted)}
.backup-schedule-controls{display:flex;align-items:flex-end;flex-wrap:wrap;gap:14px 18px}
.backup-schedule-controls[hidden]{display:none}
.backup-schedule-controls .field{min-width:170px}
.backup-form-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.backup-location-field{max-width:900px;margin-top:24px;gap:12px}
.backup-location-title{display:grid;gap:4px;color:var(--text)}
.backup-location-title strong{font-size:14px}
.backup-location-title span{font-size:12px;color:var(--muted)}
.backup-location-controls{display:grid;grid-template-columns:minmax(190px,230px) minmax(250px,1fr) 42px;align-items:end;gap:10px}
.backup-location-controls .field select{width:100%;min-height:42px;padding:10px 12px;color:var(--text);background:var(--field-bg);border:1px solid var(--line);border-radius:9px}
.backup-path-display{display:flex;align-items:center;min-height:42px;min-width:0;padding:9px 12px;overflow-wrap:anywhere;word-break:break-word;color:var(--text);background:var(--field-bg);border:1px solid var(--line);border-radius:9px;font:13px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}
.backup-copy{display:inline-grid;place-items:center;width:42px;height:42px;padding:0}
.backup-copy svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .backup-path-display,html[data-theme="dark"] .backup-location-controls .field select{color:var(--text);background:var(--field-bg);border-color:var(--line)}
@media(max-width:700px){.backup-form{align-items:stretch;flex-direction:column}.backup-auto-toggle{align-self:flex-start}.backup-schedule-controls{width:100%;align-items:stretch;flex-direction:column}.backup-schedule-controls .field{width:100%}.backup-form-actions{width:100%}.backup-form-actions .btn{flex:1}.backup-location-controls{grid-template-columns:minmax(0,1fr) 42px}.backup-location-controls .field{grid-column:1/-1}.backup-path-display{grid-column:1;grid-row:2}.backup-copy{grid-column:2;grid-row:2}}


/* Backup layout matched to the approved preview, using native MetalFLOW theme tokens. */
.backup-location-panel{max-width:920px;margin-top:22px;padding:16px;background:var(--soft);border:1px solid var(--line);border-radius:12px}
.backup-location-title{margin-bottom:12px;color:var(--text);font-size:14px}
.backup-location-controls{display:grid;grid-template-columns:auto minmax(260px,1fr) 42px;align-items:center;gap:10px}
.backup-route-switch{display:inline-flex;align-items:center;padding:3px;background:var(--field-bg);border:1px solid var(--line);border-radius:9px}
.backup-route-option{min-height:34px;padding:6px 14px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--text);font-weight:650;transition:color .16s,background .16s,border-color .16s}
.backup-route-option.active{background:var(--accent);border-color:var(--accent);color:#fff}
.backup-route-option:not(.active):hover{border-color:var(--accent);color:var(--accent)}
.backup-route-option:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.backup-path-display{display:flex;align-items:center;min-height:42px;min-width:0;padding:9px 12px;overflow-wrap:anywhere;word-break:break-word;color:var(--text);background:var(--field-bg);border:1px solid var(--line);border-radius:9px;font:13px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}
.backup-copy{display:inline-grid;place-items:center;width:42px;height:42px;padding:0}
.backup-copy svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.backup-auto-section{display:flex;flex-direction:column;align-items:flex-start;gap:14px;margin-top:22px}
.backup-auto-toggle{position:relative;display:inline-flex;align-items:center;gap:11px;min-height:40px;cursor:pointer;user-select:none}
.backup-auto-toggle input{position:absolute;width:1px;height:1px;opacity:0}
.backup-switch-track{position:relative;flex:0 0 auto;width:42px;height:24px;border:1px solid var(--line);border-radius:999px;background:var(--soft);transition:background .18s,border-color .18s,box-shadow .18s}
.backup-switch-track:after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.24);transition:transform .18s}
.backup-auto-toggle input:checked+.backup-switch-track{background:var(--accent);border-color:var(--accent)}
.backup-auto-toggle input:checked+.backup-switch-track:after{transform:translateX(18px)}
.backup-auto-toggle input:focus-visible+.backup-switch-track{outline:3px solid color-mix(in srgb,var(--accent) 28%,transparent);outline-offset:2px}
.backup-auto-copy{display:grid;gap:2px;color:var(--text)}
.backup-auto-copy strong{font-size:13px}
.backup-auto-copy small{font-size:12px;color:var(--muted)}
.backup-schedule-controls{display:flex;align-items:flex-end;flex-wrap:wrap;gap:14px 18px;padding-left:53px}
.backup-schedule-controls[hidden]{display:none}
.backup-schedule-controls .field{min-width:170px}
.backup-form-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-left:53px}
html[data-theme="dark"] .backup-location-panel{background:var(--soft);border-color:var(--line)}
html[data-theme="dark"] .backup-path-display{color:var(--text);background:var(--field-bg);border-color:var(--line)}
@media(max-width:700px){.backup-location-controls{grid-template-columns:minmax(0,1fr) 42px}.backup-route-switch{grid-column:1/-1;justify-self:start}.backup-path-display{grid-column:1;grid-row:2}.backup-copy{grid-column:2;grid-row:2}.backup-schedule-controls,.backup-form-actions{padding-left:0}.backup-schedule-controls{width:100%;align-items:stretch;flex-direction:column}.backup-schedule-controls .field{width:100%}.backup-form-actions{width:100%}.backup-form-actions .btn{flex:1}}

.backup-form{display:block;margin-top:18px}.backup-auto-section{max-width:920px}


/* Backup action and location icons use the same neutral/red button language. */
.backup-route-option{display:inline-flex;align-items:center;justify-content:center;gap:7px}
.backup-route-option svg{width:17px;height:17px;flex:0 0 17px;fill:currentColor;stroke:currentColor;stroke-width:.35}
.backup-action{display:inline-flex;align-items:center;justify-content:center;gap:8px}
.backup-action svg{width:17px;height:17px;flex:0 0 17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.backup-mode{position:relative;gap:9px;color:var(--text)!important;background:var(--panel)!important;border:1px solid var(--line);border-radius:9px;padding:8px 12px}
.backup-mode:before{content:"";width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:var(--muted)}
.backup-mode.is-on:before{background:var(--accent)}
.backup-mode.is-off:before{background:var(--muted)}
.backup-mode strong{color:var(--text)}
html[data-theme="dark"] .backup-mode{color:var(--text)!important;background:var(--panel)!important;border-color:var(--line)}
html[data-theme="dark"] .backup-mode strong{color:var(--text)}


/* Use the supplied Linux mark as a mask so it inherits MetalFLOW theme colors. */
.backup-linux-mark{display:inline-block;width:17px;height:17px;flex:0 0 17px;background:currentColor;-webkit-mask:url("linux-mark.png") center/contain no-repeat;mask:url("linux-mark.png") center/contain no-repeat}
.backup-mode{flex-wrap:wrap;row-gap:7px}
.backup-mode .backup-next-run{display:inline-flex;align-items:center;gap:5px;margin-left:5px;padding-left:12px;border-left:1px solid var(--line);color:var(--muted)}
.backup-mode .backup-next-run strong{color:var(--text)}
@media(max-width:560px){.backup-mode .backup-next-run{width:100%;margin-left:18px;padding-left:0;border-left:0}}


/* Consistent action glyphs across the full application; SVGs follow button text color. */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px}
.btn .action-button-icon{width:16px;height:16px;flex:0 0 16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .btn .action-button-icon{color:inherit}

.serial-numbers-table .sort-button{max-width:100%;white-space:nowrap;color:var(--head-text)}.serial-numbers-table .sort-button>span:first-child{white-space:nowrap}.serial-numbers-table .sort-arrows{flex:0 0 auto}

.serial-filter-control{display:flex;align-items:center;gap:8px;min-width:0}.serial-filter-control .search{width:min(390px,calc(100vw - 420px));min-width:220px}.serial-filter-clear{width:38px;height:38px;flex:0 0 38px;padding:8px}.serial-filter-clear svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}@media(max-width:600px){.serial-filter-control{width:100%}.serial-filter-control .search{width:auto;min-width:0;flex:1}}

/* v1.7.27: encabezados uniformes y acciones de serie siempre visibles */
.serial-numbers-table thead th{height:48px;vertical-align:middle;padding:12px 10px;background:var(--grid-head,#40566d);color:var(--grid-head-text,#fff);font-size:12px;font-weight:700;line-height:1.25;text-align:left;white-space:nowrap;overflow:visible;word-break:normal;overflow-wrap:normal}
.serial-numbers-table thead th .sort-button{display:inline-flex;align-items:center;justify-content:flex-start;gap:8px;width:auto;max-width:none;min-height:24px;padding:0;border:0;border-radius:0;background:transparent!important;color:inherit!important;font:inherit;font-size:12px;font-weight:700;line-height:1.25;white-space:nowrap;box-shadow:none}
.serial-numbers-table thead th .sort-button>span:first-child{color:inherit;font-size:inherit!important;line-height:inherit;white-space:nowrap}
.serial-numbers-table thead th .sort-arrows{display:inline-grid;grid-template-rows:6px 6px;align-content:center;gap:0;flex:0 0 9px;font-size:8px!important;line-height:6px;color:inherit;opacity:.72}
.serial-numbers-table th:nth-child(1),.serial-numbers-table td:nth-child(1){width:14%}
.serial-numbers-table th:nth-child(2),.serial-numbers-table td:nth-child(2){width:15%}
.serial-numbers-table th:nth-child(3),.serial-numbers-table td:nth-child(3){width:20%}
.serial-numbers-table th:nth-child(4),.serial-numbers-table td:nth-child(4){width:12%}
.serial-numbers-table th:nth-child(5),.serial-numbers-table td:nth-child(5){width:17%}
.serial-numbers-table th:last-child,.serial-numbers-table td:last-child{width:22%;min-width:190px!important;white-space:nowrap;overflow:visible}
.serial-numbers-table tbody .row-actions{display:flex;align-items:center;justify-content:flex-start;flex-wrap:nowrap;gap:5px;min-width:max-content;white-space:nowrap;overflow:visible}
.serial-numbers-table tbody .row-actions .iconbtn{display:inline-flex;flex:0 0 34px;align-items:center;justify-content:center;width:34px;height:34px;padding:0}
.serial-numbers-table tbody .row-actions .serial-delete{display:inline-flex!important;visibility:visible!important;opacity:1!important;background:var(--accent);color:#fff}

/* Grupos secundarios plegables de navegacion. */
.nav-fold{margin-top:12px}.nav-fold summary{list-style:none;display:flex;align-items:center;gap:9px;color:var(--side-muted);padding:12px;border-radius:9px;cursor:pointer;font-size:10px;font-weight:700;letter-spacing:.1em}.nav-fold summary::-webkit-details-marker{display:none}.nav-fold summary:hover{background:var(--side-active);color:var(--text)}.nav-fold summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.nav-fold summary>svg{width:19px;height:19px;flex:0 0 19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.nav-fold summary>.nav-fold-chevron{width:14px;height:14px;flex-basis:14px;margin-left:auto;transition:transform .15s}.nav-fold[open] summary>.nav-fold-chevron{transform:rotate(90deg)}.nav-fold-items{padding-top:3px}.shell.sidebar-collapsed .nav-fold summary{justify-content:center;padding:12px 8px}.shell.sidebar-collapsed .nav-fold summary>.nav-fold-chevron{display:none}@media(prefers-reduced-motion:reduce){.nav-fold summary>.nav-fold-chevron{transition:none}}
