/* ============================================
   SOPORTE MAPA - Design System & Global Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

/* --- CSS Variables --- */
:root {
    --primary: #FF8300;
    --primary-light: #FF9A33;
    --primary-dark: #E07000;
    --primary-glow: rgba(255, 131, 0, 0.15);
    --primary-subtle: rgba(255, 131, 0, 0.06);

    --secondary: #37254E;
    --secondary-light: #4A3566;
    --secondary-dark: #261938;
    --secondary-deeper: #1A1030;

    --surface-0: #F7F8FA;
    --surface-1: #FFFFFF;
    --surface-2: #F0F1F5;
    --surface-3: #E8E9EF;
    --surface-4: #D9DBE3;

    --text-primary: #1A1A2E;
    --text-secondary: #5A5E73;
    --text-muted: #9196A8;
    --text-inverse: #FFFFFF;

    --success: #16A362;
    --success-bg: rgba(22, 163, 98, 0.1);
    --warning: #E89B00;
    --warning-bg: rgba(232, 155, 0, 0.1);
    --danger: #E03E52;
    --danger-bg: rgba(224, 62, 82, 0.1);
    --info: #2B7EE0;
    --info-bg: rgba(43, 126, 224, 0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px var(--primary-glow);

    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    --sidebar-width: 280px;
    --header-height: 72px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-display);
    background: var(--surface-0);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

img { max-width: 100%; display: block; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb {
    background: var(--surface-4);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================
   AUTH PAGES (Login, Register, Recover)
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-page__canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.auth-page__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(55, 37, 78, 0.88) 0%, rgba(26, 16, 48, 0.92) 100%);
    z-index: 1;
}

.auth-page__content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 2rem;
    overflow-y: auto;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 131, 0, 0.12);
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: authCardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    color: var(--text-primary);
    margin: auto 0;
}

@keyframes authCardIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card__logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card__logo .logo-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--secondary);
}

.auth-card__logo .logo-mark span {
    color: var(--primary);
}

.auth-card__logo .logo-sub {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* Auth card overrides for light card on dark background */
.auth-card .form-input {
    background: var(--surface-2);
    border-color: #D9DBE3;
    color: var(--text-primary);
}
.auth-card .form-input::placeholder { color: var(--text-muted); }
.auth-card .form-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.auth-card .form-label { color: var(--text-secondary); }
.auth-card .form-check label { color: var(--text-secondary); }
.auth-card .auth-card__subtitle { color: var(--text-secondary); }
.auth-card .form-input-wrapper .input-icon { color: var(--text-muted); }
.auth-card .auth-card__footer { color: var(--text-muted); }
.auth-card .auth-card__divider { color: var(--text-muted); }
.auth-card .auth-card__divider::before,
.auth-card .auth-card__divider::after { background: #D9DBE3; }

.auth-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-card__subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* --- MAPA Progress Indicator (Psychology: Goal-Gradient Effect) --- */
.mapa-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2.5rem;
    padding: 1rem 0;
}

.mapa-progress__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.mapa-progress__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 2px solid var(--surface-4);
    transition: all var(--transition-base);
    position: relative;
    z-index: 1;
}

.mapa-progress__step.active .mapa-progress__icon {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.mapa-progress__step.completed .mapa-progress__icon {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.mapa-progress__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 0.5rem;
    transition: color var(--transition-base);
}

.mapa-progress__step.active .mapa-progress__label {
    color: var(--primary);
}

.mapa-progress__step.completed .mapa-progress__label {
    color: var(--success);
}

.mapa-progress__connector {
    flex: 1;
    height: 2px;
    background: var(--surface-4);
    margin: 0 -4px;
    position: relative;
    top: -12px;
    z-index: 0;
}

.mapa-progress__connector.active {
    background: linear-gradient(90deg, var(--success), var(--primary));
}

.mapa-progress__connector.completed {
    background: var(--success);
}

/* MAPA progress on dark backgrounds (dashboard hero) */
.dark-context .mapa-progress__label { color: rgba(255,255,255,0.5); }
.dark-context .mapa-progress__step.active .mapa-progress__label { color: var(--primary); }
.dark-context .mapa-progress__step.completed .mapa-progress__label { color: var(--success); }
.dark-context .mapa-progress__icon { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); border-color: rgba(255,255,255,0.15); }
.dark-context .mapa-progress__connector { background: rgba(255,255,255,0.15); }

