/* ============================================================
   panel.css — Estilo WebApp (blanco + verde pastel, LIGHT)
   100% responsivo, incluye tablas adaptables y tabs
   ============================================================ */

:root {
    /* Fondo claro */
    --bg-color:      #f6faf7;
    --bg-elev:       rgba(255, 255, 255, 0.88);
    --bg-card:       #ffffff;
    --bg-card-2:     #f4faf6;

    /* Texto */
    --texto:         #14312a;
    --texto-suave:   #5a7a6e;

    /* Superficies translúcidas (sutiles) */
    --surface:       rgba(20, 49, 42, 0.04);
    --surface-2:     rgba(20, 49, 42, 0.08);
    --surface-hover: rgba(20, 49, 42, 0.12);

    /* Marca: verde pastel */
    --brand:         #6fcf97;
    --brand-soft:    #a8e6c0;
    --brand-deep:    #2e8b57;
    --brand-tint:    rgba(111, 207, 151, 0.14);
    --brand-tint-2:  rgba(111, 207, 151, 0.28);

    /* Estados */
    --ok:            #2e8b57;
    --warn:          #b8860b;
    --danger:        #c0392b;
    --info:          #2b7bb9;

    /* Formas */
    --radius:        10px;
    --radius-lg:     14px;
    --radius-pill:   999px;

    /* Sombras (suaves para fondo claro) */
    --shadow:        0 6px 24px rgba(20, 49, 42, 0.08);
    --shadow-soft:   0 2px 10px rgba(20, 49, 42, 0.06);

    /* Bordes */
    --border:        rgba(20, 49, 42, 0.08);
    --border-strong: rgba(20, 49, 42, 0.14);
}

/* ============================================================
   Reset / base
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: linear-gradient(180deg, #eaf6ee 0%, #f6faf7 40%) fixed;
    background-color: var(--bg-color);
    color: var(--texto);
    overflow-y: auto;
    padding-bottom: 150px;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.45;
}

img, video, canvas, svg { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

code {
    font-family: 'Roboto Mono', ui-monospace, Menlo, Consolas, monospace;
    background: var(--brand-tint);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.85em;
    color: var(--brand-deep);
    word-break: break-word;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--texto);
    min-width: 0;
}

.topbar .brand .icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    font-size: 14px;
    box-shadow: 0 0 0 3px var(--brand-tint);
    flex-shrink: 0;
}

.topbar .usuario-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--texto-suave);
    min-width: 0;
}

.topbar .usuario-chip > span {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .avatar {
    width: 30px;
    height: 30px;
    background: var(--brand);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================================
   Main
   ============================================================ */
.main {
    padding: 0 0 20px 0;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.main > h1 {
    font-size: 1.4rem !important;
    margin: 16px 20px 8px !important;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--texto);
}

/* ============================================================
   Pills
   ============================================================ */
.pills {
    display: flex;
    gap: 10px;
    padding: 6px 20px 14px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.pills::-webkit-scrollbar { display: none; }

.pill {
    background: #ffffff;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--texto);
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: background 0.18s ease, transform 0.1s ease, border-color 0.18s ease;
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

.pill:hover  { background: var(--brand-tint); border-color: var(--brand-tint-2); }
.pill:active { transform: scale(0.97); }

.pill.activo {
    background: var(--brand);
    color: #ffffff;
    font-weight: 700;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-tint);
}

/* ============================================================
   Tabs (para invitacion_form)
   ============================================================ */
.tabs-nav {
    display: flex;
    gap: 6px;
    padding: 6px 16px 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0 0 0;
    border-bottom: 1px solid var(--border);
}

.tabs-nav::-webkit-scrollbar { display: none; }

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-suave);
    text-decoration: none;
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    margin-bottom: -1px;
}

.tab-item i { font-size: 14px; }

.tab-item:hover {
    background: var(--surface);
    color: var(--texto);
}

.tab-item.activo {
    color: var(--brand-deep);
    background: var(--brand-tint);
    border-color: var(--brand-tint-2);
    border-bottom-color: var(--brand);
}

.tab-item .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--texto-suave);
    line-height: 1;
}

