/* base.css — reinicio y componentes compartidos por portal y panel */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-family: var(--font); color: var(--text-primary); background: var(--bg-page); }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
body.modal-open { overflow: hidden; }

/* Utilidades */
.container { max-width: var(--w-site); margin: 0 auto; padding: 0 1.5rem; }
.container--panel { max-width: var(--w-panel); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 2000; background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: var(--radius-sm); font-weight: 700; }
.skip-link:focus { top: 1rem; }
.mt-sm { margin-top: 0.75rem; } .mt-md { margin-top: 1.25rem; } .mt-lg { margin-top: 1.5rem; }
.icon { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Botones: un solo sistema */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.7rem 1.1rem; border-radius: var(--radius-md); border: 1px solid transparent; font-size: 0.875rem; font-weight: 700; line-height: 1.2; transition: transform 0.15s, opacity 0.2s, background-color 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--red-primary), var(--red-hover)); color: #fff; box-shadow: var(--shadow-accent); }
.btn-ink { background: var(--ink); color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.btn-ink:hover { background: #1e293b; }
.btn-light { background: #fff; color: var(--red-primary); }
.btn-light:hover { background: #f1f5f9; }
.btn-ghost { background: var(--ghost-bg); border-color: var(--border-strong); color: var(--text-primary); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-whatsapp:hover { background: #15803d; }

/* Campos: un solo sistema */
.input { width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--field-bg); color: var(--text-primary); font-size: 0.9rem; }
.input:focus { border-color: var(--focus); }
.input::placeholder { color: var(--text-muted); }
.input[type="file"] { padding: 0.45rem; font-size: 0.8rem; }
textarea.input { resize: vertical; min-height: 5rem; line-height: 1.5; }
select.input option { background: var(--bg-surface); color: var(--text-primary); }
.field-group { display: flex; flex-direction: column; gap: 0.3rem; }
.field-group > label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field-group.full { grid-column: 1 / -1; }
.field-group + .field-group { margin-top: 0; }
.stack { display: grid; gap: 0.9rem; }
.fine-print { font-size: 0.78rem; color: var(--text-muted); }
.input-row { display: flex; gap: 0.5rem; }
.input-row .input { flex: 1; min-width: 0; }
.check-inline { flex-direction: row; align-items: center; gap: 0.5rem; }
.check-inline input { width: auto; accent-color: var(--red-primary); }
@media (max-width: 500px) { .field-grid { grid-template-columns: 1fr; } }

/* Buscador con ícono */
.search { position: relative; }
.search .icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; z-index: 1; }
.search .input { padding: 0.85rem 1.1rem 0.85rem 2.8rem; }

/* Píldoras: filtros y pestañas */
.pill { padding: 0.5rem 1rem; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); background: var(--pill-bg); color: var(--text-secondary); font-size: 0.8125rem; font-weight: 700; transition: border-color 0.2s, background-color 0.2s; }
.pill:hover { border-color: var(--border-strong); }
.pill.active { background: var(--red-primary); border-color: var(--red-primary); color: #fff; }

/* Superficie, etiquetas y avisos */
.panel { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 2rem; }
.tag { display: inline-block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; background: #d97706; color: #fff; padding: 0.15rem 0.45rem; border-radius: 0.25rem; }
.tag-slate { background: #334155; }
.tag-red { background: var(--red-primary); }
.notice { margin-top: 1rem; padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; border: 1px solid transparent; }
.notice-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.notice-err { background: var(--err-bg); color: var(--err-text); border-color: var(--err-line); }

/* Estados (flota, solicitudes, portal): el color viene de --st */
.st-operativo, .st-aprobada { --st: var(--st-ok); }
.st-mantenimiento, .st-recibida { --st: var(--st-warn); }
.st-fuera_servicio { --st: var(--st-bad); }
.st-en_proceso { --st: var(--st-info); }
.st-rechazada { --st: #64748b; }
.status-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--st, var(--text-muted)); flex-shrink: 0; }
.status-badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 0.2rem 0.7rem; border-radius: var(--radius-pill); background: var(--st, var(--text-muted)); color: #fff; font-size: 0.6875rem; font-weight: 700; }

/* Cabecera institucional compartida */
.header { background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); }
.header-inner { height: 4.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.monogram { width: 2.5rem; height: 2.5rem; border-radius: 0.6rem; background: var(--monogram-bg); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex-shrink: 0; }
.brand-logo { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.brand-name { display: block; font-weight: 800; font-size: 1rem; line-height: 1.2; }
.brand-loc { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Modales: un solo sistema (.open) */
.modal-overlay { display: none; position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim); backdrop-filter: blur(8px); align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); width: 100%; max-width: 38.75rem; max-height: 90vh; overflow-y: auto; padding: 1.5rem; box-shadow: var(--shadow-modal); }
.modal-sm { max-width: 28rem; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-subtle); }
.modal-title { font-size: 1.05rem; font-weight: 800; }
.close-btn { font-size: 1.5rem; line-height: 1; color: var(--text-muted); padding: 0 0.25rem; }
.close-btn:hover { color: var(--text-primary); }
.modal-footer { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: 0.75rem; }
.modal-text { font-size: 0.9rem; color: var(--text-secondary); }

/* Avisos emergentes (reemplazan alert) */
.toasts { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 0.5rem; width: min(92vw, 26rem); pointer-events: none; }
.toast { pointer-events: auto; padding: 0.8rem 1rem; border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 600; border: 1px solid; box-shadow: var(--shadow-modal); background-color: var(--bg-surface); animation: toast-in 0.18s ease-out; }
.toast-ok { background-image: linear-gradient(var(--ok-bg), var(--ok-bg)); color: var(--ok-text); border-color: var(--ok-line); }
.toast-err { background-image: linear-gradient(var(--err-bg), var(--err-bg)); color: var(--err-text); border-color: var(--err-line); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
