/* Base y accesibilidad */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-title); line-height: 1.2; font-weight: var(--weight-bold); letter-spacing: -.6px; }
h2 { font-size: var(--text-lg); line-height: 1.4; font-weight: var(--weight-semibold); margin-bottom: var(--space-4); }
h3 { font-size: var(--text-base); margin-bottom: var(--space-3); }
strong { font-weight: var(--weight-semibold); }
small { display: block; color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { clip-path: inset(50%); position: fixed; left: var(--space-4); top: -100px; background: var(--blue-strong); color: white; z-index: 100; padding: var(--space-3); }
.skip-link:focus { clip-path: none; top: var(--space-3); }
.icon { width: var(--icon-size); height: var(--icon-size); flex-shrink: 0; vertical-align: middle; }
.muted, .panel-subtitle { color: var(--muted); }
.fine-print { font-size: var(--text-xs); color: var(--muted); line-height: 1.65; }
.numeric, .metric>strong, .grand-total strong, .top-quantity, .payment-stat strong { font-variant-numeric: tabular-nums; }
.numeric { white-space: nowrap; text-align: right; }
.code { font-family: var(--font-mono); color: #bfcee0; font-size: var(--text-sm); white-space: nowrap; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }

/* Componentes compartidos */
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: var(--space-5); }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.panel-title h2 { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.panel-title>a, .panel-footer-link { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); white-space: nowrap; }
.panel-title>a .icon, .panel-footer-link .icon { width: 15px; height: 15px; }
.panel-subtitle { margin-top: 5px; font-size: var(--text-xs); line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-height); border: 1px solid var(--line-strong); background: #192b3b; color: var(--text); padding: 9px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background var(--transition), border-color var(--transition); }
.button:hover:not(:disabled) { background: #233b50; border-color: #5b7a96; text-decoration: none; }
.button.primary, .button.selected { background: var(--blue-strong); border-color: var(--blue); color: white; }
.button.primary:hover:not(:disabled), .button.selected:hover:not(:disabled) { background: var(--blue-hover); border-color: var(--blue-hover); }
.button.success { background: #087b57; border-color: #14966f; color: white; }
.button.success:hover:not(:disabled) { background: #0b9068; }
.button.danger { background: #803247; border-color: #ae4f67; }
.button.danger-ghost { color: var(--red); border-color: var(--red-line); background: var(--red-surface); }
.button.ghost { background: transparent; }
.button.compact { min-height: 36px; padding: 6px 10px; font-size: var(--text-sm); }
.button.compact .icon { width: 16px; height: 16px; }
.button.icon-button { padding: var(--space-2); min-width: 40px; min-height: 40px; }
.button.full { width: 100%; margin-top: var(--space-3); }
input, select { border: 1px solid var(--line-control); border-radius: var(--radius-sm); background: var(--surface-input); color: var(--text); min-height: var(--control-height); padding: 9px var(--space-3); max-width: 100%; min-width: 0; }
input::placeholder { color: #99adc0; }
input:read-only { background: var(--panel-soft); }
input:disabled { opacity: .65; }
input:focus-visible, select:focus-visible { outline-offset: 1px; }
input[type=number] { appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { appearance: none; }
select { cursor: pointer; }
.field { display: grid; gap: 7px; font-size: var(--text-sm); color: #c8d5e4; min-width: 0; }
.field input, .field select { width: 100%; }
.badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #36516a; border-radius: 4px; padding: 3px 7px; background: #192d3e; color: #c6d9eb; font-size: 10px; font-weight: 500; white-space: nowrap; }
.badge.green { background: var(--green-surface); border-color: var(--green-line); color: var(--green); }
.badge.amber { background: var(--amber-surface); border-color: var(--amber-line); color: var(--amber); }
.badge.red { background: var(--red-surface); border-color: var(--red-line); color: var(--red); }
.demo-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--blue-text); }
.notice { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) var(--page-gutter) 0; padding: var(--space-2) var(--space-3); border: 1px solid #32536c; border-left: 3px solid var(--blue); border-radius: var(--radius-sm); background: #142737; color: #d8e8f7; font-size: 13px; }
.notice>span { flex: 1; overflow-wrap: anywhere; }
.notice>.icon { width: 17px; height: 17px; color: var(--blue-text); }
.notice .button { min-width: 32px; min-height: 32px; border-color: transparent; background: transparent; color: var(--muted); }
.notice .button .icon { width: 16px; height: 16px; }
.notice.error { background: #2a1e27; border-color: var(--red-line); color: #ffd5dd; }
.notice.error>.icon { color: var(--red); }
.empty { text-align: center; padding: var(--space-7) var(--space-4) !important; color: var(--muted); }
.demo-note { background: var(--surface-input); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-3); margin-top: var(--space-5); font-size: var(--text-xs); line-height: 1.7; color: var(--muted); }
.demo-note strong { color: #d7e3f1; font-size: var(--text-sm); }
.demo-note p { margin-top: var(--space-1); }

/* Alertas comerciales: siempre derivadas del inventario */
.notifications { position: relative; }
#notification-toggle { position: relative; background: transparent; border-color: var(--line); color: #bed0e2; }
.notification-count { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; border: 2px solid #0e1924; border-radius: 5px; background: var(--amber); color: #1a2129; font-size: 9px; line-height: 13px; text-align: center; font-weight: 700; padding: 0 2px; }
.notification-panel { position: absolute; right: 0; top: calc(100% + 12px); width: min(410px, calc(100vw - 32px)); max-height: min(76vh, 560px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-overlay); }
.notification-panel:focus { outline: 2px solid var(--focus); outline-offset: 3px; }
.notification-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--line); }
.notification-heading h2 { margin: 0; font-size: 15px; }
.notification-heading .eyebrow { font-size: 9px; margin-bottom: 3px; }
.notification-heading .button { border-color: transparent; background: transparent; }
.notification-help { font-size: var(--text-xs); color: var(--muted); padding: var(--space-3) var(--space-4); }
.notification-list { list-style: none; padding: 0; margin: 0; }
.notification-list a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); color: var(--text); border-top: 1px solid var(--line); }
.notification-list a:hover { background: var(--surface-hover); text-decoration: none; }
.notification-list a>span:nth-child(2) { flex: 1; min-width: 0; }
.notification-list strong { display: block; font-size: var(--text-sm); overflow-wrap: anywhere; }
.notification-list small { font-size: 10px; margin-top: 3px; }
.notification-list a>.icon { width: 15px; height: 15px; color: var(--muted); }
.notification-glyph { display: flex; align-items: center; justify-content: center; width: 30px; height: 34px; flex-shrink: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.notification-glyph.amber { color: var(--amber); }
.notification-glyph.red { color: var(--red); }
.notification-footer { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); border-top: 1px solid var(--line); font-size: var(--text-sm); }
.notification-empty { padding: var(--space-6); text-align: center; color: var(--muted); font-size: var(--text-sm); }
.notification-empty>.icon { color: var(--green); display: block; margin: 0 auto var(--space-3); }
.notification-empty strong { display: block; color: var(--text); }
.notification-empty p { margin-top: var(--space-2); }

