/* ═══════════════════════════════════════════════
   Pesa Mtandao — Design System
   Shared by Admin, Teller, and Checkout portals
   ═══════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2563EB;
  --blue-dark:  #1D4ED8;
  --blue-light: #EFF6FF;
  --green:      #16A34A;
  --green-light:#F0FDF4;
  --red:        #DC2626;
  --red-light:  #FEF2F2;
  --yellow:     #CA8A04;
  --yellow-light:#FEFCE8;
  --purple:     #7C3AED;
  --purple-light:#F5F3FF;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-400:   #9CA3AF;
  --gray-600:   #4B5563;
  --gray-800:   #1F2937;
  --sidebar-w:  240px;
  --topbar-h:   60px;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:  0 4px 16px rgba(0,0,0,.12);
}

html, body { height: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Fira Code', 'Consolas', monospace; font-size: 0.85em; }

/* ── Typography ────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
small { font-size: 0.8em; }
.muted { color: var(--gray-400); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Container ─────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1.25rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--blue);  color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; }
.btn-success   { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #15803D; text-decoration: none; }
.btn-danger    { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #B91C1C; text-decoration: none; }
.btn-outline   { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue-light); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--gray-600); border-color: var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); text-decoration: none; }
.btn-block     { width: 100%; }
.btn-sm        { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg        { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Alerts ────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem 0.75rem 0.9rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 0.875rem; font-weight: 500;
  border-left-width: 4px; border-left-style: solid;
}
.alert-success { background: var(--green-light);  color: #065F46; border: 1px solid #BBF7D0; border-left: 4px solid var(--green);  }
.alert-error,
.alert-danger  { background: var(--red-light);    color: #991B1B; border: 1px solid #FECACA; border-left: 4px solid var(--red);    }
.alert-warning { background: var(--yellow-light); color: #92400E; border: 1px solid #FDE68A; border-left: 4px solid var(--yellow); }
.alert-info    { background: var(--blue-light);   color: #1E40AF; border: 1px solid #BFDBFE; border-left: 4px solid var(--blue);   }

/* ── Forms ─────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.35rem; color: var(--gray-600); }
.form-control {
  width: 100%; padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: 0.875rem;
  background: #fff; color: var(--gray-800);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
textarea.form-control { resize: vertical; }
select.form-control { appearance: none; cursor: pointer; }
.input-action-row { display: flex; gap: 0.5rem; }
.input-action-row .form-control { flex: 1; }

/* ── Badges ────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.2rem 0.55rem;
  border-radius: 999px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red);   }
.badge-yellow { background: var(--yellow-light); color: var(--yellow);}
.badge-blue   { background: var(--blue-light);   color: var(--blue);  }
.badge-gray   { background: var(--gray-100);     color: var(--gray-600); }

/* Bootstrap-style aliases — half the codebase uses these names. */
.badge-success   { background: var(--green-light);  color: var(--green);  }
.badge-danger    { background: var(--red-light);    color: var(--red);    }
.badge-warning   { background: var(--yellow-light); color: var(--yellow); }
.badge-info      { background: var(--blue-light);   color: var(--blue);   }
.badge-primary   { background: var(--blue-light);   color: var(--blue);   }
.badge-secondary { background: var(--gray-100);     color: var(--gray-600); }

/* Superseded rows in KYC tables — visually dim so admins can scan past
   them to the live row. The whole row fades, the badge gets a distinct
   muted look. */
tr.row-superseded > td { opacity: 0.55; }
tr.row-superseded a    { color: var(--gray-500); }

/* ── Panel / Card ──────────────────────────────── */
.panel {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1.5rem; overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.panel-header h2 { margin: 0; }
.panel-body  { padding: 1.25rem; }
.panel-footer{ padding: 0.75rem 1.25rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); font-size: 0.8rem; }
.panel-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 1.5rem; }
.section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: 1rem; }

/* ── Data Table ────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left; padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-600); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em;
  background: var(--gray-50);
}
.data-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ── Stats Grid ────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-card--blue   { border-top: 3px solid var(--blue);   }
.stat-card--green  { border-top: 3px solid var(--green);  }
.stat-card--purple { border-top: 3px solid var(--purple); }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-sub   { font-size: 0.78rem; color: var(--gray-400); margin-top: 0.25rem; }

/* ── Admin / Teller Layout ─────────────────────── */
.layout-admin, .layout-teller { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--gray-800); color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
  z-index: 50;
}
.sidebar-teller { background: #1E3A5F; }
.sidebar-brand {
  padding: 1.25rem 1.5rem; font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand span { color: var(--blue); }
.sidebar-brand small { font-size: 0.65rem; font-weight: 500; color: var(--gray-400); margin-left: 0.25rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,.7); font-size: 0.875rem; font-weight: 500;
  transition: background .1s, color .1s; text-decoration: none;
}
.sidebar-nav a > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav .nav-badge {
  background: #ef4444; color: #fff; border-radius: 9999px;
  font-size: .62rem; font-weight: 700; padding: .1rem .4rem;
  line-height: 1.4; min-width: 17px; text-align: center;
  display: inline-block; flex: 0 0 auto;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { border-left: 3px solid var(--blue); padding-left: calc(1.5rem - 3px); }
.sidebar-nav a.logout { color: rgba(255,100,100,.8); margin-top: 1rem; border-top: 1px solid rgba(255,255,255,.06); padding-top: 1rem; }
.sidebar-nav a.logout:hover { color: #fff; background: rgba(220,38,38,.3); }
.sidebar-user { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,.08); font-size: 0.8rem; }
.sidebar-user span { display: block; font-weight: 600; }
.sidebar-user small { color: var(--gray-400); }

.admin-body { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.admin-topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 40;
}
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; }
.topbar-date { color: var(--gray-400); font-size: 0.8rem; }
.admin-main { padding: 1.5rem; flex: 1; }

/* ── Filter Panel ──────────────────────────────── */
.filter-panel { padding: 0; }
.filter-form  { padding: 1rem 1.25rem; }
.filter-row   { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-row .form-group { margin-bottom: 0; }

/* ── Quick Actions ─────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 1rem; }
.quick-action-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1.25rem 1rem; background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); text-decoration: none; color: var(--gray-800);
  font-weight: 500; font-size: 0.875rem; text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.quick-action-card:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); text-decoration: none; }
.qa-icon { font-size: 1.75rem; }

/* ── Confirm Rows ──────────────────────────────── */
.confirm-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}
.confirm-row:last-child { border-bottom: none; }
.confirm-row span { color: var(--gray-600); }
.amount-highlight { color: var(--green); font-size: 1.1rem; }

/* ── Item Table ────────────────────────────────── */
.item-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 0.5rem; }
.item-table th { text-align: left; padding: 0.5rem 0.75rem; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); }
.item-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--gray-100); }
.item-table tfoot td { border-top: 2px solid var(--gray-200); border-bottom: none; font-weight: 600; }
.total-row td { background: var(--gray-50); }
.balance-after-row td { color: var(--gray-600); font-size: 0.8rem; }

