/* ==========================================================================
   Capacitei - sistema de design
   Dark-first, tokens em CSS custom properties, tudo responsivo (mobile -> desktop).
   ========================================================================== */

:root {
    /* superficies */
    --bg: #070912;
    --bg-soft: #0c1020;
    --surface: #111629;
    --surface-2: #171d35;
    --surface-3: #1e2643;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .16);

    /* texto */
    --text: #eef1fb;
    --text-soft: #a9b1cf;
    --text-dim: #6f78a0;

    /* marca */
    --brand: #6c5ce7;
    --brand-2: #8b7cff;
    --brand-ink: #ffffff;
    --accent: #00d2a8;
    --accent-2: #3ef0c8;
    --warn: #ffb020;
    --danger: #ff5c78;
    --info: #4aa8ff;

    /* efeitos */
    --glow-brand: 0 0 0 1px rgba(108, 92, 231, .35), 0 18px 50px -18px rgba(108, 92, 231, .75);
    --glow-accent: 0 0 0 1px rgba(0, 210, 168, .3), 0 18px 50px -18px rgba(0, 210, 168, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 12px 30px -12px rgba(0, 0, 0, .65);
    --shadow-lg: 0 30px 70px -25px rgba(0, 0, 0, .8);

    /* forma */
    --r-xs: 8px;
    --r-sm: 12px;
    --r: 16px;
    --r-lg: 22px;
    --r-xl: 30px;
    --r-full: 999px;

    /* ritmo */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;
    --sp-8: 64px;
    --sp-9: 96px;

    --container: 1200px;
    --container-wide: 1440px;
    --header-h: 68px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="light"] {
    --bg: #f6f7fc;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f2f4fb;
    --surface-3: #e8ebf7;
    --border: rgba(12, 16, 32, .1);
    --border-strong: rgba(12, 16, 32, .18);
    --text: #10142b;
    --text-soft: #4b5478;
    --text-dim: #77809f;
    --shadow: 0 12px 30px -14px rgba(16, 20, 43, .25);
    --shadow-lg: 0 30px 70px -30px rgba(16, 20, 43, .3);
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0 0 var(--sp-3); font-family: var(--font-display); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
p { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
code, pre { font-family: var(--mono); font-size: .875em; }

::selection { background: rgba(108, 92, 231, .4); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ------------------------------------------------------------- tipografia */
.h-display { font-size: clamp(2.4rem, 6.2vw, 4.6rem); line-height: 1.02; letter-spacing: -.04em; font-weight: 800; }
.h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
.h2 { font-size: clamp(1.6rem, 3.2vw, 2.35rem); }
.h3 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }
.h4 { font-size: 1.125rem; }

.lead { font-size: clamp(1.02rem, 1.6vw, 1.22rem); color: var(--text-soft); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.muted { color: var(--text-soft); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); }
.strong { font-weight: 650; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.gradient-text {
    background: linear-gradient(102deg, var(--text) 8%, var(--brand-2) 45%, var(--accent) 92%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: .75rem;
    font-weight: 650;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ------------------------------------------------------------------ layout */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }
.container-wide { width: 100%; max-width: var(--container-wide); margin-inline: auto; padding-inline: var(--sp-5); }

.section { padding-block: clamp(56px, 9vw, 116px); position: relative; }
.section-sm { padding-block: clamp(36px, 6vw, 64px); }

.stack { display: flex; flex-direction: column; }
.stack-2 { gap: var(--sp-2); }
.stack-3 { gap: var(--sp-3); }
.stack-4 { gap: var(--sp-4); }
.stack-5 { gap: var(--sp-5); }
.stack-6 { gap: var(--sp-6); }

.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.row-tight { gap: var(--sp-2); }
.row-nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 1024px) {
    .grid-sidebar { grid-template-columns: 280px minmax(0, 1fr); }
    .grid-sidebar.reverse { grid-template-columns: minmax(0, 1fr) 320px; }
}

.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }

.hide { display: none !important; }
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .only-mobile { display: none !important; } }

/* ------------------------------------------------------------------ fundos */
.aurora {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.aurora::before, .aurora::after {
    content: "";
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 820px;
    max-height: 820px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .5;
}

.aurora::before { background: radial-gradient(circle, var(--brand) 0%, transparent 68%); top: -22%; left: -12%; }
.aurora::after { background: radial-gradient(circle, var(--accent) 0%, transparent 68%); bottom: -30%; right: -14%; opacity: .32; }

[data-theme="light"] .aurora::before { opacity: .22; }
[data-theme="light"] .aurora::after { opacity: .16; }

.grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 68px 68px;
    mask-image: radial-gradient(ellipse 75% 55% at 50% 35%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 35%, #000 20%, transparent 78%);
    opacity: .5;
    pointer-events: none;
    z-index: 0;
}

.on-top { position: relative; z-index: 1; }

/* ----------------------------------------------------------------- botoes */
.btn {
    --btn-bg: var(--surface-2);
    --btn-fg: var(--text);
    --btn-bd: var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 11px 20px;
    border-radius: var(--r-full);
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-weight: 600;
    font-size: .94rem;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, border-color .2s, opacity .2s;
    white-space: nowrap;
    text-align: center;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary {
    --btn-bg: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 55%, #a58bff 100%);
    --btn-fg: var(--brand-ink);
    --btn-bd: transparent;
    box-shadow: var(--glow-brand);
}

.btn-primary:hover { box-shadow: 0 0 0 1px rgba(108, 92, 231, .5), 0 24px 60px -18px rgba(108, 92, 231, .9); }

.btn-accent {
    --btn-bg: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
    --btn-fg: #04241d;
    --btn-bd: transparent;
    box-shadow: var(--glow-accent);
}

.btn-ghost { --btn-bg: transparent; --btn-bd: var(--border-strong); }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-quiet { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-soft); }
.btn-quiet:hover { --btn-bg: var(--surface-2); color: var(--text); }
.btn-danger { --btn-bg: rgba(255, 92, 120, .14); --btn-fg: var(--danger); --btn-bd: rgba(255, 92, 120, .35); }
.btn-danger:hover { --btn-bg: rgba(255, 92, 120, .22); }

.btn-lg { padding: 15px 30px; font-size: 1.02rem; }
.btn-sm { padding: 8px 15px; font-size: .84rem; }
.btn-xs { padding: 5px 11px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; border-radius: var(--r-full); }

.btn-group { display: inline-flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ------------------------------------------------------------------ cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    position: relative;
}

.card-tight { padding: var(--sp-4); }
.card-flush { padding: 0; overflow: hidden; }

.card-glass {
    background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-strong);
}

[data-theme="light"] .card-glass { background: rgba(255, 255, 255, .8); }

.card-hover { transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.card-hover:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}

.card-head h2, .card-head h3 { margin: 0; }

/* borda em gradiente */
.card-glow { position: relative; }
.card-glow::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--brand), transparent 40%, transparent 60%, var(--accent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ------------------------------------------------------------------ pills */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.pill-brand { background: rgba(108, 92, 231, .16); border-color: rgba(108, 92, 231, .35); color: #c3b8ff; }
.pill-accent { background: rgba(0, 210, 168, .14); border-color: rgba(0, 210, 168, .35); color: var(--accent-2); }
.pill-warn { background: rgba(255, 176, 32, .14); border-color: rgba(255, 176, 32, .35); color: var(--warn); }
.pill-danger { background: rgba(255, 92, 120, .14); border-color: rgba(255, 92, 120, .35); color: var(--danger); }
.pill-info { background: rgba(74, 168, 255, .14); border-color: rgba(74, 168, 255, .35); color: var(--info); }

[data-theme="light"] .pill-brand { color: #5b4bd6; }
[data-theme="light"] .pill-accent { color: #05856c; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot-pulse { animation: pulse 1.8s var(--ease) infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .45; transform: scale(1.35); }
}

/* ----------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--sp-4); }
.field-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

label, .label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.label-req::after { content: " *"; color: var(--danger); }

.input, .select, .textarea, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="date"], input[type="datetime-local"],
input[type="time"], input[type="search"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    font: inherit;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.55; }

.input:focus, .select:focus, .textarea:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, .22);
}

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

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%236f78a0' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 11px;
    padding-right: 38px;
}

input[type="checkbox"], input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
    flex: 0 0 auto;
}

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check span { font-size: .9rem; color: var(--text); font-weight: 500; }

.hint { font-size: .8rem; color: var(--text-dim); }
.error-text { font-size: .82rem; color: var(--danger); font-weight: 500; }
.field-validation-error { color: var(--danger); font-size: .82rem; }
.input-validation-error { border-color: var(--danger) !important; }

.validation-summary-errors {
    background: rgba(255, 92, 120, .1);
    border: 1px solid rgba(255, 92, 120, .3);
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    color: var(--danger);
    font-size: .88rem;
}

.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    width: 44px; height: 25px; border-radius: var(--r-full);
    background: var(--surface-3); border: 1px solid var(--border-strong);
    position: relative; transition: background .22s var(--ease); flex: 0 0 auto;
}
.switch-track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 19px; height: 19px; border-radius: 50%; background: var(--text-soft);
    transition: transform .22s var(--ease), background .22s;
}
.switch input:checked + .switch-track { background: linear-gradient(120deg, var(--brand), var(--brand-2)); border-color: transparent; }
.switch input:checked + .switch-track::after { transform: translateX(19px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(108, 92, 231, .3); }

/* ---------------------------------------------------------------- alertas */
.alert {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font-size: .92rem;
    margin-bottom: var(--sp-4);
}

.alert-success { background: rgba(0, 210, 168, .1); border-color: rgba(0, 210, 168, .32); color: var(--accent-2); }
.alert-error { background: rgba(255, 92, 120, .1); border-color: rgba(255, 92, 120, .32); color: var(--danger); }
.alert-warn { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .32); color: var(--warn); }
.alert-info { background: rgba(74, 168, 255, .1); border-color: rgba(74, 168, 255, .32); color: var(--info); }

[data-theme="light"] .alert-success { color: #06765f; }
[data-theme="light"] .alert-error { color: #c0304b; }
[data-theme="light"] .alert-warn { color: #96650a; }

/* ---------------------------------------------------------------- tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }

table.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.table th {
    text-align: left;
    padding: 13px var(--sp-4);
    font-size: .74rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
table.table td { padding: 13px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background .15s; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table td.actions { text-align: right; white-space: nowrap; }

/* --------------------------------------------------------------- progress */
.progress {
    height: 7px;
    background: var(--surface-3);
    border-radius: var(--r-full);
    overflow: hidden;
    width: 100%;
}

.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transition: width .55s var(--ease-out);
}

.progress-lg { height: 11px; }

.ring {
    --pct: 0;
    width: 58px; height: 58px; border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-3) 0);
    display: grid; place-items: center; flex: 0 0 auto;
}
.ring::after {
    content: attr(data-label);
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface);
    display: grid; place-items: center;
    font-size: .74rem; font-weight: 700;
}

/* ------------------------------------------------------------ avatar/nav */
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: .85rem; flex: 0 0 auto;
    object-fit: cover; overflow: hidden; text-transform: uppercase;
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }

.brand-mark {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.12rem; letter-spacing: -.03em;
}
.brand-mark .logo-glyph {
    width: 32px; height: 32px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 120%);
    display: grid; place-items: center;
    color: #fff; font-weight: 900; font-size: .95rem;
    box-shadow: var(--glow-brand);
    flex: 0 0 auto;
}

