:root {
  --ba-primary: #673de7;
  --ba-secondary: #efeaff;
  --ba-bg: #f3f4f6;
  --ba-surface: #ffffff;
  --ba-text: #1c1c1f;
  --ba-muted: #6b6b73;
  --ba-success: #1b8a4a;
  --ba-warning: #c4841d;
  --ba-danger: #b42318;
  --ba-radius: 20px;
  --ba-shadow: 0 10px 30px rgba(22, 13, 44, 0.06);
  --ba-font: "Outfit", "Segoe UI", sans-serif;
  --ba-display: "Outfit", "Segoe UI", sans-serif;
  --ba-line: #ececef;
  --ba-line-strong: #dddde3;
  --ba-top: #160d2c;
  --ba-nav: #f7f7f8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ba-bg);
  color: var(--ba-text);
  font-family: var(--ba-font);
  -webkit-font-smoothing: antialiased;
}

body.has-modal { overflow: hidden; }

a { color: inherit; text-decoration: none; }

body.is-auth {
  background: #0b1020;
}

.auth-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background: #0b1020;
}

.auth-video,
.auth-overlay {
  position: absolute;
  inset: 0;
}

.auth-video {
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.auth-overlay {
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 12% 40%, rgba(8, 12, 24, 0.42), transparent 48%),
    linear-gradient(
      90deg,
      rgba(8, 12, 24, 0.58) 0%,
      rgba(8, 12, 24, 0.28) 46%,
      rgba(8, 12, 24, 0.38) 100%
    ),
    linear-gradient(
      180deg,
      rgba(11, 16, 32, 0.22) 0%,
      rgba(11, 16, 32, 0.48) 100%
    );
}

.auth-overlay::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(280px, 42vw);
  height: min(220px, 32vh);
  background: radial-gradient(circle at 100% 100%, rgba(8, 12, 24, 0.96) 0%, rgba(8, 12, 24, 0.55) 42%, transparent 74%);
}

.auth-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 28px 70px rgba(8, 12, 24, 0.28);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.auth-card .brand h1 { color: #fff; }
.auth-card .brand p { color: rgba(255, 255, 255, 0.78); }
.auth-card .field label,
.auth-card .field label:has(+ input[required]),
.auth-card .field label:has(+ select[required]) {
  color: rgba(255, 255, 255, 0.86);
}

.auth-card input,
.auth-card select {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.55);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand > div {
  display: flex;
  align-items: center;
  min-height: 48px;
}

.brand h1 {
  margin: 0;
  font-family: var(--ba-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}

.brand p {
  margin: 4px 0 0;
  color: var(--ba-muted);
  font-size: 0.85rem;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 7px;
  color: #5c5c66;
}
.field label:has(+ input[required]),
.field label:has(+ select[required]),
.field label:has(+ .input-affix input[required]) {
  color: #3a3a42;
}
.field label:has(+ input[required])::after,
.field label:has(+ select[required])::after,
.field label:has(+ .input-affix input[required])::after {
  content: " *";
  color: var(--ba-danger);
  font-weight: 700;
}

.field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-row input { flex: 1; min-width: 0; }
.field-row .btn { width: auto; flex-shrink: 0; white-space: nowrap; }
.sunat-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--ba-muted);
}
.sunat-hint.is-ok { color: var(--ba-success); }
.sunat-hint.is-error { color: var(--ba-danger); }
.sunat-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
}
.sunat-results button {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid #dbe1ef;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}
.sunat-results button:hover { border-color: var(--ba-primary); background: #f8faff; }
.sunat-results strong { font-size: 0.9rem; }
.sunat-results span { color: var(--ba-muted); font-size: 0.8rem; }

.field input, .field select, .field textarea,
.modal input, .modal select, .modal textarea {
  width: 100%;
  border: 1px solid var(--ba-line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  font: inherit;
  background: #fff;
  color: var(--ba-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea, .modal textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.modal input:focus, .modal select:focus, .modal textarea:focus,
.input-affix:focus-within {
  outline: 0;
  border-color: var(--ba-primary);
  box-shadow: 0 0 0 4px rgba(103, 61, 231, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--ba-primary); color: #fff; }
.auth-card .btn-primary { width: 100%; }
.btn-secondary { background: var(--ba-secondary); color: var(--ba-primary); }
.btn-danger { background: var(--ba-danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--ba-primary); }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #fde8e6; color: var(--ba-danger); }
.alert-ok { background: #e7f6ee; color: var(--ba-success); }

.app-frame { min-height: 100vh; background: var(--ba-bg); }
.app-top {
  height: 56px;
  background: transparent;
  color: var(--ba-text);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ba-text);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.app-top-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
.app-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ba-text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.top-icon-btn .ico { width: 18px; height: 18px; }
.bell-wrap { position: relative; }
.bell-modal {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, 86vw);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(22, 13, 44, 0.16);
  border: 1px solid var(--ba-line);
  overflow: hidden;
  z-index: 30;
}
.bell-modal[hidden] { display: none; }
.bell-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  font-size: 0.95rem;
}
.bell-modal-head span { color: var(--ba-muted); font-size: 0.8rem; }
.bell-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  color: var(--ba-text);
}
.bell-item:hover { background: #f7f7f9; }
.bell-item.is-read { opacity: 0.68; }
.bell-item strong, .bell-item small { display: block; }
.bell-item small {
  color: var(--ba-muted);
  font-size: 0.78rem;
  margin-top: 2px;
  line-height: 1.35;
}
.bell-sev {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 6px;
  flex-shrink: 0;
}
.bell-sev-info { background: #6b6b73; }
.bell-sev-warning { background: var(--ba-warning); }
.bell-sev-danger { background: var(--ba-danger); }
.bell-empty {
  margin: 0;
  padding: 18px 16px;
  color: var(--ba-muted);
  font-size: 0.9rem;
}
.bell-footer {
  display: block;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--ba-line);
  color: var(--ba-primary);
  font-weight: 600;
  font-size: 0.88rem;
}
.top-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff5c7a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ba-text);
  place-items: center;
  cursor: pointer;
}
.nav-toggle .ico { width: 20px; height: 20px; }

.app-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: var(--ba-nav);
  color: var(--ba-text);
  padding: 16px 12px 28px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  border-right: 1px solid var(--ba-line);
}

.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16, 12, 32, 0.04);
}
.side-search .ico { width: 16px; height: 16px; color: var(--ba-muted); }
.side-search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
}

