/* =============================================================
   MAPA — Mapa de Operaciones
   Sistema visual corporativo. Vanilla CSS, mobile-first.
   Spec: docs/superpowers/specs/2026-05-02-mapa-redesign-corporativo.md
   ============================================================= */

/* ----- Tokens ----- */
:root {
    /* Surfaces */
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-surface-muted: #F1F5F9;
    --color-border: #E2E8F0;
    --color-border-strong: #CBD5E1;

    /* Text */
    --color-text: #0F172A;
    --color-text-muted: #475569;
    --color-text-faint: #94A3B8;

    /* Brand */
    --color-primary: #1B2A4E;
    --color-primary-hover: #14213E;
    --color-primary-soft: #EEF2F8;

    /* Status */
    --color-status-pendiente:  #64748B;
    --color-status-en_curso:   #B45309;
    --color-status-hecho:      #0F766E;
    --color-status-descartado: #94A3B8;

    /* Priority */
    --color-priority-alta:  #B91C1C;
    --color-priority-media: #B45309;
    --color-priority-baja:  #0F766E;

    /* Danger */
    --color-danger: #B91C1C;
    --color-danger-soft: #FEE2E2;

    /* Spacing (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:    0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10);

    /* Type scale */
    --fs-xs:   12px;
    --fs-sm:   13px;
    --fs-base: 15px;
    --fs-md:   16px;
    --fs-lg:   18px;
    --fs-xl:   24px;

    /* Topbar */
    --topbar-h: 56px;
}

/* ----- Reset / base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--color-text); }
h1 { font-size: var(--fs-xl); line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; }
h2 { font-size: var(--fs-lg); line-height: 1.4; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-base); line-height: 1.5; }
p  { margin: 0; }

/* Type utilities */
.muted  { color: var(--color-text-muted); }
.faint  { color: var(--color-text-faint); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }

/* Icons (Lucide inline SVGs). Sized to surrounding font by default. */
.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }

.brand-mark {
    display: inline-block;
    flex-shrink: 0;
    border-radius: var(--radius);
}

/* ----- Layout ----- */
.main { min-height: 100%; }
body.full-map .main { position: fixed; inset: var(--topbar-h) 0 0 0; }
body.has-topbar .main { padding-top: var(--topbar-h); }
body.full-map.has-topbar .main { padding-top: 0; }

/* =============================================================
   TOPBAR
   ============================================================= */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    z-index: 1000;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text);
    text-decoration: none;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--color-text); }
.brand-title {
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-primary);
    line-height: 1;
    white-space: nowrap;
}

.topbar-spacer { flex: 1; }

.topbar-nav {
    display: none; /* desktop only */
    align-items: center;
    gap: var(--space-1);
}
.topbar-nav a {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
    font-weight: 500;
}
.topbar-nav a:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
    text-decoration: none;
}
.topbar-nav a.is-active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.user-chip {
    display: none; /* desktop only */
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-2);
    font-size: var(--fs-sm);
}
.user-chip-name {
    color: var(--color-text);
    font-weight: 500;
}
.user-chip-role {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    transition: background 120ms ease, color 120ms ease;
}
.icon-btn:hover { background: var(--color-surface-muted); color: var(--color-text); }
.icon-btn:active { background: var(--color-border); }
.icon-btn .icon { width: 20px; height: 20px; }

.topbar-menu { /* visible on mobile only */ }
.topbar-filters { /* visible on map view */ }

/* Desktop adjustments */
@media (min-width: 700px) {
    .topbar { padding: 0 var(--space-6); }
    .topbar-nav { display: inline-flex; }
    .user-chip  { display: inline-flex; }
    .topbar-menu { display: none; }
}

/* =============================================================
   SIDE MENU (mobile drawer)
   ============================================================= */
.side-menu {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 84%;
    max-width: 320px;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    overflow-y: auto;
}
.side-menu[hidden] { display: none; }

