/* =========================================================
   DebtControl — design tokens
   ========================================================= */
:root {
  --bg: #080b10;
  --bg-soft: #0c1118;
  --surface: #111823;
  --surface-2: #16202c;
  --surface-3: #1d2836;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef7;
  --text-soft: #a8b6c9;
  --text-muted: #74839a;
  --primary: #34d399;
  --primary-strong: #10b981;
  --primary-ink: #052e21;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 80px -40px rgba(0, 0, 0, 0.95);
  --ring: 0 0 0 3px rgba(52, 211, 153, 0.22);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(52, 211, 153, 0.1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(96, 165, 250, 0.08), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
strong { font-weight: 600; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* =========================================================
   Icons
   ========================================================= */
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
/* Font Awesome: tamanho base; cada contexto ajusta o font-size. */
.fa-solid { font-size: 15px; line-height: 1; width: 1.25em; text-align: center; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}
.btn .fa-solid { font-size: 13px; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: var(--primary-ink);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 10px 24px -14px rgba(16, 185, 129, 0.9);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--primary), var(--primary-strong)); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.link-btn:hover { text-decoration: underline; }

/* =========================================================
   Auth
   ========================================================= */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-aside {
  position: relative;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(700px 380px at 20% 10%, rgba(52, 211, 153, 0.16), transparent 65%),
    linear-gradient(160deg, #0a1017 0%, #070a0f 100%);
  overflow: hidden;
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset: auto -120px -180px auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.18), transparent 65%);
}

.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong { display: block; font-size: 17px; letter-spacing: -0.02em; }
.auth-brand small { color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.06));
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--primary);
}
.logo-mark .fa-solid { font-size: 17px; }

.auth-aside h1 {
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: 460px;
}
.auth-lede { color: var(--text-soft); max-width: 440px; font-size: 15px; }

.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 13.5px; }
.auth-points [data-icon] { color: var(--primary); }
.auth-foot { margin-top: auto; color: var(--text-muted); font-size: 12px; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: 16px;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 32, 44, 0.9), rgba(13, 19, 27, 0.92));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}
.auth-head { display: grid; gap: 4px; }
.auth-head h2 { font-size: 22px; letter-spacing: -0.02em; }
.auth-head p { color: var(--text-muted); font-size: 13px; }
.auth-note { color: var(--text-muted); font-size: 11.5px; text-align: center; }

/* =========================================================
   Fields, selects and segmented controls
   ========================================================= */
.field { display: grid; gap: 7px; min-width: 0; }
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field-label em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-muted); }

.field-shell {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.65);
  color: var(--text-soft);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.field-shell:hover { border-color: var(--border-strong); }
.field-shell:focus-within {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(8, 12, 17, 0.9);
  box-shadow: var(--ring);
  color: var(--primary);
}
.field-shell input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.field-shell input::placeholder { color: #56657a; }
.field-icon { display: flex; color: var(--text-muted); }
.field-icon .fa-solid { font-size: 13px; }
.field-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.field-action:hover { background: var(--surface-2); color: var(--text); }

.field-prefix, .field-suffix {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.field-shell-currency input { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: 0.01em; }
.field-shell-suffix input { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.field-shell-suffix .field-suffix { min-width: 18px; text-align: right; }

.field-row { display: flex; align-items: center; gap: 10px; }
.field-row .field-shell { flex: 0 1 180px; }
.field-hint-inline { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.field-help { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-inline { gap: 0; }
.field-search .field-shell { height: 38px; min-width: 240px; }

.field input[type="date"] { color-scheme: dark; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Custom select */
.select-shell { position: relative; display: block; }
.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 40px 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.65);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  text-overflow: ellipsis;
}
.select-shell select:hover { border-color: var(--border-strong); background: rgba(13, 19, 27, 0.9); }
.select-shell select:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: var(--ring);
}
.select-shell select:disabled { opacity: 0.6; cursor: not-allowed; }
.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.16s ease, transform 0.16s ease;
}
.select-chevron .fa-solid { font-size: 11px; }
.select-shell:hover .select-chevron { color: var(--text); }
.select-shell select:focus + .select-chevron { color: var(--primary); transform: translateY(-50%) rotate(180deg); }
select option { background: #111823; color: var(--text); }

/* Segmented control */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.65);
}
.segmented-item {
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.segmented-item:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.segmented-item.is-active {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.18), rgba(52, 211, 153, 0.08));
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.32);
}
.segmented-item:focus-visible { outline: none; box-shadow: var(--ring); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.5);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.12);
  color: var(--primary);
}
.chip:focus-visible { outline: none; box-shadow: var(--ring); }
.chips-sm .chip { height: 28px; padding: 0 10px; font-size: 12px; }

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: var(--danger-soft);
  color: #fca5a5;
  font-size: 12.5px;
}

/* =========================================================
   Shell & sidebar
   ========================================================= */
.shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(3, 6, 10, 0.7);
  backdrop-filter: blur(2px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 19, 27, 0.96), rgba(8, 12, 17, 0.98));
  z-index: 40;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: -0.02em; }
