*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:             #07101f;
    --bg-card:        #0b1628;
    --bg-card-2:      #0d1b30;
    --sidebar-bg:     #060d1a;
    --sidebar-w:      220px;
    --border:         rgba(255,255,255,0.07);
    --accent:         #2563eb;
    --accent-lt:      #3b82f6;
    --green:          #10b981;
    --red:            #ef4444;
    --yellow:         #f59e0b;
    --text:           #e2e8f0;
    --text-muted:     #64748b;
    --text-sec:       #94a3b8;
    --active-bg:      rgba(37,99,235,0.25);
    --active-border:  #2563eb;
    --radius:         12px;
    --radius-sm:      8px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; }

/* ─── LAYOUT ─────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 20px 18px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.brand-trace { color: #fff; }
.brand-sol   { color: var(--accent-lt); }

/* ─── TOPBAR (seletor de cartório) ─────────── */
.topbar {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 7px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(6,13,26,0.7);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 44px;
}
.sc-form {
    display: inline-flex;
    align-items: center;
}
.sc-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px 5px 9px;
    transition: border-color 0.15s, background 0.15s;
    color: var(--text-muted);
}
.sc-pill:focus-within {
    border-color: rgba(37,99,235,0.45);
    background: rgba(37,99,235,0.07);
    color: var(--accent-lt);
}
.sc-pill svg { flex-shrink: 0; }
.sc-select {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    max-width: 260px;
}
.sc-select option { background: var(--bg-card); }

.sidebar-nav { flex: 1; padding: 8px 0; display: flex; flex-direction: column; }

.nav-section { padding: 0 10px; }

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-sec);
    text-decoration: none;
    font-size: 14.5px;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active {
    background: var(--active-bg);
    color: #fff;
    border-left: 3px solid var(--active-border);
    padding-left: 11px;
    font-weight: 600;
}
.nav-item svg { flex-shrink: 0; width: 20px; height: 20px; }

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 14px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    border-top: 1px solid var(--border);
    cursor: pointer;
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name  { display: block; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 11px; color: var(--text-muted); }
.user-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.user-logout:hover { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ─── MAIN CONTENT ───────────────────────────── */
.main-content {
    overflow-y: auto;
    background:
        radial-gradient(ellipse 55% 35% at 85% 8%, rgba(37,99,235,0.14) 0%, transparent 55%),
        radial-gradient(ellipse 30% 25% at 15% 90%, rgba(37,99,235,0.07) 0%, transparent 50%),
        radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px),
        var(--bg);
    background-size: auto, auto, 32px 32px, auto;
    background-attachment: fixed;
}

/* ─── CARDS ──────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

/* ─── BADGES ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-green  { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-yellow { background: rgba(245,158,11,0.15);  color: var(--yellow); }
.badge-gray   { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.badge-red    { background: rgba(239,68,68,0.15);   color: var(--red); }

/* ─── LOGIN ──────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-card {
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
}
.login-brand { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 28px; }
.login-card label { display: block; font-size: 12px; color: var(--text-sec); margin-bottom: 6px; }
.login-card input {
    width: 100%; padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%; padding: 11px;
    background: var(--accent);
    border: none; border-radius: var(--radius-sm);
    color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-lt); }
.login-error { color: var(--red); font-size: 12px; margin-bottom: 12px; text-align: center; }
