/* Classic, familiar controls. Existing page order and operational IDs are retained. */
:root {
  color-scheme: light;
  --ui-ink: #243a34;
  --ui-muted: #53665f;
  --ui-green: #225c47;
  --ui-border: #cbd7cf;
  --ui-paper: #ffffff;
  --ui-soft: #f0f5ef;
  --ui-radius: 8px;
  --bg: #f5f6f2;
  --bg-1: #f5f6f2;
  --bg-2: #edf2eb;
  --bg-3: #f5f6f2;
  --surface: #fff;
  --surface-2: #f0f5ef;
  --card: #fff;
  --card-soft: #f0f5ef;
  --panel: #fff;
  --text: #243a34;
  --text-dark: #243a34;
  --white: #243a34;
  --muted: #53665f;
  --line: #cbd7cf;
  --border: #cbd7cf;
  --green: #225c47;
  --primary: #225c47;
  --primary-2: #194635;
  --success: #22613c;
  --warning: #8a5715;
  --amber: #8a5715;
  --danger: #ad3039;
  --shadow: 0 2px 8px rgb(28 54 40 / 7%);
  --radius-xl: 12px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; scroll-padding-top: 16px; }
body, body.canoita {
  margin: 0; min-height: 100vh; display: block;
  background: var(--bg); color: var(--ui-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px; line-height: 1.55; overflow-x: visible;
}
body::before, body::after { display: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { color: var(--ui-ink); line-height: 1.25; text-wrap: balance; }
body h1 { font-size: clamp(1.75rem, 3vw, 2.45rem); letter-spacing: -.025em; }
body h2 { font-size: clamp(1.2rem, 2vw, 1.55rem); }
p { line-height: 1.6; }
a { color: var(--ui-green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, summary { touch-action: manipulation; }
button, input, select, textarea, summary { max-width: 100%; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }
[hidden] { display: none !important; }
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #1264a3 !important; outline-offset: 3px;
}
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 10000; background: #fff; padding: 12px 18px; border: 2px solid var(--ui-green); }
.skip-link:focus { top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]), select, textarea) {
  min-height: 46px; min-width: 0; max-width: 100%; border: 1px solid #8eaa99;
  border-radius: 6px; background: #fff; color: var(--ui-ink);
  padding: 10px 12px; font-size: 16px; box-shadow: inset 0 1px 2px rgb(0 0 0 / 3%);
}
input[type=checkbox], input[type=radio] { accent-color: var(--ui-green); width: 22px; height: 22px; flex-shrink: 0; }
input::placeholder, textarea::placeholder { color: #67766f; opacity: 1; }
body label, body legend { color: var(--ui-ink); font-size: 14px; font-weight: 650; }
body :is(button, .button, .btn-main, .nav-btn, .nav-links a, .chip) {
  min-height: 44px; border-radius: 7px; font-weight: 650;
  white-space: normal; line-height: 1.35; text-align: center;
  box-shadow: none; transition: background-color .12s, border-color .12s;
}
body :is(button, .button, .btn-main) {
  background: var(--ui-green); color: #fff; border: 1px solid var(--ui-green); padding: 11px 17px;
}
body :is(button, .button):hover { filter: none; transform: none; }
body :is(button, .button):not(:disabled):hover { box-shadow: inset 0 0 0 999px rgb(0 0 0 / 5%); }
body :is(.secondary, .button.secondary, .qty-btn, .icon-btn, #btnLimpiar, .nav-links a, .nav-btn) {
  background: #fff; color: var(--ui-green); border: 1px solid #b3c6b8;
}
body :is(.text-button, .text-link, .income-export, .export-link) {
  background: transparent; color: var(--ui-green); text-decoration: underline; box-shadow: none;
}
body .text-button { border-color: transparent; padding: 9px 3px; }
body :is(.btn-danger, .btn-delete, .btn-no, .danger, .text-button.danger) { background: #fff0f0; color: #9c2531; border: 1px solid #d7959a; }
body :is(.btn-success, .btn-ok, .btn-listo, .btn-servido) { background: #22613c; color: #fff; border-color: #22613c; }
.nav-links { gap: 8px; }
body .nav-links a { padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
body :is(.nav-links a.active, .nav-links a[aria-current=page], .nav-btn.active) { background: var(--ui-green); color: #fff; border-color: var(--ui-green); }
body :is(.page-header, .topbar, .inventory-header) {
  background: #eaf1e8; color: var(--ui-ink); border: 1px solid var(--ui-border);
  border-top: 4px solid var(--ui-green); border-radius: 10px; box-shadow: none;
}
body :is(.page-header h1, .topbar h1, .inventory-header h1) { color: var(--ui-ink); }
body :is(.page-header p, .topbar p, .inventory-header p, .subtle, .muted, .geo-note, .eyebrow) { color: var(--ui-muted); }
body.canoita .canoita-header { background: #eaf1e8; color: var(--ui-ink); border-radius: 10px; }
body.canoita .canoita-header h1 { color: var(--ui-ink); }
body.canoita .canoita-header p { color: var(--ui-muted); }
.page-header::after, .topbar::after, .panel::before { display: none; }
.page-header h1::before, .topbar h1::before, .panel h2::before { display: none; }
body .page-heading h1::before { display: none; }
body :is(.page-heading .brand, .admin-wrap > .brand) { color: var(--ui-green); }
body :is(.page-heading p, .section-heading p, .period-heading, .pagination) { color: var(--ui-muted); }
body .receipts-section > .muted, body .count, body .legend-pill.idle { color: #506258; }
body .hero h1 { color: #fff; }
body .metric::before { background: #88ad91; height: 4px; }
body :is(.metric strong, .receipt-amount) { color: var(--ui-ink); }
body .income-wrap .metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
body .service-board-summary { flex-wrap: wrap; }
body :is(.panel, .info-card, .pedido-card, .service-board, .access-card, .login-card,
  .restaurant-card, .metric, .receipt-card, .staff-order, .accounting-gate, .product-summary-card,
  .menu-card, .cart-panel, .product-card, .print-receipt) {
  background: #fff; color: var(--ui-ink); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius); box-shadow: 0 2px 6px rgb(28 54 40 / 4%);
  min-width: 0;
}
body :is(.panel h2, .panel h3, .panel p, .panel strong, .info-card h3, .info-card p,
  .pedido-card h3, .pedido-card p, .pedido-card strong, .service-board h3, .restaurant-card h2) { color: var(--ui-ink); }
body :is(.draft-panel, .product-preview, .picker-trigger, .toggle-card, .draft-item, .board-item,
  .status-grid>div, .local-totals p, .receipt-lines, .web-request, .quick-access-group, .summary-box) {
  background: #f0f5ef; color: var(--ui-ink); border-color: var(--ui-border); border-radius: 8px;
}
body :is(.draft-head p, .board-item p, .product-summary-card p, .picker-label, .receipt-identity small,
  .receipt-kind small, .metric small, .global-metrics small, .global-metrics span, .status-grid span,
  .local-totals p, .pending-total, .small, .historical-price, .menu-detail summary) { color: var(--ui-muted); }
body :is(.product-preview strong, .picker-trigger strong, .draft-total, .pending-total strong,
  .local-totals b, .status-grid strong, .product-summary-side, .product-price) { color: var(--ui-green); }
body :is(.main-metric, .global-metrics .balance) { background: #225c47; color: #fff; border-color: #225c47; }
body :is(.main-metric strong, .main-metric span, .main-metric small, .balance strong, .balance span, .balance small) { color: #fff; }
body .global-metrics article { background: #fff; border-color: var(--ui-border); }
body .global-metrics .balance { background: #225c47; }
body .restaurant-card { border-top: 4px solid #225c47; }
body .restaurant-card.trujillo { border-top-color: #9a651d; }
body .button.trujillo { color: #57390e; background: #f6e9d2; border-color: #c5a16a; }
body :is(.trujillo .eyebrow, .trujillo .menu-detail summary) { color: #795015; }
body .local-banner { background: #214b3b; color: #fff; min-height: 48px; padding: 8px 24px; letter-spacing: .015em; }
body .local-banner nav { gap: 12px; flex-wrap: wrap; }
body .local-banner a { color: #fff; padding: 8px 3px; min-height: 40px; display: inline-flex; align-items: center; text-decoration: underline; font-size: 13px; }
body .local-banner strong { color: #fff; }
body .local-banner .session-logout { margin: 0; }
body .local-banner .session-logout button { background: #fff; color: #214b3b; border: 1px solid #fff; font-size: 14px; padding: 9px 14px; }
body :is(.alert.error, .error, .error-status) { background: #fff0f0; color: #912a32 !important; border: 1px solid #dea1a6; border-radius: 6px; }
body :is(.alert.success, .alert-ok, .badge.disponible, .status-pill.servido, .state.ready) { background: #e6f3e7; color: #245334; border-color: #a6c9ac; }
body :is(.badge.sin-stock, .row-sin-stock, .warning-box, .kitchen-note, .income-note, .catalogue-note) { background: #fff5e0; color: #6b4917; border-color: #d6bb85; }
body :is(.status-pill.pendiente, .state) { background: #eaf1fa; color: #204f7b; }
body .status-pill.preparando { background: #fff0cf; color: #74490b; }
body .status-pill.listo { background: #e2f0df; color: #31562a; }
body :is(.status-pill, .badge, .state, .draft-badge) { font-size: 13px; line-height: 1.5; }
body .empty-state, body .empty-text { background: #f4f7f2; border-color: var(--ui-border); color: var(--ui-muted); }
body :is(.timer, .countdown) { font-variant-numeric: tabular-nums; background: #eef3ed; color: #244936; }
body :is(table, th, td) { color: var(--ui-ink); }
body th { background: #edf3eb; color: #395548; font-size: 13px; text-transform: none; letter-spacing: 0; }
body td { font-size: 14px; }
body :is(th, td) { border-color: #d9e2d8; }
body tbody tr:nth-child(even) { background: #f8faf6; }
body tbody tr:hover { background: #f0f5ed; }
.table-wrap, .table-scroll, .responsive-table { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.responsive-table:focus-visible { outline: 3px solid #1264a3; }
body :is(.modal-sheet, dialog) { color: var(--ui-ink); background: #fff; border: 1px solid var(--ui-border); border-radius: 10px; max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; }
dialog::backdrop, .modal-backdrop { background: rgb(19 38 29 / 55%); }
.modal-sheet { width: min(720px, calc(100vw - 24px)); }
body :is(.modal-head h2, .dialog-head h2) { color: var(--ui-ink); }
body :is(.category-chip, .mesa-option, .product-option, .number-grid button) { background: #fff; color: var(--ui-ink); border: 1px solid #9db6a5; box-shadow: none; }
body :is(.category-chip.active, .category-chip[aria-pressed=true], .destination-tabs button[aria-pressed=true]) { background: var(--ui-green); color: #fff; border-color: var(--ui-green); }
body .category-chip.tone-platos { border-left: 5px solid #b96324; }
body .category-chip.tone-combos { border-left: 5px solid #6853a1; }
body .category-chip.tone-refrescos { border-left: 5px solid #197389; }
body .category-chip.tone-gaseosas { border-left: 5px solid #4a7a3e; }
body .category-chip.tone-infusiones { border-left: 5px solid #9a4b82; }
body .category-chip.tone-snacks { border-left: 5px solid #94700b; }
body .category-chip.tone-porciones { border-left: 5px solid #a94753; }
body .category-chip.active { outline: 2px solid var(--ui-green); outline-offset: 2px; }
body .alarm-panel { background: #fff4df; color: #624718; border: 1px solid #d7bd86; box-shadow: none; }
body :is(.alarm-panel h2, .alarm-panel p, .alarm-kicker) { color: #624718; }
body .alarm-btn.secondary { background: #fff; color: #624718; border-color: #bca475; }
.login-page { width: 100%; padding: clamp(24px, 7vh, 68px) 16px; }
.login-card { width: 100%; max-width: 460px; margin: 0 auto; padding: 28px; }
.login-card h1 { text-align: left; }
.login-card p { text-align: left; }
.login-form input { margin-bottom: 12px; }
.password-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 14px; }
.password-row input { flex: 1; width: 0; margin: 0 !important; }
body .password-toggle { flex: 0 0 auto; width: auto; background: #edf3eb; border: 1px solid #9cb4a4; color: #284c3a; font-size: 14px; padding: 8px 12px; }
.caps-warning { margin: 6px 0; color: #795015; font-size: 14px; }
.login-help { color: var(--ui-muted); font-size: 14px; }
.access-card { padding: clamp(20px, 3vw, 32px); }
.access-page { gap: clamp(24px, 6vw, 80px); }
.access-page h1, .staff-page h1 { font-family: inherit; }
.staff-links { display: flex; gap: 10px; flex-wrap: wrap; }
.staff-links .button { min-width: 120px; }
body .site-header { background: #fff; border-color: var(--ui-border); }
body .site-footer { background: #214b3b; color: #fff; }
body :is(.site-footer a, .site-footer p, .site-footer span, .site-footer small, .site-footer address) { color: #fff; }
.site-footer a { display: inline-block; padding-block: 7px; }
body .announcement { background: #214b3b; color: #fff; }
body .history-entry, body .source-banner { background: #edf3e9; color: var(--ui-ink); border-color: #bdceb7; }
body .income-export { color: #225c47; min-height: 44px; display: inline-flex; align-items: center; }
.income-table summary, .model-explanation summary { min-height: 44px; }
body .chart-detail { color: #2e5140; }
body .source-badge { color: #245032; }
body .estimate-badge { color: #795015; }
body .income-table table { min-width: 540px; }
#income-chart { min-height: 0; }
#income-chart svg { min-width: 0; width: 100%; }
.chart-scroll-hint { font-size: 14px; color: var(--ui-muted); }
body .live-status { color: var(--ui-muted); font-size: 14px; }
body .live-status button { font-size: 14px; }
.back-links { gap: 8px; }
.back-links a { min-height: 44px; display: inline-flex; align-items: center; }
body :is(.page, .container, .admin-wrap, .master-wrap, .inventory-page, .section) { min-width: 0; max-width: 100%; }
:is(.order-layout, .selector-grid, .form-grid, .metrics, .restaurant-grid, .income-grid, .cards-grid, .service-grid) > * { min-width: 0; }
body .metric strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (min-width: 801px) {
  body .admin-wrap { max-width: 1240px; }
  body .container { max-width: 1380px; }
  body .page { max-width: 1360px; }
  body .master-wrap { max-width: 1640px; }
  body .inventory-page { max-width: 1200px; }
}
@media (max-width: 1000px) {
  body :is(.page-header, .alarm-panel, .draft-panel, .draft-head) { position: static; }
  .topbar { flex-wrap: wrap; }
  .topbar .nav-links { justify-content: flex-start; }
  .order-layout { grid-template-columns: 1fr; }
  .cards-grid, .service-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  body :is(.container, .page, .admin-wrap, .master-wrap, .inventory-page) { padding: 18px 12px 30px; }
  body :is(.panel, .page-header, .topbar, .inventory-header, .restaurant-card) { padding: 18px 15px; }
  body .local-banner { padding: 9px 14px; gap: 2px 12px; font-size: 12px; }
  body .local-banner nav { gap: 10px; }
  body .local-banner a { min-height: 40px; }
  body .nav-links { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-start; }
  body .nav-links a { flex: 1 0 auto; padding: 10px 12px; font-size: 14px; }
  body :is(.page-heading, .master-heading, .inventory-header, .panel-intro, .draft-head, .service-board-top) { flex-wrap: wrap; }
  body .page-heading nav { flex-wrap: wrap; }
  .order-layout, .selector-grid, .form-grid, .income-grid { grid-template-columns: 1fr; }
  body .section { padding: 28px 16px; }
  .welcome-art .leaf { right: 12px; }
  .access-page { display: grid; grid-template-columns: 1fr; }
  .access-page > div { min-width: 0; }
  body .access-page { gap: 20px; padding-top: 22px; }
  body .access-page h1 { font-size: 28px; line-height: 1.2; margin: 12px 0; }
  body .access-page > div > p { margin: 10px 0; }
  body .access-page .eyebrow { font-size: 10px; }
  .access-card { padding: 22px 18px; }
  .staff-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-links .button { min-width: 0; padding: 12px 9px; }
  body .filters form { width: 100%; gap: 12px; }
  body .filters label { min-width: 0; flex: 1 1 140px; }
  body .filters input, body .filters select { width: 100%; max-width: 100%; }
  body .filters button { flex: 1 1 100%; }
  body .exports { gap: 12px; }
  .exports a { display: inline-flex; min-height: 44px; align-items: center; }
  body .metrics { grid-template-columns: 1fr; }
  body .metric { padding: 20px; }
  body .metric small { font-size: 13px; }
  .receipt-card summary { overflow-wrap: anywhere; }
  .receipt-card .receipt-amount { white-space: normal; }
  body .status-grid span { font-size: 12px; }
  .status-grid > div { min-width: 0; }
  body .accounting-gate { margin: 24px 12px; padding: 24px 18px; }
  body .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-chip { overflow-wrap: anywhere; font-size: 13px; }
  body .modal-sheet { width: calc(100vw - 20px); max-height: 90vh; max-height: 90dvh; padding: 18px 14px; }
  body dialog { width: calc(100vw - 24px); max-width: 100%; padding: 18px 14px; }
  .modal-head, .dialog-head { gap: 12px; flex-wrap: wrap; }
  body .alarm-panel { flex-wrap: wrap; }
  .alarm-actions { width: 100%; flex-wrap: wrap; }
  .alarm-actions button { flex: 1; }
  .chart-panel .section-heading { flex-direction: column; align-items: flex-start; }
  .income-note { font-size: 14px; }
  .pagination { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  body :is(.container, .page, .admin-wrap, .master-wrap) { padding-inline: 8px; }
  body :is(.panel, .page-header, .restaurant-card) { padding: 16px 12px; }
  .login-card { padding: 22px 18px; }
  .receipt-card summary { grid-template-columns: minmax(0, 1fr) auto 10px; }
  body .status-grid { gap: 4px; }
  body .status-grid > div { padding: 10px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: #fff; color: #111; }
  .skip-link, .password-toggle, .local-banner { display: none !important; }
  body .print-receipt { border: 0; box-shadow: none; }
  .table-wrap, .table-scroll, .responsive-table { overflow: visible; }
}