.tab-item.activo .tab-count {
    background: var(--brand);
    color: #ffffff;
}

@media (max-width: 560px) {
    .tabs-nav { padding: 4px 8px 0 8px; gap: 4px; }
    .tab-item { padding: 9px 12px; font-size: 12px; }
    .tab-item span:not(.tab-count) { display: none; }
    .tab-item i { font-size: 16px; }
    .tab-item .tab-count { display: inline-flex; }
}

/* ============================================================
   Card
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 12px 16px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.card h1, .card h2, .card h3 {
    color: var(--texto);
    letter-spacing: -0.2px;
    word-break: break-word;
}

/* ============================================================
   Grids
   ============================================================ */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 12px 16px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

/* ============================================================
   Estadísticas
   ============================================================ */
.stat-num {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
    background: linear-gradient(180deg, var(--brand-deep) 0%, var(--brand) 120%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    word-break: break-word;
}

.stat-label {
    font-size: 11.5px;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 4px;
}

/* ============================================================
   Tablas responsivas
   ============================================================ */
.card table,
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

table thead,
table tbody,
table tr {
    width: 100%;
}

table th {
    text-align: left;
    padding: 10px 10px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--brand-deep);
    border-bottom: 1px solid var(--brand-tint-2);
    background: transparent;
}

table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--texto);
}

table tr:last-child td { border-bottom: none; }

table tr:hover td { background: var(--surface); }

table td a,
table td .btn { white-space: nowrap; }

/* En móviles: apilamos filas con etiquetas de columna */
@media (max-width: 560px) {
    .card table,
    table {
        display: block;
        white-space: normal;
    }
    table thead { display: none; }

    table tbody { display: block; width: 100%; }

    table tr {
        display: block;
        background: var(--bg-card-2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    table tr:hover td { background: transparent; }

    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border-bottom: 1px dashed var(--border);
        white-space: normal;
        text-align: right;
        word-break: break-word;
    }

    table td:last-child { border-bottom: none; }

    table td::before {
        content: attr(data-label);
        color: var(--texto-suave);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 600;
        text-align: left;
        flex-shrink: 0;
        margin-right: 8px;
    }

    table td[colspan]::before { content: none; }
    table td[colspan] {
        justify-content: center;
        text-align: center;
        color: var(--texto-suave);
    }
}

/* ============================================================
   Formularios
   ============================================================ */
.campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    min-width: 0;
}

.campo label {
    font-size: 12.5px;
    color: var(--texto-suave);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="number"],
.campo input[type="date"],
.campo input[type="color"],
.campo select,
.campo textarea {
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 11px 14px;
    color: var(--texto);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.campo textarea { resize: vertical; min-height: 60px; }

.campo input::placeholder,
.campo textarea::placeholder { color: #9bb3aa; }

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    border-color: var(--brand);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--brand-tint);
}

.campo select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e8b57' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}

.campo input[type="color"] {
    padding: 4px;
    height: 42px;
    cursor: pointer;
}

/* Filas responsivas */
.fila-2, .fila-3 {
    display: grid;
    gap: 12px;
}
.fila-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fila-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 720px) {
    .fila-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .fila-2, .fila-3 { grid-template-columns: 1fr; }
}

.ayuda {
    font-size: 12px;
    color: var(--texto-suave);
    line-height: 1.55;
    margin-top: 4px;
    word-break: break-word;
}

.ayuda a { color: var(--brand-deep); text-decoration: underline; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: var(--texto);
    background: #ffffff;
    border-color: var(--border-strong);
    white-space: nowrap;
    max-width: 100%;
}

.btn:hover  { background: var(--surface); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(111, 207, 151, 0.35);
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--brand-tint-2);
    color: var(--brand-deep);
}
.btn-outline:hover {
    background: var(--brand-tint);
    color: var(--brand-deep);
}

.btn-peligro {
    background: rgba(192, 57, 43, 0.08);
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.28);
}
.btn-peligro:hover { background: rgba(192, 57, 43, 0.16); }

.btn-sm { padding: 7px 12px; font-size: 12px; }

