/* ============================================================
   FUTBOL MANAGER PRO — Main Stylesheet
   Tema: Dark Minimalist con acentos Esmeralda
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --bg-base:       #0a0d0f;
    --bg-surface:    #111518;
    --bg-card:       #161b1f;
    --bg-hover:      #1c2228;
    --border:        #1e2730;
    --border-light:  #252f38;

    --emerald:       #10b981;
    --emerald-dim:   #059669;
    --emerald-glow:  rgba(16,185,129,.15);
    --emerald-border:rgba(16,185,129,.25);

    --text-primary:  #f1f5f9;
    --text-secondary:#8b98a8;
    --text-muted:    #4d5c6a;

    --red:           #ef4444;
    --amber:         #f59e0b;
    --blue:          #3b82f6;
    --purple:        #a855f7;

    --font-display:  'Syne', sans-serif;
    --font-body:     'Inter', sans-serif;

    --radius-sm:     6px;
    --radius:        10px;
    --radius-lg:     16px;
    --radius-xl:     20px;

    --shadow-card:   0 1px 3px rgba(0,0,0,.4), 0 0 0 1px var(--border);
    --shadow-glow:   0 0 24px var(--emerald-glow);
    --transition:    .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Tipografía ────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
a { color: var(--emerald); text-decoration: none; transition: color var(--transition); }
a:hover { color: #34d399; }
p { color: var(--text-secondary); }

/* ── Layout ────────────────────────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: width .25s ease;
    overflow-x: hidden;
    overflow-y: hidden;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 38px; height: 38px;
    background: var(--emerald);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: .95rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-sub {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 400;
    font-family: var(--font-body);
    display: block;
}

/* Academia badge en sidebar */
.sidebar-academy {
    margin: .75rem 1rem;
    padding: .65rem 1rem;
    background: var(--emerald-glow);
    border: 1px solid var(--emerald-border);
    border-radius: var(--radius);
}
.sidebar-academy .acad-name {
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 700;
    color: var(--emerald);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-academy .acad-plan {
    font-size: .68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sidebar-nav {
    flex: 1;
    padding: .5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.nav-section {
    padding: 1rem 1.25rem .4rem;
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color .15s;
}
.nav-section:hover { color: var(--text-secondary); }
.nav-section .nav-section-arrow {
    font-size: .55rem;
    transition: transform .22s ease;
    opacity: .5;
    margin-right: .25rem;
}
.nav-section.collapsed-group .nav-section-arrow {
    transform: rotate(-90deg);
}
.nav-group-items {
    overflow: hidden;
    transition: max-height .25s ease;
    max-height: 1000px;
}
.nav-group-items.hidden {
    max-height: 0 !important;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: var(--text-secondary);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--emerald-glow);
    color: var(--emerald);
    border-left-color: var(--emerald);
}

.nav-item .nav-icon {
    width: 18px;
    text-align: center;
    opacity: .7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .4rem;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.nav-sub {
    padding-left: .75rem;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dim));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: .75rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}
.user-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.user-info .user-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.user-info .user-role {
    font-size: .68rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.logout-btn {
    margin-left: auto;
    color: var(--text-muted);
    padding: .3rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: none;
    font-size: 1rem;
}
.logout-btn:hover { color: var(--red); background: rgba(239,68,68,.1); }

/* ── Sidebar Collapse Button ──────────────────────────────── */
.sidebar-collapse-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: 26px; height: 26px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem;
    transition: all var(--transition);
}
.sidebar-collapse-btn:hover {
    background: var(--emerald-glow);
    border-color: var(--emerald-border);
    color: var(--emerald);
}

/* ── Collapsed Sidebar State ──────────────────────────────── */
.sidebar.collapsed {
    width: 64px;
}
.sidebar.collapsed .sidebar-text {
    display: none;
}
.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 1.25rem .5rem;
}
.sidebar.collapsed .sidebar-academy {
    display: none;
}
.sidebar.collapsed .nav-section {
    display: none;
}
.sidebar.collapsed .nav-group-items {
    max-height: 1000px !important; /* siempre visible en modo mini */
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: .7rem;
    gap: 0;
}
.sidebar.collapsed .nav-icon {
    width: auto;
    font-size: 1.1rem;
    opacity: 1;
}
.sidebar.collapsed .sidebar-footer {
    padding: .75rem .5rem;
}
.sidebar.collapsed .user-mini {
    justify-content: center;
}
.sidebar.collapsed #collapseIcon {
    transform: rotate(180deg);
    display: inline-block;
}
.sidebar.collapsed .sidebar-collapse-btn {
    margin-left: 0;
}

