/* ============================================================
   KJ Advogados — Design System (mesmo do Opus, recolorido Preto & Dourado)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Playfair+Display:wght@600;700;800;900&display=swap');

:root {
    --sidebar-w: 232px;
    --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

    /* Neutros — mesma base slate do Opus */
    --bg:          #f1f5f9;
    --bg-card:     #ffffff;
    --bg-soft:     #e8eef5;
    --border:      #e2e8f0;
    --border-soft: rgba(0,0,0,.04);

    --text:   #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;

    /* Primária → DOURADO (substitui o azul do Opus) */
    --gold:        #c9a227;
    --gold-dark:   #a8841a;
    --gold-light:  #e6c84d;
    --gold-soft:   rgba(201,162,39,.12);
    --gold-border: rgba(201,162,39,.35);
    --primary:      var(--gold);
    --primary-soft: var(--gold-soft);

    --black: #0a0a0a;

    --success: #22c55e; --success-soft: rgba(34,197,94,.10);
    --warning: #f59e0b; --warning-soft: rgba(245,158,11,.10);
    --danger:  #ef4444; --danger-soft:  rgba(239,68,68,.10);

    /* Sombras / raios / tipografia — idênticos ao Opus */
    --sh-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 8px rgba(0,0,0,.04);
    --sh:    0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --sh-lg: 0 4px 12px rgba(0,0,0,.07), 0 16px 40px rgba(0,0,0,.09);
    --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 16px;
    --fs-xs: .6875rem; --fs-sm: .8125rem; --fs-base: .9375rem; --fs-md: 1rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    font-size: var(--fs-base);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ── Layout ── */
.main-content, .main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .22s ease; }
.page-content { padding: 28px 32px 56px; max-width: 1340px; }
@media (max-width: 900px) {
    .main-content, .main { margin-left: 0; }
    .page-content { padding: 18px 16px 48px; }
}

/* ── Hero (preto com brilho dourado — mesma estrutura do hero navy do Opus) ── */
.hero {
    background: linear-gradient(135deg, #0a0a0a 0%, #1c1608 58%, #0a0a0a 100%);
    border-radius: 20px;
    padding: 28px 36px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}
.hero::before {
    content: ''; position: absolute; top: -80px; right: -50px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(201,162,39,.22) 0%, transparent 70%);
}
.hero::after {
    content: ''; position: absolute; bottom: -90px; left: 30%;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(201,162,39,.10) 0%, transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 9px; }
.hero h1 {
    font-family: var(--font-serif); font-size: 2.2rem; font-weight: 800; letter-spacing: -.01em;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #f3e3b3 0%, #d4af37 45%, #b8860b 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #e6c84d;
}
.hero p { font-size: .9rem; color: rgba(255,255,255,.62); max-width: 620px; line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ── Botões (proporções do Opus) ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 16px; border-radius: var(--r);
    font-size: var(--fs-sm); font-weight: 600; cursor: pointer; border: 1px solid transparent;
    transition: background .14s, border-color .14s, transform .1s, filter .14s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); }
.btn-gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: #1a1407; border: none; font-weight: 700;
    box-shadow: 0 2px 10px rgba(201,162,39,.32);
}
.btn-gold:hover { filter: brightness(1.06); }
.btn-dark { background: var(--black); color: var(--gold-light); }
.btn-dark:hover { background: #1a1408; }
.btn-outline { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-2); }
.btn-outline:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,68,68,.15); }
.btn-danger:hover { background: rgba(239,68,68,.14); }
.btn-sm { height: 32px; padding: 0 13px; font-size: var(--fs-xs); border-radius: var(--r-sm); }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-sm); }
.card-pad { padding: 20px 22px; }

/* ── Stat cards (topo dourado — mesma ideia dos stat-cards do Opus) ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 520px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-card {
    position: relative; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 20px 20px 18px; box-shadow: var(--sh-sm);
    overflow: hidden; transition: transform .12s, box-shadow .12s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gold); }
.stat-card.accent-green::before { background: var(--success); }
.stat-card.accent-red::before   { background: var(--danger); }
.stat-card.accent-amber::before { background: var(--warning); }
.stat-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); margin: 8px 0 5px; }
.stat-value.green { color: var(--success); } .stat-value.red { color: var(--danger); } .stat-value.gold { color: var(--gold-dark); }
.stat-meta { font-size: var(--fs-sm); color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.stat-dot.green { background: var(--success); } .stat-dot.red { background: var(--danger); } .stat-dot.amber { background: var(--warning); }

/* ── Seções ── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title { font-size: var(--fs-md); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.section-sub { font-size: var(--fs-sm); color: var(--text-3); }

/* ── Tabela ── */
.tbl-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-sm); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; padding: 12px 16px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--bg-soft); border-bottom: 1px solid var(--border); }
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); font-size: var(--fs-sm); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--bg-soft); }
.val-pos { color: var(--success); font-weight: 700; }
.val-neg { color: var(--danger); font-weight: 700; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge-pago { background: var(--success-soft); color: var(--success); }
.badge-pend { background: var(--gold-soft); color: var(--gold-dark); }
.badge-canc { background: rgba(148,148,148,.15); color: var(--text-3); }
.badge-gold { background: var(--gold-soft); color: var(--gold-dark); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.form-control {
    width: 100%; height: 40px; padding: 0 13px; font-size: var(--fs-base);
    border: 1.5px solid var(--border); border-radius: var(--r);
    background: var(--bg-card); color: var(--text); transition: border-color .14s, box-shadow .14s;
}
textarea.form-control { height: auto; padding: 10px 13px; resize: vertical; }
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,10,10,.5); backdrop-filter: blur(4px); z-index: 1200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--bg-card); border-radius: 20px; width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.1); animation: modalIn .2s cubic-bezier(.34,1.56,.64,1); }
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; background: linear-gradient(135deg, #0a0a0a, #1c1608); border-radius: 20px 20px 0 0; }
.modal-title { font-size: 1.05rem; font-weight: 800; color: #fff; letter-spacing: -.03em; }
.modal-title b { color: var(--gold-light); font-weight: 800; }
.modal-close { width: 30px; height: 30px; border: none; background: rgba(201,162,39,.18); color: var(--gold-light); border-radius: 50%; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: rgba(201,162,39,.3); }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 22px; border-top: 1px solid var(--border); }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--black); color: #fff; padding: 12px 20px; border-radius: var(--r); font-size: var(--fs-sm); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: .25s; z-index: 2000; border: 1px solid var(--gold-border); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); }

/* ── Empty ── */
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 38px; height: 38px; opacity: .4; margin-bottom: 10px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