/* --- Form Elements --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #FFFFFF;
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.95rem;
    transition: all var(--transition-base);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #FFFFFF;
}

.form-input:hover:not(:focus) {
    border-color: #B0B5C3;
}

.form-input--icon {
    padding-left: 2.75rem;
}

.form-input-wrapper {
    position: relative;
}

.form-input-wrapper .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color var(--transition-base);
}

.form-input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
}

select.form-input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239196A8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 131, 0, 0.3);
}

.btn--primary:hover {
    background: var(--primary-light);
    box-shadow: 0 6px 25px rgba(255, 131, 0, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--secondary {
    background: #FFFFFF;
    color: var(--text-primary);
    border: 1px solid #D9DBE3;
}

.btn--secondary:hover {
    background: var(--surface-2);
    border-color: #B0B5C3;
    color: var(--text-primary);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.btn--ghost:hover {
    color: var(--primary);
    background: var(--primary-subtle);
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--danger:hover {
    filter: brightness(1.1);
    color: #fff;
}

.btn--full {
    width: 100%;
}

.btn--sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn--lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn--icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.auth-card__footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-card__footer a {
    font-weight: 600;
}

.auth-card__divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-card__divider::before,
.auth-card__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #D9DBE3;
}

/* ============================================
   APP LAYOUT (Dashboard, Tickets, etc.)
   ============================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--secondary);
    border-right: none;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar__header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #FFFFFF;
}

.sidebar__logo span {
    color: var(--primary);
}

.sidebar__nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar__section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    padding: 1rem 0.75rem 0.5rem;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.sidebar__link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.sidebar__link.active {
    background: var(--primary);
    color: #FFFFFF;
}

.sidebar__link.active i {
    color: #FFFFFF;
}

.sidebar__link .badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    min-width: 22px;
    text-align: center;
}

.sidebar__footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.sidebar__user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar__user-info {
    overflow: hidden;
}

.sidebar__user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #FFFFFF;
}

.sidebar__user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #E8E9EF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 50;
}

.main-header__title {
    font-size: 1.35rem;
    font-weight: 700;
}

.main-header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.main-header__search {
    position: relative;
}

.main-header__search input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    width: 240px;
    outline: none;
    transition: all var(--transition-base);
}

.main-header__search input:focus {
    border-color: var(--primary);
    width: 300px;
    background: #FFFFFF;
}

.main-header__search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.notification-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* --- Notification Dropdown --- */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-base);
}

.notification-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #E8E9EF;
}

.notification-dropdown__list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    transition: background var(--transition-fast);
    cursor: pointer;
    border-bottom: 1px solid #F0F1F5;
}

.notification-item:hover {
    background: var(--surface-2);
}

.notification-item--unread {
    background: rgba(255, 131, 0, 0.05);
    border-left: 3px solid var(--primary);
}

.notification-item__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.notification-item__body { flex: 1; min-width: 0; }

.notification-item__text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-item__text strong { color: var(--text-primary); }

.notification-item__time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.notification-dropdown__footer {
    text-align: center;
    padding: 0.75rem;
    border-top: 1px solid #E8E9EF;
}

@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}

.page-content {
    padding: 2rem;
}

/* --- Mobile Hamburger --- */
.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */

.card {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: #D9DBE3;
}

.card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 131, 0, 0.3);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card__title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: rgba(255, 131, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card__icon--orange {
    background: rgba(255, 131, 0, 0.12);
    color: var(--primary);
}

.stat-card__icon--green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-card__icon--blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-card__icon--purple {
    background: rgba(55, 37, 78, 0.1);
    color: var(--secondary);
}

.stat-card__value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.stat-card__label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-card__trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.stat-card__trend--up { color: var(--success); }
.stat-card__trend--down { color: var(--danger); }

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid #E8E9EF;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid #E8E9EF;
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    border-bottom: 1px solid #F0F1F5;
    background: #FFFFFF;
}

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

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

