/* =====================================================
   TamApp — Sistema visual principal
   ===================================================== */

:root {
    /* Paleta tomada del logo de TamApp */
    --brand-950: #112b78;
    --brand-900: #17389f;
    --brand-800: #2554d3;
    --brand-700: #3567f0;
    --brand-600: #4d8bff;
    --brand-500: #74a7ff;
    --brand-100: #e9f2ff;
    --brand-050: #f5f8ff;
    --accent-500: #ffc84a;
    --accent-400: #ffd977;
    --accent-100: #fff4d6;
    --ink-900: #101828;
    --ink-700: #334155;
    --ink-500: #667085;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --border-soft: rgba(37, 84, 211, 0.10);
    --shadow-lg: 0 30px 80px rgba(17, 43, 120, 0.14);
    --shadow-md: 0 18px 42px rgba(37, 84, 211, 0.12);
    --shadow-sm: 0 10px 24px rgba(17, 43, 120, 0.08);
    --radius-xl: 2rem;
    --radius-lg: 1.35rem;
    --radius-md: 1rem;
}

/* Base global: define fondo, tipografía y color general */
body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(77, 139, 255, 0.18), transparent 24%),
        radial-gradient(circle at 85% 10%, rgba(255, 200, 74, 0.18), transparent 22%),
        linear-gradient(180deg, #f9fbff 0%, #eef4ff 48%, #f8fbff 100%);
    color: var(--ink-900);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.display-1, .display-2, .display-3, .display-4 {
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    letter-spacing: -0.03em;
}

a {
    color: var(--brand-800);
    text-decoration: none;
}

a:hover {
    color: var(--brand-900);
}

.text-muted {
    color: var(--ink-500) !important;
}

.page-shell {
    position: relative;
    z-index: 1;
}

.page-shell::before {
    content: "";
    position: fixed;
    inset: auto auto 4rem -4rem;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: rgba(77, 139, 255, 0.08);
    filter: blur(12px);
    z-index: -1;
}

/* Navbar: pasa de barra plana a barra de marca */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 5000;
    isolation: isolate;
    overflow: visible;
    background: rgba(17, 43, 120, 0.84);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(17, 43, 120, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.app-navbar .container {
    max-width: 1220px;
    position: relative;
    overflow: visible;
}

/* El dropdown del usuario necesita salir del alto del navbar sin ser recortado */
.app-navbar .navbar-collapse,
.app-navbar .navbar-nav,
.app-navbar .nav-item,
.app-navbar .dropdown {
    overflow: visible !important;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff;
}

.navbar-brand:hover {
    color: #fff;
}

.navbar-brand-logo {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.navbar-brand-logo img {
    width: 2.35rem;
    height: 2.35rem;
    object-fit: contain;
}

.navbar-brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.navbar-brand-copy small {
    font-family: 'Manrope', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.68);
}

.navbar-brand-copy span {
    font-size: 1.32rem;
    font-weight: 700;
}

.app-install-header-btn {
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    background: linear-gradient(135deg, #ffd869, #ffbf1f);
    color: #513300;
    font-weight: 800;
    font-size: 0.88rem;
    box-shadow: 0 10px 24px rgba(255, 196, 40, 0.24);
    white-space: nowrap;
}

.app-install-header-btn:hover,
.app-install-header-btn:focus {
    color: #4a2d00;
    background: linear-gradient(135deg, #ffe07f, #ffc93d);
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.80);
    font-weight: 700;
    border-radius: 999px;
    padding-inline: 0.95rem !important;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.app-navbar .dropdown-menu {
    position: absolute;
    z-index: 5100;
    border: 1px solid rgba(37, 84, 211, 0.08);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 0.65rem;
}

.app-navbar .dropdown {
    position: relative;
    z-index: 5090;
}

/* Cuando Bootstrap abre el menú, lo dejamos por encima de tarjetas, tablas y paneles */
.app-navbar .dropdown-menu.show {
    z-index: 5200;
}

.app-navbar .dropdown-item {
    border-radius: 0.8rem;
    padding-block: 0.7rem;
    font-weight: 600;
}

.app-navbar .dropdown-item:hover {
    background: var(--brand-050);
}

/* Menu movil: ordena el panel colapsado para login y registro */
@media (max-width: 991.98px) {
    .app-navbar .container {
        position: relative;
    }

    .app-navbar .navbar-collapse {
        position: absolute;
        top: calc(100% + 0.55rem);
        left: 0.75rem;
        right: 0.75rem;
        margin-top: 0;
        padding: 0.7rem;
        border-radius: 1rem;
        background: linear-gradient(180deg, rgba(18, 45, 123, 0.985), rgba(29, 60, 151, 0.965));
        box-shadow: 0 18px 40px rgba(8, 18, 54, 0.28);
        border: 1px solid rgba(255, 255, 255, 0.10);
    }

    .app-navbar .navbar-collapse:not(.show) {
        display: none !important;
    }

    .app-navbar .navbar-nav {
        width: 100%;
        gap: 0.35rem;
        align-items: stretch !important;
    }

    .app-navbar .nav-item {
        width: 100%;
    }

    .app-navbar .nav-link {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        min-height: 2.8rem;
        border-radius: 0.95rem;
        padding: 0.72rem 0.9rem !important;
    }

    .app-navbar .navbar-collapse .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 2.8rem;
        margin-left: 0 !important;
    }
}

.avatar-chip {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.premium-badge-nav,
.premium-badge,
.premium-badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    font-weight: 800;
}

.premium-badge-nav {
    background: linear-gradient(135deg, var(--accent-400), var(--accent-500));
    color: #3a2a00;
    font-size: 0.68rem;
    padding: 0.22rem 0.55rem;
}

.premium-badge {
    background: linear-gradient(135deg, var(--accent-400), var(--accent-500));
    color: #3a2a00;
    font-size: 0.78rem;
    padding: 0.32rem 0.75rem;
}

.premium-badge-soft {
    background: var(--accent-100);
    color: #8a5a00;
    font-size: 0.76rem;
    padding: 0.24rem 0.6rem;
}

.notification-counter {
    position: absolute;
    top: 0.05rem;
    right: 0.1rem;
    min-width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff7a59, #ff4d6d);
    color: white;
    font-size: 0.66rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
    box-shadow: 0 6px 12px rgba(255, 77, 109, 0.35);
}

.notification-menu {
    width: min(24rem, 92vw);
}

.notification-menu-head,
.notification-menu-foot {
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.98);
}

.notification-menu-head {
    border-bottom: 1px solid var(--border-soft);
}

.notification-menu-foot {
    border-top: 1px solid var(--border-soft);
    text-align: center;
}

.notification-list {
    max-height: 22rem;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.94);
}

.notification-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(37, 84, 211, 0.08);
}

