/* SGO Navimag · estilos base compartidos (mismo sistema visual de SGO Check-In y Portalón) */
:root {
  --red: #9B1B22;
  --ink: #1B1F24;
  --ink-2: #3D4652;
  --muted: #57606A;
  --placeholder: #6A737D;
  --line: #D8DCE1;
  --line-2: #C9CFD6;
  --line-3: #ECEEF1;
  --ground: #F2F3F5;
  --surface: #FFFFFF;
  --blue: #1D4E89;
  --blue-d: #163C69;
  --blue-soft: #DCE6F2;
  --send: #17733F;
  --send-d: #115A31;

  --ok-bg: #E6F4EA; --ok-bd: #A7D7B5; --ok-fg: #145C32;
  --warn-bg: #FDF0DC; --warn-bd: #E8C48A; --warn-fg: #8A4B08; --warn-icon: #B45309;
  --err-bg: #FBE7E6; --err-bd: #EBAAA6; --err-fg: #9B1B1B;
  --off-bg: #ECEEF1; --off-bd: #C9CFD6; --off-fg: #3D4652;

  --font: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid #4C8BD6; outline-offset: 2px; }

/* ---------- Campos ---------- */
.field { min-width: 0; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.lbl .opt { font-weight: 400; color: var(--muted); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.lbl-row .lbl { margin-bottom: 0; }

.ctl {
  width: 100%; height: 48px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); padding: 0 14px; font: 500 16px var(--font); color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
select.ctl { padding-right: 40px; cursor: pointer; }
.ctl::placeholder { color: var(--placeholder); }
.ctl:disabled { background: var(--ground); color: var(--muted); }
.ctl.invalid { border-color: var(--err-fg); box-shadow: 0 0 0 1px var(--err-fg); }
.ctl.warn { border-color: var(--warn-icon); }
textarea.ctl { height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
.ctl.mono { font-family: var(--mono); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.ctl.has-unit { padding-right: 44px; }
.ctl.has-icon { padding-left: 42px; }

.wrap { position: relative; }
.wrap .chev { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--muted); pointer-events: none; }
.wrap .icon-l { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }

.err-msg { margin-top: 6px; font-size: 13px; color: var(--err-fg); font-weight: 600; }
.hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.ok-msg { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok-fg); font-weight: 600; }
.warn-msg { margin-top: 6px; font-size: 13px; color: var(--warn-fg); font-weight: 600; }
.note-warn { margin-top: 8px; background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--warn-fg); line-height: 1.4; }

/* ---------- Interruptor ---------- */
.toggle {
  width: 52px; height: 30px; border-radius: 15px; border: none; background: var(--line-2);
  position: relative; padding: 0; cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.toggle::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 12px;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle[aria-pressed="true"] { background: var(--blue); }
.toggle[aria-pressed="true"]::after { transform: translateX(22px); }
.toggle.sm { width: 44px; height: 26px; border-radius: 13px; }
.toggle.sm::after { width: 20px; height: 20px; border-radius: 10px; }
.toggle.sm[aria-pressed="true"]::after { transform: translateX(18px); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.toggle-row .t-title { font-size: 15px; font-weight: 600; }
.toggle-row .t-sub { font-size: 12px; color: var(--muted); }

/* ---------- Segmentado Sí/No ---------- */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { height: 48px; border: none; background: var(--surface); color: var(--ink); font: 600 16px var(--font); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.seg button.si[aria-pressed="true"] { background: var(--err-fg); }
.seg.invalid { border-color: var(--err-fg); box-shadow: 0 0 0 1px var(--err-fg); }

/* ---------- Contador ---------- */
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; width: 168px; background: var(--surface); }
.stepper button { width: 56px; height: 48px; border: none; background: var(--ground); font: 600 22px var(--font); color: var(--ink); cursor: pointer; }
.stepper output { flex-grow: 1; text-align: center; font-size: 18px; font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: 600 15px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-d); }
.btn-send { background: var(--send); color: #fff; font-weight: 700; }
.btn-send:hover:not(:disabled) { background: var(--send-d); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--ground); }
.btn-warn-outline { background: var(--surface); color: var(--warn-fg); border-color: var(--warn-fg); }
.btn-warn { background: var(--warn-fg); color: #fff; }
.btn-err { background: var(--err-fg); color: #fff; }
.btn-off { background: var(--off-fg); color: #fff; }
.btn-off-outline { background: var(--surface); color: var(--off-fg); border-color: var(--off-fg); }
.btn-link { background: none; border: none; color: var(--blue); font: 600 13px var(--font); cursor: pointer; padding: 6px 0; }
.btn-link:hover { color: var(--blue-d); text-decoration: underline; }

/* ---------- Estado de validación ---------- */
.status { border: 1px solid; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.status-head { display: flex; gap: 10px; align-items: center; }
.status-dot { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.status-title { font-size: 16px; font-weight: 700; }
.status-body { font-size: 14px; line-height: 1.45; }
.status-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status-actions .btn { flex: 1 1 140px; }
.status.ok { background: var(--ok-bg); border-color: var(--ok-bd); } .status.ok .status-dot { background: var(--ok-fg); } .status.ok .status-title { color: var(--ok-fg); }
.status.warn { background: var(--warn-bg); border-color: var(--warn-bd); } .status.warn .status-dot { background: var(--warn-fg); } .status.warn .status-title { color: var(--warn-fg); }
.status.err { background: var(--err-bg); border-color: var(--err-bd); } .status.err .status-dot { background: var(--err-fg); } .status.err .status-title { color: var(--err-fg); }
.status.off { background: var(--off-bg); border-color: var(--off-bd); } .status.off .status-dot { background: var(--off-fg); } .status.off .status-title { color: var(--off-fg); }
.status.loading { background: var(--surface); border-color: var(--line); }

/* Barra compacta */
.status-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid; font-size: 13px; }
.status-bar .dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.status-bar .tag { font-weight: 700; white-space: nowrap; }
.status-bar .rest { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-bar.ok { background: var(--ok-bg); border-color: var(--ok-bd); } .status-bar.ok .dot { background: var(--ok-fg); } .status-bar.ok .tag { color: var(--ok-fg); }
.status-bar.warn { background: var(--warn-bg); border-color: var(--warn-bd); } .status-bar.warn .dot { background: var(--warn-fg); } .status-bar.warn .tag { color: var(--warn-fg); }
.status-bar.err { background: var(--err-bg); border-color: var(--err-bd); } .status-bar.err .dot { background: var(--err-fg); } .status-bar.err .tag { color: var(--err-fg); }
.status-bar.off { background: var(--off-bg); border-color: var(--off-bd); } .status-bar.off .dot { background: var(--off-fg); } .status-bar.off .tag { color: var(--off-fg); }

/* ---------- Tarjetas de reserva / cliente ---------- */
.pick {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; font: inherit; color: inherit; cursor: pointer;
}
.pick:hover { border-color: var(--line-2); background: #FAFBFC; }
.pick[aria-pressed="true"] { border: 2px solid var(--blue); padding: 11px 13px; }
.pick-body { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pick-name { font-size: 15px; font-weight: 700; }
.pick-desc { font-size: 13px; color: var(--ink-2); }
.pick-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; font-size: 12px; color: var(--muted); }
.pick-check { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--line-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.pick[aria-pressed="true"] .pick-check { background: var(--blue); border-color: var(--blue); }
.pick[aria-pressed="true"] .pick-check::after { content: ''; width: 9px; height: 5px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }

.plate { font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--line-3); color: var(--ink); padding: 3px 7px; border-radius: 6px; }
.chip-warn { font-size: 12px; color: var(--warn-fg); background: var(--warn-bg); padding: 3px 7px; border-radius: 6px; font-weight: 600; }
.chip-pend { font-size: 11px; font-weight: 700; color: var(--warn-fg); background: var(--warn-bg); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }

.total { height: 48px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--ground); display: flex; align-items: center; padding: 0 14px; font-size: 17px; font-weight: 700; }

.empty { padding: 16px; text-align: center; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: 12px; }

/* ---------- Carga ---------- */
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--blue); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }

/* ---------- Diálogos ---------- */
dialog.dlg { border: none; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--ink); box-shadow: 0 20px 60px rgba(16, 24, 40, .25); }
dialog.dlg::backdrop { background: rgba(27, 31, 36, .5); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.dlg-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.icon-btn { width: 44px; height: 44px; border: none; background: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: inherit; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

.summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 100; max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0s !important; }
}
.total.warn { border-style: solid; border-color: var(--warn-icon); background: var(--warn-bg); color: var(--warn-fg); }
.ctl.calc { background: var(--ground); font-weight: 700; color: var(--ink); border-style: dashed; }

/* Obligatorio sin llenar: relleno rojo suave; al llenarse vuelve a blanco */
.ctl.req-empty { background: #FDF1F0; border-color: #E9B5B1; }
.seg.req-empty { border-color: #E9B5B1; }
.seg.req-empty button[aria-pressed="false"] { background: #FDF1F0; }
.req-count { font-size: 13px; font-weight: 600; color: var(--err-fg); display: flex; align-items: center; gap: 6px; }
.req-count.ok { color: var(--ok-fg); }
.req-count:empty { display: none; }

/* ---------- Diálogos: estilo general ---------- */
dialog.dlg { border-radius: 20px; box-shadow: 0 24px 64px rgba(16, 24, 40, .28), 0 2px 6px rgba(16, 24, 40, .08); }
dialog.dlg::backdrop { background: rgba(27, 31, 36, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.dlg[open] { animation: dlg-in .18s ease-out; }
dialog.dlg[open]::backdrop { animation: dlg-fade .18s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
.dlg-head { padding: 18px 22px; }
.dlg-head h2 { font-size: 19px; }
.dlg-body { padding: 20px 22px; }
.dlg-foot { padding: 14px 22px 20px; background: #FAFBFC; border-radius: 0 0 20px 20px; }

/* ---------- Modal de confirmación ---------- */
dialog.dlg-confirm { width: min(420px, calc(100vw - 32px)); padding: 28px 24px 22px; text-align: center; }
.confirm-icon {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--warn-bg); color: var(--warn-icon); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px rgba(253, 240, 220, .55);
}
.confirm-title { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink); }
.confirm-valor {
  display: inline-block; margin: 14px auto 0; padding: 8px 18px; border-radius: 12px;
  background: var(--ground); border: 1px solid var(--line); font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: .3px;
}
.confirm-valor.mono { font-family: var(--mono); letter-spacing: 2px; }
.confirm-msg { margin: 12px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.confirm-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.confirm-actions .btn { height: 48px; font-size: 16px; border-radius: 12px; }
