/* =========================================================
   FiadoPro — Sistema de cuentas por cobrar
   Hoja de estilos principal
   ========================================================= */

:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef3f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --sidebar: #0b1524;
  --sidebar-2: #0f1e33;
  --primary: #0f9d8a;
  --primary-700: #0b7f70;
  --primary-800: #09675c;
  --primary-50: #e7f8f5;
  --primary-100: #c9f0e9;
  --amber: #d97706;
  --amber-50: #fff8ea;
  --amber-100: #fef0cf;
  --red: #dc2626;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --blue: #2563eb;
  --blue-50: #eff6ff;
  --green: #16a34a;
  --green-50: #effdf4;
  --violet: #7c3aed;
  --violet-50: #f5f3ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -8px rgba(15, 23, 42, 0.12);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -16px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(15, 23, 42, 0.35);
  --sidebar-w: 264px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { letter-spacing: -0.02em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary-700); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
::selection { background: var(--primary-100); color: var(--primary-800); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   Login
   ========================================================= */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
}

.login-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(15, 157, 138, 0.22), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(37, 99, 235, 0.14), transparent 55%),
    linear-gradient(150deg, #0b1524 0%, #0d1b2e 55%, #0a1422 100%);
  color: #e2e8f0;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
  pointer-events: none;
}

