:root {
  --orange: #F26B1D;
  --orange-600: #E4570F;
  --orange-700: #C2410C;
  --orange-50: #FFF6EF;
  --orange-100: #FFE9DA;
  --orange-200: #FFD3B4;
  --ink: #1F1A17;
  --ink-2: #4A413B;
  --muted: #8A7F77;
  --line: #EFE7E1;
  --bg: #FFFBF8;
  --surface: #FFFFFF;
  --green: #12805C;
  --green-50: #E8F6F0;
  --red: #C53030;
  --red-50: #FDECEC;
  --amber-50: #FFF7E0;
  --amber: #9A6700;
  --blue-50: #EAF2FF;
  --blue: #2457C5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 26, 23, .04), 0 8px 24px rgba(31, 26, 23, .06);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--orange-700); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 16px rgba(242, 107, 29, .28); }
.btn-primary:hover:not(:disabled) { background: var(--orange-600); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--orange-200); background: var(--orange-50); }
.btn-soft { background: var(--orange-50); color: var(--orange-700); }
.btn-soft:hover:not(:disabled) { background: var(--orange-100); }
.btn-danger { background: var(--red-50); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #fbd5d5; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; color: inherit; display: inline-flex; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { resize: vertical; min-height: 70px; }
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(242, 107, 29, .14); }
.input-pin { letter-spacing: .6em; font-size: 22px; font-weight: 700; text-align: center; padding-left: calc(14px + .6em); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-error { background: var(--red-50); color: var(--red); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.form-ok { background: var(--green-50); color: var(--green); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--orange-50); color: var(--orange-700); white-space: nowrap; }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.amber { background: var(--amber-50); color: var(--amber); }
.badge.blue { background: var(--blue-50); color: var(--blue); }
.badge.gray { background: #F1EEEC; color: var(--ink-2); }

.seg { display: inline-flex; background: #F6F1ED; padding: 4px; border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--orange-700); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--orange-50); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(31, 26, 23, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 560px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); animation: pop .18s; }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #FDFAF8; border-radius: 0 0 20px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); animation: pop .2s; max-width: 360px; }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- autenticação ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { background: radial-gradient(120% 90% at 0% 0%, #FF9A55 0%, var(--orange) 45%, var(--orange-700) 100%); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-brand::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .08); }
.auth-brand h1 { font-size: 44px; line-height: 1.08; max-width: 480px; margin-top: auto; }
.auth-brand p { font-size: 17px; opacity: .9; max-width: 440px; }
.auth-brand .feats { display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
.auth-brand .feats div { font-size: 13px; opacity: .9; }
.auth-brand .feats b { display: block; font-size: 22px; opacity: 1; }
.auth-brand.photo { background: #fff; padding: 0; }
.auth-brand.photo::after { right: auto; bottom: auto; inset: 0; width: auto; height: auto; border: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .0) 60%, rgba(0, 0, 0, .18) 100%); }
.auth-brand.photo .hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.auth-brand.photo .brand { position: absolute; top: 24px; left: 24px; z-index: 1; }
.auth-brand.photo .brand img { width: auto; height: 30px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-box { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: inherit; text-decoration: none; }
.brand img { width: auto; height: 34px; }
.brand.light { background: rgba(255, 255, 255, .94); padding: 8px 14px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.topbar .brand img { height: 42px; }

/* ---------- app do cliente ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.nav { display: flex; gap: 4px; overflow-x: auto; }
.nav a { padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: #F8F3EF; }
.nav a.active { color: var(--orange-700); background: var(--orange-50); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--orange-100); color: var(--orange-700); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }

.hero { background: radial-gradient(140% 120% at 100% 0%, #FF9A55 0%, var(--orange) 40%, var(--orange-700) 100%); color: #fff; border-radius: 22px; padding: 28px 30px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; position: relative; overflow: hidden; box-shadow: 0 18px 40px rgba(242, 107, 29, .28); }
.hero::after { content: ''; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; border: 44px solid rgba(255, 255, 255, .08); }
.hero .label { opacity: .85; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.hero .big { font-size: 42px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 4px; }
.hero .chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .18); padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.hero .side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: center; position: relative; z-index: 1; }
.hero .side div { background: rgba(255, 255, 255, .12); border-radius: 14px; padding: 12px 14px; }
.hero .side span { font-size: 12px; opacity: .85; display: block; }
.hero .side b { font-size: 17px; }
.hero .icon-btn { color: #fff; }
.hero .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.blur .money { filter: blur(8px); user-select: none; }

.layout-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.layout-2 > * { min-width: 0; } /* senão o canvas do gráfico alarga a coluna no celular */
.chart-box { position: relative; height: 300px; }

.group-head { display: flex; align-items: center; gap: 14px; }
.group-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.fund { border: 1px solid var(--line); border-radius: 14px; padding: 16px; transition: border-color .15s, box-shadow .15s; }
.fund:hover { border-color: var(--orange-200); box-shadow: 0 6px 18px rgba(242, 107, 29, .08); }
.fund + .fund { margin-top: 12px; }
.fund .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fund .vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fund .vals span { font-size: 12px; color: var(--muted); display: block; }
.fund .vals b { font-size: 15px; }
.progress { height: 6px; border-radius: 6px; background: #F3ECE6; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--orange); border-radius: 6px; }

.tx-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.tx-icon.aporte { background: var(--blue-50); color: var(--blue); }
.tx-icon.rendimento { background: var(--green-50); color: var(--green); }
.tx-icon.resgate { background: var(--red-50); color: var(--red); }
.tx-icon.ajuste { background: #F1EEEC; color: var(--ink-2); }

.redeem-option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.redeem-option:hover { border-color: var(--orange-200); }
.redeem-option.active { border-color: var(--orange); background: var(--orange-50); }
.redeem-option input { accent-color: var(--orange); width: 18px; height: 18px; }
.redeem-option.disabled { opacity: .55; cursor: not-allowed; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 6px 10px 20px; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.sidebar a:hover { background: #F8F3EF; }
.sidebar a.active { background: var(--orange-50); color: var(--orange-700); }
.sidebar a .count { margin-left: auto; background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 8px; }
.sidebar svg { width: 18px; height: 18px; flex-shrink: 0; }
.admin-main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.mobile-bar { display: none; }
.preview { background: var(--orange-50); border: 1px dashed var(--orange-200); border-radius: 12px; padding: 12px 14px; font-size: 14px; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .layout-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .admin-main { padding: 20px 16px 60px; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; }
  .auth-brand h1 { font-size: 30px; margin-top: 28px; }
  .auth-brand .feats { display: none; }
  .auth-brand.photo { min-height: 0; height: 190px; }
  .topbar-in { padding: 10px 16px; gap: 12px 8px; flex-wrap: wrap; }
  .topbar-in > .avatar { display: none; }
  .topbar-in .nav { order: 3; width: 100%; }
  .container { padding: 20px 16px 50px; }
  .hero { padding: 22px; }
  .hero .big { font-size: 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 18px; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .fund .vals { grid-template-columns: 1fr 1fr; }
  .toasts { left: 16px; right: 16px; }
}

/* ---------- agrupamento de empresas ---------- */
.check-list { border: 1.5px solid var(--line); border-radius: 12px; max-height: 320px; overflow-y: auto; }
.check-list .check { padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.check-list .check:last-child { border-bottom: 0; }
.check-list .check:hover { background: var(--orange-50); }
.company { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.company + .company { margin-top: 16px; }
.company-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.company-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--orange-50); color: var(--orange-700); display: grid; place-items: center; flex-shrink: 0; }
.company .fund { background: #fff; }
.company-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.company-list div { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---------- notificações ---------- */
.bell-wrap { position: relative; display: inline-flex; }
.bell-dot { position: absolute; top: -1px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; line-height: 1; pointer-events: none; }
.bell-wrap.ring > .icon-btn svg { animation: ring 1s ease 2; transform-origin: 50% 8%; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(0); } }
.notif-panel { position: absolute; right: -8px; top: calc(100% + 12px); width: 380px; max-height: min(520px, 72vh); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(31, 26, 23, .16); z-index: 40; overflow: hidden; }
.notif-panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list .notif-item:last-child, .notif-admin .notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--orange-50); }
.notif-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--orange-100); color: var(--orange-700); }
.notif-icon svg { width: 17px; height: 17px; }
.notif-icon.importante { background: var(--red-50); color: var(--red); }
.notif-icon.novidade { background: var(--green-50); color: var(--green); }
.notif-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.notif-body { font-size: 13.5px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; margin: 4px 0 6px; }
.notif-preview { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
@media (max-width: 760px) {
  .notif-panel { position: fixed; left: 16px; right: 16px; top: 60px; width: auto; }
}
