:root {
    /* ── PALETA LUFAN (baseada na logo oficial) ── */
    --lufan-dark:    #1e3a8a;   /* Azul escuro do "Lufan" */
    --lufan-blue:    #2563eb;   /* Azul royal principal */
    --lufan-bright:  #3b82f6;   /* Azul vibrante */
    --lufan-light:   #60a5fa;   /* Azul claro */
    --lufan-cyan:    #22d3ee;   /* Ciano da nuvem */
    --lufan-sky:     #38bdf8;   /* Azul céu */
    --lufan-ice:     #e0f2fe;   /* Azul gelo (fundos) */
    --lufan-navy:    #1e40af;   /* Azul marinho */

    /* ── TEMA CLARO ── */
    --primary:       var(--lufan-blue);
    --primary-dk:    var(--lufan-dark);
    --accent:        var(--lufan-bright);
    --accent-hv:     var(--lufan-navy);
    --accent-2:      var(--lufan-cyan);
    --bg:            #f1f5f9;
    --card:          #ffffff;
    --text:          #0f172a;
    --text-2:        var(--lufan-dark);
    --muted:         #64748b;
    --sb-bg:         #ffffff;
    --sb-txt:        #475569;
    --sb-act:        var(--lufan-blue);
    --sb-hv-bg:      var(--lufan-ice);
    --border:        #e2e8f0;
    --ok:            #10b981;
    --warn:          #f59e0b;
    --err:           #ef4444;
    --info:          var(--lufan-cyan);
    --in-bg:         #ffffff;
    --in-bd:         #cbd5e1;
    --in-tx:         #0f172a;
    --stripe:        #f8fafc;
    --shadow:        0 2px 12px rgba(30, 58, 138, 0.08);
    --shadow-lg:     0 10px 30px rgba(30, 58, 138, 0.12);
    --r:             10px;
    --tr:            all 0.25s ease;

    /* ── GRADIENTES (igual ao da logo) ── */
    --grad-lufan:    linear-gradient(135deg, var(--lufan-dark) 0%, var(--lufan-blue) 50%, var(--lufan-cyan) 100%);
    --grad-primary:  linear-gradient(135deg, var(--lufan-blue), var(--lufan-bright));
    --grad-accent:   linear-gradient(135deg, var(--lufan-bright), var(--lufan-cyan));
    --grad-hero:     linear-gradient(135deg, var(--lufan-dark) 0%, var(--lufan-blue) 50%, var(--lufan-cyan) 100%);
    --grad-sidebar:  linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --grad-dark:     linear-gradient(135deg, #1e3a8a, #1e40af);
}

[data-theme="dark"] {
    --primary:    var(--lufan-bright);
    --primary-dk: var(--lufan-blue);
    --accent:     var(--lufan-cyan);
    --accent-hv:  var(--lufan-sky);
    --bg:         #0a0f1e;
    --card:       #131a2e;
    --text:       #e2e8f0;
    --text-2:     var(--lufan-light);
    --muted:      #94a3b8;
    --sb-bg:      #0d1424;
    --sb-txt:     #94a3b8;
    --sb-act:     var(--lufan-cyan);
    --sb-hv-bg:   rgba(34, 211, 238, 0.1);
    --border:     #1e2a4a;
    --in-bg:      #1a2238;
    --in-bd:      #2d3a5c;
    --in-tx:      #e2e8f0;
    --stripe:     #161e34;
    --shadow:     0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:  0 10px 30px rgba(0, 0, 0, 0.5);

    --grad-primary:  linear-gradient(135deg, var(--lufan-blue), var(--lufan-cyan));
    --grad-sidebar:  linear-gradient(180deg, #0d1424 0%, #0a0f1e 100%);
    --grad-hero:     linear-gradient(135deg, #0a0f1e 0%, #131a2e 50%, #1e3a8a 100%);
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: var(--tr);
    -webkit-font-smoothing: antialiased;
}

/* ── LOGIN PAGE ── */
.lp {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad-hero);
    position: relative;
    overflow: hidden;
}
.lp::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 30% 70%, rgba(34, 211, 238, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(96, 165, 250, 0.18) 0%, transparent 50%);
    animation: bgPulse 18s ease infinite;
}
@keyframes bgPulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}
.lb {
    background: var(--card);
    border-radius: 18px;
    padding: 40px;
    width: 410px;
    max-width: 95%;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
    border-top: 4px solid transparent;
    background-image: linear-gradient(var(--card), var(--card)), var(--grad-lufan);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}
.ll { text-align: center; margin-bottom: 28px; }
.ll img { max-width: 180px; }
.ll h1 {
    background: var(--grad-lufan);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 16px;
    margin-top: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── LAYOUT ── */
.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sb {
    width: 260px;
    background: var(--sb-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
}
.sbh {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--grad-lufan);
    position: relative;
    overflow: hidden;
}
.sbh::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.sbh img {
    max-width: 140px;
    position: relative;
    z-index: 1;
    filter: brightness(0) invert(1);
}
.sbh span {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    margin-top: 8px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
.sbn { flex: 1; padding: 12px 0; }
.sbn a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sb-txt);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--tr);
    position: relative;
}
.sbn a:hover {
    background: var(--sb-hv-bg);
    color: var(--lufan-blue);
}
.sbn a.on {
    background: var(--sb-hv-bg);
    color: var(--lufan-blue);
    border-left-color: var(--lufan-blue);
    font-weight: 600;
}
[data-theme="dark"] .sbn a.on {
    color: var(--lufan-cyan);
    border-left-color: var(--lufan-cyan);
}
.sbn .ni { font-size: 17px; width: 22px; text-align: center; }
.sep {
    padding: 14px 20px 5px;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--lufan-blue);
    font-weight: 700;
    opacity: 0.6;
}
[data-theme="dark"] .sep { color: var(--lufan-cyan); }
.sbf {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    background: var(--stripe);
}