/* Tooltip para modo collapsed */
.sidebar.collapsed .nav-item {
    position: relative;
}
.sidebar.collapsed .nav-item::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: .78rem;
    font-weight: 500;
    padding: .35rem .7rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Ajuste del main cuando está collapsed */
.main-content.sidebar-collapsed {
    margin-left: 64px;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { flex: 1; }

.page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .1rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--emerald); }
.breadcrumb .sep { opacity: .4; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.topbar-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-size: .9rem;
    text-decoration: none;
}
.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* ── Page Body ─────────────────────────────────────────────── */
.page-body {
    flex: 1;
    padding: 1.75rem 2rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}

.stat-card.emerald::before { background: var(--emerald); }
.stat-card.blue::before    { background: var(--blue); }
.stat-card.amber::before   { background: var(--amber); }
.stat-card.red::before     { background: var(--red); }
.stat-card.purple::before  { background: var(--purple); }

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
}

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

.stat-icon.emerald { background: rgba(16,185,129,.12); }
.stat-icon.blue    { background: rgba(59,130,246,.12); }
.stat-icon.amber   { background: rgba(245,158,11,.12); }
.stat-icon.red     { background: rgba(239,68,68,.12); }
.stat-icon.purple  { background: rgba(168,85,247,.12); }

.stat-info { flex: 1; min-width: 0; }

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: .2rem;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-change {
    font-size: .75rem;
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-top: .3rem;
}
.stat-change.up   { color: var(--emerald); }
.stat-change.down { color: var(--red); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--emerald);
    color: #0a0d0f;
    border-color: var(--emerald);
}
.btn-primary:hover:not(:disabled) {
    background: #34d399;
    border-color: #34d399;
    color: #0a0d0f;
    box-shadow: 0 0 16px rgba(16,185,129,.3);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--border-light);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-danger {
    background: rgba(239,68,68,.1);
    color: var(--red);
    border-color: rgba(239,68,68,.3);
}
.btn-danger:hover:not(:disabled) {
    background: var(--red);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: .35rem .75rem;
    font-size: .8rem;
}

.btn-lg {
    padding: .85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    justify-content: center;
}

