/* Portal do contador — visual do app Suwap (src/SuwapPdv.Desktop/Themes/Tokens.xaml) levado para a web. */
:root {
  --brand: #2563eb; --brand-strong: #1d4ed8; --brand-500: #3b82f6; --brand-soft: #eff6ff; --brand-100: #dbeafe; --brand-ring: rgba(37, 99, 235, .18);
  --logo: #2d4856;
  --bg: #f8fafc; --surface: #fff; --surface-2: #f8fafc; --hover: #f1f5f9;
  --text: #1e293b; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e2e8f0; --line-strong: #cbd5e1;
  --danger: #dc2626; --danger-soft: #fef2f2; --danger-line: #fecaca; --danger-text: #b91c1c;
  --ok: #16a34a; --ok-soft: #f0fdf4; --ok-line: #bbf7d0; --ok-text: #15803d;
  --warn: #b45309; --warn-soft: #fffbeb; --warn-line: #fde68a; --warn-text: #92400e;
  --r: 8px; --r-lg: 12px; --r-xl: 14px;
  --sh-1: 0 1px 3px rgba(15, 23, 42, .05); --sh-2: 0 5px 20px rgba(15, 23, 42, .13); --sh-3: 0 10px 40px rgba(15, 23, 42, .22);
  --sh-btn: 0 3px 12px rgba(37, 99, 235, .35);
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --side: 252px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: .01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.neg { color: var(--danger-text); }
.pos { color: var(--ok-text); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.right { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 1px; }
svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.badge svg { width: 12px; height: 12px; vertical-align: -1px; }

/* ------------------------------------------------------------------ casca */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); box-shadow: 4px 0 12px rgba(15, 23, 42, .03); }
.side-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 18px 18px; }
.side-brand img { height: 40px; width: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-strong); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.company { margin: 0 14px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.company b { display: block; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company span { font-size: 11.5px; color: var(--muted); }
.company button { margin-top: 6px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav h4 { margin: 14px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a[aria-current="page"] svg { color: var(--brand); }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn-soft); color: var(--warn-text); font-size: 11px; font-weight: 700; text-align: center; }
.me { display: flex; align-items: center; gap: 10px; margin: 0 12px 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--logo); color: #fff; font-weight: 650; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 28px; background: rgba(248, 250, 252, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .title { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.top .title h1 { font-size: 18px; white-space: nowrap; }
.content { padding: 24px 28px 40px; max-width: 1640px; width: 100%; }
.foot { margin-top: auto; padding: 16px 28px; color: var(--faint); font-size: 11.5px; border-top: 1px solid var(--line); }
.menu-btn { display: none; }

/* ------------------------------------------------------------------ blocos */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card > .hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > .hd h2 { font-size: 15px; }
.card > .bd { padding: 18px; }
.card > .ft { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tone { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.tone svg { width: 20px; height: 20px; }
.tone.brand, .tone.blue { background: #eff6ff; color: #2563eb; } .tone.teal { background: #f0fdfa; color: #0d9488; }
.tone.violet { background: #f5f3ff; color: #7c3aed; } .tone.amber { background: #fffbeb; color: #d97706; }
.tone.green { background: #f0fdf4; color: #16a34a; } .tone.rose { background: #fff1f2; color: #e11d48; }
.tone.indigo { background: #eef2ff; color: #4f46e5; } .tone.slate { background: #f1f5f9; color: #475569; } .tone.cyan { background: #ecfeff; color: #0891b2; }

.kpi { display: flex; gap: 12px; padding: 16px 18px; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .val { font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: inherit; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-line); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line); }
.badge.muted { background: var(--hover); color: var(--muted); border-color: var(--line); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-100); }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid; font-size: 13px; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.alert.info { background: var(--brand-soft); border-color: var(--brand-100); color: var(--brand-strong); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------ botões e campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--sh-btn); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 36px; padding: 0; }
.btn.block { width: 100%; }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .err { font-size: 11.5px; color: var(--danger-text); font-weight: 500; }
.input, .select, textarea.input { height: 36px; width: 100%; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.input.sm, .select.sm { height: 32px; font-size: 13px; }
.input.search { padding-left: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='7.5'/%3E%3Cpath d='M21 21l-5.25-5.25'/%3E%3C/svg%3E") no-repeat 11px center / 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.seg { display: inline-flex; padding: 3px; background: var(--hover); border-radius: 10px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.form { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.form .s2 { grid-column: span 2; } .form .s3 { grid-column: span 3; } .form .s4 { grid-column: span 4; } .form .s5 { grid-column: span 5; }
.form .s6 { grid-column: span 6; } .form .s8 { grid-column: span 8; } .form .s12 { grid-column: span 12; }

/* período e filtros */
.period { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 2px; }
.period .btn { height: 30px; border: 0; }
.period .cur { min-width: 150px; text-align: center; font-weight: 650; padding: 0 6px; cursor: pointer; border: 0; background: none; height: 30px; border-radius: 6px; }
.period .cur:hover { background: var(--hover); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filters .field { width: auto; }

/* ------------------------------------------------------------------ tabela */
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 160px; }
.table-wrap.free { max-height: none; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr:hover td { background: #fbfdff; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--brand-soft); }
.t tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-strong); }
.t .ellip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t tr.dim td { color: var(--faint); }
.t tr.group td { background: var(--surface-2); font-weight: 650; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty svg { width: 40px; height: 40px; color: var(--faint); }
.empty b { color: var(--text-2); font-size: 14px; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 50%, #eef2f7 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ painel lateral, modal, avisos */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .38); display: flex; justify-content: flex-end; animation: fade .15s; }
.scrim.center { justify-content: center; align-items: center; padding: 20px; }
@keyframes fade { from { opacity: 0; } }
.drawer { width: min(980px, 100%); height: 100%; background: var(--bg); box-shadow: var(--sh-3); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer > .hd, .modal > .hd { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer > .bd { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); overflow: hidden; animation: pop .16s ease-out; }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: .5; } }
.modal > .bd { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal > .ft { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: var(--r-lg); background: #0f172a; color: #fff; box-shadow: var(--sh-2); font-size: 13px; animation: pop .16s; display: flex; gap: 10px; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }

.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.kv > div { min-width: 0; }
.kv dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.kv dd { margin: 2px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.kv .w2 { grid-column: span 2; } .kv .w4 { grid-column: span 4; }
.section-title { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; font-size: 12px; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 10px; font-size: 13px; color: var(--text-2); }
.steps li > span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-size: 11px; font-weight: 700; }
.check-list { display: flex; flex-direction: column; }
.check-list > div { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check-list > div:last-child { border-bottom: 0; }
.check-list .ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.check-list .ico svg { width: 16px; height: 16px; }
.tree-indent { display: inline-block; }
.progress { height: 4px; background: var(--brand-100); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 30%; background: var(--brand); border-radius: inherit; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: linear-gradient(180deg, #f8fafc 0%, #fff 55%); }
.login .hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #fff; background: radial-gradient(1200px 600px at -10% -10%, #3b82f6 0%, transparent 55%), linear-gradient(160deg, #1d4ed8 0%, #1e3a8a 55%, #172554 100%); }
.login .hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06); }
.login .hero img { height: 44px; width: auto; align-self: flex-start; }
.login .hero h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 700; max-width: 460px; letter-spacing: -.02em; }
.login .hero p { color: #dbeafe; max-width: 460px; font-size: 15px; }
.login .hero ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; max-width: 460px; }
.login .hero li { display: flex; gap: 10px; color: #e0e7ff; font-size: 14px; }
.login .hero li svg { flex: none; width: 18px; height: 18px; color: #93c5fd; margin-top: 2px; }
.login .pane { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login form h1 { font-size: 24px; }
.login .recent { display: flex; flex-wrap: wrap; gap: 6px; }
.login .recent button { cursor: pointer; }

/* ------------------------------------------------------------------ DANFE (impressão) */
.danfe { background: #fff; color: #000; font: 10.5px/1.25 Arial, Helvetica, sans-serif; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); }
.danfe .box { border: 1px solid #000; padding: 3px 5px; }
.danfe .row2 { display: grid; gap: 0; }
.danfe .lab { font-size: 7.5px; text-transform: uppercase; color: #333; }
.danfe .v { font-size: 10.5px; font-weight: 600; min-height: 13px; }
.danfe table { width: 100%; border-collapse: collapse; font-size: 9px; }
.danfe th, .danfe td { border: 1px solid #000; padding: 2px 3px; }
.danfe th { font-size: 7.5px; text-transform: uppercase; }
.danfe .title { text-align: center; font-weight: 700; font-size: 14px; }
.danfe .sec { margin: 6px 0 2px; font-size: 8.5px; font-weight: 700; text-transform: uppercase; }

#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root .danfe { border: 0; padding: 0; }
  @page { size: A4; margin: 8mm; }
}

/* ------------------------------------------------------------------ telas pequenas */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv .w4 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 70; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sh-3); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .form > * { grid-column: span 1 !important; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .hero { display: none; }
  .table-wrap { max-height: none; }
}
