/* ============================================================
   Fontes auto-hospedadas (sem chamada externa ao Google Fonts)
   ============================================================ */
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/manrope-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/manrope-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/manrope-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/manrope-latin-700-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/assets/fonts/manrope-latin-700-normal.woff2') format('woff2');
}

:root {
    --bg: #101319;
    --bg-card: #171b23;
    --bg-soft: #1c212b;
    --border: #262b36;
    --blue: #4f7fff;
    --blue-dark: #3b6ef6;
    --blue-light: rgba(79,127,255,.15);
    --purple: #9d8bff;
    --purple-light: rgba(157,139,255,.15);
    --green: #34d399;
    --green-light: rgba(52,211,153,.14);
    --red: #f87171;
    --red-light: rgba(248,113,113,.14);
    --amber: #fbbf24;
    --amber-light: rgba(251,191,36,.14);
    --text: #f1f2f6;
    --text-muted: #8b909e;
    --radius: 20px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 12px 28px -16px rgba(0,0,0,.55);
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: var(--font-body);
    font-weight: 800;
    letter-spacing: -.2px;
    margin: 0 0 6px;
    color: var(--text);
}

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

.container { max-width: 1120px; margin: 0 auto; padding: 22px 18px calc(48px + var(--safe-bottom)); }

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}
.navbar .brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
    letter-spacing: -.2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar .brand img.logo-icon {
    width: 30px; height: 30px;
    border-radius: 10px;
    flex-shrink: 0;
    display: block;
}
.brand-word { display: flex; flex-direction: column; line-height: 1.1; }
.brand-word .sub { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-muted); text-transform: uppercase; }
.nav-tabs { display: flex; gap: 6px; }
.nav-tabs a { padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.nav-tabs a.active { background: var(--blue-light); color: var(--blue); }
.navbar { flex-wrap: wrap; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 700;
    min-height: 44px;
    transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
    box-shadow: 0 6px 14px -6px rgba(59,110,246,.45);
}
.btn:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.danger { background: var(--red); box-shadow: 0 6px 14px -6px rgba(239,68,68,.4); }
.btn.danger:hover { background: #dc2626; }
.btn.secondary {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
    font-weight: 700;
}
.btn.secondary:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

/* Icon squares (estilo Dental Finance) */
.icon-badge {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}
.icon-badge.blue { background: var(--blue-light); }
.icon-badge.purple { background: var(--purple-light); }
.icon-badge.green { background: var(--green-light); }
.icon-badge.red { background: var(--red-light); }
.icon-badge.amber { background: var(--amber-light); }

.stat-card { display: flex; align-items: flex-start; gap: 14px; }
.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.3px; }

.pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
}
.pill.blue { background: var(--blue-light); color: var(--blue-dark); }
.pill.purple { background: var(--purple-light); color: var(--purple); }
.pill.green { background: var(--green-light); color: var(--green); }
.pill.red { background: var(--red-light); color: var(--red); }
.pill.amber { background: var(--amber-light); color: #a86a00; }

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
@media (min-width: 560px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
    display: block;
}
.product-card:hover, .product-card:active {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(20,22,40,.05), 0 16px 28px -14px rgba(59,110,246,.28);
}
.product-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--bg-soft); display: block; }
.product-card .name {
    padding: 13px 14px 15px;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--text);
}

/* ---------- Forms ---------- */
input, select, textarea {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 13px 15px;
    border-radius: var(--radius-xs);
    font-family: var(--font-body);
    font-size: 15px;
    margin-bottom: 14px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--blue-light);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

label { font-size: 12.5px; font-weight: 700; display: block; margin-bottom: 7px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--blue-light);
    color: var(--blue-dark);
}
.badge.green { background: var(--green-light); color: var(--green); }
.badge.purple { background: var(--purple-light); color: var(--purple); }
.badge.amber { background: var(--amber-light); color: #a86a00; }

/* ---------- Auth screens ---------- */
.center-box {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px calc(24px + var(--safe-bottom));
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    text-align: center;
    padding: 36px 28px 32px;
}
.auth-card h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.alert {
    padding: 13px 16px;
    border-radius: var(--radius-xs);
    margin-bottom: 16px;
    font-size: 14px;
    text-align: left;
    font-weight: 600;
}
.alert.success { background: var(--green-light); color: var(--green); }
.alert.error { background: var(--red-light); color: var(--red); }

/* ---------- Lesson modal ---------- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20,22,40,.45);
    backdrop-filter: blur(3px);
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 22px 20px calc(26px + var(--safe-bottom));
    border: 1px solid var(--border);
    border-bottom: none;
}
@media (min-width: 720px) {
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: var(--radius); border-bottom: 1px solid var(--border); padding: 26px; }
}
.modal-close { float: right; cursor: pointer; color: var(--text-muted); font-size: 24px; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--blue); }

.lesson-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    min-height: 44px;
    box-shadow: var(--shadow);
    transition: border-color .15s ease, transform .15s ease;
}
.lesson-row:hover, .lesson-row:active { border-color: var(--blue); transform: translateX(2px); }
.lesson-row strong { font-size: 15px; }
.lesson-row span { color: var(--blue); font-size: 20px; }