.sidebar-brand small { color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em; }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; padding-right: 2px; }
.nav-label {
  padding: 12px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5d6b80;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.nav-item [data-icon] .fa-solid { font-size: 14px; }
.nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.16), rgba(52, 211, 153, 0.04));
  border-color: rgba(52, 211, 153, 0.28);
  color: var(--primary);
}
.nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.nav-count:empty { display: none; }

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.6);
}
.user-chip strong { display: block; font-size: 12.5px; line-height: 1.2; }
.user-chip small { color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(52, 211, 153, 0.14);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

/* =========================================================
   Topbar, views
   ========================================================= */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.78);
  backdrop-filter: blur(16px);
}
#sidebarToggle { display: none; }
.topbar-title { display: grid; gap: 1px; }
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.topbar h1 { font-size: 20px; letter-spacing: -0.025em; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-note { color: var(--text-muted); font-size: 11.5px; }

.views { padding: 24px 28px 56px; }
.view { display: none; animation: rise 0.24s ease both; }
.view.is-active { display: grid; gap: 18px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.page-head p { color: var(--text-muted); font-size: 13px; }

/* =========================================================
   Panels, KPIs, lists
   ========================================================= */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 32, 44, 0.72), rgba(13, 19, 27, 0.76));
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.panel-flush { padding: 6px 18px 14px; }
.panel-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.panel-flush .panel-head { padding-top: 12px; }
.panel-head h2 { font-size: 15px; letter-spacing: -0.015em; }
.panel-head p { color: var(--text-muted); font-size: 12px; }

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.5);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.kpi {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(24, 35, 48, 0.9), rgba(12, 18, 26, 0.9));
  box-shadow: var(--shadow);
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(52, 211, 153, 0.1);
  color: var(--primary);
}
.kpi-icon .fa-solid { font-size: 13px; }
.kpi-value { font-size: 23px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-hint { color: var(--text-muted); font-size: 11.5px; }
.kpi-risk { border-color: rgba(248, 113, 113, 0.26); background: linear-gradient(160deg, rgba(46, 24, 28, 0.75), rgba(14, 12, 16, 0.9)); }
.kpi-risk .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi-risk .kpi-value { color: #fca5a5; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }

.chart { position: relative; height: 200px; }
.chart-lg { height: 236px; }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); }
.legend i:not(.fa-solid) { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); }

.panel-mora {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 20px;
}
.mora-item { display: grid; gap: 3px; }
.mora-item strong { font-size: 18px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.stack { display: grid; }
.stack-lg { gap: 10px; }
.stack > * + * { border-top: 1px solid rgba(148, 163, 184, 0.08); }
.stack-lg > * + * { border-top: 0; }

.empty {
  display: grid;
  gap: 4px;
  padding: 26px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}
.empty strong { color: var(--text-soft); font-size: 13px; }

/* List rows */
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  min-width: 0;
}
.list-main { min-width: 0; display: grid; gap: 2px; }
.list-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.list-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { color: var(--text-muted); font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.list-side { margin-left: auto; text-align: right; display: grid; gap: 3px; justify-items: end; }
.list-side strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.list-side small { color: var(--text-muted); font-size: 11px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-paid { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.3); color: var(--primary); }
.badge-pending { background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.28); color: var(--info); }
.badge-partial { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.3); color: var(--warn); }
.badge-overdue { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.34); color: var(--danger); }
.badge-written_off { background: rgba(148, 163, 184, 0.12); border-color: var(--border-strong); color: var(--text-muted); }
.badge-active { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.28); color: var(--primary); }
.badge-settled { background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.28); color: var(--info); }
.badge-defaulted { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.34); color: var(--danger); }
.badge-cancelled { background: rgba(148, 163, 184, 0.12); border-color: var(--border-strong); color: var(--text-muted); }

.progress { height: 5px; border-radius: 999px; background: rgba(148, 163, 184, 0.14); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-strong), var(--primary)); }

