/* =====================================================================
   Arremate — interface (painel do cliente e super admin)
   ===================================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #1f4fd8;
  --primary-2: #1a43b8;
  --primary-soft: #e8eefc;
  --accent: #f59e0b;
  --ok: #059669;
  --ok-soft: #e6f6f0;
  --warn: #d97706;
  --warn-soft: #fdf3e2;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info-soft: #eaf2ff;
  --side: #0c1424;
  --side-2: #131e33;
  --side-text: #c4cddd;
  --side-muted: #6f7d96;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .04);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b111d; --surface: #111a2b; --surface-2: #0f1727; --border: #1f2b42; --text: #e6ebf4; --text-2: #a6b1c5; --muted: #6b7891;
    --primary: #5b8cff; --primary-2: #7aa2ff; --primary-soft: #182a50; --ok-soft: #0f2b24; --warn-soft: #2e230f; --bad-soft: #321718; --info-soft: #14233f;
    --side: #070c16; --side-2: #0e1626; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b111d; --surface: #111a2b; --surface-2: #0f1727; --border: #1f2b42; --text: #e6ebf4; --text-2: #a6b1c5; --muted: #6b7891;
  --primary: #5b8cff; --primary-2: #7aa2ff; --primary-soft: #182a50; --ok-soft: #0f2b24; --warn-soft: #2e230f; --bad-soft: #321718; --info-soft: #14233f;
  --side: #070c16; --side-2: #0e1626; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
small, .small { font-size: 12px; }
.muted { color: var(--text-2); }
.faint { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.side .brand small { display: block; font-weight: 500; color: var(--side-muted); font-size: 11px; letter-spacing: 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2f62ff, #1739a6); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.logo svg { width: 20px; height: 20px; }
.nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--side-text); padding: 9px 12px; border-radius: 8px; font-weight: 500; margin: 1px 0; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.on { background: #1b2a49; color: #fff; box-shadow: inset 3px 0 0 #4d7cff; }
.nav a svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav .pill { margin-left: auto; background: #e1474b; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.side .foot { padding: 14px 18px; border-top: 1px solid #1a2438; font-size: 12px; color: var(--side-muted); }
.side .foot b { color: var(--side-text); font-weight: 600; display: block; font-size: 13px; }
.main { flex: 1; margin-left: 248px; min-width: 0; display: flex; flex-direction: column; }
.top { height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.top .title { font-weight: 650; font-size: 16px; }
.top .sp { flex: 1; }
.top .icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-2); cursor: pointer; position: relative; }
.top .icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.top .icon-btn svg { width: 18px; height: 18px; }
.top .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; background: #e1474b; border-radius: 50%; border: 2px solid var(--surface); }
.status-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 5px 11px; }
.status-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-chip.off i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.menu-btn { display: none; }
.content { padding: 26px 28px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.backdrop { display: none; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .hd h2, .card .hd h3 { margin: 0; }
.card .hd .sp { flex: 1; }
.card .bd { padding: 20px; }
.card .bd.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.kpi { padding: 18px 20px; }
.kpi .lbl { color: var(--text-2); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; background: var(--primary); color: #fff; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--primary-2); text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.sec { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.sec:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; color: var(--text); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=tel], input[type=url], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: -3px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 13.5px; cursor: pointer; margin-bottom: 8px; }
.inline-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t .nowrap { white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; line-height: 18px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--primary); border-color: transparent; }
.badge.demo { background: #fff4d6; color: #8a5a00; border-color: #f3d58a; }

.score { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; font-variant-numeric: tabular-nums; }
.score.alta { background: var(--ok-soft); color: var(--ok); }
.score.media { background: var(--warn-soft); color: var(--warn); }
.score.baixa { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.score.sm { width: 34px; height: 34px; font-size: 13px; border-radius: 9px; }

.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: transparent; color: #9a5b00; }
.alert.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.alert.info { background: var(--info-soft); border-color: transparent; color: var(--primary); }
:root[data-theme="dark"] .alert.warn { color: #f3c26b; }
.alert .grow { flex: 1; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty svg { width: 42px; height: 42px; color: var(--muted); margin-bottom: 10px; }
.empty h3 { color: var(--text); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary), #6c93ff); border-radius: 99px; transition: width .4s; }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .progress { flex: 1; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--text-2); font-weight: 600; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on, .tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 140px; }
.filters .f.grow { flex: 1; min-width: 220px; }
.filters label { font-size: 11.5px; color: var(--text-2); }

.list-item { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t1 { font-weight: 600; color: var(--text); }
.list-item .t2 { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; font-weight: 500; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }

.modal-bg { position: fixed; inset: 0; background: rgba(8, 13, 24, .55); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal-bg.on { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { max-width: 860px; }
.modal .hd { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal .hd h2 { margin: 0; flex: 1; }
.modal .bd { padding: 22px; }
.modal .ft { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13.5px; max-width: 380px; animation: tin .2s ease-out; }
.toast.ok { background: #065f46; } .toast.bad { background: #991b1b; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.chart-box { position: relative; height: 260px; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.kbd { font-family: ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: ui-monospace, monospace; font-size: 12px; }

/* ---------- autenticação / páginas públicas ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: radial-gradient(1200px 600px at 10% 10%, #1e3a8a 0%, #0b1530 55%, #070d1c 100%); color: #dbe5ff; padding: 48px 56px; display: flex; flex-direction: column; }
.auth .art .brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 700; font-size: 20px; }
.auth .art h1 { font-size: 36px; color: #fff; margin: auto 0 14px; max-width: 520px; letter-spacing: -.02em; line-height: 1.15; }
.auth .art p { color: #b6c4e6; font-size: 15.5px; max-width: 500px; }
.auth .art ul { list-style: none; padding: 0; margin: 22px 0 auto; max-width: 480px; }
.auth .art li { padding: 8px 0 8px 30px; position: relative; color: #d3ddf5; }
.auth .art li:before { content: ""; position: absolute; left: 0; top: 11px; width: 18px; height: 18px; border-radius: 50%; background: #2a4cb3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/11px no-repeat; }
.auth .art .fine { font-size: 12px; color: #7c8db5; }
.auth .form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth .form .box { width: 100%; max-width: 400px; }
.auth .form h2 { font-size: 24px; margin-bottom: 6px; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.plan { border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--surface); position: relative; display: flex; flex-direction: column; }
.plan.hl { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.plan .tag { position: absolute; top: -11px; left: 20px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.plan .price { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.plan .price small { font-size: 14px; font-weight: 500; color: var(--text-2); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; flex: 1; }
.plan li { padding: 5px 0 5px 24px; position: relative; font-size: 13.5px; }
.plan li:before { content: "✓"; position: absolute; left: 2px; color: var(--ok); font-weight: 700; }
.plan li.no { color: var(--muted); }
.plan li.no:before { content: "–"; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 8px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.pix { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.pix img { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }

.banner { padding: 10px 28px; font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); color: #8a5300; }
.banner.info { background: var(--info-soft); color: var(--primary); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.imp { background: #2b1a4d; color: #e9dcff; }
.banner a { font-weight: 700; }

/* ---------- impressão ---------- */
@media print {
  .side, .top, .no-print, .banner { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { transform: translateX(-100%); }
  body.nav-open .side { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: grid !important; }
  .top { padding: 0 16px; }
  .content { padding: 18px 16px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .pix { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .status-chip span { display: none; }
  .banner { padding: 10px 16px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .kpi .val { font-size: 21px; }
}