/* ── Checkout Layout ───────────────────────────── */
.checkout-body { background: var(--gray-100); display: flex; justify-content: center; align-items: flex-start; padding: 2rem 1rem; min-height: 100vh; }
.checkout-wrap { width: 100%; max-width: 520px; }
.checkout-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
}
.checkout-logos { display: flex; align-items: center; gap: 0.75rem; }
.merchant-logo  { height: 36px; object-fit: contain; }
.checkout-sep   { color: var(--gray-400); font-size: 1.2rem; }
.pm-badge  { font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.pm-badge span { color: var(--blue); }
.checkout-security { font-size: 0.8rem; color: var(--gray-400); }
.lock-icon { margin-right: 0.25rem; }

.checkout-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow); margin-bottom: 1rem;
}
.checkout-form .btn { margin-top: 0.5rem; }
.checkout-steps {
  display: flex; gap: 1rem; justify-content: center;
  margin: 1rem 0; font-size: 0.8rem;
}
.step { color: var(--gray-400); }
.step.active { color: var(--blue); font-weight: 600; }
.step.done   { color: var(--green); }
.checkout-abandon { text-align: center; margin-top: 0.5rem; }
.checkout-back    { text-align: center; margin-top: 1rem; }
.link-muted       { color: var(--gray-400); font-size: 0.8rem; }
.merchant-name    { font-weight: 600; margin-bottom: 0.75rem; }
.confirm-account  { margin-bottom: 0.75rem; }

/* ── Receipt Slip ──────────────────────────────── */
.receipt-slip       { max-width: 540px; }
.receipt-slip-body  { padding: 1.25rem; }
.result-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; margin: 0 auto 1rem;
}
.result-success { background: var(--green-light); color: var(--green); }
.result-error   { background: var(--red-light);   color: var(--red); }
.receipt-number { font-size: 0.9rem; color: var(--gray-400); margin-top: 0.25rem; }
.receipt-date   { font-size: 0.8rem; color: var(--gray-400); }

/* ── Login Layout ──────────────────────────────── */
.login-body  { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--gray-100); }
.login-wrap  { width: 100%; max-width: 380px; padding: 1.5rem 1rem; }
.login-brand {
  text-align: center; font-size: 1.5rem; font-weight: 800;
  letter-spacing: -.02em; margin-bottom: 1.5rem;
}
.login-brand span { color: var(--blue); }
.login-role-badge { font-size: 0.7rem; font-weight: 600; background: var(--blue-light); color: var(--blue); border-radius: 4px; padding: 0.2rem 0.5rem; vertical-align: middle; }
.login-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow-lg); }
.login-card h1 { margin-bottom: 1.25rem; }
.login-footer { text-align: center; margin-top: 1rem; color: var(--gray-600); font-size: 0.8rem; }

/* ── Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 1.5rem;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Customer Preview ──────────────────────────── */
.customer-preview {
  background: var(--blue-light); border: 1px solid #BFDBFE;
  border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem;
}

/* ── Public Site Header ────────────────────────── */
.layout-main { display: flex; flex-direction: column; min-height: 100vh; }
.site-header { background: #fff; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; color: var(--gray-800); }
.brand span { color: var(--blue); }
.site-header nav a { margin-left: 1.5rem; color: var(--gray-600); font-weight: 500; }
.site-footer { margin-top: auto; background: var(--gray-800); color: rgba(255,255,255,.5); font-size: 0.8rem; }
.site-footer .container { padding-top: 1rem; padding-bottom: 1rem; }

/* ── Deposit Form ──────────────────────────────── */
.deposit-form .btn-success { margin-top: 1.5rem; }

/* ── Print ─────────────────────────────────────── */
@media print {
  .sidebar, .admin-topbar, .btn, .checkout-steps, .checkout-abandon { display: none !important; }
  .admin-body { margin-left: 0; }
  .panel { box-shadow: none; border: none; }
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .admin-body { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { flex-direction: column; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.5rem 0.6rem; }
}

/* ── Collapsible <details> chevron (opt-in via class="chev") ──────────
   Pages that hide the browser-default disclosure marker (list-style:none)
   lose the visual cue that a panel is expandable. Adding class="chev" to
   a <summary> brings back a rotating triangle before the existing icon.
   Opt-in (not global) so this never disrupts <summary> layouts that
   already use display:flex with custom item arrangement. */
details > summary.chev::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.8em;
  opacity: 0.65;
  transition: transform 0.15s ease;
  transform-origin: center;
}
details[open] > summary.chev::before {
  transform: rotate(90deg);
  opacity: 0.9;
}