.notification-item:hover {
    background: var(--brand-050);
}

.notification-item.is-unread {
    background: rgba(37, 84, 211, 0.05);
}

.notification-copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    color: var(--ink-900);
}

.notification-copy small {
    color: var(--ink-500);
    line-height: 1.35;
}

.notification-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.notification-dot-info { background: var(--brand-700); }
.notification-dot-success { background: #159f6b; }
.notification-dot-warning { background: #f59e0b; }
.notification-dot-exacto { background: #ef4444; }

.notification-empty {
    padding: 1.1rem 1rem;
    color: var(--ink-500);
}

.premium-upsell {
    background:
        linear-gradient(135deg, rgba(255, 244, 214, 0.92), rgba(255, 255, 255, 0.96)),
        radial-gradient(circle at top right, rgba(255, 200, 74, 0.22), transparent 28%);
    border: 1px solid rgba(255, 200, 74, 0.25) !important;
}

.premium-mark-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    line-height: 1;
    vertical-align: middle;
    filter: drop-shadow(0 1px 2px rgba(255, 200, 74, 0.22));
}

/* Flash: mejora visual sin tocar la lógica de mensajes */
.flash-stack {
    max-width: 1220px;
}

.alert {
    border: 0;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

/* Superficies generales */
.card,
.surface-card {
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-hover:hover,
.surface-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.section-shell {
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.72));
    border: 1px solid rgba(37, 84, 211, 0.08);
    box-shadow: var(--shadow-lg);
}

/* Página de inicio */
.home-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 3vw, 3rem);
    border-radius: 2rem;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.94), rgba(233,242,255,0.96)),
        url('/static/img/hero-orbit.svg') center / cover no-repeat;
    border: 1px solid rgba(37, 84, 211, 0.10);
    box-shadow: var(--shadow-lg);
}