.side-menu-close {
    align-self: flex-end;
    width: 40px; height: 40px;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    display: inline-flex; align-items: center; justify-content: center;
}
.side-menu-close:hover { background: var(--color-surface-muted); color: var(--color-text); }

.side-menu-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-2);
}
.side-menu-avatar {
    width: 40px; height: 40px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--fs-sm);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.side-menu-user {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.side-menu-user-name {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side-menu-user-email {
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-menu a,
.side-menu button.btn-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: 48px;
    padding: 0 var(--space-3);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: var(--fs-base);
    font-weight: 500;
    text-decoration: none;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
}
.side-menu a:hover,
.side-menu button.btn-link:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
    text-decoration: none;
}
.side-menu a .icon,
.side-menu button.btn-link .icon {
    width: 20px; height: 20px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.side-menu a:hover .icon,
.side-menu button.btn-link:hover .icon {
    color: var(--color-primary);
}
.side-menu form { margin: 0; padding: 0; }

/* =============================================================
   FORMS / FIELDS
   ============================================================= */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.field > label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=date],
.field input[type=file],
.field textarea,
.field select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--fs-md); /* ≥16px stops iOS zoom */
    line-height: 1.4;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input::placeholder,
.field textarea::placeholder {
    color: var(--color-text-faint);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.field input[type=file] {
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-sm);
}
.field textarea { min-height: 96px; resize: vertical; }
.field select { appearance: none; padding-right: var(--space-8);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5 6 6.5 11 1.5' stroke='%23475569' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
}

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: #fff;
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease,
                color 120ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--color-primary-hover); color: #fff; text-decoration: none; }
.btn:active { background: var(--color-primary-hover); }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { /* alias */ }

.btn-secondary {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
    color: var(--color-primary);
}
.btn-secondary:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
    color: var(--color-primary-hover);
}

.btn-danger {
    background: var(--color-surface);
    border-color: var(--color-danger);
    color: var(--color-danger);
}
.btn-danger:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.btn-link {
    background: transparent;
    border: 0;
    color: var(--color-primary);
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-sm);
    font-weight: 500;
    min-height: 32px;
}
.btn-link:hover { text-decoration: underline; color: var(--color-primary-hover); }
.btn-link[disabled] {
    color: var(--color-text-faint);
    cursor: not-allowed;
    text-decoration: none;
}

.btn-block { width: 100%; }

/* =============================================================
   CHIPS (toggle groups — rectangular, not pill)
   ============================================================= */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: 1;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.chip:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
}
.chip[aria-pressed="true"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* =============================================================
   TAGS / BADGES (rectangular, status + priority)
   ============================================================= */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-transform: capitalize;
}

/* Status: translucent-tinted background with saturated text. */
.tag-pendiente   { background: rgba(100, 116, 139, 0.12); color: var(--color-status-pendiente); }
.tag-en_curso    { background: rgba(180, 83, 9, 0.12);    color: var(--color-status-en_curso); }
.tag-hecho       { background: rgba(15, 118, 110, 0.12);  color: var(--color-status-hecho); }
.tag-descartado  { background: rgba(148, 163, 184, 0.18); color: var(--color-status-descartado); }

/* Priority */
.tag-alta   { background: rgba(185, 28, 28, 0.12); color: var(--color-priority-alta); }
.tag-media  { background: rgba(180, 83, 9, 0.12);  color: var(--color-priority-media); }
.tag-baja   { background: rgba(15, 118, 110, 0.12); color: var(--color-priority-baja); }

/* =============================================================
   FLASH MESSAGES
   ============================================================= */
.flash {
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-sm);
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
}
.flash-error { background: var(--color-danger-soft); color: var(--color-danger); }
.flash-ok    { background: rgba(15, 118, 110, 0.12); color: var(--color-status-hecho); }

/* =============================================================
   AUTH PAGES
   ============================================================= */