/* Loan cards */
.loan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.loan-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(24, 35, 48, 0.86), rgba(11, 17, 24, 0.92));
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.loan-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 26px 50px -34px rgba(0, 0, 0, 1); }
.loan-card:focus-visible { outline: none; box-shadow: var(--ring); }
.loan-card-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.loan-card-head strong { font-size: 14.5px; letter-spacing: -0.01em; }
.loan-card-head small { display: block; color: var(--text-muted); font-size: 11.5px; }
.loan-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.loan-metric span { display: block; color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.loan-metric strong { font-size: 13.5px; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .field-search { margin-left: auto; }

/* Reports */
.report-list { margin: 0; display: grid; gap: 2px; }
.report-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
.report-list > div:last-child { border-bottom: 0; }
.report-list dt { color: var(--text-muted); font-size: 12.5px; }
.report-list dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* =========================================================
   Simulator
   ========================================================= */
.sim-grid { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.form-panel { display: grid; gap: 16px; }
.sim-results { display: grid; gap: 14px; min-width: 0; }

.mini-rows { display: grid; gap: 2px; margin-top: 8px; max-height: 160px; overflow: auto; }
.mini-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 2px;
  font-size: 12px;
  color: var(--text-soft);
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
}
.mini-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.mini-row i { font-style: normal; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* =========================================================
   Dialogs
   ========================================================= */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #131b26, #0b1119);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dialog-lg { width: min(880px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(3, 6, 10, 0.72); backdrop-filter: blur(4px); }
.dialog[open] { animation: pop 0.18s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { font-size: 17px; letter-spacing: -0.02em; }
.dialog-head p { color: var(--text-muted); font-size: 12px; }
.dialog-body { padding: 18px 22px; display: grid; gap: 14px; overflow-y: auto; }
.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.5);
}

.form-section { display: grid; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
.form-section:last-of-type { border-bottom: 0; padding-bottom: 0; }
.form-section-head { display: flex; align-items: center; gap: 8px; color: var(--primary); }
.form-section-head h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.form-section-head .fa-solid { font-size: 13px; }

.form-advanced summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.form-advanced summary::-webkit-details-marker { display: none; }
.form-advanced summary::after { content: "+"; margin-left: auto; color: var(--text-muted); font-weight: 700; }
.form-advanced[open] summary::after { content: "−"; }
.form-advanced summary small { color: var(--text-muted); font-weight: 400; font-size: 11.5px; }
.form-advanced summary .fa-solid { font-size: 13px; color: var(--warn); }
.form-advanced[open] summary { border-style: solid; border-color: rgba(251, 191, 36, 0.32); }
.form-advanced > div, .form-advanced > p { margin-top: 14px; }

.preview {
  border-radius: var(--radius);
  border: 1px solid rgba(52, 211, 153, 0.24);
  background: linear-gradient(170deg, rgba(52, 211, 153, 0.08), rgba(8, 12, 17, 0.4));
  padding: 14px;
  display: grid;
  gap: 10px;
}
.preview-head { display: flex; align-items: center; gap: 8px; color: var(--primary); }
.preview-head h3 { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.preview-head .fa-solid { font-size: 13px; }
.preview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.preview-grid > div { display: grid; gap: 2px; min-width: 0; }
.preview-grid span { color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.preview-grid strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.payment-summary { display: grid; gap: 8px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(8, 12, 17, 0.5); }
.payment-summary .row-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-soft); }
.payment-summary .row-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.payment-summary .row-line.is-total { padding-top: 8px; border-top: 1px solid rgba(148, 163, 184, 0.12); }
.payment-summary .row-line.is-total strong { font-size: 16px; color: var(--primary); }

.allocation { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(8, 12, 17, 0.35); }
.allocation-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.allocation-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); }
.allocation-line i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.allocation-line b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

/* =========================================================
   Toasts
   ========================================================= */
.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(17, 24, 35, 0.97);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--text-soft);
  animation: slide-in 0.2s ease both;
}
.toast strong { display: block; color: var(--text); font-size: 13px; }
.toast [data-icon] { flex: none; margin-top: 1px; }
.toast-success { border-color: rgba(52, 211, 153, 0.4); }
.toast-success [data-icon] { color: var(--primary); }
.toast-error { border-color: rgba(248, 113, 113, 0.4); }
.toast-error [data-icon] { color: var(--danger); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.08)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-mora { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .sim-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-panel { min-height: 100vh; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 268px;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .sidebar.is-open { transform: none; }
  #sidebarToggle { display: inline-flex; }
  .views { padding: 18px 16px 44px; }
  .topbar { padding: 14px 16px; }
  .loan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .kpi-grid, .kpi-grid-2, .kpi-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .panel-mora { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .list-row { flex-wrap: wrap; }
  .list-side { margin-left: 0; width: 100%; justify-items: start; text-align: left; }
  .toolbar .field-search { margin-left: 0; width: 100%; }
  .field-search .field-shell { min-width: 0; width: 100%; }
  .topbar-actions .sync-note { display: none; }
  .dialog, .dialog-lg { width: calc(100vw - 16px); }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .toasts, .link-btn, .btn, .chips, .toolbar { display: none !important; }
  .shell { display: block; }
  .views { padding: 0; }
  .view { display: none !important; }
  .view.is-active { display: grid !important; }
  .panel, .kpi { border-color: #d6dbe3; background: #fff; box-shadow: none; }
  .kpi-value, .kpi-hint, .kpi-label, .panel-head p, .list-meta, .report-list dt { color: #4b5563; }
  .report-list dd, .list-side strong { color: #111; }
}


/* =========================================================
   Ações, administração e estados adicionais
   ========================================================= */
.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); color: #fecaca; }

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.auth-note { margin: 0; text-align: center; font-size: 12px; color: var(--text-muted); }

.row-actions { display: flex; gap: 6px; flex: none; }
.row-actions .icon-btn { width: 32px; height: 32px; }
.row-actions .icon-btn .fa-solid { font-size: 13px; }
.icon-btn.is-danger:hover { color: var(--danger); background: var(--danger-soft); }

.list-row.is-muted .list-title span,
.list-row.is-muted .list-side strong { color: var(--text-muted); text-decoration: line-through; }

.badge-reversed,
.badge-inactive { background: rgba(148, 163, 184, 0.12); border-color: var(--border-strong); color: var(--text-muted); }
.badge-admin { background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.32); color: #c4b5fd; }
.badge-analyst { background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.28); color: var(--info); }

.field-shell-area { height: auto; padding: 10px 12px; align-items: flex-start; }
.field-shell-area textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.field-shell-area textarea::placeholder { color: #56657a; }
.field-label em { font-style: normal; font-weight: 400; color: var(--text-muted); font-size: 11px; margin-left: 4px; }

.audit-action { font-variant-numeric: tabular-nums; color: var(--text-soft); }

.skeleton {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
@keyframes skeleton { to { background-position: -200% 0; } }

@media (max-width: 720px) {
  .page-head { flex-wrap: wrap; }
  .row-actions { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================
   Caixa e patrimônio
   ========================================================= */
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; gap: 6px; border-radius: 8px; }
.btn-soft { background: rgba(148, 163, 184, 0.08); border-color: var(--border); color: var(--text-soft); }
.btn-soft:hover { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: var(--text); }

.kpi-hero {
  border-color: rgba(52, 211, 153, 0.3);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(52, 211, 153, 0.16), transparent 55%),
    linear-gradient(160deg, rgba(18, 38, 34, 0.92), rgba(10, 16, 22, 0.94));
}
.kpi-hero .kpi-value { color: #a7f3d0; }
.kpi-hint b { color: var(--text-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-cash .kpi-icon { background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.kpi-actions { display: flex; gap: 6px; margin-top: 2px; }
.kpi-value.is-negative, .amount-out { color: #fca5a5; }
.amount-in { color: #6ee7b7; }
.mora-item .kpi-label { display: inline-flex; align-items: center; gap: 6px; }
.mora-item .kpi-label .fa-solid { font-size: 11px; color: var(--text-muted); }

.mix-bar {
  display: flex;
  gap: 3px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.1);
}
.mix-bar span { min-width: 4px; transition: flex 0.4s ease; }
.mix-bar .is-empty { flex: 1; background: transparent; }
.mix-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mix-legend li { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; row-gap: 2px; font-size: 12px; color: var(--text-soft); }
.mix-legend i { width: 9px; height: 9px; border-radius: 3px; }
.mix-legend b { grid-column: 2; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.mix-legend small { grid-column: 2; color: var(--text-muted); font-size: 11px; }

.cash-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-soft);
}
.cash-icon .fa-solid { font-size: 14px; }
.cash-icon.is-in { background: rgba(52, 211, 153, 0.12); color: var(--primary); }
.cash-icon.is-out { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.cash-icon.is-gold { background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.cash-icon.is-muted { color: var(--text-muted); }
.list-meta .fa-solid { font-size: 10px; width: auto; margin-right: 2px; }

.segmented-cash .segmented-item { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.segmented-cash .segmented-item[data-value="withdrawal"].is-active { background: rgba(248, 113, 113, 0.16); color: #fecaca; }
.adjust-current {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.06);
  border: 1px dashed var(--border-strong);
}
.adjust-current strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.field-help.is-warning { color: var(--warn); }
#cashPreview b { color: var(--text); font-variant-numeric: tabular-nums; }
#cashPreview b.amount-out { color: #fca5a5; }

/* =========================================================
   Seletor personalizado (substitui a lista nativa)
   ========================================================= */
.select-shell.is-enhanced select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.select-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 44px;
  padding: 0 40px 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.65);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.select-trigger:hover { border-color: var(--border-strong); background: rgba(13, 19, 27, 0.9); }
.select-trigger:focus-visible, .select-shell.is-open .select-trigger {
  outline: none;
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: var(--ring);
}
.select-trigger:disabled { opacity: 0.6; cursor: not-allowed; }
.select-trigger.is-placeholder .select-trigger-label { color: var(--text-muted); }
.select-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger-icon { display: inline-flex; color: var(--primary); }
.select-trigger-icon:empty { display: none; }
.select-trigger-icon .fa-solid { font-size: 13px; }
.select-shell.is-open .select-chevron { color: var(--primary); transform: translateY(-50%) rotate(180deg); }

.select-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(14, 20, 29, 0.98);
  color: var(--text);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
  scrollbar-width: thin;
}
.select-menu:popover-open { animation: select-in 0.14s ease both; }
.select-menu:focus { outline: none; }
@keyframes select-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-soft);
}
.select-option[hidden] { display: none; }
.select-option.is-active { background: rgba(148, 163, 184, 0.1); color: var(--text); }
.select-option.is-selected { color: var(--text); }
.select-option.is-selected .select-option-text > span { font-weight: 600; }
.select-option.is-disabled { opacity: 0.45; cursor: not-allowed; }
.select-option-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-soft);
}
.select-option-icon .fa-solid { font-size: 12px; }
.select-option.is-selected .select-option-icon { background: rgba(52, 211, 153, 0.14); color: var(--primary); }
.select-option-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.select-option-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-option-text small { color: var(--text-muted); font-size: 11.5px; }
.select-option-check { color: var(--primary); opacity: 0; }
.select-option-check .fa-solid { font-size: 11px; }
.select-option.is-selected .select-option-check { opacity: 1; }
.select-search {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px -6px 6px;
  padding: 10px 12px;
  background: rgb(14, 20, 29);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.select-search .fa-solid { font-size: 12px; }
.select-search input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.select-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

@media (max-width: 1180px) {
  .mix-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpi-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .select-menu:popover-open { animation: none; }
  .mix-bar span { transition: none; }
}

/* =========================================================
   Foto e vídeos do cliente
   ========================================================= */
.avatar { overflow: hidden; }
.avatar.has-photo { background: var(--surface-2); padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.avatar-xl { width: 76px; height: 76px; border-radius: 18px; font-size: 24px; }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 9px; cursor: pointer; flex: none; transition: transform 0.16s ease; }
.avatar-btn:hover { transform: scale(1.06); }
.avatar-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.photo-picker { display: flex; align-items: center; gap: 16px; }
.photo-picker-preview {
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.16s ease, color 0.16s ease;
}
.photo-picker-preview:hover { border-color: rgba(52, 211, 153, 0.6); color: var(--primary); }
.photo-picker-preview:focus-visible { outline: none; box-shadow: var(--ring); }
.photo-picker-preview.has-photo { border-style: solid; border-color: rgba(52, 211, 153, 0.4); }
.photo-picker-preview .fa-solid { font-size: 22px; }
.photo-picker-body { display: grid; gap: 4px; min-width: 0; }
.photo-picker-body strong { font-size: 13.5px; }
.photo-picker-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

.icon-btn.media-count { position: relative; }
.icon-btn.media-count b {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.icon-btn.media-count.has-items { color: var(--primary); }

.media-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.media-upload { display: grid; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.dropzone {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 16px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border-strong);
  background: rgba(8, 12, 17, 0.45);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.dropzone:hover, .dropzone.is-dragging { border-color: rgba(52, 211, 153, 0.6); background: rgba(52, 211, 153, 0.06); }
.dropzone.has-file { border-style: solid; border-color: rgba(52, 211, 153, 0.45); }
.dropzone strong { font-size: 13.5px; word-break: break-word; }
.dropzone-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--primary);
}
.dropzone-icon .fa-solid { font-size: 18px; }
.media-upload-actions { display: flex; justify-content: flex-end; gap: 8px; }
.upload-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.upload-progress-bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.upload-progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-strong), var(--primary)); transition: width 0.2s ease; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.media-grid > .empty { grid-column: 1 / -1; }
.media-card {
  display: grid;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(8, 12, 17, 0.5);
  overflow: hidden;
}
.media-card video { width: 100%; aspect-ratio: 16 / 10; background: #000; display: block; }
.media-card-body { display: grid; gap: 6px; padding: 10px 12px 12px; }
.media-card-body strong { font-size: 13px; line-height: 1.35; }
.media-card-actions { display: flex; gap: 6px; margin-top: 2px; }
.media-card-actions a { text-decoration: none; }
.btn.is-danger { color: #fca5a5; }
.btn.is-danger:hover { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.35); }

/* =========================================================
   Barra de navegação inferior (telas pequenas)
   Segue o padrão dos apps que as pessoas já usam (Lei de Jakob):
   4 destinos principais + "Mais", ao alcance do polegar.
   ========================================================= */
.bottom-nav { display: none; }

@media (max-width: 980px) {
  #sidebarToggle { display: none; }
  .views { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgba(9, 13, 19, 0.94);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
  }
  .bottom-nav-item {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .bottom-nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
  .bottom-nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 30px;
    border-radius: 999px;
    transition: background 0.18s ease, color 0.18s ease;
  }
  .bottom-nav-icon .fa-solid { font-size: 17px; }
  .bottom-nav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
  .bottom-nav-item.is-active { color: var(--text); }
  .bottom-nav-item.is-active .bottom-nav-icon { background: rgba(52, 211, 153, 0.16); color: var(--primary); }
  .bottom-nav-item:active .bottom-nav-icon { transform: scale(0.94); }
  .bottom-nav-badge {
    position: absolute;
    top: -2px;
    left: calc(50% + 6px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    border: 2px solid rgb(9, 13, 19);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
  }
}

@media print {
  .bottom-nav { display: none !important; }
}

/* =========================================================
   Indicador global de carregamento / reconexão
   ========================================================= */
.net-status {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 32px);
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(14, 20, 29, 0.96);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: net-in 0.18s ease both;
}
.net-status[hidden] { display: none; }
.net-status[data-tone="warn"] { border-color: rgba(251, 191, 36, 0.45); color: #fde68a; }
.net-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--primary);
  animation: net-spin 0.8s linear infinite;
}
.net-status[data-tone="warn"] .net-spinner { border-top-color: var(--warn); }
@keyframes net-spin { to { transform: rotate(360deg); } }
@keyframes net-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .net-spinner { animation-duration: 2.4s !important; }
}
@media print {
  .net-status { display: none !important; }
}

/* =========================================================
   Simulador: atraso
   ========================================================= */
.sim-late { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid rgba(148, 163, 184, 0.1); }
.sim-late .form-section-head { color: var(--warn); }
.sim-late .form-advanced > div, .sim-late .form-advanced > label { margin-top: 14px; }
.sim-late-panel { border-color: rgba(251, 191, 36, 0.26); }
.sim-late-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.sim-late-kpis .is-total strong { color: #fca5a5; font-size: 15px; }
.sim-late-row { grid-template-columns: 44px minmax(0, 1fr) auto auto; column-gap: 16px; }
.sim-late-row > :nth-child(3), .sim-late-row > :nth-child(4) { text-align: right; min-width: 96px; }
.sim-late-head { padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.sim-late-head i { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.sim-late-rows { display: grid; max-height: 320px; overflow: auto; }
.sim-late-rows .mini-row + .mini-row { border-top: 1px solid rgba(148, 163, 184, 0.06); }
.sim-late-row.is-base i, .sim-late-row.is-base b { color: var(--text-muted); }
@media (max-width: 640px) {
  .sim-late-kpis { grid-template-columns: minmax(0, 1fr); }
  .sim-late-row { column-gap: 8px; }
  .sim-late-row > :nth-child(3), .sim-late-row > :nth-child(4) { min-width: 0; }
}

/* Dashboard com 5 cartões */
/* 5 cartões sem buracos: 5 colunas; 3 (patrimônio largo); 2 (patrimônio na linha toda); 1. */
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-profit .kpi-value { color: #6ee7b7; }
@media (max-width: 1500px) {
  .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid-5 .kpi-hero { grid-column: span 2; }
}
@media (max-width: 1100px) {
  .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid-5 .kpi-hero { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .kpi-grid-5 { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid-5 .kpi-hero { grid-column: auto; }
}

/* Redefinição de senha */
.form-success {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  font-size: 12.5px;
}
.auth-links { display: flex; justify-content: center; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }

/* =========================================================
   Modelos, contrato e WhatsApp
   ========================================================= */
.btn-whatsapp { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-whatsapp:hover:not(:disabled) { background: #19914a; border-color: #19914a; }
.btn-whatsapp:disabled { opacity: 0.45; cursor: not-allowed; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.dialog-foot-wrap { flex-wrap: wrap; }

.template-row .template-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(31, 168, 85, 0.12); color: #4ade80;
}
.template-snippet { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52ch; }

.check-field { display: flex; align-items: flex-start; gap: 10px; padding-top: 24px; cursor: pointer; }
.check-field input { margin-top: 3px; accent-color: var(--accent, #34d399); width: 16px; height: 16px; }
.check-field span { display: grid; gap: 2px; font-size: 13px; }
.check-field small { color: var(--text-muted); font-size: 11.5px; }

.template-editor { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.template-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.template-side { display: grid; gap: 14px; }
.template-vars { display: grid; gap: 10px; max-height: 240px; overflow: auto; padding-right: 4px; }
.var-group { display: grid; gap: 6px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chip {
  font: 500 11.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 4px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(148, 163, 184, 0.06); color: var(--text);
}
.var-chip:hover { border-color: #34d399; color: #6ee7b7; }

.wa-preview { display: grid; gap: 6px; }
.wa-bubble {
  background: #0b3d2c; color: #e9edef; border-radius: 10px 10px 10px 2px;
  padding: 10px 12px; font-size: 13px; line-height: 1.5; max-height: 320px; overflow: auto;
  overflow-wrap: anywhere;
}
.wa-bubble.is-document { background: #f8fafc; color: #0f172a; border-radius: 8px; font-family: Georgia, 'Times New Roman', serif; }
.wa-bubble .muted { color: #8fa3ad; }

#contractText { font-family: Georgia, 'Times New Roman', serif; font-size: 13.5px; line-height: 1.6; }
.contract-badge {
  display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-muted); font-size: 13px;
}
.contract-badge.is-edited { border-color: rgba(251, 191, 36, 0.4); color: #fcd34d; }

.segmented-block { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 760px) {
  .template-editor { grid-template-columns: minmax(0, 1fr); }
  .check-field { padding-top: 0; }
  .template-snippet { display: none; }
}
@media (max-width: 640px) {
  .row-actions { width: 100%; justify-content: flex-end; }
  .dialog-foot-wrap .btn { flex: 1 1 calc(50% - 8px); }
}

/* Textos: contratos, cobranças e tags */
.texts-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.texts-main { display: grid; gap: 16px; }
.tags-panel { position: sticky; top: 16px; }
.tags-list { display: grid; gap: 14px; max-height: calc(100vh - 220px); overflow: auto; }
.tags-group { display: grid; gap: 4px; }
.tag-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 6px 8px; border-radius: 8px; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.tag-row:hover { background: rgba(52, 211, 153, 0.08); }
.tag-row code { font-size: 12px; color: #6ee7b7; }
.tag-row span { font-size: 12px; color: var(--text-muted); }

.contract-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.contract-choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); background: rgba(148, 163, 184, 0.04); color: var(--text); font: inherit; font-size: 13px;
}
.contract-choice:hover { border-color: var(--border-strong); }
.contract-choice.is-active { border-color: #34d399; background: rgba(52, 211, 153, 0.1); }
.contract-choice-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: rgba(148, 163, 184, 0.14);
}
.contract-choice.is-active .contract-choice-num { background: #34d399; color: #052e1f; }
.contract-choice-name { flex: 1; min-width: 0; }
.contract-choice small { font-size: 10.5px; color: #6ee7b7; text-transform: uppercase; letter-spacing: 0.05em; }
.contract-state-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.contract-state-row .contract-badge { height: 28px; font-size: 12px; }

@media (max-width: 980px) {
  .texts-grid { grid-template-columns: minmax(0, 1fr); }
  .tags-panel { position: static; }
  .tags-list { max-height: none; }
}

/* =========================================================
   Loading central (popover na camada do topo)
   ========================================================= */
.loader {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  background: rgba(6, 9, 13, 0.62);
  backdrop-filter: blur(7px) saturate(0.8);
  -webkit-backdrop-filter: blur(7px) saturate(0.8);
  color: var(--text);
  z-index: 1000;
  place-items: center;
}
.loader.is-open { display: grid; animation: loader-in .18s ease-out; }
.loader::backdrop { background: transparent; }
.loader-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: min(300px, 100%);
  padding: 30px 34px 26px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(22, 32, 44, 0.96), rgba(13, 19, 27, 0.96));
  border: 1px solid rgba(52, 211, 153, 0.22);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 6px rgba(52, 211, 153, 0.04);
  text-align: center;
}
.loader-mark {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 6px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 40%, rgba(52, 211, 153, 0.16), rgba(52, 211, 153, 0) 70%);
}
.loader-card strong { font-size: 16px; letter-spacing: -0.01em; }
.loader-card span { color: var(--text-soft); font-size: 13px; }
@keyframes loader-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   Skeleton
   ========================================================= */
.skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08) 0%, rgba(148, 163, 184, 0.18) 45%, rgba(148, 163, 184, 0.08) 90%);
  background-size: 220% 100%;
  animation: skeleton 1.3s ease-in-out infinite;
}
.skeleton-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; }
.skeleton-row + .skeleton-row { border-top: 1px solid rgba(148, 163, 184, 0.06); }
.skeleton-avatar { width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; }
.skeleton-lines { display: grid; gap: 8px; flex: 1; }
.skeleton-line { height: 11px; width: 62%; }
.skeleton-line.is-short { width: 38%; }
.skeleton-pill { width: 84px; height: 26px; border-radius: 999px; flex-shrink: 0; }
.skeleton-block { height: 56px; width: 100%; margin-top: 6px; }
.skeleton-card { display: grid; gap: 10px; pointer-events: none; }
.is-skeleton {
  color: transparent !important;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08) 0%, rgba(148, 163, 184, 0.18) 45%, rgba(148, 163, 184, 0.08) 90%);
  background-size: 220% 100%;
  animation: skeleton 1.3s ease-in-out infinite;
}
@keyframes skeleton { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* =========================================================
   Calendário
   ========================================================= */
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.calendar-nav { display: flex; align-items: center; gap: 6px; }
.calendar-nav h2 { min-width: 180px; text-align: center; font-size: 17px; letter-spacing: -0.01em; }
.calendar-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.calendar-summary div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: rgba(148, 163, 184, 0.05); border: 1px solid var(--border); }
.calendar-summary span { font-size: 11.5px; color: var(--text-muted); }
.calendar-summary strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.calendar-summary .is-danger strong { color: #fca5a5; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays span { font-size: 11.5px; color: var(--text-muted); text-align: center; padding-bottom: 6px; }
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 92px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.cal-cell.is-blank { border-color: transparent; background: none; cursor: default; }
.cal-cell:hover:not(.is-blank) { border-color: var(--border-strong); }
.cal-cell:focus-visible { outline: none; box-shadow: var(--ring); }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.cal-amount { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-chip, .cal-more { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: rgba(148, 163, 184, 0.1); color: var(--text-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dot { display: none; }
.cal-cell.is-today .cal-num { color: var(--primary-ink); background: var(--primary); border-radius: 999px; padding: 0 7px; }
.cal-cell.is-selected { border-color: var(--primary); background: rgba(52, 211, 153, 0.07); }
.cal-cell.tone-open .cal-amount { color: var(--info); }
.cal-cell.tone-today { border-color: rgba(251, 191, 36, 0.45); }
.cal-cell.tone-today .cal-amount { color: var(--warn); }
.cal-cell.tone-overdue { border-color: rgba(248, 113, 113, 0.42); background: rgba(248, 113, 113, 0.06); }
.cal-cell.tone-overdue .cal-amount { color: #fca5a5; }
.cal-cell.tone-paid .cal-num::after { content: ' ✓'; color: var(--primary); }
.calendar-day { position: sticky; top: 16px; }

/* =========================================================
   Avisos de vencimento
   ========================================================= */
.notify { position: relative; }
.notify-btn { position: relative; }
.notify-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
  background: var(--info); color: #071224; border: 2px solid var(--bg);
}
.notify-count.is-danger { background: var(--danger); color: #2b0606; }
.notify-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 16px; border: 1px solid var(--border-strong);
  background: var(--surface); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.notify-panel[hidden] { display: none; }
.notify-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.notify-head strong { display: block; font-size: 14px; }
.notify-head small { color: var(--text-muted); font-size: 12px; }
.notify-list { overflow: auto; padding: 6px 8px; }
.notify-group h3 { display: flex; justify-content: space-between; margin: 10px 8px 4px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.notify-group h3 span { color: var(--text-muted); font-weight: 500; }
.notify-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.notify-item:hover { background: rgba(148, 163, 184, 0.06); }
.notify-open { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.notify-open strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-open span { font-size: 11.5px; color: var(--text-muted); }
.notify-item b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.notify-item.tone-overdue b { color: #fca5a5; }
.notify-item.tone-today b { color: var(--warn); }
.notify-item .btn-xs { padding: 4px 8px; }
.notify-more { margin: 2px 8px 6px; padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: 12px; cursor: pointer; }
.notify-empty { margin: 18px 12px; color: var(--text-muted); font-size: 13px; text-align: center; }
.notify-foot { display: grid; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.notify-foot small { color: var(--text-muted); font-size: 11.5px; }
.notify-foot small:empty { display: none; }

/* =========================================================
   Responsividade
   ========================================================= */
@media (max-width: 1100px) {
  .calendar-layout { grid-template-columns: minmax(0, 1fr); }
  .calendar-day { position: static; }
}
@media (max-width: 640px) {
  .calendar-head { flex-wrap: wrap; }
  .calendar-nav h2 { min-width: 0; flex: 1; font-size: 15px; }
  .calendar-nav { flex: 1; }
  .calendar-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .calendar-summary div { padding: 8px; }
  .calendar-summary strong { font-size: 12.5px; }
  .calendar-weekdays, .calendar-grid { gap: 3px; }
  .cal-cell { min-height: 48px; padding: 5px 4px; align-items: center; border-radius: 9px; }
  .cal-amount, .cal-chips { display: none; }
  .cal-dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--info); }
  .cal-cell.tone-today .cal-dot { background: var(--warn); }
  .cal-cell.tone-overdue .cal-dot { background: var(--danger); }
  .cal-cell.tone-paid .cal-num::after { content: ''; }
  .notify-panel { position: fixed; top: 64px; right: 16px; left: 16px; width: auto; }
  .loader-card { padding: 24px 22px 20px; }
  .loader-mark { width: 80px; height: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-mark { animation: loader-pulse 1.6s ease-in-out infinite alternate; }
  .skeleton, .is-skeleton { animation: none; }
  .loader.is-open { animation: none; }
}
@keyframes loader-pulse { from { opacity: .55; } to { opacity: 1; } }

.notify-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Logo: duas moedas entrelaçadas */
.coins-mark { width: 22px; height: 22px; display: block; overflow: visible; }
.coins-mark path { fill: none; stroke: #05f29b; stroke-width: 2.4; stroke-linecap: butt; }
.loader-mark .coins-mark { width: 60px; height: 60px; }

/* No loading, as moedas se desenham uma depois da outra e giram de leve. */
.coins-mark.is-animated { animation: cm-turn 2.6s cubic-bezier(.65, 0, .35, 1) infinite; }
.coins-mark.is-animated .cm-ring { stroke-dasharray: 30; stroke-dashoffset: 30; animation: cm-draw 2.6s ease-in-out infinite; }
.coins-mark.is-animated .cm-arc { stroke-dasharray: 32; stroke-dashoffset: 32; animation: cm-draw 2.6s ease-in-out .35s infinite; }
@keyframes cm-draw {
  0% { stroke-dashoffset: 30; opacity: 1; }
  40%, 75% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes cm-turn {
  0%, 30% { transform: rotate(0deg); }
  70%, 100% { transform: rotate(-20deg); }
}
@media (max-width: 640px) { .loader-mark .coins-mark { width: 52px; height: 52px; } }
@media (prefers-reduced-motion: reduce) {
  .coins-mark.is-animated, .coins-mark.is-animated path { animation: none; stroke-dashoffset: 0; }
}

/* =========================================================
   Grades sem buraco no fim (larguras intermediárias)
   ========================================================= */
@media (max-width: 1180px) {
  /* 3 indicadores continuam lado a lado até o celular. */
  .kpi-grid.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Faixa de juros e multas (5 itens): o último ímpar ocupa a linha toda. */
  .panel-mora > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  /* Os 3 números do contrato são curtos: ficam em 3 colunas. */
  .loan-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpi-grid.kpi-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .loan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loan-metrics > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Loading: só a animação do ícone, sem cartão nem textos. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.loader { background: rgba(6, 9, 13, 0.55); }
.loader .loader-card { min-width: 0; padding: 0; gap: 0; background: none; border: 0; box-shadow: none; }
.loader .loader-mark { width: 120px; height: 120px; margin: 0; border-radius: 50%; background: radial-gradient(circle, rgba(5, 242, 155, 0.14), rgba(5, 242, 155, 0) 68%); }
.loader .loader-mark .coins-mark { width: 72px; height: 72px; }
@media (max-width: 640px) { .loader .loader-mark .coins-mark { width: 60px; height: 60px; } }

/* Chave Pix (página Textos) */
.pix-panel { margin-bottom: 16px; }
.pix-form { display: grid; grid-template-columns: 170px minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.pix-actions { display: flex; gap: 8px; padding-bottom: 2px; }
.pix-status { font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.pix-status.is-set { border-color: rgba(52, 211, 153, 0.4); color: #6ee7b7; }
@media (max-width: 980px) {
  .pix-form { grid-template-columns: 150px minmax(0, 1fr); }
  .pix-actions { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .pix-form { grid-template-columns: minmax(0, 1fr); }
  .pix-panel .panel-head { flex-wrap: wrap; }
}

/* WhatsApp automático (página Textos) */
.wa-panel { margin-bottom: 16px; }
.wa-body { display: grid; gap: 16px; }
.wa-connect { display: grid; gap: 10px; justify-items: start; }
.wa-qr { display: grid; gap: 8px; justify-items: center; padding: 12px; border-radius: 12px; background: #fff; }
.wa-qr img { display: block; width: 220px; height: 220px; }
.wa-qr small { color: #334155; font-size: 12px; max-width: 220px; text-align: center; }
.wa-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.wa-form .check-field { padding-top: 0; }
.wa-form .pix-actions { grid-column: 1 / -1; }
.pix-status.is-warn { border-color: rgba(251, 191, 36, 0.4); color: #fcd34d; }
.wa-log summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.wa-log-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.wa-log-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.wa-log-list .is-sent { color: #6ee7b7; }
.wa-log-list .is-failed { color: #fca5a5; }
.wa-log-list .is-skipped { color: #fcd34d; }
@media (max-width: 980px) { .wa-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .wa-form { grid-template-columns: minmax(0, 1fr); }
  .wa-panel .panel-head { flex-wrap: wrap; }
}

/* WhatsApp: forma de conexão, código no celular e mensagem de teste */
.wa-modes { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; }
.wa-mode { padding: 6px 14px; border: 0; border-radius: 999px; background: none; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.wa-mode.is-active { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
.wa-pair-phone { width: min(100%, 280px); }
.wa-code { display: grid; gap: 10px; justify-items: start; padding: 14px 16px; border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 12px; }
.wa-code-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 30px; font-weight: 700; letter-spacing: 0.12em; color: #6ee7b7; }
.wa-code ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; color: var(--text-muted); }
.wa-test { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.wa-test h3 { margin: 0; font-size: 15px; }
.wa-test-form { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 12px 16px; align-items: end; }
.wa-test-form .wa-test-text { grid-column: 1 / -1; }

.wa-test-form .check-field { padding-top: 0; }
@media (max-width: 640px) {
  .wa-test-form { grid-template-columns: minmax(0, 1fr); }
  .wa-code-value { font-size: 26px; }
}
.pix-form > .pix-actions { grid-column: 1 / -1; }

/* Mercado Pago (página Textos) */
.mp-panel { margin-bottom: 16px; }
.mp-body { display: grid; gap: 12px; }
.mp-test { display: grid; gap: 10px; justify-items: start; }
.mp-test-code { display: grid; gap: 8px; justify-items: start; width: 100%; }
.mp-test-code code { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 11.5px; word-break: break-all; color: var(--text-muted); }
.mp-paid { color: #6ee7b7; font-weight: 600; }
@media (max-width: 640px) {
  .mp-panel .panel-head { flex-wrap: wrap; }
}
.mp-oauth { display: grid; gap: 6px; justify-items: start; }

/* Falha ao carregar as telas (core/main.js) */
.load-failure { position: fixed; inset: auto 16px 16px; z-index: 1000; display: grid; gap: 8px; justify-items: start; max-width: 420px; margin: 0 auto; padding: 16px; border-radius: 12px; border: 1px solid rgba(248, 113, 113, 0.4); background: #111823; color: var(--text); }
.load-failure span { color: var(--text-muted); font-size: 13px; }