.btn-bloque { width: 100%; display: flex; }

@media (max-width: 560px) {
    .card > .row-header,
    .row-header {
        flex-direction: column;
        align-items: stretch;
    }
    .row-header .btn { width: 100%; }
}

/* ============================================================
   Alertas
   ============================================================ */
.alerta {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13.5px;
    margin: 10px 0 16px;
    border: 1px solid transparent;
    line-height: 1.5;
    word-break: break-word;
}

.alerta-exito {
    background: rgba(46, 139, 87, 0.10);
    color: var(--brand-deep);
    border-color: rgba(46, 139, 87, 0.28);
}

.alerta-error {
    background: rgba(192, 57, 43, 0.10);
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.28);
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: var(--surface);
    color: var(--texto-suave);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.badge-activo,
.badge-generico       { background: rgba(111, 207, 151, 0.18); color: var(--brand-deep); border-color: rgba(46, 139, 87, 0.28); }
.badge-borrador       { background: rgba(184, 134, 11, 0.14); color: #8a6508; border-color: rgba(184, 134, 11, 0.28); }
.badge-vencido,
.badge-usado          { background: rgba(192, 57, 43, 0.12); color: var(--danger); border-color: rgba(192, 57, 43, 0.28); }
.badge-pendiente      { background: var(--surface-2); color: var(--texto-suave); }
.badge-personalizado  { background: var(--brand-tint); color: var(--brand-deep); border-color: var(--brand-tint-2); }

/* ============================================================
   Row header
   ============================================================ */
.row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   Switch-opciones
   ============================================================ */
.switch-opciones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.switch-opcion {
    position: relative;
    display: block;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #ffffff;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

.switch-opcion input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-opcion strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--texto);
}

.switch-opcion span {
    display: block;
    font-size: 12px;
    color: var(--texto-suave);
    line-height: 1.5;
    word-break: break-word;
}

.switch-opcion:hover { background: var(--surface); }

.switch-opcion.activa {
    background: var(--brand-tint);
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

/* ============================================================
   Color picker
   ============================================================ */
.color-picker-row {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.color-swatch {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-strong);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    background: #ffffff;
}

.color-swatch input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
}

.color-swatch.vacio {
    background: repeating-linear-gradient(
        45deg,
        rgba(20, 49, 42, 0.06),
        rgba(20, 49, 42, 0.06) 6px,
        rgba(20, 49, 42, 0.02) 6px,
        rgba(20, 49, 42, 0.02) 12px
    );
}

.color-swatch-quitar {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: var(--brand-deep);
    box-shadow: 0 1px 4px rgba(20, 49, 42, 0.25);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.color-swatch:hover .color-swatch-quitar,
.color-swatch:focus-within .color-swatch-quitar,
.color-swatch:not(.vacio) .color-swatch-quitar { opacity: 1; }

/* ============================================================
   Dropzone
   ============================================================ */
.dropzone {
    position: relative;
    border: 2px dashed var(--brand-tint-2);
    border-radius: var(--radius);
    background: var(--bg-card-2);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    color: var(--texto-suave);
    margin-top: 4px;
}

.dropzone:hover,
.dropzone.dropzone-hover {
    border-color: var(--brand);
    background: var(--brand-tint);
    color: var(--texto);
}

.dropzone-inner p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

.dropzone-inner small {
    color: var(--texto-suave);
    font-size: 11px;
}

.dropzone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-deep);
    font-size: 18px;
    margin-bottom: 8px;
}

.dropzone-preview {
    display: block;
    width: 100%;
    max-width: 180px;
    border-radius: var(--radius);
    margin-top: 10px;
    border: 1px solid var(--brand-tint-2);
}

/* ============================================================
   Pase card
   ============================================================ */
.pase-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    margin-top: 12px;
    flex-wrap: wrap;
}

