:root {
  --ink: #18231f;
  --muted: #67736e;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --canvas: #edf2ef;
  --line: #dfe7e2;
  --brand: #146b4a;
  --brand-strong: #0e543a;
  --brand-soft: #dff2e8;
  --income: #178354;
  --income-soft: #e2f4ea;
  --expense: #c55042;
  --expense-soft: #fae8e5;
  --warning: #a76b13;
  --warning-soft: #fff1d7;
  --shadow: 0 18px 50px rgba(28, 46, 38, 0.08);
  --shadow-sm: 0 8px 24px rgba(28, 46, 38, 0.06);
  --radius: 20px;
  --radius-sm: 14px;
}

[data-theme="dark"] {
  --ink: #eef5f1;
  --muted: #a2b0a9;
  --surface: #18221e;
  --surface-soft: #202c27;
  --canvas: #101713;
  --line: #2d3b34;
  --brand: #61c696;
  --brand-strong: #89d9af;
  --brand-soft: #1f3e30;
  --income: #6bd0a0;
  --income-soft: #203b2e;
  --expense: #f08e81;
  --expense-soft: #432b28;
  --warning: #e9ba66;
  --warning-soft: #3d3423;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.min-w-0 { min-width: 0; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  width: 260px;
  flex-direction: column;
  padding: 28px 20px 22px;
  background: #113c2d;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px 38px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  background: rgba(255,255,255,.11);
  font-size: 1.05rem;
}

.brand strong { display: block; font-size: .96rem; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 2px; color: rgba(255,255,255,.58); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }

.side-label {
  margin: 0 12px 10px;
  color: rgba(255,255,255,.42);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.side-nav { display: grid; gap: 7px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  border-radius: 12px;
  color: rgba(255,255,255,.7);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.side-link i { width: 20px; text-align: center; }
.side-link:hover { color: #fff; transform: translateX(2px); }
.side-link.active { background: rgba(255,255,255,.12); color: #fff; }

.sidebar-footer { margin-top: auto; }

.admin-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
}

.admin-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 11px;
  background: #d6f1e4;
  color: #146b4a;
}

.admin-chip strong { display: block; font-size: .78rem; }
.admin-chip span { display: block; color: rgba(255,255,255,.5); font-size: .67rem; }

.sidebar-action {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.62);
  font-size: .78rem;
  font-weight: 650;
  text-decoration: none;
}

.sidebar-action:hover { color: #fff; }

.main-shell { min-height: 100vh; margin-left: 260px; }

.topbar {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-kicker { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.topbar-title { margin: 2px 0 0; color: var(--ink); font-size: 1rem; font-weight: 800; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.icon-button:hover { color: var(--brand); }

.session-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
}

.session-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--income); box-shadow: 0 0 0 4px var(--income-soft); }

.content-wrap { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 34px 0 64px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--brand); font-size: .71rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -.05em; }
.page-heading p { max-width: 620px; margin: 8px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.65; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-pad { padding: 24px; }
.panel-title { margin: 0; font-size: .95rem; font-weight: 800; letter-spacing: -.025em; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); font-size: .76rem; }

.btn { border-radius: 12px; font-size: .82rem; font-weight: 750; }
.btn-brand { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { border-color: var(--brand-strong); background: var(--brand-strong); color: #fff; }
.btn-soft { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-soft:hover { border-color: var(--brand); color: var(--brand); }

.hero-balance {
  position: relative;
  overflow: hidden;
  min-height: 242px;
  padding: 32px;
  border: 0;
  background: linear-gradient(135deg, #124632 0%, #0d3727 100%);
  color: #fff;
  box-shadow: 0 20px 50px rgba(15, 60, 43, .2);
}

.hero-balance::after {
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 270px;
  height: 270px;
  border: 46px solid rgba(255,255,255,.055);
  border-radius: 50%;
  content: "";
}

.hero-top { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 20px; }
.hero-label { color: rgba(255,255,255,.62); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero-amount { position: relative; z-index: 1; margin: 14px 0 26px; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.06em; }
.health-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); font-size: .71rem; font-weight: 750; }
.health-pill i { font-size: .55rem; color: #8ee2b5; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 10px; }
.hero-actions .btn { padding: 11px 15px; }
.hero-actions .btn-light { color: #134733; }
.hero-actions .btn-outline-light { border-color: rgba(255,255,255,.26); color: #fff; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 22px; }
.stack { display: grid; gap: 22px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.metric-card { padding: 20px; }
.metric-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.metric-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 12px; }
.metric-icon.income { background: var(--income-soft); color: var(--income); }
.metric-icon.expense { background: var(--expense-soft); color: var(--expense); }
.metric-card small { color: var(--muted); font-size: .7rem; font-weight: 700; }
.metric-value { margin-top: 6px; color: var(--ink); font-size: 1.2rem; font-weight: 800; letter-spacing: -.035em; }

.analysis-list { display: grid; gap: 22px; margin-top: 26px; }
.analysis-row-head { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: .76rem; font-weight: 700; }
.analysis-row-head span:first-child { color: var(--muted); }
.clean-progress { overflow: hidden; height: 8px; border-radius: 999px; background: var(--surface-soft); }
.clean-progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.clean-progress.expense span { background: var(--expense); }
.insight { display: flex; gap: 11px; margin-top: 22px; padding: 13px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-strong); font-size: .75rem; font-weight: 650; line-height: 1.5; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.text-link { color: var(--brand); font-size: .74rem; font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.transaction-list { display: grid; gap: 10px; }
.transaction-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.transaction-row:last-child { border-bottom: 0; padding-bottom: 0; }
.transaction-row:first-child { padding-top: 0; }
.transaction-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; }
.transaction-icon.income { background: var(--income-soft); color: var(--income); }
.transaction-icon.expense { background: var(--expense-soft); color: var(--expense); }
.transaction-name { overflow: hidden; margin: 0; font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.transaction-meta { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.transaction-amount { font-size: .8rem; font-weight: 800; white-space: nowrap; }
.transaction-amount.income { color: var(--income); }
.transaction-amount.expense { color: var(--expense); }

.empty-state { padding: 48px 24px; text-align: center; }
.empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 16px; place-items: center; border-radius: 18px; background: var(--surface-soft); color: var(--muted); font-size: 1.2rem; }
.empty-state h3 { margin: 0; font-size: .95rem; font-weight: 800; }
.empty-state p { margin: 7px auto 0; color: var(--muted); font-size: .78rem; }

.form-panel { padding: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-span { grid-column: 1 / -1; }
.form-label { margin-bottom: 8px; color: var(--ink); font-size: .73rem; font-weight: 800; }
.form-hint { margin-top: 7px; color: var(--muted); font-size: .68rem; }
.form-control, .form-select, .input-group-text {
  min-height: 48px;
  border-color: var(--line);
  border-radius: 12px;
  background-color: var(--surface-soft);
  color: var(--ink);
  font-size: .83rem;
}
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.form-control:focus, .form-select:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); color: var(--ink); }
.input-group > .input-group-text { border-radius: 12px 0 0 12px; color: var(--muted); font-weight: 800; }
.input-group > .form-control { border-radius: 0 12px 12px 0; }

.type-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 6px; border-radius: 14px; background: var(--surface-soft); }
.type-switch input { position: absolute; opacity: 0; pointer-events: none; }
.type-switch label { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 800; }
.type-switch input:checked + label[for="typeIN"] { background: var(--income-soft); color: var(--income); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.type-switch input:checked + label[for="typeOUT"] { background: var(--expense-soft); color: var(--expense); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.category-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.category-suggestion { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .67rem; font-weight: 750; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.category-suggestion:hover, .category-suggestion.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.category-suggestion:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent); outline-offset: 2px; }

.upload-zone {
  position: relative;
  padding: 26px;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: 16px;
  background: var(--surface-soft);
  text-align: center;
  transition: border-color .18s ease, background .18s ease;
}
.upload-zone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.upload-glyph { display: grid; width: 46px; height: 46px; margin: 0 auto 12px; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.upload-zone strong { display: block; font-size: .8rem; }
.upload-zone span { display: block; margin-top: 5px; color: var(--muted); font-size: .69rem; }
.preview-grid { position: relative; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.preview-card { position: relative; overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.preview-card img { width: 100%; height: 100%; object-fit: cover; }
.preview-card button { position: absolute; top: 5px; right: 5px; display: grid; width: 24px; height: 24px; place-items: center; border: 0; border-radius: 50%; background: rgba(20,28,24,.78); color: #fff; font-size: .65rem; }

.submit-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.submit-row .btn { min-height: 46px; padding-inline: 20px; }

.status-card { max-width: 620px; margin: 80px auto 0; padding: 44px; text-align: center; }
.status-icon { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; place-items: center; border-radius: 20px; background: var(--brand-soft); color: var(--brand); font-size: 1.35rem; }
.status-card h2 { font-size: 1.15rem; font-weight: 800; }
.status-card p { color: var(--muted); font-size: .78rem; }

.filter-panel { padding: 18px; margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: minmax(190px, 1.15fr) minmax(170px, .8fr) repeat(2, minmax(145px, .7fr)) auto; gap: 10px; align-items: end; }
.filter-panel .form-label { margin-bottom: 6px; }
.filter-panel .form-control { min-height: 43px; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { min-height: 43px; }
.period-summary { margin-bottom: 18px; padding: 20px; }
.period-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.period-range { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .68rem; font-weight: 750; white-space: nowrap; }
.period-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.period-metric { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.period-metric > span:last-child { min-width: 0; }
.period-metric-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 12px; }
.period-metric small { display: block; color: var(--muted); font-size: .65rem; font-weight: 700; }
.period-metric strong { display: block; margin-top: 4px; font-size: clamp(.86rem, 1.6vw, 1.05rem); font-weight: 850; line-height: 1.25; letter-spacing: -.03em; overflow-wrap: anywhere; }
.period-metric.income .period-metric-icon { background: var(--income-soft); color: var(--income); }
.period-metric.income strong { color: var(--income); }
.period-metric.expense .period-metric-icon { background: var(--expense-soft); color: var(--expense); }
.period-metric.expense strong { color: var(--expense); }
.period-metric.balance .period-metric-icon { background: var(--brand-soft); color: var(--brand); }
.period-metric.balance strong { color: var(--brand); }
.period-metric.balance.negative .period-metric-icon { background: var(--expense-soft); color: var(--expense); }
.period-metric.balance.negative strong { color: var(--expense); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-chip { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .71rem; font-weight: 800; text-decoration: none; }
.filter-chip.active { border-color: var(--brand); background: var(--brand); color: #fff; }

.history-panel { overflow: hidden; }
.history-head { display: grid; grid-template-columns: minmax(0, 1.4fr) .8fr .8fr .7fr; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.history-item { display: grid; width: 100%; grid-template-columns: minmax(0, 1.4fr) .8fr .8fr .7fr; gap: 12px; align-items: center; padding: 15px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: var(--surface-soft); }
.history-contact { display: flex; min-width: 0; align-items: center; gap: 11px; }
.history-contact .transaction-icon { width: 38px; height: 38px; flex: 0 0 38px; }
.history-name { overflow: hidden; font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.history-description { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.history-category { align-items: center; gap: 5px; max-width: 100%; margin-top: 6px; padding: 5px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: .61rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.history-date, .history-proof { color: var(--muted); font-size: .71rem; font-weight: 650; }
.proof-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .65rem; font-weight: 800; }

.modal-content { border: 0; background: var(--surface); color: var(--ink); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-size: 1rem; font-weight: 800; }
.btn-close { filter: none; }
[data-theme="dark"] .btn-close { filter: invert(1); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); min-height: 510px; }
.receipt-gallery { min-width: 0; min-height: 440px; padding: 20px; background: var(--surface-soft); }
.receipt-carousel { position: relative; overflow: hidden; height: 100%; min-height: 440px; border: 1px solid var(--line); border-radius: 16px; background: #0c1511; }
.receipt-carousel .carousel-inner, .receipt-carousel .carousel-item { height: 100%; min-height: 440px; }
.receipt-slide { display: flex; width: 100%; height: 100%; min-height: 440px; align-items: center; justify-content: center; padding: 18px; }
.receipt-slide img { display: block; width: 100%; height: 100%; max-height: 520px; object-fit: contain; }
.receipt-carousel .carousel-control-prev, .receipt-carousel .carousel-control-next { width: 15%; opacity: .95; }
.receipt-carousel .carousel-control-prev-icon, .receipt-carousel .carousel-control-next-icon { width: 40px; height: 40px; border-radius: 50%; background-color: rgba(8, 16, 12, .62); background-size: 45%; }
.receipt-carousel .carousel-indicators { margin-bottom: 14px; }
.receipt-carousel .carousel-indicators [data-bs-target] { width: 7px; height: 7px; border: 0; border-radius: 50%; }
.receipt-count { position: absolute; top: 14px; right: 14px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: rgba(8, 16, 12, .7); color: #fff; font-size: .65rem; font-weight: 800; backdrop-filter: blur(8px); }
.detail-copy { min-width: 0; padding: 28px; }
.detail-amount { margin: 10px 0 28px; font-size: 2rem; font-weight: 850; line-height: 1.15; letter-spacing: -.05em; overflow-wrap: anywhere; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-line { display: grid; grid-template-columns: 100px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.detail-line dt { color: var(--muted); font-size: .7rem; font-weight: 700; }
.detail-line dd { margin: 0; font-size: .75rem; font-weight: 750; line-height: 1.5; }

.contacts-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 22px; align-items: start; }
.contact-form { position: sticky; top: 22px; padding: 24px; }
.contact-list-panel { padding: 10px 22px; }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-row:last-child { border-bottom: 0; }
.contact-person { display: flex; min-width: 0; align-items: center; gap: 12px; }
.contact-avatar { display: grid; width: 41px; height: 41px; flex: 0 0 41px; place-items: center; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 850; text-transform: uppercase; }
.contact-name { overflow: hidden; font-size: .8rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.contact-phone { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.whatsapp-link { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 11px; background: var(--income-soft); color: var(--income); text-decoration: none; }

.login-page { background: #0f392a; }
.login-page .sidebar, .login-page .topbar, .login-page .mobile-nav { display: none; }
.login-page .main-shell { margin-left: 0; }
.login-page .content-wrap { display: grid; width: 100%; min-height: 100vh; padding: 0; place-items: center; }
.login-shell { display: grid; width: min(920px, calc(100% - 34px)); grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.login-intro { position: relative; overflow: hidden; padding: 54px; background: linear-gradient(145deg, #174f3a, #0e3124); color: #fff; }
.login-intro::after { position: absolute; right: -100px; bottom: -130px; width: 330px; height: 330px; border: 55px solid rgba(255,255,255,.05); border-radius: 50%; content: ""; }
.login-brand { display: flex; align-items: center; gap: 11px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.login-brand .brand-mark { width: 38px; height: 38px; }
.login-intro h1 { position: relative; z-index: 1; max-width: 380px; margin: 90px 0 16px; font-size: 2.45rem; font-weight: 800; letter-spacing: -.055em; line-height: 1.08; }
.login-intro p { position: relative; z-index: 1; max-width: 360px; margin: 0; color: rgba(255,255,255,.65); font-size: .83rem; line-height: 1.7; }
.login-form { padding: 54px 48px; }
.login-form h2 { margin: 36px 0 8px; font-size: 1.6rem; font-weight: 800; letter-spacing: -.04em; }
.login-form > p { margin-bottom: 30px; color: var(--muted); font-size: .78rem; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 46px; }
.password-toggle { position: absolute; top: 50%; right: 9px; z-index: 2; width: 34px; height: 34px; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); }

.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 1090; width: min(360px, calc(100vw - 36px)); }
.alert { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: .76rem; }

.mobile-nav { display: none; }
.d-none { display: none !important; }

@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .main-shell { margin-left: 0; }
  .topbar { padding: 0 22px; }
  .content-wrap { width: min(100% - 36px, 820px); padding-bottom: 108px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .contacts-layout { grid-template-columns: 1fr; }
  .contact-form { position: static; }
  .mobile-nav {
    position: fixed;
    right: 14px;
    bottom: 12px;
    left: 14px;
    z-index: 1040;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 14px 40px rgba(20,38,30,.18);
    backdrop-filter: blur(18px);
  }
  .mobile-link { display: flex; min-height: 48px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 12px; color: var(--muted); font-size: .6rem; font-weight: 800; text-decoration: none; }
  .mobile-link i { font-size: .9rem; }
  .mobile-link.active { background: var(--brand-soft); color: var(--brand); }
  .detail-layout { grid-template-columns: 1fr; }
  .receipt-gallery { min-height: 360px; }
  .receipt-carousel, .receipt-carousel .carousel-inner, .receipt-carousel .carousel-item, .receipt-slide { min-height: 360px; }
}

@media (max-width: 767.98px) {
  .topbar { min-height: 68px; }
  .session-badge { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .hero-balance { min-height: 226px; padding: 25px; }
  .hero-top { align-items: flex-start; flex-direction: column; gap: 10px; }
  .hero-amount { margin: 12px 0 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
  .preview-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid > :first-child { grid-column: 1 / -1; }
  .filter-grid > :nth-child(2) { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .filter-actions .btn:first-child { flex: 1; }
  .period-summary-head { flex-direction: column; }
  .period-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-metric.balance { grid-column: 1 / -1; }
  .history-head { display: none; }
  .history-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  #transactionList { display: grid; gap: 12px; }
  .history-item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "contact proof"
      "amount amount"
      "date date";
    gap: 8px 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  .history-item:last-child { border-bottom: 1px solid var(--line); }
  .history-contact { grid-area: contact; align-items: flex-start; }
  .history-name { padding-top: 1px; font-size: .82rem; }
  .history-description { display: -webkit-box !important; overflow: hidden; white-space: normal; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .history-item > .transaction-amount { grid-area: amount; justify-self: start; padding-left: 49px; font-size: 1rem; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
  .history-date { grid-area: date; padding-left: 49px; }
  .history-proof { grid-area: proof; align-self: start; justify-self: end; white-space: nowrap; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .login-form { padding: 42px 28px; }
  .login-form h2 { margin-top: 8px; }
}

@media (max-width: 479.98px) {
  .content-wrap { width: calc(100% - 28px); padding-top: 24px; }
  .topbar { padding-inline: 16px; }
  .page-heading > .btn { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .panel-pad, .form-panel { padding: 20px; }
  .preview-grid { display: flex; overflow-x: auto; gap: 10px; padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
  .preview-card { width: 132px; flex: 0 0 132px; scroll-snap-align: start; }
  .submit-row { align-items: stretch; flex-direction: column-reverse; }
  .submit-row .btn { width: 100%; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-grid > :first-child, .filter-grid > :nth-child(2), .filter-actions { grid-column: auto; }
  .period-metrics { grid-template-columns: 1fr; }
  .period-metric.balance { grid-column: auto; }
  .period-range { width: 100%; justify-content: center; white-space: normal; text-align: center; }
  .receipt-gallery { min-height: 310px; padding: 0; }
  .receipt-carousel { border-width: 0; border-radius: 0; }
  .receipt-carousel, .receipt-carousel .carousel-inner, .receipt-carousel .carousel-item, .receipt-slide { min-height: 310px; }
  .receipt-slide { padding: 12px; }
  .receipt-slide img { max-height: 390px; }
  .receipt-carousel .carousel-control-prev-icon, .receipt-carousel .carousel-control-next-icon { width: 36px; height: 36px; }
  .detail-copy { padding: 22px; }
  .detail-amount { font-size: clamp(1.45rem, 8vw, 2rem); }
  .detail-line { grid-template-columns: 84px 1fr; }
}

@media (max-width: 359.98px) {
  .history-item { grid-template-areas: "contact contact" "proof proof" "amount amount" "date date"; }
  .history-proof { justify-self: start; padding-left: 49px; }
  .proof-pill { padding: 5px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