/* ── MAIN ── */
.mc {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* ── TOPBAR ── */
.tb {
    background: var(--card);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 500;
    border-bottom: 1px solid var(--border);
}
.tbl { display: flex; align-items: center; gap: 14px; }
.tbl h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.tbr { display: flex; align-items: center; gap: 12px; }
.mbtn {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
}
.thbtn {
    background: var(--in-bg);
    border: 1.5px solid var(--in-bd);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
    transition: var(--tr);
}
.thbtn:hover {
    border-color: var(--lufan-blue);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
}
.av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--grad-lufan);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}
.un { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--text); }
.ur {
    font-size: 10px;
    color: var(--lufan-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}
[data-theme="dark"] .ur { color: var(--lufan-cyan); }

/* ── CONTENT ── */
.ct { padding: 26px 28px; }

/* ── CARDS ── */
.card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: var(--tr);
}
.card:hover { box-shadow: var(--shadow-lg); }
.ch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border);
}
.ch h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── STATS ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    transition: var(--tr);
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--grad-lufan);
    border-radius: 12px 0 0 12px;
}
.stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.si {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.ia { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.ib { background: linear-gradient(135deg, #2563eb, #22d3ee); }
.ic { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.id { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.ie { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.if { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.sv { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text); }
.sl {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ── FORMS ── */
.fg { margin-bottom: 15px; }
.fg label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text);
}
.fg label .req { color: var(--lufan-bright); font-weight: 700; }
.fc {
    width: 100%;
    padding: 10px 13px;
    border: 2px solid var(--in-bd);
    border-radius: 8px;
    font-size: 13.5px;
    background: var(--in-bg);
    color: var(--in-tx);
    transition: var(--tr);
}
.fc:focus {
    outline: none;
    border-color: var(--lufan-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.fc:hover { border-color: var(--lufan-light); }
select.fc { cursor: pointer; }
textarea.fc { resize: vertical; min-height: 80px; }
.fg2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    gap: 0 20px;
}
.st {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 700;
    color: var(--lufan-blue);
    padding: 16px 0 8px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid;
    border-image: var(--grad-lufan) 1;
}
[data-theme="dark"] .st { color: var(--lufan-cyan); }
.st::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--grad-lufan);
    border-radius: 2px;
}

/* ── BUTTONS ── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tr);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transition: width 0.5s, height 0.5s, top 0.5s, left 0.5s;
}
.btn:active::after {
    width: 220px; height: 220px;
    top: calc(50% - 110px); left: calc(50% - 110px);
}
.btn:hover { transform: translateY(-1px); }
.bp {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.bp:hover { box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4); }
.bs {
    background: var(--grad-dark);
    color: #fff;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}
.bs:hover { box-shadow: 0 6px 18px rgba(30, 58, 138, 0.4); }
.bg {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
}
.bg:hover { box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35); }
.bd {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}
.bd:hover { box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35); }
.bw {
    background: linear-gradient(135deg, var(--lufan-cyan), var(--lufan-sky));
    color: #ffffff;
}
.bw:hover { box-shadow: 0 6px 18px rgba(34, 211, 238, 0.4); }
.bsm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.bg2 { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── ALERTS ── */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid;
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--ok);
    color: #047857;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--err);
    color: #b91c1c;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warn);
    color: #b45309;
}
.alert-info {
    background: rgba(34, 211, 238, 0.1);
    border-color: var(--lufan-cyan);
    color: var(--lufan-blue);
}

/* ── TABLES ── */
.tw { overflow-x: auto; border-radius: 8px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t thead th {
    background: var(--grad-lufan);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    letter-spacing: 0.4px;
}
table.t thead th:first-child { border-radius: 8px 0 0 0; }
table.t thead th:last-child { border-radius: 0 8px 0 0; }
table.t tbody tr { transition: background 0.15s; }
table.t tbody tr:nth-child(even) { background: var(--stripe); }
table.t tbody tr:hover { background: rgba(37, 99, 235, 0.06); }
table.t tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.acts { display: flex; gap: 5px; }

/* ── BADGES ── */
.b {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.bg-g  { background: rgba(16, 185, 129, 0.15); color: #047857; }
.bg-r  { background: rgba(239, 68, 68, 0.15);  color: #b91c1c; }
.bg-y  { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.bg-b  { background: rgba(37, 99, 235, 0.15);  color: var(--lufan-blue); }
.bg-p  { background: rgba(34, 211, 238, 0.15); color: #0e7490; }

/* ── SEARCH ── */
.sr { display: flex; gap: 10px; margin-bottom: 16px; }
.sr input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--in-bd);
    border-radius: 8px;
    font-size: 13.5px;
    background: var(--in-bg);
    color: var(--in-tx);
    transition: var(--tr);
}
.sr input:focus {
    outline: none;
    border-color: var(--lufan-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ── MOBILE OVERLAY ── */
.ov {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 999;
    backdrop-filter: blur(3px);
}
.ov.on { display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sb { transform: translateX(-100%); }
    .sb.open { transform: translateX(0); }
    .mc { margin-left: 0; }
    .mbtn { display: block; }
    .ct { padding: 14px; }
    .fg2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .tb { padding: 11px 14px; }
    .un, .ur { display: none; }
}
@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--grad-primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--lufan-dark); }

/* ── SELECTION & LINKS ── */
::selection {
    background: rgba(37, 99, 235, 0.25);
    color: var(--text);
}
a { color: var(--lufan-blue); transition: var(--tr); }
a:hover { color: var(--lufan-bright); }

/* ── LOADING (opcional) ── */
.spin {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--lufan-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }