/* AdminPortal shared stylesheet — ported from MerchantPortal's design
   system (welcome.css / terminal.css) so both portals look and behave
   the same way. Nav markup/behavior (brand-bar, menu-bar, dropdown-panel,
   click-toggle via common.js) is copied as-is; generic components below
   (cards, tables, forms, flashes) are restyled with the same tokens so
   existing AdminPortal pages don't need their markup touched. */

:root {
  --brand:       #1a56db;
  --brand-dark:  #1340b0;
  --brand-light: #e8effe;
  --surface:     #ffffff;
  --bg:          #eef2ff;
  --text:        #0f172a;
  --muted:       #64748b;
  --border:      #cbd5e1;
  --green:       #10b981;
  --green-light: #d1fae5;
  --red:         #ef4444;
  --red-light:   #fee2e2;
  --input-bg:    #f8fafc;
  --amber:       #f59e0b;
  --amber-light: #fef3c7;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 65% 50% at 80% 15%, rgba(110,231,183,0.28) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 10% 85%, rgba(147,197,253,0.22) 0%, transparent 60%);
}

/* ---------- Brand bar + Menu bar (top navigation) ---------- */

.brand-bar {
  position: relative; z-index: 200;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.brand-link {
  font-weight: 700; font-size: 1rem; color: var(--brand);
  text-decoration: none; display: flex; align-items: center; gap: 0.6rem;
}
.brand-link svg { width: 18px; height: 18px; fill: var(--brand); flex-shrink: 0; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-text { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-left: 0.75rem; border-left: 1px solid var(--border); }
.nav-user {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--muted);
}
.nav-user svg { width: 15px; height: 15px; fill: var(--muted); }

.menu-bar {
  position: relative; z-index: 190;
  background: var(--brand);
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  padding: 0 0.75rem;
  min-height: 44px;
}

.menu-nav {
  display: flex;
  align-items: stretch;
  list-style: none;
  margin: 0; padding: 0;
  flex: 1;
}

.menu-nav .nav-item {
  position: relative;
  display: flex;
  align-items: stretch;
}

.menu-nav .nav-link {
  display: flex; align-items: center; gap: 0.35rem;
  color: rgba(255,255,255,0.88);
  font-size: 0.855rem; font-weight: 500;
  padding: 0 1rem;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  cursor: pointer;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.menu-nav .nav-link svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.menu-nav .nav-link:hover,
.menu-nav .nav-link:focus {
  color: #fff;
  background: rgba(255,255,255,0.10);
  outline: none;
}
.menu-nav .nav-link.active,
.menu-nav .nav-link.open {
  color: #fff;
  background: rgba(0,0,0,0.15);
  border-bottom-color: rgba(255,255,255,0.7);
}

.chevron { width: 10px; height: 10px; fill: currentColor; transition: transform 0.2s; margin-left: 2px; }
.nav-link.open .chevron { transform: rotate(180deg); }

.dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.13);
  padding: 0.35rem 0;
  z-index: 500;
}
.dropdown-panel.show { display: block; }
.dropdown-panel a {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.855rem; color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.dropdown-panel a svg { width: 14px; height: 14px; fill: var(--muted); flex-shrink: 0; }
.dropdown-panel a:hover { background: var(--brand-light); color: var(--brand); }
.dropdown-panel a:hover svg { fill: var(--brand); }
.dropdown-panel hr { margin: 0.25rem 0; border: none; border-top: 1px solid #f1f5f9; }

.menu-nav.ms-auto { flex: 0 0 auto; margin-left: auto !important; }
.dd-flex-center { align-items: center; display: flex; }
.btn-signout-nav {
  display: flex; align-items: center; gap: 0.4rem;
  color: rgba(255,255,255,0.78);
  font-size: 0.8rem; font-weight: 500;
  padding: 0 0.9rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 7px;
  margin: 7px 0 7px 4px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-signout-nav svg { width: 14px; height: 14px; fill: currentColor; }
.btn-signout-nav:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ---------- Page shell ---------- */

.main-wrap { position: relative; z-index: 1; flex: 1; padding: 2rem 1.5rem 3rem; }
.page-container { max-width: 1200px; margin: 0 auto; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.4rem; }
.page-header h1 { font-weight: 700; font-size: 1.4rem; color: var(--text); margin: 0; letter-spacing: -0.02em; }

/* ---------- Generic components used across AdminPortal pages ---------- */

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 20px rgba(15,23,42,0.06); }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.88rem; }
th { background: #f8fafc; font-weight: 700; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.btn { display: inline-block; padding: 0.6rem 1.1rem; background: var(--brand); color: #fff; border: none; border-radius: 10px; text-decoration: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: background 0.2s, box-shadow 0.2s, transform 0.1s; }
.btn:hover { background: var(--brand-dark); box-shadow: 0 4px 14px rgba(26,86,219,0.28); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #f1f5f9; color: var(--text); }
.btn.secondary:hover { background: #e2e8f0; box-shadow: none; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #dc2626; box-shadow: 0 4px 14px rgba(239,68,68,0.28); }
.btn.warn { background: #b8860b; }

.card { background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px; padding: 1.3rem 1.5rem; box-shadow: 0 4px 20px rgba(15,23,42,0.06); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.cards .num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.cards .label { font-size: 0.8rem; color: var(--muted); }

form.stacked label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0.7rem 0 0.35rem; }
form.stacked input, form.stacked select { width: 100%; padding: 0.62rem 0.85rem; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.9rem; background: var(--input-bg); color: var(--text); font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; }
form.stacked input:focus, form.stacked select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background: #fff; }

.flash { padding: 0.7rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.88rem; font-weight: 600; }
.flash.ok { background: var(--green-light); color: #065f46; }
.flash.error { background: var(--red-light); color: #991b1b; }
.alert-error { display: flex; align-items: center; gap: 0.5rem; background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; border-radius: 10px; font-size: 0.82rem; padding: 0.7rem 0.9rem; margin-bottom: 1.2rem; }
.alert-error svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }

.actions-row { margin-bottom: 1rem; }

.status-pill { display: inline-block; padding: 0.28rem 0.75rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; }
.status-pill.active { background: var(--green-light); color: #065f46; }
.status-pill.inactive { background: var(--red-light); color: #991b1b; }

.org-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--brand-light); color: var(--brand);
  border-radius: 8px; font-size: 0.72rem; font-weight: 600;
  padding: 0.28rem 0.75rem;
}
.org-badge svg { width: 12px; height: 12px; fill: var(--brand); }

/* ---------- Selector card (Terminal's Organization/Merchant picker) ---------- */

.selector-card { background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px; box-shadow: 0 4px 20px rgba(15,23,42,0.07); padding: 1.4rem 1.6rem; margin-bottom: 1.4rem; }
.selector-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; display: block; }
.select-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.plain-select { flex: 1; min-width: 200px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--input-bg); color: var(--text); font-size: 0.9rem; font-family: inherit; padding: 0.65rem 2.4rem 0.65rem 1rem; outline: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.85rem center; transition: border-color 0.2s, box-shadow 0.2s; }
.plain-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background-color: #fff; }
.plain-select:disabled { opacity: 0.55; }
.btn-load { background: var(--brand); color: #fff; border: none; border-radius: 10px; font-weight: 600; font-size: 0.88rem; padding: 0.68rem 1.4rem; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; white-space: nowrap; transition: background 0.2s, box-shadow 0.2s, transform 0.1s; }
.btn-load:hover { background: var(--brand-dark); box-shadow: 0 4px 14px rgba(26,86,219,0.28); }
.btn-load:active { transform: scale(0.98); }
.btn-load svg { width: 15px; height: 15px; fill: #fff; }

.no-merchant { background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px; box-shadow: 0 4px 20px rgba(15,23,42,0.06); padding: 4rem 1rem; text-align: center; color: var(--muted); }
.no-merchant svg { width: 44px; height: 44px; fill: #cbd5e1; margin-bottom: 0.9rem; display: block; margin-left: auto; margin-right: auto; }
.no-merchant h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin: 0 0 0.35rem; }
.no-merchant p { font-size: 0.82rem; margin: 0; }

/* ---------- Form card (Terminal's sectioned form) ---------- */

.form-card { background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px; box-shadow: 0 4px 20px rgba(15,23,42,0.07); overflow: hidden; }
.section-header { background: #f8fafc; border-bottom: 1px solid var(--border); padding: 0.8rem 1.6rem; display: flex; align-items: center; gap: 0.55rem; }
.section-header svg { width: 14px; height: 14px; fill: var(--brand); flex-shrink: 0; }
.section-header span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.section-header .opt { font-weight: 400; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.section-body { padding: 1.3rem 1.6rem; }
.section-divider { border: none; border-top: 1px solid #f1f5f9; margin: 0; }

.field-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem 1.2rem; }
@media (max-width: 900px) { .field-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.field label .req { color: var(--red); margin-left: 2px; }
.field input, .field select { border: 1.5px solid var(--border); border-radius: 9px; background: var(--input-bg); color: var(--text); font-size: 0.88rem; font-family: inherit; padding: 0.58rem 0.9rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background: #fff; }
.field input.prefilled { background: #f0f4ff; color: var(--brand); font-weight: 600; border-color: #c3d4f7; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.2rem; }
.field .hint { font-size: 0.67rem; color: var(--muted); margin-top: 0.1rem; }
.field-span2 { grid-column: span 2; }
.field-span4 { grid-column: 1 / -1; }
.field input.mono-wide { font-family: 'Consolas','Courier New',monospace; font-size: 0.8rem; letter-spacing: 0.01em; }

.btn-submit-wrap { padding: 1.2rem 1.6rem; border-top: 1px solid #f1f5f9; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn-submit { background: linear-gradient(135deg, var(--brand) 0%, #2563eb 100%); color: #fff; border: none; border-radius: 10px; font-weight: 700; font-size: 0.92rem; padding: 0.75rem 2rem; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; box-shadow: 0 4px 14px rgba(26,86,219,0.3); transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s; }
.btn-submit svg { width: 16px; height: 16px; fill: #fff; }
.btn-submit:hover { opacity: 0.92; box-shadow: 0 6px 20px rgba(26,86,219,0.4); }
.btn-submit:active { transform: scale(0.98); }
.btn-reset { background: transparent; color: var(--muted); border: 1.5px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 0.88rem; padding: 0.72rem 1.2rem; display: flex; align-items: center; gap: 0.4rem; cursor: pointer; transition: background 0.15s, color 0.15s; }
.btn-reset svg { width: 14px; height: 14px; fill: currentColor; }
.btn-reset:hover { background: #f1f5f9; color: var(--text); }

.page-footer { position: relative; z-index: 1; text-align: center; font-size: 0.7rem; color: #94a3b8; padding: 1rem; }

@media (max-width: 600px) { .selector-card, .section-body { padding: 1rem; } .btn-submit-wrap { padding: 1rem; } }

/* ---------- Login page ---------- */

.top-bar {
  position: relative; z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; font-size: 1rem; color: var(--brand); text-decoration: none; display: flex; align-items: center; gap: 0.6rem; }
.brand svg { width: 18px; height: 18px; fill: var(--brand); flex-shrink: 0; }
.secure-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; color: var(--muted);
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 20px; padding: 0.25rem 0.7rem;
}
.secure-badge svg { width: 12px; height: 12px; fill: var(--green); }

.login-card {
  background: var(--surface);
  border: 1px solid #dde3f0;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(15,23,42,0.10), 0 1px 4px rgba(15,23,42,0.05);
  width: 100%;
  max-width: 440px;
  padding: 2.5rem 2.5rem 2rem;
}
@media (max-width: 500px) { .login-card { padding: 1.8rem 1.4rem 1.6rem; border-radius: 16px; } }

.login-logo { height: 44px; width: auto; margin-bottom: 1.2rem; }

.card-title    { font-weight: 700; font-size: 1.7rem; color: var(--text); margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.card-subtitle { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.8rem; }

.field-label {
  display: block;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.4rem;
}
.input-wrap { position: relative; display: flex; align-items: stretch; }
.input-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: #94a3b8; pointer-events: none; z-index: 2; }
.field-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field-input.has-toggle { padding-right: 2.8rem; }
.field-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background: #fff; }

.btn-eye { position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 0; cursor: pointer; color: #94a3b8; display: flex; align-items: center; transition: color 0.2s; z-index: 2; }
.btn-eye:hover { color: var(--brand); }
.btn-eye svg { width: 18px; height: 18px; fill: currentColor; }

.btn-signin {
  width: 100%; margin-top: 0.5rem;
  background: var(--brand); color: #fff;
  border: none; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem;
  padding: 0.78rem 1rem;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.btn-signin svg { width: 18px; height: 18px; fill: #fff; }
.btn-signin:hover { background: var(--brand-dark); box-shadow: 0 4px 18px rgba(26,86,219,0.3); }
.btn-signin:active { transform: scale(0.98); }

.card-foot {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  text-align: center; font-size: 0.72rem; color: #94a3b8;
  margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid #f1f5f9;
}
.card-foot svg { width: 14px; height: 14px; fill: var(--green); }

.mb-3 { margin-bottom: 1rem; }
.hidden { display: none; }

/* Chargeback: pick-one modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-backdrop.hidden { display: none; }
.modal-box { background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(15,23,42,0.35); width: 100%; max-width: 900px; max-height: 85vh; overflow: auto; padding: 1.3rem 1.5rem; }
.modal-box h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.modal-box p.sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.85rem; }
.modal-box table { margin-bottom: 1rem; }
.modal-box form { display: inline; margin: 0; }
.modal-box .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Analytics (ported from MerchantPortal analytics_overview.css) */
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* Selector + period bar */
.controls-bar {
  background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15,23,42,0.07); padding: 1.1rem 1.6rem;
  margin-bottom: 1.4rem; display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap;
  animation: fadeUp 0.4s cubic-bezier(0.16,1,0.3,1) both;
}
.ctrl-group { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 200px; }
.ctrl-label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ctrl-select {
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--input-bg); color: var(--text);
  font-size: 0.88rem; font-family: inherit;
  padding: 0.6rem 2.2rem 0.6rem 0.9rem; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ctrl-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background-color: #fff; }
.btn-apply {
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  font-weight: 600; font-size: 0.88rem; padding: 0.62rem 1.4rem;
  display: flex; align-items: center; gap: 0.4rem; cursor: pointer; white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.btn-apply svg { width: 14px; height: 14px; fill: #fff; }
.btn-apply:hover  { background: var(--brand-dark); box-shadow: 0 4px 14px rgba(26,86,219,0.28); }
.btn-apply:active { transform: scale(0.98); }

/* KPI cards grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.4rem;
}
.kpi-card {
  background: var(--surface); border: 1px solid #dde3f0; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(15,23,42,0.06); padding: 0.85rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  animation: fadeUp 0.45s cubic-bezier(0.16,1,0.3,1) both;
}
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.30s; }
.kpi-card:nth-child(7) { animation-delay: 0.35s; }
.kpi-card:nth-child(8) { animation-delay: 0.40s; }
.kpi-icon {
  width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 0.15rem;
}
.kpi-icon svg { width: 13px; height: 13px; fill: currentColor; }
.kpi-icon.blue   { background: var(--brand-light); color: var(--brand); }
.kpi-icon.green  { background: var(--green-light); color: #065f46; }
.kpi-icon.red    { background: var(--red-light);   color: #991b1b; }
.kpi-icon.amber  { background: var(--amber-light); color: #92400e; }
.kpi-icon.purple { background: #ede9fe; color: #5b21b6; }
.kpi-icon.teal   { background: #ccfbf1; color: #134e4a; }
.kpi-label { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
.kpi-sub   { font-size: 0.66rem; color: var(--muted); }

/* Charts row */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
@media (max-width: 860px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15,23,42,0.06); overflow: hidden;
  animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both;
  animation-delay: 0.15s;
}
.chart-card-header {
  padding: 1rem 1.4rem 0.6rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chart-title { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.chart-sub   { font-size: 0.7rem; color: var(--muted); }
.chart-body  { padding: 0.5rem 1rem 1rem; position: relative; }

/* Bottom breakdowns */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) { .breakdown-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .breakdown-grid { grid-template-columns: 1fr; } }

.breakdown-card {
  background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15,23,42,0.06); overflow: hidden;
  animation: fadeUp 0.55s cubic-bezier(0.16,1,0.3,1) both;
  animation-delay: 0.2s;
}
.breakdown-header {
  background: #f8fafc; border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.2rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.breakdown-header svg { width: 14px; height: 14px; fill: var(--brand); }
.breakdown-header span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.breakdown-list { padding: 0.5rem 0; }
.breakdown-row {
  display: flex; align-items: center; padding: 0.55rem 1.2rem; gap: 0.7rem;
  border-bottom: 1px solid #f8fafc; transition: background 0.1s;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row:hover { background: #f8fafc; }
.breakdown-bar-wrap { flex: 1; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.breakdown-bar { height: 100%; border-radius: 3px; background: var(--brand); transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.breakdown-bar.green  { background: var(--green); }
.breakdown-bar.red    { background: var(--red); }
.breakdown-bar.amber  { background: var(--amber); }
.breakdown-label { font-size: 0.78rem; font-weight: 600; color: var(--text); min-width: 80px; }
.breakdown-count { font-size: 0.72rem; color: var(--muted); min-width: 50px; text-align: right; }

/* No-data state */
.no-data {
  text-align: center; padding: 4rem 1rem; color: var(--muted);
}
.no-data svg { width: 48px; height: 48px; fill: #cbd5e1; margin-bottom: 0.9rem; display: block; margin-left: auto; margin-right: auto; }
.no-data h3  { font-size: 1rem; font-weight: 600; color: var(--text); margin: 0 0 0.35rem; }
.no-data p   { font-size: 0.82rem; margin: 0; }

@media (max-width: 600px) {
  .controls-bar { padding: 1rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

.ctrl-input {
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--input-bg); color: var(--text);
  font-size: 0.88rem; font-family: inherit; padding: 0.6rem 0.9rem; outline: none; width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ctrl-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background: #fff; }

/* Settlement statement (ported from MerchantPortal settlement.css) */
/* Statement card */
.statement-card {
  background: var(--surface); border: 1px solid #dde3f0; border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15,23,42,0.07);
  padding: 1.8rem 2rem; margin-bottom: 1.4rem;
  animation: fadeUp 0.45s cubic-bezier(0.16,1,0.3,1) both;
}
.statement-header {
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem;
  padding-bottom: 1.2rem; margin-bottom: 1.4rem; border-bottom: 2px solid var(--border);
}
.statement-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); margin: 0 0 0.2rem; }
.statement-header .sub { font-size: 0.8rem; color: var(--muted); }
.statement-meta { text-align: right; font-size: 0.8rem; color: var(--muted); }
.statement-meta strong { color: var(--text); }

.stmt-section { margin-bottom: 1.6rem; }
.stmt-section:last-child { margin-bottom: 0; }
.stmt-section-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 0.7rem; padding-bottom: 0.4rem; border-bottom: 1px solid #eef1f8;
}
.stmt-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.45rem 0; font-size: 0.88rem; border-bottom: 1px solid #f5f7fb;
}
.stmt-row:last-child { border-bottom: none; }
.stmt-row .lbl { color: var(--muted); }
.stmt-row .lbl small { display: block; font-size: 0.72rem; color: #a3adc2; margin-top: 0.1rem; }
.stmt-row .val { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stmt-row.deduct .val { color: #b91c1c; }
.stmt-row.add .val { color: #059669; }
.stmt-row.total { font-size: 1rem; font-weight: 700; padding-top: 0.7rem; margin-top: 0.3rem; border-top: 2px solid var(--border); }
.stmt-row.total .val { font-size: 1.3rem; color: var(--brand); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.7rem; margin-bottom: 0.8rem; }
.card-tile { background: var(--input-bg); border-radius: 10px; padding: 0.7rem 0.85rem; text-align: center; }
.card-tile .brand { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
.card-tile .amt   { font-size: 1rem; font-weight: 700; color: var(--text); }

.btn-print {
  background: #fff; color: var(--brand); border: 1.5px solid var(--brand); border-radius: 10px;
  font-weight: 600; font-size: 0.85rem; padding: 0.6rem 1.3rem;
  display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
  transition: background 0.2s;
}
.btn-print:hover { background: var(--brand-light); }
.btn-print svg { width: 15px; height: 15px; fill: currentColor; }
.statement-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }

@media print {
  .no-print, .brand-bar, .menu-bar, .page-header, .page-footer { display: none !important; }
  body { background: #fff !important; }
  body::before { display: none !important; }
  .statement-card { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .main-wrap { padding: 0 !important; }
}
.card-tile .brand { display: block; text-align: center; }