.auth-shell {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-4);
    background: var(--color-bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-8);
}
.auth-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
.auth-header h1 {
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
    margin: 0;
}
.auth-subtitle {
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
    margin: 0;
}
.auth-subtitle strong {
    color: var(--color-text);
    font-weight: 600;
}
.auth-card .form-stack { gap: var(--space-4); }
.auth-card .btn { width: 100%; margin-top: var(--space-2); }
.auth-footer {
    margin-top: var(--space-6);
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--color-text-faint);
    letter-spacing: 0.04em;
}

/* =============================================================
   MAP VIEW
   ============================================================= */
#map { height: 100%; width: 100%; background: var(--color-surface-muted); }

/* Action bar — locate + plus, joined as a single pill. */
.fab-bar {
    position: fixed;
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    align-items: stretch;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 800;
}
.fab-bar > .fab + .fab { border-left: 1px solid var(--color-border); }

.fab {
    width: 48px;
    height: 48px;
    background: var(--color-surface);
    border: 0;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease, color 120ms ease;
}
.fab:hover  { background: var(--color-surface-muted); color: var(--color-primary-hover); }
.fab:active { background: var(--color-border); }
.fab .icon  { width: 22px; height: 22px; stroke-width: 2; }

/* Legacy single-FAB (kept so existing JS that targets .fab keeps working). */
.fabs {
    position: fixed;
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: 800;
}

/* Leaflet layer-control: corporate segmented look. */
.leaflet-top.leaflet-right { padding: var(--space-3); }
.mapa-layers-control.leaflet-control-layers,
.leaflet-control-layers {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0;
    overflow: hidden;
}
.leaflet-control-layers-expanded {
    padding: var(--space-1);
}
.leaflet-control-layers-list {
    display: flex;
    flex-direction: row;
    gap: 0;
}
.leaflet-control-layers-base label {
    margin: 0;
    padding: 6px var(--space-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 120ms ease, color 120ms ease;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.leaflet-control-layers-base label:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}
.leaflet-control-layers-base label input[type=radio] {
    /* hide native radio, use label state */
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.leaflet-control-layers-base label span { padding-left: 0; }
.leaflet-control-layers-base label:has(input:checked) {
    background: var(--color-primary);
    color: #fff;
}
.leaflet-control-layers-separator { display: none; }

/* Pin tooltip (provisional pin hint) */
.leaflet-tooltip.leaflet-tooltip-top {
    background: var(--color-primary);
    color: #fff;
    border: 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 4px var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 500;
}
.leaflet-tooltip.leaflet-tooltip-top::before {
    border-top-color: var(--color-primary);
}

/* Leaflet zoom control — softer corporate style */
.leaflet-bar a {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border) !important;
}
.leaflet-bar a:hover {
    background: var(--color-surface-muted);
}

/* Pin SVG container — strip default leaflet div padding */
.mapa-pin, .mapa-temp-pin {
    background: transparent !important;
    border: 0 !important;
}

/* =============================================================
   BOTTOM SHEETS
   ============================================================= */
.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 85vh;
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
    z-index: 900;
    padding: var(--space-6);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
}
.sheet[aria-hidden="false"] { transform: translateY(0); }
.sheet-handle {
    width: 32px;
    height: 4px;
    background: var(--color-border-strong);
    border-radius: var(--radius-pill);
    margin: 0 auto var(--space-4);
}
.sheet-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.sheet-header h2 {
    margin: 0;
    flex: 1 1 auto;
    font-size: var(--fs-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text);
    min-width: 0;
}
.sheet-header .tag { flex-shrink: 0; }
.sheet-header .icon-btn { flex-shrink: 0; }

.sheet-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-6);
    flex-wrap: wrap;
}
.sheet-actions .btn { flex: 1 1 auto; }
.sheet-actions .btn:last-child:first-child { flex: 0 1 auto; }

.sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 850;
    display: none;
}
.sheet-backdrop[data-open="true"] { display: block; }

/* Detail sheet — comments and meta blocks */
.sheet img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: var(--space-2) 0;
    display: block;
}
.sheet p { margin: var(--space-2) 0; color: var(--color-text); font-size: var(--fs-base); }
.sheet p strong { font-weight: 600; }
.sheet p em { color: var(--color-text-muted); font-style: normal; }