/* ------------------------------------------------------------- app shell */
.app-header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.app-header .container-wide { display: flex; align-items: center; gap: var(--sp-4); }

.app-nav { display: flex; align-items: center; gap: 2px; }
.app-nav a {
    padding: 8px 13px;
    border-radius: var(--r-full);
    font-size: .9rem;
    font-weight: 550;
    color: var(--text-soft);
    transition: background .2s, color .2s;
}
.app-nav a:hover { background: var(--surface-2); color: var(--text); }
.app-nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.app-body { min-height: calc(100vh - var(--header-h)); padding-block: var(--sp-6) var(--sp-8); }

@media (max-width: 900px) {
    .app-nav { display: none; }
    .app-body { padding-bottom: 96px; }
}

/* barra inferior no celular */
.tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 70;
    display: none;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: 7px max(var(--sp-3), env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom));
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    font-size: .66rem;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: var(--r-sm);
    transition: color .2s, background .2s;
}
.tabbar a.active { color: var(--accent); background: rgba(0, 210, 168, .08); }
.tabbar a svg { width: 21px; height: 21px; }

@media (max-width: 900px) { .tabbar { display: flex; } }

/* menu do usuario */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 232px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 80;
    display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: dropIn .18s var(--ease-out); }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left;
    padding: 9px 12px; border-radius: var(--r-xs);
    font-size: .89rem; background: none; border: 0; cursor: pointer;
    color: var(--text); transition: background .15s;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }

@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- sidebar */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: sticky;
    top: calc(var(--header-h) + var(--sp-5));
}

.side-nav .side-group {
    font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--text-dim); font-weight: 700;
    padding: var(--sp-4) 12px 6px;
}

.side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--r-sm);
    font-size: .9rem; color: var(--text-soft); font-weight: 550;
    transition: background .18s, color .18s;
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active {
    background: linear-gradient(100deg, rgba(108, 92, 231, .2), rgba(0, 210, 168, .07));
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(108, 92, 231, .28);
}
.side-nav a svg { width: 18px; height: 18px; opacity: .85; flex: 0 0 auto; }

@media (max-width: 1023px) {
    .side-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: var(--sp-2);
        padding-bottom: var(--sp-2);
        scrollbar-width: none;
    }
    .side-nav::-webkit-scrollbar { display: none; }
    .side-nav .side-group { display: none; }
    .side-nav a { white-space: nowrap; background: var(--surface); border: 1px solid var(--border); }
}

/* -------------------------------------------------------- rails (Netflix) */
.rail { margin-bottom: var(--sp-7); position: relative; }

.rail-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--sp-4); margin-bottom: var(--sp-4);
}
.rail-head h2 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.5rem); }
.rail-head a { font-size: .85rem; color: var(--text-soft); font-weight: 600; }
.rail-head a:hover { color: var(--accent); }