.home-hero::after {
    content: "";
    position: absolute;
    inset: auto -8% -28% auto;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: rgba(255, 200, 74, 0.20);
    filter: blur(18px);
    z-index: 0;
}

.home-hero > * {
    position: relative;
    z-index: 1;
}

.brand-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: rgba(37, 84, 211, 0.08);
    color: var(--brand-900);
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.home-title {
    font-size: clamp(2.55rem, 5vw, 4.8rem);
    line-height: 0.95;
    margin-bottom: 1rem;
}

.home-title .accent {
    color: var(--brand-800);
}

.home-subtitle {
    max-width: 40rem;
    font-size: 1.08rem;
    color: var(--ink-700);
}

.hero-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.75rem;
}

.hero-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.hero-stat {
    padding: 1rem 1.1rem;
    border-radius: 1.2rem;
    background: rgba(255,255,255,0.74);
    border: 1px solid rgba(37,84,211,0.10);
}

.hero-stat strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.35rem;
    color: var(--brand-900);
}

.hero-stat span {
    font-size: 0.9rem;
    color: var(--ink-500);
}

.hero-visual {
    padding: 1.25rem;
    border-radius: 1.75rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.84), rgba(223,235,255,0.92));
    border: 1px solid rgba(37, 84, 211, 0.12);
    box-shadow: var(--shadow-md);
}

.hero-visual img {
    width: 100%;
    max-width: 380px;
    filter: drop-shadow(0 24px 38px rgba(37, 84, 211, 0.14));
}

/* El logo limpio queda centrado y con aire para que no se sienta pegado al borde */
.hero-logo-clean {
    display: block;
    width: min(100%, 24rem) !important;
    max-width: 24rem !important;
    margin: 0 auto;
    height: auto !important;
    object-fit: contain;
}

.hero-visual-note {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 1.2rem;
    background: rgba(17,43,120,0.90);
    color: #fff;
}

.hero-visual-note strong {
    display: block;
    font-size: 1rem;
}

.feature-panel,
.step-card,
.info-highlight {
    height: 100%;
    padding: 1.5rem;
    border-radius: 1.4rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(37,84,211,0.10);
    box-shadow: var(--shadow-sm);
}

.feature-icon,
.step-icon {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(77,139,255,0.18), rgba(255,200,74,0.22));
    color: var(--brand-900);
    font-size: 1.4rem;
}

.step-number-chip {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--brand-700), var(--brand-800));
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    box-shadow: 0 12px 25px rgba(37, 84, 211, 0.18);
}

/* Dashboard */
.dashboard-hero {
    padding: 1.75rem;
    border-radius: 1.8rem;
    background: linear-gradient(135deg, rgba(17,43,120,0.96), rgba(53,103,240,0.88));
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.dashboard-hero .eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.74);
}

.dashboard-hero .stat-pill {
    padding: 0.8rem 1rem;
    border-radius: 1.1rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.12);
}

.dashboard-hero .stat-pill strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-heading .icon {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 1rem;
    background: rgba(37, 84, 211, 0.10);
    color: var(--brand-800);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Auth */
.auth-shell {
    min-height: calc(100vh - 15rem);
    display: grid;
    align-items: center;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    align-items: stretch;
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    border-radius: 1.9rem;
    padding: 2rem;
    background:
        linear-gradient(155deg, rgba(17,43,120,0.96), rgba(53,103,240,0.88)),
        url('/static/img/hero-orbit.svg') center / cover no-repeat;
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    right: -4rem;
    bottom: -4rem;
    width: 14rem;
    height: 14rem;
    border-radius: 50%;
    background: rgba(255, 200, 74, 0.24);
    filter: blur(10px);
}

.auth-brand-panel > * {
    position: relative;
    z-index: 1;
}

.auth-brand-top {
    display: flex;
    align-items: center;
    gap: 0.95rem;
}

.auth-brand-top img {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.10);
}