.btn-icon.sm { width: 28px; height: 28px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.required::after {
    content: ' *';
    color: var(--red);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: .65rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .88rem;
    transition: all var(--transition);
    outline: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

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

select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn  { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }

.input-prefix, .input-suffix {
    padding: .65rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: .85rem;
    display: flex;
    align-items: center;
}
.input-prefix { border-right: none; border-radius: var(--radius) 0 0 var(--radius); }
.input-suffix { border-left: none; border-radius: 0 var(--radius) var(--radius) 0; }
.input-prefix ~ input, .input-suffix ~ input {
    border-radius: 0;
    flex: 1;
}

.form-error {
    font-size: .78rem;
    color: var(--red);
    margin-top: .35rem;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.form-hint {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .35rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

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

thead {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

thead th {
    padding: .75rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: .85rem 1rem;
    font-size: .875rem;
    color: var(--text-secondary);
}

/* ── Badges / Pills ─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .65rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-emerald { background: rgba(16,185,129,.12);  color: #34d399; }
.badge-red     { background: rgba(239,68,68,.12);   color: #f87171; }
.badge-amber   { background: rgba(245,158,11,.12);  color: #fbbf24; }
.badge-blue    { background: rgba(59,130,246,.12);  color: #60a5fa; }
.badge-purple  { background: rgba(168,85,247,.12);  color: #c084fc; }
.badge-gray    { background: rgba(100,116,139,.12); color: #94a3b8; }

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dim));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm  { width: 28px; height: 28px; font-size: .65rem; }
.avatar.lg  { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar.xl  { width: 80px; height: 80px; font-size: 1.5rem; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    font-size: .875rem;
}

.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }

.alert-emerald { background: rgba(16,185,129,.08);  border-color: rgba(16,185,129,.25); color: #34d399; }
.alert-red     { background: rgba(239,68,68,.08);   border-color: rgba(239,68,68,.25);  color: #f87171; }
.alert-amber   { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.25); color: #fbbf24; }
.alert-blue    { background: rgba(59,130,246,.08);  border-color: rgba(59,130,246,.25); color: #60a5fa; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.95) translateY(10px);
    transition: transform var(--transition);
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body    { padding: 1.5rem; }
.modal-footer  { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .75rem; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 20px;
    background: var(--emerald);
    transition: width .5s ease;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    gap: .25rem;
}

.tab {
    padding: .6rem 1.2rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    white-space: nowrap;
}

.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--emerald); border-bottom-color: var(--emerald); }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: .4;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: .5rem;
}

.empty-state p {
    font-size: .875rem;
    margin-bottom: 1.5rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}

.pagination-info {
    font-size: .8rem;
    color: var(--text-muted);
}

.pagination-pages {
    display: flex;
    gap: .25rem;
}

.page-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.page-btn:hover { border-color: var(--emerald); color: var(--emerald); }
.page-btn.active { background: var(--emerald); color: #0a0d0f; border-color: var(--emerald); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown { position: relative; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    min-width: 180px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    overflow: hidden;
    opacity: 0;
    transform: scale(.95) translateY(-5px);
    pointer-events: none;
    transition: all var(--transition);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1rem;
    color: var(--text-secondary);
    font-size: .85rem;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* ── Search ─────────────────────────────────────────────────── */
.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-box input {
    padding-left: 2.5rem;
    background: var(--bg-card);
    border-color: var(--border);
}

.search-box .search-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .9rem;
    pointer-events: none;
}

/* ── Toggle / Switch ────────────────────────────────────────── */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
}

.toggle input { display: none; }

.toggle-track {
    width: 40px; height: 22px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    position: relative;
    transition: all var(--transition);
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle input:checked + .toggle-track {
    background: var(--emerald-glow);
    border-color: var(--emerald);
}

.toggle input:checked + .toggle-track::after {
    background: var(--emerald);
    left: 20px;
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-emerald { color: var(--emerald) !important; }
.text-red     { color: var(--red)     !important; }
.text-amber   { color: var(--amber)   !important; }
.text-blue    { color: var(--blue)    !important; }
.text-muted   { color: var(--text-muted)    !important; }
.text-secondary { color: var(--text-secondary) !important; }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1; }

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

.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.p-0 { padding: 0; }

.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.font-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.125rem; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.border-t { border-top: 1px solid var(--border); padding-top: 1rem; }

.opacity-60 { opacity: .6; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-base);
    position: relative;
}

.auth-wrapper::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 70% 30%, rgba(16,185,129,.06) 0%, transparent 60%),
                radial-gradient(ellipse at 30% 70%, rgba(59,130,246,.04) 0%, transparent 60%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.auth-logo-icon {
    width: 48px; height: 48px;
    background: var(--emerald);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: .35rem;
}

.auth-subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* ── Sidebar Mobile Toggle ──────────────────────────────────── */
.mobile-toggle {
    display: none;
    width: 36px; height: 36px;
    align-items: center; justify-content: center;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: all var(--transition);
}

/* ── Loader ─────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

.fade-in {
    animation: fadeIn .35s ease forwards;
}

.stagger > * {
    opacity: 0;
    animation: fadeIn .35s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .1s;  }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .2s;  }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .3s;  }
.stagger > *:nth-child(7) { animation-delay: .35s; }
.stagger > *:nth-child(8) { animation-delay: .4s;  }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: 260px !important; }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.7); }
    .sidebar.collapsed { transform: translateX(-100%); }
    .sidebar.collapsed.open { transform: translateX(0); width: 260px !important; }
    .sidebar.collapsed .sidebar-text { display: revert; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: .6rem 1.25rem; gap: .75rem; }
    .sidebar.collapsed .nav-section { display: block; }
    .sidebar.collapsed .sidebar-academy { display: block; }
    .sidebar.collapsed .sidebar-footer { padding: 1rem 1.25rem; }
    .sidebar.collapsed .user-mini { justify-content: flex-start; }
    .sidebar.collapsed .nav-item::after { display: none; }
    .sidebar-collapse-btn { display: none; }
    .main-content { margin-left: 0 !important; }
    .mobile-toggle { display: flex; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .page-body { padding: 1rem; }
    .topbar { padding: 0 1rem; }
    .auth-card { padding: 1.75rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* ── Scrollbar personalizada ────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }