:root {
    --navy-950: #08152f;
    --navy-900: #0d1d43;
    --navy-800: #142957;
    --blue: #13a8ff;
    --blue-dark: #0688d1;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #14213d;
    --muted: #71809b;
    --line: #e3e9f2;
    --success: #197a50;
    --danger: #b83b4a;
    --warning: #98620a;
    --radius: 18px;
    --shadow: 0 18px 50px rgba(13, 29, 67, .09);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { padding: .15rem .4rem; background: #edf2f9; border-radius: 6px; }

.auth-page { display: grid; grid-template-columns: minmax(380px, .95fr) minmax(440px, 1.05fr); min-height: 100vh; }
.auth-visual { position: relative; overflow: hidden; padding: 48px; color: #fff; background: radial-gradient(circle at 78% 25%, rgba(19,168,255,.4), transparent 26%), linear-gradient(150deg, rgba(8,21,47,.96), rgba(20,41,87,.94)); }
.auth-visual::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, black, transparent); }
.auth-visual::after { content: ""; position: absolute; width: 430px; height: 430px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: -120px; bottom: -120px; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.02); }
.brand-mark { position: relative; z-index: 1; display: block; width: 150px; height: auto; }
.visual-content { position: absolute; z-index: 1; left: 48px; right: 48px; bottom: 70px; }
.visual-content h1 { margin: 14px 0 24px; font-size: clamp(48px, 7vw, 86px); line-height: .92; letter-spacing: -5px; }
.visual-content h1 strong { color: var(--blue); font-weight: 800; }
.visual-content p { margin: 0; font-size: 20px; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: #fff; }
.auth-box { width: min(100%, 470px); }
.auth-box h2 { margin: 8px 0 10px; font-size: 36px; letter-spacing: -1.4px; }
.muted { color: var(--muted); }
.eyebrow { display: inline-block; color: var(--blue-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.eyebrow.light { color: #9bdcff; }
.form-stack { display: grid; gap: 18px; margin-top: 28px; }
.form-stack label { display: grid; gap: 8px; font-size: 14px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; color: var(--text); background: #fff; outline: none; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(19,168,255,.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 0; border-radius: 11px; font-weight: 800; transition: .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-dark)); box-shadow: 0 10px 25px rgba(19,168,255,.24); }
.btn-secondary { color: var(--navy-900); background: #edf2f9; }
.btn-small { min-height: 34px; padding: 7px 11px; font-size: 13px; }
.btn-block { width: 100%; min-height: 50px; }
.subtle-link { display: block; margin-top: 22px; color: var(--muted); text-align: center; font-size: 14px; }
.alert { margin: 20px 0; padding: 13px 15px; border-radius: 12px; font-size: 14px; font-weight: 650; }
.alert-error { color: #842d3a; background: #fff0f2; border: 1px solid #ffd0d6; }
.alert-success { color: #11633f; background: #eaf9f1; border: 1px solid #c3efd7; }

.app-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 26px 18px; color: #fff; background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 28px; }
.sidebar-brand span:last-child { display: grid; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand small { margin-top: 3px; color: #90a4ca; font-size: 11px; }
.brand-symbol { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--navy-950); background: var(--blue); font-weight: 900; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a { display: flex; justify-content: space-between; align-items: center; padding: 12px 13px; border-radius: 11px; color: #c7d2e7; font-size: 14px; font-weight: 650; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-nav a.disabled { opacity: .55; pointer-events: none; }
.sidebar-nav small { color: #7590bd; font-size: 10px; }
.sidebar-logout { margin-top: auto; padding: 12px 13px; color: #9bb0d2; font-size: 14px; }
.app-main { min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; height: 76px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.topbar > div { display: grid; text-align: right; }
.topbar span { font-size: 11px; }
.topbar strong { font-size: 14px; }
.menu-toggle { display: none; margin-right: auto; border: 0; background: transparent; font-size: 22px; }
.content-area { padding: 34px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.page-heading h1 { margin: 5px 0 5px; font-size: 35px; letter-spacing: -1.5px; }
.page-heading p { margin: 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -25px; top: -35px; border-radius: 50%; background: #eff5fb; }
.metric-card.accent::after { background: rgba(19,168,255,.18); }
.metric-card span, .metric-card small { position: relative; z-index: 1; display: block; color: var(--muted); }
.metric-card strong { position: relative; z-index: 1; display: block; margin: 9px 0 4px; font-size: 34px; }
.metric-card small { font-size: 12px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 4px; font-size: 19px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 230px auto; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fbfcfe; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { padding: 40px; color: var(--muted); text-align: center; }
.status { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: capitalize; white-space: nowrap; }
.status-ativo, .status-disponivel, .status-concluido { color: #11633f; background: #e4f7ed; }
.status-aguardando_ativacao, .status-aguardando_pagamento, .status-em_andamento { color: #855909; background: #fff4d9; }
.status-bloqueado, .status-cancelado, .status-revogado { color: #8b2d3b; background: #ffebee; }
.module-grid { display: grid; gap: 15px; }
.module-card { display: grid; grid-template-columns: 56px 1fr; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.module-order { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, var(--navy-800), var(--blue)); font-size: 21px; font-weight: 900; }
.module-card h2 { margin: 9px 0 7px; }
.module-card p { margin: 0; color: var(--muted); }
.module-meta { display: flex; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 12px; font-weight: 700; }

.user-header { display: flex; justify-content: space-between; align-items: center; height: 76px; padding: 0 max(24px, calc((100vw - 1180px)/2)); color: #fff; background: var(--navy-950); }
.user-header > div { display: flex; gap: 18px; align-items: center; }
.user-header a:last-child { color: #9bdcff; }
.user-brand { display: flex; align-items: center; gap: 10px; }
.user-brand > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--navy-950); background: var(--blue); font-weight: 900; }
.user-content { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0; }
.trail-list { display: grid; gap: 18px; }
.trail-card { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 20px; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.trail-number { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, var(--navy-800), var(--blue)); font-size: 24px; font-weight: 900; }
.trail-content h2 { margin: 10px 0 6px; }
.trail-content p { margin: 0 0 18px; color: var(--muted); }
.progress-line { height: 9px; overflow: hidden; margin-bottom: 8px; border-radius: 999px; background: #e8eef6; }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--blue-dark)); }
.trail-content small { color: var(--muted); }
.empty-state, .center-page { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.empty-state { min-height: 260px; padding: 40px; border: 1px dashed #cbd6e5; border-radius: var(--radius); background: #fff; }
.empty-state h1, .empty-state h2 { margin: 10px 0; }
.empty-state p { color: var(--muted); }

@media (max-width: 960px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { min-height: 330px; }
    .visual-content { bottom: 42px; }
    .visual-content h1 { font-size: 58px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 20; left: -290px; width: 270px; transition: left .25s; }
    .sidebar-open .sidebar { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
    .menu-toggle { display: block; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .auth-visual { min-height: 270px; padding: 28px; }
    .brand-mark { width: 125px; }
    .visual-content { left: 28px; bottom: 30px; }
    .visual-content h1 { margin-bottom: 14px; font-size: 43px; letter-spacing: -3px; }
    .visual-content p { font-size: 15px; }
    .auth-panel { padding: 30px 22px; }
    .auth-box h2 { font-size: 30px; }
    .content-area { padding: 24px 16px; }
    .topbar { padding: 0 18px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
    .user-header { padding: 0 18px; }
    .user-header > div > span { display: none; }
    .user-content { width: min(100% - 28px, 1180px); padding: 30px 0; }
    .trail-card { grid-template-columns: 1fr; }
}
