/* AC FINANCE Xai-Xai — painel de gestão de microcrédito */
:root {
    --gold: #b8901a; --gold-2: #d4af37; --gold-soft: #f6efd8;
    --ink: #17171a; --ink-2: #2a2a2f; --muted: #6b6b73; --line: #e5e3dc; --bg: #f5f4f0; --card: #fff;
    --green: #1f8a4c; --red: #c53a3a; --amber: #c27c0e; --blue: #2b63b8;
    --radius: 10px; --shadow: 0 1px 2px rgba(20,20,20,.06), 0 4px 14px rgba(20,20,20,.05);
    --sidebar: 236px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.ic { vertical-align: -3px; flex: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .mono { font-variant-numeric: tabular-nums; } .grow { flex: 1; }

/* ---- layout ---- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--ink); color: #d9d6cb; display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid #2c2c31; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #111; display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: .95rem; letter-spacing: .02em; } .brand small { color: var(--gold-2); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 10px 10px 14px; flex: 1; }
.nav h6 { margin: 14px 10px 6px; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #77767d; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #cfccc0; font-size: .92rem; }
.nav a:hover { background: #232327; text-decoration: none; color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(212,175,55,.22), rgba(212,175,55,.05)); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold-2); }
.nav .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; font-weight: 600; }
.userbox { padding: 12px 16px; border-top: 1px solid #2c2c31; font-size: .85rem; }
.userbox b { display: block; color: #fff; } .userbox span { color: #8d8b84; font-size: .78rem; }
.userbox form { margin-top: 8px; }
.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 1.25rem; } .topbar .menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1500px; }
.bell { position: relative; } .bell > button { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--ink-2); position: relative; }
.bell > button:hover { background: var(--bg); }
.bell .dot { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; border-radius: 99px; font-size: .65rem; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.bell-panel { position: absolute; right: 0; top: 42px; width: 360px; max-width: 92vw; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.15); display: none; overflow: hidden; }
.bell-panel.open { display: block; }
.bell-panel header { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.bell-item { padding: 10px 14px; border-bottom: 1px solid #f0eee8; font-size: .84rem; } .bell-item.unread { background: #fffaf0; }
.bell-item b { display: block; } .bell-item time { color: var(--muted); font-size: .75rem; }
.bell-panel footer { padding: 9px 14px; text-align: center; font-size: .85rem; }

/* ---- cards, grids ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > .hd h2, .card > .hd h3 { font-size: 1rem; } .card > .bd { padding: 18px; } .card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 18px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.kpi .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); flex: none; }
.kpi.red .ico { background: #fbe9e9; color: var(--red); } .kpi.green .ico { background: #e4f4ea; color: var(--green); } .kpi.blue .ico { background: #e6eefa; color: var(--blue); }
.kpi small { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; display: block; }
.kpi strong { font-size: 1.4rem; display: block; margin: 2px 0; font-variant-numeric: tabular-nums; } .kpi span { color: var(--muted); font-size: .8rem; }
.chart-box { position: relative; height: 300px; } .chart-box.sm { height: 240px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; background: #faf9f6; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid #f0eee8; vertical-align: middle; }
table.t tr:hover td { background: #fcfbf8; } table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 700; background: #faf9f6; border-top: 2px solid var(--line); }
table.t tr.row-void td { color: #999; text-decoration: line-through; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: #e4f4ea; color: #166a3a; } .badge-red { background: #fbe9e9; color: #a22b2b; } .badge-amber { background: #fcf0d6; color: #8d5a06; }
.badge-blue { background: #e6eefa; color: #214f97; } .badge-grey { background: #eceae4; color: #55555c; }
.pager { display: flex; gap: 6px; padding: 14px 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.pager a, .pager span.cur { padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); } .pager span.cur { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- forms ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f7f6f2; text-decoration: none; } .btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: #1a1405; } .btn-primary:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); } .btn-dark:hover { background: #000; }
.btn-danger { background: #fff; color: var(--red); border-color: #e8c4c4; } .btn-danger:hover { background: #fbe9e9; }
.btn-sm { padding: 5px 11px; font-size: .82rem; } .btn-ghost { border-color: transparent; background: transparent; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.f { grid-column: span 6; } .f.c3 { grid-column: span 3; } .f.c4 { grid-column: span 4; } .f.c8 { grid-column: span 8; } .f.c12 { grid-column: span 12; } .f.c2 { grid-column: span 2; }
label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; } label .req { color: var(--red); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=tel], input[type=search], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #d6d3ca; border-radius: 8px; background: #fff; font: inherit; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(212,175,55,.45); border-color: var(--gold); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); background: #fff8f8; }
.err { color: var(--red); font-size: .78rem; min-height: 1em; margin-top: 3px; } .hint { color: var(--muted); font-size: .76rem; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; } .check input { width: auto; }
.sec-title { grid-column: 1 / -1; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; } .filters > div { min-width: 140px; } .filters .grow { flex: 1; min-width: 220px; }
.row-add { display: grid; grid-template-columns: 1.2fr 2.5fr 1.2fr auto; gap: 10px; margin-bottom: 8px; align-items: start; }
.row-file { display: grid; grid-template-columns: 2fr 1.4fr auto; gap: 10px; margin-bottom: 8px; align-items: center; }

/* ---- misc ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; } .alert-ok { background: #e4f4ea; color: #166a3a; } .alert-err { background: #fbe9e9; color: #a22b2b; }
.alert-info { background: #e6eefa; color: #214f97; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: .9rem; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; font-size: .9rem; border: 1px solid transparent; margin-bottom: -1px; }
.tabs a.active { background: #fff; color: var(--ink); border-color: var(--line); border-bottom-color: #fff; } .tabs a:hover { text-decoration: none; color: var(--ink); }
.progress { height: 8px; background: #ece9df; border-radius: 99px; overflow: hidden; } .progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-row { display: flex; flex-wrap: wrap; gap: 26px; padding: 16px 18px; background: var(--gold-soft); border-radius: var(--radius); margin-bottom: 18px; }
.summary-row div small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; } .summary-row div b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---- modal / toasts ---- */
.modal { position: fixed; inset: 0; background: rgba(15,15,18,.55); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal.open { display: flex; } .modal .box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal .box.wide { max-width: 760px; } .modal .box > header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); } .modal .box > header h3 { flex: 1; font-size: 1.05rem; }
.modal .box > .bd { padding: 20px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: .9rem; max-width: 380px; border-left: 4px solid var(--green); } .toast.err { border-left-color: var(--red); }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #2a2410, #111 55%); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 34px 30px; box-shadow: 0 25px 70px rgba(0,0,0,.5); }
.login-card .logo { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; margin-bottom: 14px; }
.login-card h1 { font-size: 1.35rem; } .login-card p { color: var(--muted); margin: 4px 0 22px; }
.login-card .f { grid-column: auto; margin-bottom: 14px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; } .sidebar.open { transform: none; }
    .main { margin-left: 0; } .topbar .menu-btn { display: inline-flex; } .content { padding: 16px 14px 50px; } .topbar { padding: 12px 14px; }
    .g2, .g4 { grid-template-columns: 1fr; } .f, .f.c3, .f.c4, .f.c8, .f.c2 { grid-column: span 12; } .row-add, .row-file { grid-template-columns: 1fr; } .dl { grid-template-columns: 110px 1fr; }
}
@media print {
    .sidebar, .topbar, .no-print, .toolbar, .filters, .pager, .tabs, #toasts, .btn { display: none !important; }
    .main { margin: 0; } .content { padding: 0; max-width: none; } body { background: #fff; } .card { box-shadow: none; border: 0; }
    table.t { font-size: 10px; } table.t th, table.t td { padding: 4px 6px; } .print-head { display: block !important; }
}
.print-head { display: none; margin-bottom: 14px; } .print-head h2 { font-size: 1.2rem; }

/* autocomplete de cliente */
[data-client-lookup] { position: relative; } .lookup-list { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(0,0,0,.12); z-index: 20; max-height: 260px; overflow-y: auto; }
.lookup-list:empty { display: none; } .lookup-item { display: block; padding: 9px 12px; color: var(--ink); border-bottom: 1px solid #f2f0ea; } .lookup-item:hover { background: var(--gold-soft); text-decoration: none; }
.lookup-chosen { display: none; margin-top: 8px; padding: 10px 12px; background: var(--gold-soft); border-radius: 8px; }

/* Logotipo */
.brand { flex-direction: column; align-items: flex-start; gap: 8px; }
.brand .logo-img { width: 100%; max-width: 190px; height: auto; border-radius: 4px; display: block; }
.login-card .logo-img { width: 100%; max-width: 250px; height: auto; display: block; margin: 0 auto 18px; }
.login-card h1 { text-align: center; } .login-card > p { text-align: center; }