.auth-brand-copy span {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
}

.auth-brand-copy small {
    color: rgba(255,255,255,0.74);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: 700;
}

.auth-brand-panel .brand-points {
    display: grid;
    gap: 0.9rem;
    margin-top: 2rem;
}

.brand-point {
    display: flex;
    gap: 0.9rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.10);
}

.brand-point i {
    color: var(--accent-400);
}

.auth-card {
    padding: 2rem;
    border-radius: 1.9rem;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(37,84,211,0.12);
    box-shadow: var(--shadow-md);
}

.auth-card .auth-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(77,139,255,0.18), rgba(255,200,74,0.22));
    color: var(--brand-900);
    font-size: 1.5rem;
}

/* Formularios y botones */
.form-control,
.form-select {
    border-radius: 0.95rem;
    border: 1px solid rgba(37, 84, 211, 0.14);
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.92);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37,84,211,0.45);
    box-shadow: 0 0 0 0.25rem rgba(37,84,211,0.12);
}

.form-control-lg {
    border-radius: 1rem;
}

.btn {
    border-radius: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(180deg, var(--brand-700), var(--brand-800));
    border: 0;
    box-shadow: 0 16px 32px rgba(37,84,211,0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, var(--brand-800), var(--brand-900));
}

.btn-outline-primary {
    border-color: rgba(37,84,211,0.25);
    color: var(--brand-800);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: rgba(37,84,211,0.08);
    color: var(--brand-900);
    border-color: rgba(37,84,211,0.35);
}

.btn-warning {
    background: linear-gradient(180deg, #ffd76c, #ffbd32);
    border: 0;
    color: #5d3d00;
    box-shadow: 0 16px 30px rgba(255, 200, 74, 0.26);
}

.btn-warning:hover,
.btn-warning:focus {
    color: #4f3200;
    background: linear-gradient(180deg, #ffd054, #ffb400);
}

.btn-lg {
    border-radius: 1rem;
}

/* Componentes existentes que deben conservar buen look */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-500);
}