.sheet h3 {
    margin-top: var(--space-6);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sheet [data-role="comments"] {
    margin-top: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.sheet [data-role="comments"] > div {
    border-top: 1px solid var(--color-border) !important;
    padding: var(--space-3) 0 !important;
}
.sheet [data-role="comments"] > div:first-child { border-top: 0 !important; }
.sheet [data-role="comments"] strong {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text);
}
.sheet [data-role="comments"] span {
    color: var(--color-text-faint) !important;
    font-size: var(--fs-xs) !important;
    margin-left: var(--space-1);
}
.sheet [data-role="comments"] > div > div {
    margin-top: var(--space-1);
    font-size: var(--fs-sm);
    color: var(--color-text);
}

/* =============================================================
   LIST VIEW
   ============================================================= */
.page-container {
    padding: var(--space-4);
    max-width: 1200px;
    margin: 0 auto;
}
@media (min-width: 700px) {
    .page-container { padding: var(--space-6); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.page-header h1 {
    font-size: var(--fs-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.list-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.list-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
}
.list-table thead th {
    position: sticky;
    top: var(--topbar-h);
    background: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 0 var(--color-border);
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    z-index: 1;
}
.list-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--fs-sm);
    color: var(--color-text);
    vertical-align: middle;
    min-height: 56px;
}
.list-table tbody tr {
    transition: background 100ms ease;
}
.list-table tbody tr:hover { background: var(--color-surface-muted); cursor: pointer; }
.list-table tbody tr:last-child td { border-bottom: 0; }

/* Priority stripe — left border on first cell */
.list-table .priority-stripe {
    border-left: 3px solid var(--color-border);
}
.list-table .priority-alta  { border-left-color: var(--color-priority-alta); }
.list-table .priority-media { border-left-color: var(--color-priority-media); }
.list-table .priority-baja  { border-left-color: var(--color-priority-baja); }

.list-table .col-title {
    font-weight: 500;
    color: var(--color-text);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-empty {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
}
.list-empty .icon {
    width: 40px; height: 40px;
    color: var(--color-text-faint);
    margin-bottom: var(--space-3);
}
.list-empty p { margin-bottom: var(--space-4); }

/* =============================================================
   ADMIN — USERS
   ============================================================= */
.admin-table .col-actions { text-align: right; white-space: nowrap; }
.admin-table select[data-action="set-role"] {
    height: 36px;
    padding: 0 var(--space-6) 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5 6 6.5 11 1.5' stroke='%23475569' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-2) center;
    appearance: none;
    font-size: var(--fs-sm);
    color: var(--color-text);
}
.admin-table select[data-action="set-role"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.admin-table select[disabled] {
    color: var(--color-text-faint);
    background-color: var(--color-surface-muted);
    cursor: not-allowed;
}

/* iOS-style toggle for activo */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    cursor: pointer;
}
.toggle input {
    appearance: none;
    -webkit-appearance: none;
    width: 100%; height: 100%;
    margin: 0;
    border-radius: var(--radius-pill);
    background: var(--color-border-strong);
    transition: background 150ms ease;
    cursor: pointer;
    border: 0;
}
.toggle input:checked { background: var(--color-status-hecho); }
.toggle input:disabled { opacity: 0.5; cursor: not-allowed; }
.toggle::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: var(--radius-pill);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 150ms ease;
    pointer-events: none;
}
.toggle input:checked + ::before,
.toggle:has(input:checked)::after {
    transform: translateX(16px);
}

.admin-empty {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 480px) {
    .brand-title { display: none; } /* mark only on very narrow */
}
@media (min-width: 700px) {
    .auth-card { padding: var(--space-10) var(--space-8); }
    .fab-bar { right: var(--space-6); bottom: var(--space-6); }
    .sheet { padding: var(--space-8); }
    .list-table thead th { padding: var(--space-3) var(--space-6); }
    .list-table tbody td { padding: var(--space-4) var(--space-6); }
}
