/* ===========================================================
   TransBnk Net Banking — UI styles (matches Figma design)
   =========================================================== */

:root {
  --bg:           #f6f7fb;
  --surface:      #ffffff;
  --text:         #0f172a;
  --muted:        #64748b;
  --muted-2:      #94a3b8;
  --border:       #e5e7eb;

  --sidebar-bg:   #1f2333;
  --sidebar-fg:   #cbd5e1;
  --sidebar-fg-strong: #ffffff;
  --sidebar-active: #3b82f6;

  --primary:      #3b82f6;
  --primary-600:  #2563eb;
  --success:      #10b981;
  --success-soft: #d1fae5;
  --danger:       #ef4444;

  --card-blue-1:  #3a8bff;
  --card-blue-2:  #2c5be6;
  --card-purple-1:#5b3bff;
  --card-purple-2:#3a1ad6;
  --card-green-1: #1ab87e;
  --card-green-2: #0e9063;
  --card-teal-1:  #0891b2;
  --card-teal-2:  #0e7490;

  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 6px 18px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===========================================================
   LOGIN PAGE
   =========================================================== */
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-left {
  position: relative;
  background: #1f1b2e;
  background: radial-gradient(circle at 30% 30%, #2a2540, #14101f 70%);
  overflow: hidden;
  color: #fff;
}

.brand-corner {
  position: absolute;
  top: 36px; left: 40px;
  display: flex; align-items: center; gap: 12px;
  z-index: 2;
}
.brand-corner svg { width: 36px; height: 36px; }
.brand-corner-text {
  font-weight: 700; font-size: 16px; line-height: 1;
}
.brand-corner-text small {
  display: block; font-size: 10px; font-weight: 400;
  margin-top: 4px; letter-spacing: .5px; opacity: .8;
}

/* Decorative arcs */
.bg-arc {
  position: absolute;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 50%;
  pointer-events: none;
}
.bg-arc--top    { width: 520px; height: 520px; top: -260px; left: -120px; }
.bg-arc--bottom { width: 720px; height: 720px; bottom: -420px; left: 40%; border-color: rgba(255,255,255,.10); }

/* Stage with two cards (decorative) */
.card-stage {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 520px; height: 360px;
}
.bank-card {
  position: absolute;
  width: 320px; height: 200px;
  border-radius: 18px;
  padding: 18px 22px;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 30px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.05);
  display: flex; flex-direction: column; justify-content: space-between;
}
.bank-card--white {
  background: linear-gradient(135deg,#f3f3f3,#cfcfcf);
  color: #111;
  transform: rotate(-12deg) translate(-90px,-30px);
}
.bank-card--dark {
  background:
    radial-gradient(120% 80% at 70% 30%, #ff6b6b22, transparent 60%),
    radial-gradient(120% 80% at 30% 80%, #5b5bff33, transparent 60%),
    linear-gradient(135deg,#1a1a1a,#000);
  color: #fff;
  transform: rotate(8deg) translate(70px,40px);
}
.bc-line { font-weight: 700; letter-spacing: 2px; opacity: .85; }
.bc-chip {
  width: 38px; height: 28px; border-radius: 5px;
  background: linear-gradient(135deg,#f5d57c,#caa24a);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.bc-row { display: flex; justify-content: space-between; align-items: end; }
.bc-name { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; }
.bc-name small { display: block; font-size: 9px; opacity: .8; font-weight: 400; margin-top: 2px; }
.bc-network { font-weight: 800; font-style: italic; font-size: 18px; }
.bank-card--white .bc-network { color: #1a1f71; }

/* Right pane */
.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: #fff;
}
.login-form-wrap { width: 100%; max-width: 420px; }
.login-title { font-size: 36px; font-weight: 800; margin: 0 0 6px; }
.login-sub   { color: var(--muted); margin: 0 0 28px; }

.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label {
  font-size: 13px; color: #334155; font-weight: 500; margin-bottom: 6px;
}
.field input[type="text"], .field input[type="password"], .field input[type="email"] {
  height: 44px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 14px; font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.field input:disabled { background: #f8fafc; color: #64748b; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm    { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost {
  background: #fff; border-color: var(--border); color: #334155;
}
.btn-ghost:hover { background: #f8fafc; }

.muted-link { color: var(--muted-2); font-size: 13px; }
.login-foot { margin-top: 16px; text-align: center; }

.alert {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info  { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* OTP grid */
.otp-grid {  grid-template-columns: repeat(4, 1fr); gap: 12px; }
.otp-cell {
  max-width: 15%;
  height: 40px; text-align: center; font-size: 22px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  outline: none;
}
.otp-cell:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }

/* ===========================================================
   APP SHELL (sidebar + main)
   =========================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 18px 16px;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 24px;
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-text { color: #fff; font-weight: 700; font-size: 15px; }
.brand-text sup { font-size: 9px; font-weight: 500; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-fg); font-size: 14px; font-weight: 500;
  background: none; border: 0; cursor: pointer; text-align: left;
  width: 100%;
}
.nav-item .nav-icon {
  width: 20px; display: inline-flex; justify-content: center; opacity: .9;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active); color: #fff;
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
}

.sidebar-logout { margin-top: auto; }
.logout-btn {
  background: rgba(255,255,255,.04);
  color: var(--sidebar-fg);
}
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Main area */
.main-area { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500;
  background: #fff;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg,#3b82f6,#8b5cf6);
  color: #fff; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.last-login {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: #475569;
  background: #fff;
}
.last-login .dot { color: #ef4444; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.pwa-install-btn {
  border-color: #6366f1; color: #6366f1;
}
.pwa-install-btn:hover { background: #ede9fe; }
.bell-dot {
  position: absolute; top: 6px; right: 8px;
  width: 8px; height: 8px; background: #3b82f6; border-radius: 50%;
}

.content {
  padding: 28px;
  display: flex; flex-direction: column; gap: 28px;
}

/* ===========================================================
   DASHBOARD CARDS ROW
   =========================================================== */
.cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.cards-row--single { grid-template-columns: 1fr; }

/* padding for a panel whose body is a grid rather than tiles */
.panel-body { padding: 16px 20px 20px; }

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.panel--balance .balance-card { padding: 33px 20px 20px; }
.muted-uppercase {
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
}
.muted-on-dark { color: rgba(255,255,255,.85); }
.balance-amount {
  font-size: 28px; font-weight: 800; margin-top: 6px;
  display: flex; align-items: center; gap: 12px;
}
.eye-toggle {
  font-size: 14px; color: var(--muted-2); cursor: pointer; user-select: none;
}
.cc .eye-toggle { color: rgba(255,255,255,.85); }
.strong { font-weight: 700; }
.strong-light { font-weight: 700; color: #fff; }
.mt-16 { margin-top: 16px; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; margin-top: 16px;
  border-top: 1px solid var(--border);
  font-family: 'Inter', monospace; letter-spacing: 2px;
  color: #334155; font-weight: 600; font-size: 13px;
}

.see-all { color: var(--muted-2); font-size: 13px; }
.cards-grid {
  display: grid;
  /* grid-template-columns: 1fr 1fr; */
  gap: 16px;
  padding: 16px 20px 20px;
}
.cards-grid--wide { padding: 0; }

/* Visa-like cards (blue + purple) */
.cc {
  position: relative;
  border-radius: 16px;
  padding: 18px 20px;
  color: #fff;
  /* min-height: 152px; */
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 12px 28px rgba(15,23,42,.18);
  overflow: hidden;
}
.cc--blue   { background: linear-gradient(135deg,var(--card-blue-1),var(--card-blue-2)); }
.cc--purple { background: linear-gradient(135deg,var(--card-purple-1),var(--card-purple-2)); }
.cc--green  { background: linear-gradient(135deg,var(--card-green-1),var(--card-green-2)); }
.cc--teal   { background: linear-gradient(135deg,var(--card-teal-1),var(--card-teal-2)); }
.cc::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(120% 80% at 0% 100%, rgba(255,255,255,.10), transparent 60%);
  pointer-events: none;
}
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.cc-amount {
  font-size: 22px; font-weight: 800; margin-top: 4px;
  display: flex; align-items: center; gap: 10px;
}
.cc-chip {
  width: 36px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg,#f5d57c 0%,#caa24a 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.cc-mid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px;
}
.cc-mid--3col { grid-template-columns: 1fr 1fr 1fr; }
.cc-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px; margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,.18);
  font-family: 'Inter', monospace; letter-spacing: 2px;
  font-weight: 600; font-size: 13px;
}
.cc-network { letter-spacing: -2px; opacity: .8; }

/* ===========================================================
   TRANSACTIONS
   =========================================================== */
.txn-section .section-title {
  font-size: 22px; font-weight: 800; margin: 0;
}
.section-sub { color: var(--muted); margin: 4px 0 16px; }

.panel--txn { padding: 20px; }
.txn-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 12px;
}
.txn-head h3 { margin: 0; font-size: 16px; }
.txn-tools { display: flex; gap: 10px; align-items: center; }
.txn-tools input {
  height: 36px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; font-size: 13px; min-width: 240px;
}

.table-wrap { overflow-x: auto; border-radius: 10px; }
.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.data-table thead th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 12px 14px;
  font-weight: 600; font-size: 13px;
  letter-spacing: .2px;
}
.data-table thead th:first-child { border-top-left-radius: 10px; }
.data-table thead th:last-child  { border-top-right-radius: 10px; }
.data-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: #334155;
}
.data-table tbody tr:hover td { background: #fafbff; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

.amt-debit  { color: #dc2626; font-weight: 600; }
.amt-credit { color: #16a34a; font-weight: 600; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge--completed { background: var(--success-soft); color: #047857; }
.badge--pending   { background: #fef3c7; color: #92400e; }
.badge--failed    { background: #fee2e2; color: #b91c1c; }
.badge--reversed  { background: #e0e7ff; color: #3730a3; }

.export-link { color: #475569; font-size: 13px; }
.export-link:hover { color: var(--primary); }

.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 16px 20px 20px;
}
.settings-grid label {
  display: block; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px;
}

/* ===========================================================
   QR SCANNER MODAL
   =========================================================== */
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.qr-modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: min(420px, calc(100vw - 32px));
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15,23,42,.28);
}
.qr-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
}
.qr-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.qr-close-btn:hover { background: var(--bg); }

.qr-scanner-view {
  position: relative;
  background: #000;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.qr-scanner-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qr-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.qr-frame-corner {
  position: absolute;
  width: 44px;
  height: 44px;
  border-color: #4ade80;
  border-style: solid;
  border-width: 0;
}
.qr-frame-corner--tl { top: 18%; left: 18%; border-top-width: 3px; border-left-width: 3px;  border-radius: 4px 0 0 0; }
.qr-frame-corner--tr { top: 18%; right: 18%; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.qr-frame-corner--bl { bottom: 18%; left: 18%; border-bottom-width: 3px; border-left-width: 3px;  border-radius: 0 0 0 4px; }
.qr-frame-corner--br { bottom: 18%; right: 18%; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }
.qr-scan-line {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
  animation: qrScan 1.8s ease-in-out infinite;
  top: 18%;
}
@keyframes qrScan {
  0%   { top: 18%; opacity: 1; }
  50%  { top: 82%; opacity: 1; }
  100% { top: 18%; opacity: 1; }
}
.qr-hint {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,.8);
  font-size: 13px;
  margin: 0;
}

.qr-result-view {
  padding: 28px 24px;
  text-align: center;
}
.qr-result-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.qr-result-title {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
}
.qr-result-details {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px 14px;
  text-align: left;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.qr-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}
.qr-detail-row:last-child { border-bottom: none; }
.qr-detail-label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0; }
.qr-detail-value { font-weight: 600; text-align: right; word-break: break-all; }

.qr-vpa-block {
  background: var(--bg-card, #f5f7fa);
  border: 1.5px solid var(--primary, #4f6ef7);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 14px;
}
.qr-vpa-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--primary, #4f6ef7);
  margin-bottom: 6px;
}
.qr-vpa-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qr-vpa-value {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  word-break: break-all;
}
.qr-copy-btn {
  background: none;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.qr-copy-btn:hover { background: var(--primary, #4f6ef7); color: #fff; border-color: var(--primary, #4f6ef7); }

/* Send Money Form */
.send-form { padding: 8px 0 4px; }
.send-field { margin-bottom: 14px; }
.send-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 5px;
}
.send-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border, #e0e0e0);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  box-sizing: border-box;
  transition: border-color .15s;
}
.send-input:focus { outline: none; border-color: var(--primary, #4f6ef7); }

.qr-error-view {
  padding: 32px 24px;
  text-align: center;
}
.qr-error-icon { font-size: 36px; margin-bottom: 12px; }
.qr-error-msg  { color: var(--danger); margin: 0 0 20px; font-size: 14px; line-height: 1.5; }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1100px) {
  .cards-row     { grid-template-columns: 1fr; }
  .cards-grid    { grid-template-columns: 1fr; }
  .cc-mid--3col  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .login-shell   { grid-template-columns: 1fr; }
  .login-left    { display: none; }
  .app-shell     { grid-template-columns: 80px 1fr; }
  .sidebar .brand-text,
  .sidebar .nav-item span:not(.nav-icon) { display: none; }
  .last-login    { display: none; }
}

/* ===========================================================
   LEDGER TILE ACTIONS
   =========================================================== */
.ledger-action {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--primary-600);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.ledger-action:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* the three per-row buttons */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
td.col-actions { text-align: right; }

/* ===========================================================
   ROW "VIEW" ACTION + KEY/VALUE DETAIL TABLE (modal)
   =========================================================== */
.col-view { width: 1%; white-space: nowrap; text-align: center; }
td.col-view { text-align: center; }
.view-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--primary-600);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.view-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* two-column label/value table used inside the popups */
.data-table--kv tbody td {
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table--kv tbody tr:hover td { background: transparent; }
.data-table--kv tbody td:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
  width: 40%;
}
.data-table--kv tbody td:last-child {
  text-align: right;
  word-break: break-word;
}
.modal-scroll { max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ===========================================================
   PWA INSTALL POPUP (login screen, phones)
   =========================================================== */
.text-center { text-align: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

#installPopup {
  display: none;                 /* jquery fades it in */
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 9998;
  max-width: 440px;
  margin: 0 auto;
  box-shadow: 0 18px 44px rgba(15,23,42,.22);
}
#installPopup .body { position: relative; padding: 24px 20px 20px; }
#installPopup p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px; line-height: 1.55;
}

.hidePopupBtn {
  position: absolute; top: 8px; right: 10px;
  width: 32px; height: 32px;
  background: none; border: 0; border-radius: 8px;
  font-size: 20px; line-height: 1; color: var(--muted);
  cursor: pointer;
}
.hidePopupBtn:hover { background: var(--bg); color: var(--text); }

.install-now-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 44px; padding: 0 16px;
  border: 0; border-radius: 10px;
  background: var(--primary); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.install-now-btn:hover { background: var(--primary-600); }

/* ===========================================================
   DATATABLES — re-skinned to match the panels above
   (dataTables.min.css loads first, these rules win)
   =========================================================== */
.dt-container { font-size: 13px; color: #475569; }

/* the grid controls sit outside the scroller, only the table scrolls */
.table-wrap { overflow: visible; }
div.dt-layout-table > div { overflow-x: auto; -webkit-overflow-scrolling: touch; }

div.dt-layout-row { align-items: center; gap: 10px; margin: 0 0 12px; }
div.dt-layout-row:last-child { margin: 12px 0 0; }

/* cell padding: DataTables' own selectors are more specific than .data-table */
table.data-table.dataTable > thead > tr > th {
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  border-bottom: 0;
}
table.data-table.dataTable > tbody > tr > td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
table.data-table.dataTable > tbody > tr:last-child > td { border-bottom: 0; }
table.data-table.dataTable > tbody > tr:hover > td { background: #fafbff; }
table.data-table.dataTable > tbody > tr > td.dt-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

/* "Show N rows" */
div.dt-length select.dt-input {
  height: 34px;
  padding: 0 8px;
  margin: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}
div.dt-info { color: var(--muted); font-size: 13px; padding: 0; }

/* search box */
div.dt-search input.dt-input {
  height: 34px;
  min-width: 200px;
  padding: 0 12px;
  margin-left: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}

/* pager */
div.dt-paging { display: flex; }
div.dt-paging nav { display: flex; flex-wrap: wrap; gap: 6px; }
div.dt-paging button.dt-paging-button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
div.dt-paging button.dt-paging-button:hover:not(.disabled) {
  background: #f1f5f9;
  border-color: var(--border);
  color: var(--text);
}
div.dt-paging button.dt-paging-button.current,
div.dt-paging button.dt-paging-button.current:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
div.dt-paging button.dt-paging-button.disabled,
div.dt-paging button.dt-paging-button.disabled:hover {
  background: #fff;
  color: var(--muted-2);
  cursor: default;
  opacity: .6;
}

/* loading overlay */
div.dt-processing {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 10px 16px;
  font-weight: 600;
  color: var(--muted);
}

/* ===========================================================
   MOBILE (phones) — keep this block last so it wins the cascade
   =========================================================== */
@media (max-width: 640px) {

  /* shell: sidebar becomes a slim bar above the content */
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar-brand { padding: 0; flex-shrink: 0; }
  .brand-mark svg { width: 26px; height: 26px; }
  .sidebar .brand-text { display: block; font-size: 14px; }
  .sidebar-nav {
    flex-direction: row;
    margin-left: auto;
    gap: 6px;
  }
  .nav-item { width: auto; padding: 8px 10px; }
  .sidebar-logout { margin-top: 0; }

  /* topbar */
  .topbar {
    padding: 10px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar-spacer { display: none; }
  .topbar-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .user-chip {
    min-width: 0;
    font-size: 12px;
    padding: 5px 12px 5px 5px;
  }
  .user-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* content */
  .content { padding: 16px 14px; gap: 20px; }
  .txn-section .section-title { font-size: 18px; }
  .section-sub { font-size: 13px; margin-bottom: 12px; }
  .panel-head { padding: 14px 16px; }
  .cards-grid { padding: 14px 16px 16px; gap: 14px; }

  /* ledger tiles */
  .cc { padding: 16px; }
  .cc-top { gap: 12px; }
  .cc-top > div:last-child { flex-shrink: 0; }
  .cc-mid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cc-mid--3col { grid-template-columns: 1fr 1fr; }
  .cc-foot { gap: 10px; flex-wrap: wrap; }
  .row-actions { flex-wrap: wrap; justify-content: flex-start; }
  .strong-light { word-break: break-word; }

  /* transaction toolbar */
  .panel--txn { padding: 14px; }
  .txn-head { gap: 10px; }
  .txn-head h3 { font-size: 15px; }
  .txn-tools { flex-wrap: wrap; width: 100%; }
  .txn-tools input {
    flex: 1 1 140px;
    min-width: 0;
  }
  .txn-tools .btn { flex: 1 1 100%; }
  #txn-pager .txn-tools .btn { flex: 1 1 auto; }

  /* the table stays a table - the columns dropped here live in the row popup */
  .data-table { font-size: 12.5px; }
  table.data-table.dataTable > thead > tr > th { padding: 10px 8px; font-size: 12px; }
  table.data-table.dataTable > tbody > tr > td { padding: 10px 8px; }
  .col-extra { display: none; }
  .badge { padding: 3px 8px; font-size: 11px; }
  .view-btn { padding: 5px 10px; }

  /* grid controls stack instead of sitting on one line */
  div.dt-layout-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  div.dt-layout-cell { justify-content: center; text-align: center; }
  div.dt-paging { justify-content: center; }
  div.dt-paging nav { justify-content: center; }
}

@media (max-width: 420px) {
  .col-extra-sm { display: none; }
}