.pase-qr {
    width: 90px;
    height: 90px;
    border-radius: var(--radius);
    background: #ffffff;
    padding: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.pase-info {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13.5px;
    word-break: break-word;
}

.pase-info strong { font-size: 15px; color: var(--texto); }

.pase-acciones {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 560px) {
    .pase-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .pase-qr { margin: 0 auto; }
    .pase-acciones { justify-content: center; }
    .pase-acciones .btn { flex: 1 1 auto; }
}

/* ============================================================
   Link público
   ============================================================ */
.link-publico {
    font-family: 'Roboto Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--brand-deep);
    background: var(--brand-tint);
    border: 1px solid var(--brand-tint-2);
    border-radius: 8px;
    padding: 6px 10px;
    word-break: break-all;
    display: inline-block;
    margin-top: 4px;
    max-width: 100%;
}

/* ============================================================
   Scanner (check-in)
   ============================================================ */
.scanner-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.scanner-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-marco {
    position: absolute;
    inset: 12%;
    border: 3px solid var(--brand);
    border-radius: 18px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
    pointer-events: none;
}

.resultado-checkin {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    word-break: break-word;
}

.resultado-checkin h2 {
    font-size: 1.05rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.resultado-checkin p { font-size: 13.5px; line-height: 1.5; }

.resultado-ok {
    background: rgba(111, 207, 151, 0.15);
    border-color: rgba(46, 139, 87, 0.35);
    color: var(--brand-deep);
}

.resultado-error {
    background: rgba(192, 57, 43, 0.10);
    border-color: rgba(192, 57, 43, 0.28);
    color: var(--danger);
}

.resultado-repetido {
    background: rgba(184, 134, 11, 0.12);
    border-color: rgba(184, 134, 11, 0.32);
    color: #8a6508;
}

/* ============================================================
   Bottom navigation
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom, 12px);
    z-index: 1000;
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--texto-suave);
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
    min-width: 0;
    flex: 1 1 0;
    max-width: 90px;
}

.nav-item i {
    font-size: 19px;
    margin-bottom: 2px;
}

.nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.nav-item.activo,
.nav-item.active {
    color: var(--brand-deep);
}

.nav-item.activo i,
.nav-item.active i {
    filter: drop-shadow(0 0 6px rgba(111, 207, 151, 0.55));
}

.nav-item:hover { color: var(--brand-deep); }

/* ============================================================
   Utilidades
   ============================================================ */
.texto-suave { color: var(--texto-suave); }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--brand-tint-2);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ============================================================
   Breakpoints globales
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
    .main > h1 { font-size: 1.25rem !important; }
    .card { margin: 10px 12px; padding: 14px; }
    .grid-cards { margin: 10px 12px; gap: 10px; }
    .pills { padding: 6px 12px 12px 12px; }
}

/* Móvil grande */
@media (max-width: 640px) {
    body { font-size: 14.5px; padding-bottom: 140px; }
    .topbar { padding: 12px 14px; }
    .topbar .brand { font-size: 18px; }
    .topbar .brand .icono { width: 26px; height: 26px; font-size: 13px; }
    .topbar .usuario-chip > span { max-width: 100px; }
    .main > h1 { margin: 12px 14px 6px !important; }
    .card { margin: 8px 10px; padding: 12px; border-radius: 12px; }
    .grid-cards {
        margin: 8px 10px;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }
    .pills { padding: 4px 10px 10px 10px; gap: 8px; }
    .pill { padding: 7px 13px; font-size: 12.5px; }
    .stat-num { font-size: 24px; }
    .stat-label { font-size: 10.5px; }
    .btn { padding: 10px 15px; font-size: 13px; }
    .btn-sm { padding: 6px 10px; font-size: 11.5px; }
}

/* Móvil pequeño */
@media (max-width: 380px) {
    .topbar .usuario-chip > span { display: none; }
    .grid-cards { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .card { padding: 10px; margin: 6px 8px; }
    .stat-num { font-size: 22px; }
    .nav-item { font-size: 9.5px; }
    .nav-item i { font-size: 17px; }
    .color-swatch { width: 46px; height: 46px; }
}

/* Landscape en móvil (poco alto) */
@media (max-height: 500px) and (orientation: landscape) {
    body { padding-bottom: 90px; }
    .bottom-nav { padding: 4px 0; }
    .nav-item i { font-size: 16px; }
    .nav-item span { display: none; }
}