.login-brand > * { position: relative; z-index: 1; }

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(145deg, #14b8a6, #0b7f70);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 21px;
  box-shadow: 0 8px 24px -6px rgba(15, 157, 138, 0.55);
  flex: 0 0 auto;
}
.brand-name { font-size: 20px; font-weight: 750; letter-spacing: -0.03em; color: #f8fafc; line-height: 1.1; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: #7dd3c8; margin-top: 3px; }

.login-hero { max-width: 620px; padding: 48px 0 24px; }
.login-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
  color: #7dd3c8; background: rgba(15, 157, 138, 0.12);
  border: 1px solid rgba(125, 211, 200, 0.22);
  padding: 7px 12px; border-radius: 99px; margin-bottom: 22px;
}
.login-hero h1 {
  font-size: clamp(38px, 4.2vw, 60px);
  line-height: 1.02;
  font-weight: 760;
  color: #f8fafc;
  margin-bottom: 20px;
}
.login-hero h1 span { color: #5eead4; }
.login-hero p { font-size: 16px; line-height: 1.65; color: #94a3b8; max-width: 520px; }

.login-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px; max-width: 560px; }
.login-feature {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 12px;
  font-size: 12.5px; color: #cbd5e1; line-height: 1.4;
}
.login-feature svg { color: #5eead4; flex: 0 0 auto; margin-top: 1px; }

.login-footer { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #64748b; }
.login-footer .dot { width: 4px; height: 4px; border-radius: 50%; background: #475569; }

.login-panel {
  background: #f8fafc;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
}
.login-box { width: 100%; max-width: 430px; }
.login-box h2 { font-size: 25px; font-weight: 750; margin-bottom: 7px; }
.login-box > p { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }

.role-list { display: flex; flex-direction: column; gap: 10px; }
.role-card {
  width: 100%;
  display: flex; align-items: center; gap: 13px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  color: var(--text);
}
.role-card:hover { border-color: #8ed9cf; box-shadow: 0 6px 20px -10px rgba(15, 157, 138, 0.35); transform: translateY(-1px); }
.role-card:active { transform: translateY(0); }
.role-avatar {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary-50); color: var(--primary-700);
  font-weight: 750; font-size: 14px;
}
.role-card.super .role-avatar { background: var(--violet-50); color: var(--violet); }
.role-card.collector .role-avatar { background: var(--amber-50); color: var(--amber); }
.role-info { min-width: 0; flex: 1; }
.role-info strong { display: block; font-size: 13.5px; font-weight: 700; }
.role-info span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-arrow { color: var(--muted-2); flex: 0 0 auto; }

.demo-note {
  margin-top: 22px;
  background: #eef6ff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
}
.demo-note strong { color: #1e3a5f; }

/* =========================================================
   App shell
   ========================================================= */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0b1524 0%, #0b1728 60%, #0a1422 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  z-index: 50;
  border-right: 1px solid rgba(148, 163, 184, 0.08);
}
.sidebar-head { padding: 22px 20px 18px; }
.sidebar-head .brand-name { font-size: 18px; }
.sidebar-head .brand-sub { font-size: 10px; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #1e293b; border: 0; }

.nav-section { margin-top: 16px; }
.nav-section:first-child { margin-top: 2px; }
.nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: #52637a; padding: 0 12px; margin-bottom: 7px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #9fb0c5;
  font-size: 13px; font-weight: 550;
  margin-bottom: 2px;
  transition: background .14s, color .14s;
  position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.055); color: #e2e8f0; text-decoration: none; }
.nav-link.active { background: rgba(15, 157, 138, 0.16); color: #5eead4; font-weight: 650; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: #2dd4bf;
}
.nav-link svg { flex: 0 0 auto; opacity: .9; }
.nav-badge {
  margin-left: auto;
  min-width: 19px; height: 19px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 99px;
  background: #f59e0b; color: #1c1917;
  font-size: 10px; font-weight: 800;
}

.sidebar-store {
  margin: 10px 12px 4px;
  padding: 11px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(148, 163, 184, 0.1);
}
.sidebar-store small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: #64748b; margin-bottom: 4px; }
.sidebar-store strong { display: block; font-size: 12.5px; color: #e2e8f0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(148, 163, 184, 0.09); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-box:hover { background: rgba(255, 255, 255, .045); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #14b8a6, #0b7f70);
  color: #fff; font-size: 12px; font-weight: 750;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta strong { display: block; font-size: 12px; color: #e2e8f0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { display: block; font-size: 10.5px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn-dark {
  border: 0; background: transparent; color: #64748b; padding: 6px; border-radius: 7px;
}
.icon-btn-dark:hover { background: rgba(255,255,255,.06); color: #cbd5e1; }

.main { margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 30px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 11.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.menu-toggle { display: none !important; }

.store-switcher {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 10px 6px 11px; border-radius: 9px;
  font-size: 12px; color: var(--text-2); max-width: 250px;
}
.store-switcher svg { color: var(--primary); flex: 0 0 auto; }
.store-switcher select {
  border: 0; background: transparent; font-size: 12px; font-weight: 600; color: var(--text-2);
  max-width: 190px; outline: none; cursor: pointer;
}

.content { padding: 26px 30px 64px; max-width: 1560px; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h2 { font-size: 24px; font-weight: 760; line-height: 1.2; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 720px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-700); }
.breadcrumb svg { color: var(--muted-2); }

.demo-banner {
  display: flex; align-items: center; gap: 10px;
  background: #fffbeb; border: 1px solid #fde68a;
  color: #92400e; border-radius: 11px;
  padding: 10px 14px; font-size: 12.5px; margin-bottom: 18px;
}
.demo-banner svg { flex: 0 0 auto; }
.demo-banner strong { font-weight: 700; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12.5px; font-weight: 650;
  line-height: 1.2;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .1s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(15, 157, 138, .25); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { flex: 0 0 auto; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px -2px rgba(15, 157, 138, .45); }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-secondary:hover { background: var(--surface-2); border-color: #b6c2d1; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.btn-danger-soft:hover { background: var(--red-100); }
.btn-whatsapp { background: #25d366; color: #063a1d; }
.btn-whatsapp:hover { background: #1fbe5b; }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 8px; }
.btn-lg { padding: 10px 17px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; border-radius: 7px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-50); color: var(--red); }

/* =========================================================
   Cards / KPI
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 17px 19px 0;
}
.card-head h3 { font-size: 14px; font-weight: 700; }
.card-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 16px 19px 19px; }
.card-body.tight { padding: 10px 12px 12px; }
.card-link { font-size: 11.5px; font-weight: 650; color: var(--primary-700); white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--kpi-glow, rgba(15, 157, 138, .06));
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.kpi-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--kpi-bg, var(--primary-50)); color: var(--kpi-color, var(--primary-700));
  flex: 0 0 auto;
}
.kpi-value { font-size: 25px; font-weight: 760; letter-spacing: -0.035em; line-height: 1.1; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-sub { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.kpi-sub strong { color: var(--text-2); font-weight: 650; }
.kpi.green { --kpi-bg: var(--green-50); --kpi-color: var(--green); --kpi-glow: rgba(22, 163, 74, .06); }
.kpi.red { --kpi-bg: var(--red-50); --kpi-color: var(--red); --kpi-glow: rgba(220, 38, 38, .06); }
.kpi.amber { --kpi-bg: var(--amber-50); --kpi-color: var(--amber); --kpi-glow: rgba(217, 119, 6, .07); }
.kpi.blue { --kpi-bg: var(--blue-50); --kpi-color: var(--blue); --kpi-glow: rgba(37, 99, 235, .06); }
.kpi.violet { --kpi-bg: var(--violet-50); --kpi-color: var(--violet); --kpi-glow: rgba(124, 58, 237, .06); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-2-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 > *, .grid-2-equal > *, .grid-3 > *, .detail-grid > *, .settings-grid > *, .stack > *, .card { min-width: 0; }

/* =========================================================
   Tables
   ========================================================= */
.table-card { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700;
  background: var(--surface-2);
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #edf2f7; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #fbfdff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions-cell { text-align: right; white-space: nowrap; }
table.data .cell-main { font-weight: 650; color: var(--text); }
table.data .cell-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); flex-wrap: wrap;
}
.row-click { cursor: pointer; }

.person-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar {
  width: 33px; height: 33px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 750; letter-spacing: .02em;
  background: var(--primary-50); color: var(--primary-700);
}
.avatar.a1 { background: #e0f2fe; color: #0369a1; }
.avatar.a2 { background: #fef3c7; color: #b45309; }
.avatar.a3 { background: #ede9fe; color: #6d28d9; }
.avatar.a4 { background: #fce7f3; color: #be185d; }
.avatar.a5 { background: #dcfce7; color: #15803d; }
.avatar.a6 { background: #ffedd5; color: #c2410c; }
.avatar.sm { width: 27px; height: 27px; border-radius: 8px; font-size: 9.5px; }
.avatar.lg { width: 54px; height: 54px; border-radius: 15px; font-size: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1.4;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.no-dot::before { display: none; }
.badge-green { background: var(--green-50); color: #15803d; }
.badge-red { background: var(--red-50); color: #b91c1c; }
.badge-amber { background: var(--amber-50); color: #b45309; }
.badge-blue { background: var(--blue-50); color: #1d4ed8; }
.badge-slate { background: #f1f5f9; color: #475569; }
.badge-violet { background: var(--violet-50); color: #6d28d9; }
.badge-teal { background: var(--primary-50); color: var(--primary-700); }

/* =========================================================
   Forms
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.field .required { color: var(--red); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
  font-size: 12.5px;
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 157, 138, .13);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.textarea { resize: vertical; min-height: 82px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error {
  background: var(--red-50); border: 1px solid var(--red-100); color: #b91c1c;
  border-radius: 8px; padding: 8px 11px; font-size: 11.5px; margin-top: 2px;
}
.form-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; font-size: 11.5px; color: var(--muted); line-height: 1.55; }

.search-box { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-box .input { padding-left: 32px; }
.filter-bar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 13px 15px; border-bottom: 1px solid var(--border);
}
.filter-bar .select { width: auto; min-width: 135px; font-size: 11.5px; padding-top: 7px; padding-bottom: 7px; }
.filter-bar .input { font-size: 11.5px; padding-top: 7px; padding-bottom: 7px; }
.filter-spacer { flex: 1; }

.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-2); line-height: 1.4; }
.checkbox-row input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; }

.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px;
  transition: .18s; cursor: pointer;
}
.switch span::before {
  content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 3px rgba(15,23,42,.25);
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 3px solid rgba(15,157,138,.25); }

/* =========================================================
   Modal
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 15, 28, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 38px 18px;
  overflow-y: auto;
  animation: fadeIn .16s ease;
}
.modal {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  margin: auto;
  animation: modalIn .18s ease;
  overflow: hidden;
}
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 940px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 19px 21px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 750; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.modal-close { border: 0; background: var(--surface-2); color: var(--muted); width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 18px 21px; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 14px 21px 18px; border-top: 1px solid var(--border);
  background: #fcfdff;
  flex-wrap: wrap;
}
.modal-foot .left { margin-right: auto; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* =========================================================
   Toast
   ========================================================= */
.toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
  pointer-events: none;
}
.toast {
  background: #0f172a; color: #e2e8f0;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px; line-height: 1.45;
  box-shadow: 0 12px 30px -12px rgba(15,23,42,.5);
  display: flex; align-items: flex-start; gap: 9px;
  animation: toastIn .2s ease;
  pointer-events: auto;
}
.toast svg { flex: 0 0 auto; margin-top: 1px; }
.toast.success svg { color: #4ade80; }
.toast.error svg { color: #f87171; }
.toast.info svg { color: #60a5fa; }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* =========================================================
   Dashboard pieces
   ========================================================= */
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 168px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar-wrap { width: 100%; max-width: 42px; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
  width: 100%; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #2dd4bf, #0f9d8a);
  min-height: 3px;
  transition: height .3s ease;
  position: relative;
}
.chart-bar:hover { filter: brightness(1.08); }
.chart-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart-value { font-size: 9.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.aging-list { display: flex; flex-direction: column; gap: 13px; }
.aging-row { display: grid; grid-template-columns: 88px 1fr 74px; align-items: center; gap: 10px; font-size: 11.5px; }
.aging-label { color: var(--text-2); font-weight: 600; }
.aging-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.aging-fill { height: 100%; border-radius: 99px; background: var(--primary); min-width: 2px; }
.aging-fill.warn { background: #f59e0b; }
.aging-fill.danger { background: #ef4444; }
.aging-fill.dark { background: #991b1b; }
.aging-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-2); }

.debtor-list { display: flex; flex-direction: column; }
.debtor-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.debtor-row:last-child { border-bottom: 0; }
.debtor-info { flex: 1; min-width: 0; }
.debtor-info strong { display: block; font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debtor-info span { display: block; font-size: 10.5px; color: var(--muted); }
.debtor-amount { text-align: right; }
.debtor-amount strong { display: block; font-size: 12px; font-variant-numeric: tabular-nums; }
.debtor-amount span { display: block; font-size: 10px; color: var(--red); }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-icon { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--muted); }
.timeline-icon.green { background: var(--green-50); color: var(--green); }
.timeline-icon.blue { background: var(--blue-50); color: var(--blue); }
.timeline-icon.amber { background: var(--amber-50); color: var(--amber); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body p { font-size: 11.5px; color: var(--text-2); line-height: 1.45; }
.timeline-body p strong { color: var(--text); font-weight: 650; }
.timeline-body span { font-size: 10px; color: var(--muted-2); }
.timeline-amt { font-size: 11.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.progress-summary { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1; height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; }
.progress-fill.warn { background: #f59e0b; }
.progress-fill.danger { background: #ef4444; }

/* =========================================================
   Detail layouts
   ========================================================= */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .85fr); gap: 16px; align-items: start; }
.profile-card { padding: 20px; }
.profile-top { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 17px; }
.profile-top h3 { font-size: 19px; font-weight: 750; line-height: 1.2; }
.profile-top p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.profile-meta { display: flex; flex-direction: column; gap: 9px; font-size: 12px; color: var(--text-2); }
.profile-meta-row { display: flex; align-items: flex-start; gap: 8px; }
.profile-meta-row svg { color: var(--muted-2); flex: 0 0 auto; margin-top: 1px; }
.profile-actions { display: flex; flex-direction: column; gap: 7px; margin-top: 17px; }

.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mini-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; }
.mini-kpi span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.mini-kpi strong { display: block; font-size: 15px; font-weight: 750; margin-top: 3px; font-variant-numeric: tabular-nums; }
.mini-kpi strong.red { color: var(--red); }
.mini-kpi strong.green { color: var(--green); }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.info-item span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 2px; }
.info-item strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere; }

.schedule-list { display: flex; flex-direction: column; }
.schedule-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 11.5px; }
.schedule-row:last-child { border-bottom: 0; }
.schedule-num { width: 23px; height: 23px; border-radius: 7px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: 0 0 auto; }
.schedule-info { flex: 1; }
.schedule-info strong { display: block; font-weight: 600; color: var(--text-2); }
.schedule-info span { display: block; font-size: 10px; color: var(--muted); }
.schedule-amt { font-variant-numeric: tabular-nums; font-weight: 650; }

/* =========================================================
   Store cards / reports
   ========================================================= */
.store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.store-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.store-card-head { display: flex; align-items: flex-start; gap: 11px; }
.store-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; flex: 0 0 auto; }
.store-card-head h3 { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.store-card-head p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.store-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.store-metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 9px; }
.store-metric span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.store-metric strong { display: block; font-size: 13.5px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.store-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  border: 0; background: transparent; padding: 9px 13px 11px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-700); border-bottom-color: var(--primary); }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid #f1f5f9; }
.setting-row:last-child { border-bottom: 0; }
.setting-row p { font-size: 11.5px; color: var(--muted); margin-top: 2px; max-width: 520px; line-height: 1.5; }
.setting-row strong { font-size: 12.5px; font-weight: 650; }
.setting-row .switch { margin-top: 2px; }

.method-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.method-row:last-child { border-bottom: 0; }
.method-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.method-info { flex: 1; min-width: 0; }
.method-info strong { display: block; font-size: 12px; font-weight: 650; }
.method-info span { display: block; font-size: 10.5px; color: var(--muted); }

.report-block { margin-bottom: 16px; }
.report-table th { background: #f8fafc; }
.report-table td, .report-table th { padding: 9px 12px; }
.total-row td { font-weight: 750; background: #f8fafc; border-top: 1px solid var(--border-strong); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }

.print-only { display: none; }

/* =========================================================
   Empty states
   ========================================================= */
.empty-state { padding: 38px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.empty-icon { width: 46px; height: 46px; border-radius: 13px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; margin-bottom: 4px; }
.empty-state h4 { font-size: 13.5px; font-weight: 700; }
.empty-state p { font-size: 11.5px; color: var(--muted); max-width: 360px; line-height: 1.55; }
.empty-state .btn { margin-top: 8px; }

/* =========================================================
   Receipt / print
   ========================================================= */
.receipt {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 22px; max-width: 420px; margin: 0 auto;
  font-size: 12px; color: var(--text-2);
}
.receipt-head { text-align: center; padding-bottom: 12px; border-bottom: 1px dashed var(--border-strong); margin-bottom: 12px; }
.receipt-head h3 { font-size: 16px; font-weight: 750; }
.receipt-head p { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.receipt-row strong { color: var(--text); font-weight: 650; }
.receipt-total { border-top: 1px dashed var(--border-strong); margin-top: 10px; padding-top: 10px; font-size: 14px; }
.receipt-total strong { font-size: 17px; }
.receipt-foot { text-align: center; font-size: 10px; color: var(--muted); border-top: 1px dashed var(--border-strong); margin-top: 14px; padding-top: 10px; }

@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .receipt { border: 0; max-width: 100%; padding: 0; }
  .print-only { display: block; }
  @page { margin: 16mm; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 24px 22px 56px; }
}

@media (max-width: 1080px) {
  .grid-2, .grid-2-equal { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: 380px; padding: 36px 36px 30px; }
  .login-hero { padding: 30px 0 8px; }
  .login-hero h1 { font-size: 40px; }
  .login-features { margin-top: 20px; }
  .login-footer { display: none; }
  .login-panel { padding: 36px 28px 48px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.25); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(8,15,28,.45); z-index: 45;
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid !important; }
  .topbar { padding: 0 16px; height: 64px; }
  .content { padding: 20px 16px 54px; }
  .page-head h2 { font-size: 21px; }
  .topbar-title p { display: none; }
  .store-switcher { max-width: 180px; }
  .store-switcher select { max-width: 120px; }
  .store-switcher .sw-label { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .modal-overlay { padding: 18px 10px; }
}

@media (max-width: 680px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px; }
  .kpi-value { font-size: 21px; }
  .store-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .login-brand { padding: 30px 22px 24px; min-height: 0; }
  .login-hero h1 { font-size: 33px; }
  .login-hero p { font-size: 14px; }
  .login-features { grid-template-columns: 1fr; }
  .login-panel { padding: 30px 18px 44px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .filter-bar { padding: 11px; }
  .search-box { max-width: none; width: 100%; }
  .filter-bar .select { flex: 1; }
  .modal { border-radius: 14px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot .btn { flex: 1; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 8px 9px; }
  .topbar { gap: 8px; }
  .topbar-title h1 { font-size: 15px; }
  .store-switcher { max-width: 150px; padding: 5px 8px; gap: 6px; }
  .store-switcher select { max-width: 92px; font-size: 11px; }
  .chart-bars { gap: 7px; }
  .aging-row { grid-template-columns: 74px 1fr 64px; }
  .mini-kpis { grid-template-columns: 1fr; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .sale-item-row { grid-template-columns: 1fr 1fr !important; }
  .sale-item-row .field:first-child { grid-column: 1 / -1; }
  .sale-item-row .icon-btn { justify-self: end; }
}

@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 29px; }
  .role-card { padding: 11px; }
}
