:root {
    --primary: #ea580c; --primary-dark: #c2410c; --primary-light: #ffedd5;
    --success: #4d7c0f; --success-light: #f7fee7;
    --danger: #dc2626; --danger-light: #fef2f2;
    --warning: #d97706; --warning-light: #fef3c7;
    --gray-50: #fafaf9; --gray-100: #f5f5f4; --gray-200: #e7e5e4; --gray-300: #d6d3d1;
    --gray-400: #a8a29e; --gray-500: #78716c; --gray-600: #57534e; --gray-700: #44403c;
    --surface: #fff; --surface-2: #fff; --surface-alt: #fafaf9;
    --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,.07),0 10px 15px rgba(0,0,0,.1);
}

/* ── TEMA OSCURO ── */
html[data-theme="dark"] {
    --primary: #f97316; --primary-dark: #ea580c; --primary-light: #431407;
    --success: #65a30d; --success-light: #1a2e05;
    --danger: #ef4444; --danger-light: #450a0a;
    --warning: #f59e0b; --warning-light: #451a03;
    --gray-50: #221f1d; --gray-100: #1c1917; --gray-200: #3f3a37; --gray-300: #57534e;
    --gray-400: #a8a29e; --gray-500: #d6d3d1; --gray-600: #e7e5e4; --gray-700: #f5f5f4;
    --surface: #292524; --surface-2: #35302d; --surface-alt: #1c1917;
    --shadow: 0 1px 3px rgba(0,0,0,.4),0 1px 2px rgba(0,0,0,.5);
    --shadow-lg: 0 4px 6px rgba(0,0,0,.5),0 10px 15px rgba(0,0,0,.6);
}
html[data-theme="dark"] body { background: var(--gray-100); color: var(--gray-700); }
html[data-theme="dark"] .mesa-btn.occupied { background: #33260f; }
html[data-theme="dark"] .mesa-btn.owner { background: #2b1606; }
html[data-theme="dark"] .mesa-btn.cooking { background: #2b1a08; }
html[data-theme="dark"] .mesa-btn.served { background: #17220a; }
html[data-theme="dark"] .mesa-btn.paying { background: #2a0d13; }
html[data-theme="dark"] .mesa-btn .mesa-total { color: var(--gray-700); }
html[data-theme="dark"] .sidebar { background: #1c1917; }
html[data-theme="dark"] .series-item .series-tipo { background: var(--surface-2); }
html[data-theme="dark"] #btn-theme { background: var(--surface-2); border-color: var(--gray-300); color: var(--gray-500); }
html[data-theme="dark"] .loading-overlay { background: rgba(28,25,23,.75); }
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]), html[data-theme="dark"] select, html[data-theme="dark"] textarea { color: var(--gray-700); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--gray-400); opacity: 1; }
html[data-theme="dark"] select option { background: var(--surface); color: var(--gray-700); }
html[data-theme="dark"] .report-controls input, html[data-theme="dark"] #search-producto { color: var(--gray-700); background: var(--surface-2); }
html[data-theme="dark"] .report-table th, html[data-theme="dark"] .table th { background: var(--surface-2); }
html[data-theme="dark"] .report-table tfoot td { background: var(--gray-50); }
html[data-theme="dark"] .table tr:hover td { background: var(--gray-50); }
html[data-theme="dark"] .order-item:hover { background: var(--gray-50); }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator, html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.75) sepia(.3) saturate(3) hue-rotate(-10deg); cursor: pointer; }
html[data-theme="dark"] .config-tab:hover, html[data-theme="dark"] .admin-tab:hover { color: var(--gray-300); background: var(--surface-2); }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; background: var(--gray-100); color: var(--gray-700); height: 100vh; overflow: hidden; }
input,select,textarea,button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