.rail-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    gap: var(--sp-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--sp-5);
    padding-bottom: var(--sp-3);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.rail-track > * { scroll-snap-align: start; }
.rail-track::-webkit-scrollbar { height: 6px; }
.rail-track::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); }
.rail-track::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 640px) { .rail-track { grid-auto-columns: minmax(74%, 1fr); } }

.rail-nav { display: flex; gap: 6px; }
.rail-nav button {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    display: grid; place-items: center; cursor: pointer;
    transition: background .2s, transform .2s;
}
.rail-nav button:hover { background: var(--surface-3); transform: scale(1.06); }

/* ------------------------------------------------------------ card curso */
.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
    height: 100%;
}

.course-card:hover { transform: translateY(-5px) scale(1.012); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

.course-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.course-card:hover .course-thumb img { transform: scale(1.06); }
.course-thumb .thumb-fallback { font-size: 2rem; opacity: .35; font-weight: 800; letter-spacing: -.05em; }

.course-thumb .thumb-badges {
    position: absolute; top: 10px; left: 10px; right: 10px;
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: space-between;
}

.course-thumb .thumb-progress { position: absolute; bottom: 0; left: 0; right: 0; }

.course-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-body h3 { font-size: 1rem; margin: 0; line-height: 1.3; }
.course-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: .78rem; color: var(--text-dim); margin-top: auto; padding-top: 6px; }
.course-meta span { display: inline-flex; align-items: center; gap: 4px; }

.price-tag { font-size: 1.05rem; font-weight: 750; letter-spacing: -.02em; }
.price-free { color: var(--accent-2); }

/* --------------------------------------------------------------- estados */
.empty {
    text-align: center;
    padding: clamp(40px, 7vw, 72px) var(--sp-5);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.empty .empty-glyph {
    width: 62px; height: 62px; margin: 0 auto var(--sp-4);
    border-radius: var(--r);
    background: linear-gradient(135deg, rgba(108, 92, 231, .22), rgba(0, 210, 168, .14));
    display: grid; place-items: center; font-size: 1.6rem;
}
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-soft); max-width: 460px; margin-inline: auto; }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-loading { position: relative; pointer-events: none; opacity: .65; }

/* ---------------------------------------------------------------- toasts */
.toast-host {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 200;
    display: flex; flex-direction: column; gap: 10px;
    max-width: min(380px, calc(100vw - 40px));
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-sm);
    padding: 13px 16px;
    box-shadow: var(--shadow-lg);
    font-size: .9rem;
    animation: toastIn .28s var(--ease-out);
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) { .toast-host { bottom: 88px; } }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(4, 6, 14, .72);
    backdrop-filter: blur(5px);
    display: grid; place-items: center;
    padding: var(--sp-4);
    animation: fadeIn .2s var(--ease);
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: min(560px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: var(--sp-6);
    animation: modalIn .26s var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ tabs */
.tabs {
    display: flex; gap: 3px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-5);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
    padding: 11px 16px;
    font-size: .9rem; font-weight: 600;
    color: var(--text-soft);
    border: 0; background: none; cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ stats */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--sp-4) var(--sp-5);
    display: flex; flex-direction: column; gap: 3px;
}
.stat .stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); font-weight: 700; }
.stat .stat-value { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 780; letter-spacing: -.035em; line-height: 1.1; }
.stat .stat-foot { font-size: .8rem; color: var(--text-soft); }
.stat-up { color: var(--accent-2); }
.stat-down { color: var(--danger); }

/* ------------------------------------------------------------------ misc */
.divider-label {
    display: flex; align-items: center; gap: var(--sp-4);
    color: var(--text-dim); font-size: .8rem; margin: var(--sp-5) 0;
}
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.kbd {
    display: inline-block; padding: 2px 7px;
    border-radius: 6px; border: 1px solid var(--border-strong);
    background: var(--surface-2); font-family: var(--mono); font-size: .78rem;
}

.scroll-x { overflow-x: auto; }
.aspect-video { aspect-ratio: 16 / 9; width: 100%; }

.link-accent { color: var(--accent); font-weight: 600; }
.link-accent:hover { text-decoration: underline; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; top: -60px; left: var(--sp-4); z-index: 300;
    background: var(--brand); color: #fff; padding: 10px 18px;
    border-radius: var(--r-sm); transition: top .2s;
}
.skip-link:focus { top: var(--sp-3); }

/* animacao de entrada por scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

@media print {
    .app-header, .tabbar, .side-nav, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
}