.admin-users-list-head {
    display: grid;
    grid-template-columns: 2.2fr 1.3fr 1.35fr 1.4fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(245, 248, 255, 0.96);
    border-bottom: 1px solid rgba(37, 84, 211, 0.10);
    color: var(--ink-500);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-users-list {
    display: grid;
}

.admin-user-row {
    display: grid;
    grid-template-columns: 2.2fr 1.3fr 1.35fr 1.4fr;
    gap: 1rem;
    align-items: start;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(37, 84, 211, 0.10);
}

.admin-user-row.is-superadmin {
    background: rgba(255, 244, 244, 0.6);
}

.admin-user-row.is-empty {
    background: rgba(255, 249, 235, 0.6);
}

.admin-user-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.admin-user-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.admin-user-copy {
    min-width: 0;
}

.admin-user-name {
    font-weight: 800;
    color: var(--ink-900);
    margin-bottom: 0.1rem;
}

.admin-user-email {
    color: var(--ink-500);
    word-break: break-word;
    margin-bottom: 0.2rem;
}

.admin-user-meta {
    font-size: 0.88rem;
    color: var(--ink-500);
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.admin-user-activity,
.admin-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.admin-user-status {
    min-width: 0;
}

.admin-user-note {
    display: inline-flex;
    align-items: center;
    margin-top: 0.6rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.admin-user-note.is-warning {
    background: rgba(255, 200, 74, 0.18);
    color: #9a6500;
}

.admin-user-note.is-success {
    background: rgba(21, 159, 107, 0.12);
    color: #157a54;
}

.admin-user-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.admin-user-dropdown .dropdown-menu {
    min-width: 14rem;
    border-radius: 1rem;
    border: 1px solid rgba(37, 84, 211, 0.12);
    padding: 0.45rem;
}

.admin-user-dropdown .dropdown-item {
    border-radius: 0.8rem;
    padding: 0.65rem 0.8rem;
    font-weight: 700;
}

.admin-user-dropdown form {
    margin: 0;
}

.admin-user-menu-btn {
    min-width: 8.4rem;
    justify-content: center;
}

.admin-users-table-shell {
    overflow: visible;
}

.admin-users-table {
    width: 100%;
    table-layout: fixed;
}

.admin-users-table th,
.admin-users-table td {
    vertical-align: top;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.admin-users-table th:nth-child(1),
.admin-users-table td:nth-child(1) { width: 18%; }

.admin-users-table th:nth-child(2),
.admin-users-table td:nth-child(2) { width: 18%; }

.admin-users-table th:nth-child(3),
.admin-users-table td:nth-child(3) { width: 9%; }

.admin-users-table th:nth-child(4),
.admin-users-table td:nth-child(4) { width: 18%; }

.admin-users-table th:nth-child(5),
.admin-users-table td:nth-child(5) { width: 14%; }

.admin-users-table th:nth-child(6),
.admin-users-table td:nth-child(6) { width: 10%; }

.admin-users-table th:nth-child(7),
.admin-users-table td:nth-child(7) { width: 13%; }

.admin-users-email {
    word-break: break-word;
}

.admin-users-badges {
    align-items: flex-start;
}

.admin-users-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
    max-width: 18rem;
}

.admin-users-actions form {
    margin: 0;
}

.admin-users-actions .btn {
    min-width: 5.1rem;
    justify-content: center;
}

.table-primary {
    --bs-table-bg: #edf3ff !important;
}

.table-danger {
    --bs-table-bg: #fff4f4 !important;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

.progress {
    border-radius: 999px;
    background: rgba(37,84,211,0.12);
}

input[name="codigo"] {
    font-family: 'Space Grotesk', monospace;
    border: 2px dashed rgba(37,84,211,0.28);
    border-radius: 1rem;
    background: #f3f8ff;
    text-align: center;
}

.partido-card {
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.partido-card.border-primary {
    border-width: 2px !important;
    transform: scale(1.01);
}

.partido-card.border-start.border-warning {
    border-left-width: 4px !important;
    background: #fff8ea;
}

.partido-card input[type="number"] {
    font-size: 1.6rem;
    font-weight: 800;
    padding: 0.3rem;
    border-radius: 0.7rem;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Footer */
.install-app-banner {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 5300;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 430px;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(37, 84, 211, 0.16);
    border-radius: 1.25rem;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.98), rgba(241,246,255,0.98)),
        radial-gradient(circle at top right, rgba(255, 200, 74, 0.2), transparent 55%);
    box-shadow: 0 20px 40px rgba(20, 42, 107, 0.18);
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.install-app-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.install-app-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.install-app-copy strong {
    color: var(--ink-900);
    font-size: 1rem;
}

.install-app-copy small {
    color: var(--ink-500);
    line-height: 1.4;
}

.install-app-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.polla-header-wrap,
.polla-header-admin,
.polla-header-actions,
.polla-payment-summary,
.polla-payment-summary-card,
.parrilla-item-actions,
.pagos-card-head,
.especiales-header {
    min-width: 0;
}

.polla-invite-card {
    min-width: 220px;
}

.polla-payment-summary-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 255, 0.95)),
        radial-gradient(circle at top right, rgba(37, 84, 211, 0.10), transparent 34%);
    border: 1px solid rgba(37, 84, 211, 0.10) !important;
    box-shadow: 0 16px 34px rgba(37, 84, 211, 0.10);
}

.polla-activity-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.polla-activity-card {
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(37, 84, 211, 0.10);
    box-shadow: 0 10px 24px rgba(37, 84, 211, 0.08);
}

.polla-activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.polla-match-pill-next {
    background: linear-gradient(135deg, rgba(255, 247, 214, 0.92), rgba(255, 255, 255, 0.96));
    border-color: rgba(255, 196, 0, 0.20);
}

.polla-match-pill-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-500);
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.polla-activity-teams {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    color: var(--ink-700);
    font-weight: 600;
    line-height: 1.2;
}

.polla-activity-teams strong {
    color: var(--brand-700);
}

.polla-match-pill-meta {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--ink-500);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}

.polla-match-pill-shield {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
}

.polla-compact-today-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.polla-compact-today-item {
    font-size: 0.82rem;
    color: var(--ink-500);
    line-height: 1.3;
}

.pagos-card details summary,
.parrilla-item-actions .btn,
.polla-header-actions .btn {
    white-space: nowrap;
}

.app-footer {
    margin-top: auto;
    border-top: 1px solid rgba(37,84,211,0.10);
    background: rgba(17,43,120,0.95);
    color: rgba(255,255,255,0.82);
}

.app-footer strong {
    color: #fff;
}

/* Responsive */
@media (max-width: 991.98px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .home-hero {
        padding: 1.5rem;
    }

    .hero-stat-grid {
        grid-template-columns: 1fr;
    }

    .polla-header-admin,
    .polla-header-actions,
    .polla-payment-summary,
    .pagos-card-head,
    .especiales-header {
        width: 100%;
    }

    .polla-header-admin {
        align-items: stretch !important;
    }

    .polla-invite-card {
        width: 100%;
        min-width: 0;
    }

    .polla-header-actions .btn,
    .parrilla-item-actions .btn,
    .pagos-card details summary,
    .pagos-card .btn,
    .especiales-header .btn {
        width: 100%;
        justify-content: center;
    }

    .polla-payment-summary-card {
        width: 100%;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .polla-activity-strip {
        grid-template-columns: 1fr;
    }

    .polla-payment-progress {
        width: 100% !important;
    }

    .parrilla-item {
        align-items: stretch !important;
        flex-direction: column;
        gap: 0.85rem;
    }

    .parrilla-item-actions {
        width: 100%;
        flex-direction: column;
    }

    .pagos-card-head {
        gap: 0.75rem;
        flex-direction: column;
        align-items: stretch !important;
    }

    .pagos-card {
        padding: 1rem !important;
    }

    .especiales-summary-grid .card,
    .especiales-variable-grid .border,
    .especiales-checkbox-grid .form-check {
        height: auto !important;
    }

    .install-app-banner {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
        align-items: flex-start;
        flex-direction: column;
    }

    .install-app-actions {
        width: 100%;
    }

    .install-app-actions .btn {
        flex: 1 1 0;
    }

    .admin-users-list-head {
        display: none;
    }

    .admin-user-row {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .admin-user-actions {
        justify-content: flex-start;
    }

    .admin-user-menu-btn {
        min-width: 0;
    }

    .admin-users-table,
    .admin-users-table thead,
    .admin-users-table tbody,
    .admin-users-table tr,
    .admin-users-table th,
    .admin-users-table td {
        display: block;
        width: 100% !important;
    }

    .admin-users-table thead {
        display: none;
    }

    .admin-users-table tr {
        padding: 1rem;
        border-bottom: 1px solid rgba(37, 84, 211, 0.10);
    }

    .admin-users-table td {
        padding: 0.35rem 0 !important;
        border: 0;
    }

    .admin-users-actions {
        justify-content: flex-start;
        max-width: none;
    }
}

@media (max-width: 576px) {
    .page-shell {
        padding-inline: 0.15rem;
    }

    .app-install-header-btn {
        display: inline-flex;
        font-size: 0.8rem;
        padding: 0.48rem 0.8rem;
    }

    .app-navbar .container {
        row-gap: 0.45rem;
    }

    .app-navbar .navbar-brand {
        min-width: 0;
    }

    .navbar-brand-copy small {
        display: none;
    }

    .navbar-brand-copy span {
        font-size: 1.08rem;
    }

    .app-navbar .navbar-toggler {
        flex-shrink: 0;
    }

    .home-title {
        font-size: 2.6rem;
    }

    .hero-action-row {
        flex-direction: column;
    }

    .hero-action-row .btn {
        width: 100%;
    }

    .partido-card input[type="number"] {
        width: 58px !important;
        font-size: 1.3rem;
    }

    .display-4 {
        font-size: 2rem;
    }

    .table-responsive table {
        font-size: 0.9rem;
    }
}