/* ── LOGIN ── */
#login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #431407 0%, #ea580c 100%); padding: 1rem; }
.login-box { background: var(--surface); padding: 2.5rem; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; }
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: .25rem; }
.login-box h1 { font-size: 1.6rem; margin-bottom: .25rem; color: var(--gray-700); text-align: center; }
.login-box h1 span { color: var(--primary); }
.login-box p { color: var(--gray-500); margin-bottom: 1.5rem; font-size: .875rem; text-align: center; }
.login-box .form-group { margin-bottom: 1rem; }
.login-box label { display: block; font-size: .8rem; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.login-box input { width: 100%; padding: .6rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); color: var(--gray-700); background: var(--surface-2); }
.login-box button { width: 100%; padding: .7rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.login-box button:hover { background: var(--primary-dark); }
#login-error { color: var(--danger); font-size: .8rem; margin-top: .5rem; text-align: center; }
.login-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); text-align: center; font-size: .75rem; color: var(--gray-500); }
.login-footer strong { color: var(--primary); font-weight: 700; }

/* ── APP LAYOUT ── */
#pos-app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #292524; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1rem; border-bottom: 1px solid #44403c; }
.sidebar-header h2 { font-size: 1rem; line-height: 1.25; }
.sidebar-header h2 span { display: block; font-size: .78rem; font-weight: 400; color: #fdba74; }
.sidebar-header small { color: #a8a29e; font-size: .75rem; }
.sidebar-credit { text-align: center; font-size: .65rem; color: #78716c; padding: .45rem 0 .15rem; }
.sidebar-credit:hover { color: #d6d3d1; }
.sidebar-nav { flex: 1; padding: .5rem; }
.sidebar-nav button { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .6rem .75rem; background: none; border: none; color: #d6d3d1; border-radius: var(--radius); cursor: pointer; text-align: left; font-size: .85rem; margin-bottom: 2px; }
.sidebar-nav button:hover { background: #44403c; color: #fff; }
.sidebar-nav button.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: .5rem; border-top: 1px solid #44403c; }
.sidebar-footer button { width: 100%; padding: .5rem; background: none; border: 1px solid #78716c; color: #a8a29e; border-radius: var(--radius); cursor: pointer; font-size: .8rem; }
.sidebar-footer button:hover { background: #44403c; color: #fff; }
#caja-indicator { padding: .5rem .75rem; font-size: .75rem; border-radius: var(--radius); margin: .5rem; text-align: center; }
.caja-open { background: #3f2d1d; color: #fbbf24; }
.caja-closed { background: #451a03; color: #fdba74; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--gray-200); }
.main-header h1 { font-size: 1.1rem; font-weight: 600; }
#btn-menu-toggle { display: none; background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: .25rem; color: var(--gray-700); }
#btn-theme { padding: .35rem .7rem; border: 1px solid var(--gray-300); border-radius: 6px; background: var(--surface-2); cursor: pointer; font-size: .9rem; color: var(--gray-600); line-height: 1; }
#btn-theme:hover { border-color: var(--primary); color: var(--primary); }
#header-right { display: flex; align-items: center; gap: .5rem; }
#btn-theme { width: 2rem; height: 2rem; border: 1px solid var(--gray-300); border-radius: 8px; background: var(--surface-2); color: var(--gray-600); font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
#btn-theme:hover { border-color: var(--primary); color: var(--primary); }

.view-panel { flex: 1; overflow-y: auto; padding: 1rem; }

/* ── POS VIEW ── */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; height: calc(100vh - 60px); overflow: hidden; }
.pos-products { overflow-y: auto; padding-right: .5rem; }
.pos-order { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.pos-right-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.pos-right-tab { flex: 1; padding: .5rem .75rem; font-size: .78rem; font-weight: 600; background: var(--gray-100); border: none; cursor: pointer; color: var(--gray-500); border-bottom: 2px solid transparent; transition: all .15s; }
.pos-right-tab.active { background: var(--surface); color: var(--primary); border-bottom-color: var(--primary); }
.pos-right-panel { flex: 1; overflow-y: auto; display: none; }
.pos-right-panel.active { display: flex; flex-direction: column; }
.order-header { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.order-header h3 { font-size: .9rem; }
.order-header small { color: var(--gray-500); font-size: .75rem; }
.order-items { flex: 1; overflow-y: auto; padding: .5rem; }
.order-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 200px; color: var(--gray-400); gap: .5rem; }
.order-item { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--gray-100); align-items: center; }
.order-item:hover { background: var(--gray-50); }
.item-info { overflow: hidden; }
.item-name { font-size: .8rem; font-weight: 500; }
.item-note { font-size: .7rem; color: var(--warning); }
.item-meta { display: flex; gap: .5rem; font-size: .75rem; color: var(--gray-500); margin-top: 2px; }
.item-qty { font-weight: 600; background: var(--gray-100); padding: 0 4px; border-radius: 4px; }
.item-total { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.item-actions { display: flex; gap: 2px; }
.item-actions button { background: none; border: none; cursor: pointer; font-size: .7rem; padding: 2px 4px; border-radius: 4px; }
.item-actions button:hover { background: var(--gray-200); }

.order-totals { padding: .75rem 1rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.total-row { display: flex; justify-content: space-between; font-size: .8rem; padding: 2px 0; }
.total-row.total { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--gray-300); padding-top: 4px; margin-top: 4px; color: var(--primary); }
.order-client { padding: .5rem 1rem; font-size: .75rem; color: var(--gray-500); border-top: 1px solid var(--gray-200); }
.btn-cobrar { margin: .5rem 1rem 1rem; padding: .75rem; background: var(--success); color: #fff; border: none; border-radius: var(--radius); font-weight: 700; cursor: pointer; font-size: 1rem; }
.btn-cobrar:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-cobrar:hover:not(:disabled) { background: #3f6212; }
.btn-cancelar { background: var(--gray-200); border: none; border-radius: var(--radius); cursor: pointer; color: var(--gray-600); }
.btn-cancelar:hover { background: var(--gray-300); }

/* ── MESA GRID ── */
.mesa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.mesa-group { margin-bottom: 1.25rem; }
.mesa-group-title { font-size: .78rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; margin: .25rem 0 .6rem; padding-bottom: .25rem; border-bottom: 1px solid var(--gray-200); }
.mesa-group .mesa-grid { margin-bottom: 0; }
.mesa-btn { position: relative; padding: .65rem .5rem; background: var(--surface); border: 2px solid var(--gray-200); border-radius: 10px; cursor: pointer; text-align: center; font-size: .8rem; font-weight: 600; color: var(--gray-700); transition: all .15s; overflow: hidden; }
.mesa-btn:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mesa-btn.free { border-color: var(--gray-200); background: var(--surface); }
.mesa-btn.empty { border-color: var(--gray-300); background: var(--surface-alt); }
html[data-theme="dark"] .mesa-btn.free { border-color: var(--gray-300); background: var(--surface-2); }
html[data-theme="dark"] .mesa-btn.empty { border-color: var(--gray-400); }
.mesa-btn.empty .mesa-mozo { color: var(--gray-400); }
.mesa-btn.occupied { border-color: var(--warning); background: var(--warning-light); }
.mesa-btn.owner { border-color: var(--primary); background: var(--primary-light); }
.mesa-btn.cooking { border-color: var(--primary); background: var(--primary-light); }
.mesa-btn.served { border-color: var(--success); background: var(--success-light); }
.mesa-btn.paying { border-color: var(--danger); background: var(--danger-light); }
.mesa-btn.active { border-color: var(--success) !important; background: var(--success-light) !important; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.mesa-btn.disabled { opacity: .55; cursor: not-allowed; }
.mesa-btn.disabled:hover { border-color: inherit; box-shadow: none; }
.mesa-btn .badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: .65rem; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; z-index:1; }
.mesa-btn .mesa-mozo { display: block; font-size: .65rem; font-weight: 400; color: var(--gray-500); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mesa-btn .mesa-total { display: block; font-size: .95rem; font-weight: 800; color: var(--gray-700); margin-top: 3px; }
.mesa-btn .mesa-cap { display: block; font-size: .62rem; font-weight: 400; color: var(--gray-400); margin-top: 1px; }
.mesa-btn.occupied .mesa-total, .mesa-btn.cooking .mesa-total, .mesa-btn.served .mesa-total, .mesa-btn.paying .mesa-total { color: var(--gray-700); }

/* ── CATEGORIA TABS ── */
.categoria-tabs { display: flex; gap: 4px; margin-bottom: .75rem; overflow-x: auto; padding-bottom: 4px; }
.categoria-tab { padding: .35rem .65rem; border: 1px solid var(--gray-200); background: var(--surface); border-radius: 20px; cursor: pointer; font-size: .75rem; white-space: nowrap; }
.categoria-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.categoria-tab:hover:not(.active) { background: var(--gray-100); }

/* ── PRODUCTOS GRID ── */
.productos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.producto-card { background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: .75rem .5rem; text-align: center; cursor: pointer; transition: all .1s; }
.producto-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.producto-card .nombre { font-size: .8rem; font-weight: 600; }
.producto-card .precio { font-size: .9rem; font-weight: 700; color: var(--primary); margin-top: 4px; }
.producto-card .cat-label { font-size: .65rem; color: var(--gray-400); margin-top: 2px; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; backdrop-filter:blur(2px); }
.modal { background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.15); width: 100%; max-width: 500px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); border-radius:14px 14px 0 0; }
.modal-header h2 { font-size: 1rem; font-weight:700; color:var(--gray-700); }
.close-btn { width:32px;height:32px;display:flex;align-items:center;justify-content:center; background:none; border:none; font-size:1.4rem; cursor:pointer; color:var(--gray-400); border-radius:8px; transition:all .15s; }
.close-btn:hover { background:var(--gray-200); color:var(--gray-600); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; min-height: 0; }
#payment-modal .modal-body { padding: .9rem; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
#payment-modal .modal-body::-webkit-scrollbar { display: none; }
.modal-footer { display:flex; justify-content:end; gap:.5rem; padding:1rem 1.25rem; border-top:1px solid var(--gray-200); background:var(--gray-50); border-radius:0 0 14px 14px; }

/* ── PAYMENT ── */
.payment-total-display { text-align: center; margin-bottom: .5rem; }
.payment-total-display .label { font-size: .7rem; color: var(--gray-500); }
.payment-total-display .amount { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.doc-type-select { display: flex; gap: 4px; }
.doc-type-select button { flex: 1; padding: .3rem; border: 1px solid var(--gray-200); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-size: .7rem; }
.doc-type-select button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.client-form { animation: fadeIn .2s; }
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: .4rem; margin-bottom: .35rem; }
.form-row label { font-size: .65rem; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 2px; }
.form-row input,.form-row select { width: 100%; padding: .25rem .4rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .75rem; }

.payment-methods { margin-bottom: .5rem; }
.payment-row { display: grid; grid-template-columns: 1fr 1fr 70px; gap: .4rem; align-items: center; padding: .2rem 0; border-bottom: 1px solid var(--gray-100); }
.metodo-label { font-size: .78rem; }
.metodo-label small { color: var(--gray-400); font-size: .6rem; }
.payment-input { padding: .25rem .4rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .78rem; text-align: right; background: var(--surface-2); color: var(--gray-700); }
.payment-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px var(--primary-light); }
.monto-val { font-weight: 700; font-size: .78rem; text-align: right; color: var(--gray-600); }
.payment-summary { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .5rem; background: var(--gray-50); border-radius: var(--radius); margin: .3rem 0; }
.vuelto { font-size: 1rem; font-weight: 700; color: var(--success); }
.btn-pagar { width: 100%; padding: .55rem; background: var(--success); color: #fff; border: none; border-radius: var(--radius); font-weight: 700; font-size: .9rem; cursor: pointer; }
.btn-pagar:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-pagar:hover:not(:disabled) { background: #3f6212; }
.btn-secondary { padding: .4rem .8rem; background: var(--gray-200); border: none; border-radius: var(--radius); cursor: pointer; font-size: .75rem; }
.btn-secondary:hover { background: var(--gray-300); }

/* ── KITCHEN ── */
#kitchen-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.kitchen-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.k-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gray-200); }
.k-mesa { font-size: 1rem; font-weight: 700; }
.k-codigo { font-size: .75rem; color: var(--gray-500); }
.k-mesero { font-size: .75rem; color: var(--gray-400); }
.k-item { display: flex; align-items: center; justify-content: space-between; padding: .5rem; margin-bottom: 4px; border-radius: var(--radius); background: var(--gray-50); border-left: 4px solid var(--gray-300); }
.k-item.cocinando { border-left-color: var(--warning); background: var(--warning-light); }
.k-item.listo { border-left-color: var(--success); background: var(--success-light); }
.k-item.servido { border-left-color: var(--primary); background: var(--primary-light); opacity: .7; }
.k-item.devuelto { border-left-color: var(--danger); background: var(--danger-light); opacity: .6; }
.k-item-info { flex: 1; }
.k-cant { font-weight: 700; margin-right: 4px; }
.k-nombre { font-size: .85rem; }
.k-nota { font-size: .7rem; color: var(--warning); display: block; }
.k-item-actions { display: flex; gap: 4px; }
.k-estado-badge { font-size: .65rem; padding: 2px 6px; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.k-estado-badge.pendiente { background: var(--gray-200); color: var(--gray-600); }
.k-estado-badge.cocinando { background: var(--warning); color: #fff; }
.k-estado-badge.listo { background: var(--success); color: #fff; }
.k-estado-badge.servido { background: var(--primary); color: #fff; }
.k-estado-badge.devuelto { background: var(--danger); color: #fff; }
.btn-cocina { padding: .35rem .6rem; border: none; border-radius: var(--radius); font-size: .7rem; font-weight: 600; cursor: pointer; }
.btn-cocinar { background: var(--warning); color: #fff; }
.btn-listo { background: var(--success); color: #fff; }
.btn-servido { background: var(--primary); color: #fff; }
.btn-devuelto { background: var(--danger); color: #fff; }
.kichen-empty { grid-column: 1/-1; text-align: center; padding: 3rem; color: var(--gray-400); font-size: 1.1rem; }

/* ── REPORTS ── */
.report-controls { display: flex; gap: .5rem; align-items: end; margin-bottom: 1rem; flex-wrap: wrap; }
.report-controls label { font-size: .75rem; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 2px; }
.report-controls input { padding: .4rem .5rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .8rem; color: var(--gray-700); background: var(--surface-2); }
.report-controls button { padding: .4rem .75rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-size: .8rem; }
.report-controls button:hover { background: var(--primary-dark); }
.report-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.report-table th { background: var(--gray-100); padding: .5rem .75rem; text-align: left; font-weight: 600; border-bottom: 2px solid var(--gray-200); }
.report-table td { padding: .4rem .75rem; border-bottom: 1px solid var(--gray-100); }
.report-table tfoot td { font-weight: 700; background: var(--gray-50); }
.resumen-card { background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; text-align: center; }
.resumen-card .num { font-size: 1.5rem; font-weight: 800; color: var(--primary); }

/* ── CONFIG ── */
.config-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: .75rem; }
.config-header h2 { font-size: 1.1rem; }
.config-tabs { display: flex; gap: 4px; background: var(--gray-100); border-radius: 10px; padding: 4px; }
.config-tab { padding: .5rem 1rem; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: .8rem; font-weight: 500; color: var(--gray-500); transition: all .15s; white-space: nowrap; }
.config-tab:hover { color: var(--gray-700); background: rgba(255,255,255,.5); }
.config-tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.02); }
.config-tab-panel { display: none; }
.config-tab-panel.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.config-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; max-width: 900px; }
.config-section h3 { font-size: .95rem; margin-bottom: 1rem; color: var(--gray-700); }
.config-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.config-section-head h3 { margin-bottom: 0; }
.config-loading { color: var(--gray-400); font-size: .85rem; margin: 0; }
.form-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
.form-row-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-row-grid-3 { grid-template-columns: repeat(3, 1fr); }
.series-item { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 8px; margin-bottom: .5rem; transition: border-color .15s; }
.series-item:hover { border-color: var(--gray-300); }
.series-item .series-tipo { font-weight: 600; font-size: .75rem; background: var(--surface); border: 1px solid var(--gray-200); color: var(--gray-600); padding: 3px 10px; border-radius: 6px; min-width: 3.5rem; text-align: center; }
.series-item .series-serie { font-family: monospace; font-size: .9rem; font-weight: 600; color: var(--gray-700); }
.series-item .series-correlativo { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--gray-500); }
.series-item .series-correlativo-input { width: 7rem; padding: .35rem .5rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .85rem; text-align: center; background: var(--surface-2); color: var(--gray-700); }
.series-item .series-save-btn { background: var(--primary); }
.series-item .series-save-btn:hover { background: var(--primary-dark); }
.series-subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: .75rem; }
.series-subtab { padding: .4rem .85rem; border: 1px solid var(--gray-200); background: var(--surface); border-radius: 20px; cursor: pointer; font-size: .78rem; font-weight: 500; color: var(--gray-500); transition: all .15s; white-space: nowrap; }
.series-subtab:hover { border-color: var(--primary); color: var(--primary); }
.series-subtab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.series-scope-note { font-size: .75rem; color: var(--gray-500); margin-bottom: .75rem; }
.series-item .series-sucursal-select { padding: .3rem .4rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .78rem; background: var(--surface-2); color: var(--gray-600); max-width: 10rem; }
.series-add-form { display: flex; align-items: end; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--gray-200); }
.series-add-form .form-group { margin-bottom: 0; }
.series-add-form select, .series-add-form input { padding: .45rem .6rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .85rem; color: var(--gray-700); background: var(--surface-2); }
.admin-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; flex-wrap:wrap; gap:.5rem; }
.admin-tabs { display:flex; gap:0; background:var(--gray-100); border-radius:10px; padding:3px; }
.admin-tab { padding:.45rem 1rem; border:none; background:transparent; border-radius:8px; cursor:pointer; font-size:.8rem; font-weight:500; color:var(--gray-500); transition:all .15s; white-space:nowrap; }
.admin-tab:hover { color:var(--gray-700); background:rgba(255,255,255,.4); }
.admin-tab.active { background: var(--surface); color:var(--primary); font-weight:600; box-shadow:0 1px 3px rgba(0,0,0,.08),0 0 0 1px rgba(0,0,0,.02); }
.admin-panel-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.75rem; padding-bottom:.5rem; border-bottom:1px solid var(--gray-200); }
.admin-panel-header strong { font-size:.85rem; color:var(--gray-600); text-transform:uppercase; letter-spacing:.02em; }
.admin-panel .form-group { margin-bottom: .75rem; }
.admin-panel .form-group label { display: block; font-size: .75rem; font-weight: 600; color: var(--gray-600); margin-bottom: 3px; }
.admin-panel .form-group input:not([type="checkbox"]),.admin-panel .form-group select,.admin-panel .form-group textarea { width: 100%; padding: .4rem .5rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .85rem; color: var(--gray-700); }

/* ── NOMBRES EN MAYÚSCULAS (productos, categorías, mesas, clientes, proveedores) ── */
#f-prod-nombre, #f-cat-nombre, #f-mesa-nombre, #f-mesa-ubicacion,
#cli-nombre, #cli-direccion, #prov-nombre, #prov-contacto, #prov-direccion,
#cliente-nombre, #cliente-direccion, #sa-serie { text-transform: uppercase; }

/* ── TOAST ── */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: .75rem 1.25rem; border-radius: var(--radius); color: #fff; font-size: .85rem; font-weight: 600; z-index: 9999; animation: slideIn .3s; box-shadow: var(--shadow-lg); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--primary); }

/* ── LOADING ── */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }

.btn { padding: .45rem .9rem; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: .8rem; display: inline-flex; align-items: center; gap: .35rem; }
.btn-primary { padding: .5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 600; display:inline-flex;align-items:center;gap:.35rem; }
.btn-primary:hover { background: var(--primary-dark); transform:translateY(-1px); box-shadow:0 2px 8px rgba(234,88,12,.35); }
.btn-cancel { background: var(--gray-200); color: var(--gray-600); }
.btn-cancel:hover { background: var(--gray-300); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #3f6212; }
.btn-danger { background: var(--danger) !important; }
.btn-danger:hover { background: #b91c1c !important; }
.btn-sm { padding: .25rem .5rem; font-size: .75rem; background: var(--primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.form-group { margin-bottom: .85rem; }
.form-group label { display: block; font-size: .78rem; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.form-group input:not([type="checkbox"]):not([type="radio"]),.form-group select,.form-group textarea { width: 100%; padding: .45rem .6rem; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .85rem; transition: border-color .15s; background: var(--surface-2); color: var(--gray-700); }
.form-group input[type="checkbox"] { width: auto; padding: 0; border: none; border-radius: 0; box-shadow: none; accent-color: var(--primary); }
.form-group input:focus,.form-group select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px var(--primary-light); }
.form-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .pos-layout { grid-template-columns: 1fr 300px; }
    .form-row-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── RESPONSIVE HELPERS ── */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

.sidebar-backdrop { display: none; }
.sidebar-backdrop.hidden { display: none; }

.order-sheet-handle { display: none; }

.cart-fab { display: none; position: fixed; right: 1rem; bottom: 1rem; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; border: none; box-shadow: 0 6px 18px rgba(234,88,12,.45); font-size: 1.4rem; align-items: center; justify-content: center; cursor: pointer; z-index: 480; transition: bottom .25s ease, transform .15s; }
.cart-fab:active { transform: scale(.92); }
.cart-fab .cart-fab-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.cart-fab.hidden { display: none !important; }
body.order-sheet-open .cart-fab { bottom: calc(75vh + .75rem); }

@media (max-width: 768px) {
    .sidebar { width: 260px; left: -260px; position: fixed; top: 0; bottom: 0; z-index: 600; transition: left .2s; }
    .sidebar.mobile-show { left: 0; box-shadow: 6px 0 24px rgba(0,0,0,.35); }
    .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 560; }
    .sidebar-backdrop.hidden { display: none; }
    #btn-menu-toggle { display: block; }
    .main-header { padding: .6rem .85rem; }
    .main-header h1 { font-size: .95rem; }
    .view-panel { padding: .75rem; }
    .sidebar-nav button { font-size: .95rem; padding: .75rem .85rem; }
    .sidebar-footer button { padding: .65rem; }

    .pos-layout { grid-template-columns: 1fr; height: calc(100vh - 56px); }
    .pos-order { position: fixed; bottom: 0; left: 0; right: 0; height: 75vh; max-height: 75vh; border-radius: 16px 16px 0 0; z-index: 460; box-shadow: 0 -10px 30px rgba(0,0,0,.18); transform: translateY(105%); transition: transform .25s ease; }
    .pos-order.mobile-open { transform: translateY(0); }
    .order-sheet-handle { display: flex; justify-content: center; align-items: center; padding: .5rem 0 .25rem; cursor: pointer; flex-shrink: 0; }
    .order-sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--gray-300); transition: background .15s; }
    .order-sheet-handle:hover span { background: var(--gray-400); }
    .cart-fab { display: flex; }

    .mesa-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .35rem; }
    .mesa-btn { padding: .5rem .35rem; font-size: .75rem; }
    .productos-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .modal { max-width: 100%; margin: .5rem; max-height: 95vh; }
    .config-tabs, .admin-tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .config-tab, .admin-tab { flex: 1 0 auto; }
    .form-row-grid, .form-row-grid-4 { grid-template-columns: 1fr; }
    .config-section { padding: 1rem; }
    .series-item { flex-wrap: wrap; }
    .series-item .series-correlativo { margin-left: 0; }
    .toast { right: 1rem; left: 1rem; bottom: 1rem; text-align: center; }
    .admin-panel { padding: .75rem; }
    .login-box { padding: 1.75rem; }
    .k-item { flex-wrap: wrap; gap: .4rem; }
    .k-item-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 480px) {
    .login-box { padding: 1.5rem 1.25rem; }
    .login-box h1 { font-size: 1.35rem; }
    .login-logo { font-size: 2rem; }
    .mesa-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
    .productos-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
    .pos-right-tab { font-size: .72rem; padding: .45rem .5rem; }
    .filter-bar > div { flex: 1 1 100%; }
    .filter-bar input, .filter-bar select { width: 100%; }
    .admin-header, .config-header { flex-direction: column; align-items: flex-start; }
    .report-controls button { flex: 1 1 45%; }
    .main-header h1 { font-size: .9rem; }
    #header-right { gap: .35rem; }
    .btn-cobrar { font-size: .95rem; }
    .order-sheet-handle span { width: 38px; }
}
/* ── TABLE ── */
.table { width: 100%; border-collapse: collapse; font-size: .8rem; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { background: var(--gray-100); padding: .5rem .6rem; text-align: left; font-weight: 600; border-bottom: 2px solid var(--gray-200); font-size: .75rem; }
.table td { padding: .4rem .6rem; border-bottom: 1px solid var(--gray-100); }
.table tr:hover td { background: var(--gray-50); }
.badge { display: inline-block; padding: 2px 6px; border-radius: 10px; font-size: .65rem; font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.admin-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.sucursal-select { background: #44403c; color: #fff; border: 1px solid #78716c; border-radius: 4px; cursor: pointer; }
.sucursal-select option { background: #292524; color: #fff; }