/* --- Badges / Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--open {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge--progress {
    background: var(--info-bg);
    color: var(--info);
}

.badge--closed {
    background: var(--success-bg);
    color: var(--success);
}

.badge--urgent {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge--paid {
    background: var(--success-bg);
    color: var(--success);
}

.badge--pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge--overdue {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge--phase {
    background: rgba(255, 131, 0, 0.12);
    color: var(--primary);
}

/* ============================================
   TICKETS
   ============================================ */

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-item {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.ticket-item:hover {
    border-color: rgba(255, 131, 0, 0.3);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.ticket-item__priority {
    width: 4px;
    height: 40px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.ticket-item__priority--high { background: var(--danger); }
.ticket-item__priority--medium { background: var(--warning); }
.ticket-item__priority--low { background: var(--success); }

.ticket-item__body {
    flex: 1;
    min-width: 0;
}

.ticket-item__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-item__meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.ticket-item__date {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Ticket Detail / Chat --- */
.ticket-chat {
    max-height: 500px;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
}

.chat-message--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-message--support .chat-message__avatar {
    background: var(--primary);
    color: #fff;
}

.chat-message--user .chat-message__avatar {
    background: var(--secondary);
    color: #fff;
}

.chat-message__bubble {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message--support .chat-message__bubble {
    background: var(--surface-2);
    border-bottom-left-radius: 4px;
}

.chat-message--user .chat-message__bubble {
    background: rgba(255, 131, 0, 0.1);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.chat-message__time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.ticket-reply {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid #E8E9EF;
}

.ticket-reply input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.95rem;
    outline: none;
}

.ticket-reply input:focus {
    border-color: var(--primary);
}

/* ============================================
   INVOICES
   ============================================ */

.invoice-card {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all var(--transition-base);
}

.invoice-card:hover {
    border-color: rgba(255, 131, 0, 0.3);
    box-shadow: var(--shadow-sm);
}

.invoice-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 131, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.3rem;
    flex-shrink: 0;
}

.invoice-card__info {
    flex: 1;
    min-width: 0;
}

.invoice-card__number {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.invoice-card__detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.invoice-card__amount {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
}

.invoice-card__actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   RESOURCES / CONTENT
   ============================================ */

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.resource-card {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.resource-card:hover {
    border-color: rgba(255, 131, 0, 0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.resource-card__thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.resource-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.resource-card__thumbnail .play-icon {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 131, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    backdrop-filter: blur(8px);
    transition: transform var(--transition-bounce);
}

.resource-card:hover .play-icon {
    transform: scale(1.1);
}

.resource-card__type-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.resource-card__body {
    padding: 1.25rem;
}

.resource-card__title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-card__desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #F0F1F5;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   STORE
   ============================================ */

.store-hero {
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary));
    border-radius: var(--radius-xl);
    padding: 3rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.store-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 131, 0, 0.15), transparent 70%);
    border-radius: 50%;
}

.store-hero__title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    position: relative;
    color: #FFFFFF;
}

.store-hero__subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    max-width: 500px;
    position: relative;
}

.store-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.product-card:hover {
    border-color: rgba(255, 131, 0, 0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-card__image {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
}

.product-card__body {
    padding: 1.25rem;
}

.product-card__title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}

.product-card__desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-card__price {
    font-size: 1.3rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--primary);
}

.product-card__price small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Stripe Checkout Container --- */
.checkout-container {
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-xl);
    padding: 2rem;
    min-height: 400px;
}

.checkout-container #checkout {
    min-height: 350px;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-bounce);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #E8E9EF;
}

.modal__title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.modal__close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #E8E9EF;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state__icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state__text {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #E8E9EF;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-display);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   GRID LAYOUTS
   ============================================ */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ============================================
   FILE UPLOAD
   ============================================ */

.file-upload {
    border: 2px dashed #D9DBE3;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.file-upload__icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.file-upload__text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.file-upload__hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

/* ============================================
   VIDEO PLAYER MODAL
   ============================================ */

.video-modal .modal {
    max-width: 900px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-wrapper video,
.video-wrapper iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #FFFFFF;
    border: 1px solid #E8E9EF;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 300px;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--info); }
.toast--warning { border-left: 3px solid var(--warning); }

.toast__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--info .toast__icon { color: var(--info); }

.toast__message {
    flex: 1;
    font-size: 0.9rem;
}

.toast__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1.5rem;
}

.pagination__btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    border: 1px solid #D9DBE3;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-display);
}

.pagination__btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.pagination__btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================
   ADMIN SPECIFIC
   ============================================ */

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-toolbar__filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 0.85rem;
    background: #FFFFFF;
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    outline: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239196A8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.filter-select:focus {
    border-color: var(--primary);
}

/* --- Link Copy Widget --- */
.link-copy {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.link-copy__input {
    flex: 1;
    padding: 0.5rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    outline: none;
}

.link-copy__btn {
    padding: 0.5rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid #D9DBE3;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.link-copy__btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.15);
        z-index: 200;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 1.25rem;
    }

    .main-header {
        padding: 0 1.25rem;
    }

    .main-header__search input {
        width: 160px;
    }

    .main-header__search input:focus {
        width: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .store-products {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-item__date {
        margin-left: 0;
    }

    .invoice-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .mapa-progress__label {
        font-size: 0.6rem;
    }

    .mapa-progress__icon {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .store-hero {
        padding: 2rem 1.5rem;
    }

    .store-hero__title {
        font-size: 1.5rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Noise Texture Overlay --- */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: multiply;
}