.nav-flat { margin-bottom: 8px; }
.nav-group {
  margin-bottom: 6px;
}
.nav-group summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  color: var(--ba-muted);
  font-size: 0.92rem;
  border-radius: 10px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: "▾";
  float: right;
  font-size: 0.7rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #2a2a30;
  font-size: 0.94rem;
}
.nav-link .ico { width: 18px; height: 18px; color: #5c5c66; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.7); }
.nav-link.is-active {
  background: #fff;
  box-shadow: 0 6px 16px rgba(22, 13, 44, 0.08);
  font-weight: 600;
}
.nav-link[hidden] { display: none; }
.side-tenant {
  margin: 22px 12px 0;
  color: var(--ba-muted);
  font-size: 0.75rem;
}

.main { padding: 28px 40px 48px; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 22px; }
.page-title h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.04em; }
.page-title p { margin: 4px 0 0; color: var(--ba-muted); font-size: 0.9rem; }
.page-title-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-chip {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ececef;
  color: var(--ba-text);
  font-size: 0.72rem;
  font-weight: 700;
}

.card {
  background: var(--ba-surface);
  border-radius: var(--ba-radius);
  box-shadow: var(--ba-shadow);
  border: 1px solid var(--ba-line);
  padding: 22px;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat h2 { margin: 0; font-size: 1.8rem; }
.stat p { margin: 6px 0 0; color: var(--ba-muted); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--ba-line);
  font-size: 0.92rem;
}
.table th {
  color: var(--ba-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.table tbody tr:hover { background: #f8faff; }
.table-sub { color: var(--ba-muted); font-size: 0.8rem; margin-top: 2px; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-ok { background: #e7f6ee; color: var(--ba-success); }
.badge-warn { background: #fff4dc; color: var(--ba-warning); }
.badge-danger { background: #fde8e6; color: var(--ba-danger); }
.badge-muted { background: #eef1f7; color: var(--ba-muted); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters .field { margin: 0; min-width: 150px; }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; width: auto; }

.table-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-actions a:not(.btn) { color: var(--ba-primary); font-weight: 600; }

.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-neg { color: var(--ba-danger); }
.money-pos { color: var(--ba-success); }

.empty { text-align: center; padding: 40px 16px; color: var(--ba-muted); }

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: var(--ba-muted);
  font-size: 0.9rem;
}

.card-title {
  margin: 0 0 12px;
  font-family: var(--ba-display);
  font-size: 1.05rem;
}

.readonly-total {
  border: 1px solid var(--ba-line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  background: #f4f1ff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
}

.form-stack { display: grid; gap: 14px; }
.form-section {
  border: 1px solid var(--ba-line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  background: #fafafa;
}
.form-section header { margin-bottom: 12px; }
.form-section header h3 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6b73;
}
.form-section header p {
  margin: 4px 0 0;
  color: var(--ba-muted);
  font-size: 0.8rem;
}
.form-section .grid { gap: 14px 16px; }
.form-section .field { margin-bottom: 0; }
.form-section .field-wide { grid-column: 1 / -1; }
.form-money { align-items: end; }
.input-affix {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ba-line-strong);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.input-affix span {
  display: grid;
  place-items: center;
  padding: 0 10px;
  background: #f3f4f6;
  color: #5c5c66;
  font-size: 0.72rem;
  font-weight: 700;
  border-right: 1px solid var(--ba-line);
}
.input-affix input {
  border: 0;
  border-radius: 0;
  min-height: 40px;
  box-shadow: none;
}

.muted-lead {
  margin: -8px 0 18px;
  color: var(--ba-muted);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  margin: 12px 0 8px;
}

.chart-col { flex: 1; text-align: center; }
.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 130px;
}
.chart-income, .chart-expense {
  width: 10px;
  border-radius: 999px 999px 4px 4px;
  min-height: 8px;
}
.chart-income { background: #2f7d57; }
.chart-expense { background: #b42318; }
.chart-col small { display: block; margin-top: 6px; color: var(--ba-muted); text-transform: capitalize; }

.legend { color: var(--ba-muted); font-size: 0.85rem; }
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin: 0 6px 0 10px;
}
.dot.income { background: #2f7d57; }
.dot.expense { background: #b42318; margin-left: 16px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  color: var(--ba-text);
}
.check input { width: auto; }

.sidebar { overflow-y: auto; max-height: calc(100vh - 56px); }

body.is-sheet-form .main {
  position: relative;
  min-height: calc(100vh - 56px);
}
body.is-sheet-form .alert {
  position: relative;
  z-index: 3;
  margin: 16px 16px 0;
}

.sheet {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 120px);
  padding: 28px 16px 40px;
}
.sheet-backdrop {
  position: absolute;
  inset: -24px -8px -40px;
  background: rgba(16, 12, 32, 0.34);
  backdrop-filter: blur(5px);
  border-radius: 0;
}
.sheet-card {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  max-height: min(88vh, 920px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--ba-surface);
  border: 1px solid var(--ba-line);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(16, 12, 32, 0.22);
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--ba-line);
  flex-shrink: 0;
}
.sheet-body {
  padding: 22px 24px 24px;
  overflow: auto;
}
.sheet-kicker {
  margin: 0 0 4px;
  color: var(--ba-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sheet-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.sheet .modal-actions {
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--ba-surface) 28%);
  padding-top: 16px;
}

.budget-bar {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: #eceef4;
  overflow: hidden;
}
.budget-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ba-primary), color-mix(in srgb, var(--ba-primary) 65%, white));
}

.meta-list { margin: 0; display: grid; gap: 12px; }
.meta-list > div { display: grid; gap: 2px; }
.meta-list dt { color: var(--ba-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.meta-list dd { margin: 0; font-size: 0.95rem; line-height: 1.45; }
.meta-list a { color: var(--ba-primary); font-weight: 600; }

.payment-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(103, 61, 231, 0.06), transparent 55%),
    var(--ba-surface);
}
.payment-hero__main { min-width: 0; }
.payment-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.payment-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef1f7;
  color: #3a3a42;
  font-size: 0.75rem;
  font-weight: 600;
}
.payment-hero__amount {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.payment-hero__meta {
  margin: 8px 0 0;
  color: var(--ba-muted);
  font-size: 0.92rem;
}
.payment-hero__side {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 180px;
  padding-left: 24px;
  border-left: 1px solid var(--ba-line);
}
.payment-hero__side span {
  color: var(--ba-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.payment-hero__side strong {
  font-size: 0.98rem;
  font-weight: 600;
}
.payment-detail { align-items: start; }
.receipt-card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.receipt-card__eyebrow {
  margin: 0 0 4px;
  color: var(--ba-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.receipt-preview {
  border: 1px solid var(--ba-line);
  border-radius: 14px;
  overflow: hidden;
  background: #f7f8fb;
  min-height: 420px;
}
.receipt-preview__frame {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  border: 0;
  background: #fff;
}
.receipt-preview__image-wrap {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 16px;
}
.receipt-preview__image {
  max-width: 100%;
  max-height: min(70vh, 640px);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(16, 12, 32, 0.08);
}
.receipt-preview__empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  color: var(--ba-muted);
  gap: 8px;
}
.receipt-preview__empty a { color: var(--ba-primary); font-weight: 600; }

@media (max-width: 900px) {
  .payment-hero {
    flex-direction: column;
  }
  .payment-hero__side {
    border-left: 0;
    border-top: 1px solid var(--ba-line);
    padding-left: 0;
    padding-top: 16px;
    min-width: 0;
  }
  .receipt-preview,
  .receipt-preview__frame,
  .receipt-preview__image-wrap {
    min-height: 320px;
  }
  .receipt-preview__frame { height: 420px; }
}
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ba-line);
  font-size: 0.92rem;
}
.list-row span { color: var(--ba-muted); white-space: nowrap; }
.empty-inline { color: var(--ba-muted); margin: 0; }

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 12, 32, 0.42);
  backdrop-filter: blur(6px);
}
.modal-dialog {
  position: relative;
  width: min(840px, 100%);
  max-height: min(88vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--ba-surface);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(16, 12, 32, 0.22);
}
.modal-dialog-sm { width: min(520px, 100%); }
.modal-dialog-wide { width: min(920px, 100%); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ba-line);
  flex-shrink: 0;
}
.modal-header h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.03em; }
.modal-x {
  border: 0;
  background: #f3f4f6;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--ba-text);
}
.modal-body {
  padding: 18px 22px 0;
  overflow: auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  margin: 18px -22px 0;
  padding: 14px 22px;
  border-top: 1px solid var(--ba-line);
  background: #fff;
}
.modal .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal .form-money { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal .btn { border-radius: 12px; padding: 10px 16px; }

.ico { width: 18px; height: 18px; display: block; }

.overview {
  width: min(920px, 100%);
  margin: 28px auto 0;
}
.overview-hello {
  margin: 0 0 22px;
  text-align: center;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.05em;
  font-weight: 700;
}
.ask-card {
  background: #fff;
  border-radius: 28px;
  padding: 22px 22px 18px;
  box-shadow: 0 16px 40px rgba(22, 13, 44, 0.06);
}
.ask-box {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ba-line);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fafafa;
}
.ask-box input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font: inherit;
  font-size: 1rem;
}
.ask-box .ico { color: var(--ba-muted); width: 20px; height: 20px; }
.quick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ba-line);
  color: #2a2a30;
  font-size: 0.9rem;
  box-shadow: 0 1px 2px rgba(16,12,32,0.04);
}
.chip .ico { width: 16px; height: 16px; color: #5c5c66; }
.chip:hover { border-color: #cfc8ea; background: #faf8ff; }
.chip[hidden] { display: none; }

.panel-card {
  margin-top: 28px;
  background: #fff;
  border-radius: 24px;
  padding: 8px 8px 16px;
  box-shadow: 0 16px 40px rgba(22, 13, 44, 0.05);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 8px;
}
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-table { width: 100%; border-collapse: collapse; }
.panel-table th, .panel-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f3;
  font-size: 0.92rem;
}
.panel-table th {
  color: var(--ba-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.panel-table tr:last-child td { border-bottom: 0; }
.status-ok {
  color: var(--ba-success);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ghost-btn {
  border: 1px solid var(--ba-line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.85rem;
  color: #2a2a30;
}
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.mini-stat {
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px rgba(22, 13, 44, 0.04);
}
.mini-stat p { margin: 0; color: var(--ba-muted); font-size: 0.8rem; }
.mini-stat h3 { margin: 6px 0 0; font-size: 1.15rem; letter-spacing: -0.03em; }
.pending-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 4px 0;
  color: var(--ba-muted);
  font-size: 0.92rem;
}
.pending-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eee;
  color: #333;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.report-toolbar {
  background: #fff;
  border: 1px solid var(--ba-line);
  border-radius: 20px;
  padding: 18px 20px 16px;
  margin-bottom: 18px;
  box-shadow: 0 10px 28px rgba(22, 13, 44, 0.04);
}
.report-toolbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.report-kicker {
  margin: 0 0 2px;
  color: var(--ba-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.report-toolbar-top strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.period-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--ba-line);
  background: #fff;
  color: #2a2a30;
  font-size: 0.85rem;
}
.period-chip:hover { border-color: #cfc8ea; background: #faf8ff; }
.period-chip.is-on {
  background: #673de7;
  border-color: #673de7;
  color: #fff;
  font-weight: 600;
}
.period-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.period-custom .field { margin: 0; min-width: 160px; }
.report-note { margin: 0; color: var(--ba-muted); font-size: 0.88rem; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.report-card {
  display: block;
  background: #fff;
  border: 1px solid var(--ba-line);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 24px rgba(22, 13, 44, 0.04);
}
.report-card p { margin: 0; color: var(--ba-muted); font-size: 0.82rem; }
.report-card h2 { margin: 8px 0 10px; font-size: 1.2rem; letter-spacing: -0.03em; }
.report-card h2 small { color: var(--ba-muted); font-weight: 500; }
.report-card span { color: #673de7; font-size: 0.8rem; font-weight: 600; }
.report-card:hover { border-color: #d5c9f5; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .nav-toggle { display: grid; }
  .sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 56px;
    z-index: 15;
    width: min(280px, 88vw);
    box-shadow: 20px 0 40px rgba(0,0,0,0.12);
  }
  .sidebar.is-open { display: block; }
  .main { padding: 16px; }
  .overview-stats { grid-template-columns: 1fr 1fr; }
  .modal .grid-3,
  .modal .form-money { grid-template-columns: 1fr; }
}
