/* ========================================
   نظام إدارة الحسابات المالية
   Stylesheet — Light theme, RTL, Mobile-first
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  /* Palette — warm cream + emerald + gold */
  --bg: #faf7f2;
  --bg-soft: #f3ede2;
  --surface: #ffffff;
  --surface-2: #fbf8f3;
  --border: #e8dfce;
  --border-strong: #d6c9b0;

  --ink: #1f2a26;
  --ink-soft: #4a5853;
  --ink-mute: #87928e;

  --primary: #0f6b5b;       /* deep emerald */
  --primary-soft: #16846f;
  --primary-bg: #e3f0ec;
  --accent: #c08a2c;         /* warm gold */
  --accent-soft: #d8a64b;
  --accent-bg: #f7ecd5;

  --success: #2f8f5e;
  --success-bg: #e3f3ea;
  --danger: #c0392b;
  --danger-bg: #f8e3e0;
  --warning: #b88314;
  --warning-bg: #fbf0d6;
  --info: #2c6bb8;
  --info-bg: #e3edf8;

  --shadow-sm: 0 1px 2px rgba(31,42,38,.05), 0 1px 3px rgba(31,42,38,.04);
  --shadow-md: 0 4px 12px rgba(31,42,38,.06), 0 2px 4px rgba(31,42,38,.04);
  --shadow-lg: 0 16px 40px rgba(31,42,38,.10), 0 4px 12px rgba(31,42,38,.06);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --t-fast: 0.15s cubic-bezier(.4,0,.2,1);
  --t-base: 0.25s cubic-bezier(.4,0,.2,1);
  --t-slow: 0.4s cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body { direction: rtl; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-soft); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ========== AUTH PAGES (login/signup) ========== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at top right, var(--accent-bg) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, var(--primary-bg) 0%, transparent 50%),
    var(--bg);
  position: relative;
}

.auth-shell::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31,42,38,.04) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.5s cubic-bezier(.2,.8,.2,1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}
.brand-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15,107,91,.25);
}
.brand-title { font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.brand-subtitle { font-size: .9rem; color: var(--ink-mute); }

/* ========== FORMS ========== */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-label .req { color: var(--danger); margin-inline-start: 2px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  font-size: .95rem;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(15,107,91,.10);
}
.input::placeholder { color: var(--ink-mute); }
.textarea { resize: vertical; min-height: 80px; }

.field-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.field-error {
  font-size: .8rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.field.has-error .input,
.field.has-error .select { border-color: var(--danger); background: var(--danger-bg); }
.field.has-error .field-error { display: block; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: .95rem;
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15,107,91,.25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-soft); }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-soft); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--border-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a52e22; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #277a4f; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 22px; font-size: 1rem; }

.btn-icon {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.btn-icon:hover { background: var(--bg-soft); color: var(--ink); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }

.auth-foot {
  text-align: center;
  margin-top: 18px;
  font-size: .9rem;
  color: var(--ink-soft);
}

/* ========== APP SHELL — navbar + sidebar ========== */
.app-shell { min-height: 100vh; }

.navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--ink);
  font-size: 1rem;
}
.navbar-brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  display: grid; place-items: center;
  color: #fff;
}
.navbar-status {
  font-size: .8rem;
  color: var(--ink-mute);
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
}
.navbar-brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.navbar-user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
  font-weight: 600;
  color: var(--ink-soft);
}
@media (max-width: 460px) {
  .navbar-brand-name { max-width: 110px; font-size: .9rem; }
  .navbar-user-name  { max-width: 90px; }
}
@media (min-width: 700px) {
  .navbar-brand-name { max-width: 280px; }
  .navbar-user-name  { max-width: 220px; }
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); flex-shrink: 0; }
.navbar-spacer { flex: 1; }

.menu-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--ink);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.menu-toggle:hover { background: var(--bg-soft); border-color: var(--border-strong); }

/* sidebar (slides from the right since RTL = end) */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(31,42,38,.45);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { opacity: 1; pointer-events: all; }

.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--t-base);
  display: flex; flex-direction: column;
  box-shadow: -16px 0 40px rgba(31,42,38,.12);
}
.sidebar.open { transform: translateX(0); }

.sidebar-head {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}
.sidebar-user-name { font-weight: 700; color: var(--ink); font-size: .95rem; }
.sidebar-user-role { font-size: .75rem; color: var(--ink-mute); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: .92rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-link:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar-link.active {
  background: var(--primary-bg);
  color: var(--primary);
}
.sidebar-link svg { flex-shrink: 0; }

.sidebar-section-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-mute);
  padding: 14px 14px 6px;
  font-weight: 600;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ========== PAGE CONTENT ========== */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.page-subtitle { color: var(--ink-mute); font-size: .9rem; margin-top: 2px; }

/* ========== CARDS ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.card-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
  display: flex; align-items: center; gap: 8px;
}
.card-title svg { color: var(--primary); }

/* user info card — light emerald, centered, elegant */
.userinfo-card {
  background:
    radial-gradient(circle at 80% -20%, rgba(192,138,44,.10) 0%, transparent 55%),
    radial-gradient(circle at 0% 120%,  rgba(15,107,91,.10) 0%, transparent 55%),
    linear-gradient(135deg, #e3f0ec 0%, #eef7f3 50%, #f4faf6 100%);
  color: var(--primary);
  border: 1px solid #cfe5dd;
  position: relative;
  overflow: hidden;
  padding: 28px 22px;
  box-shadow: 0 4px 20px -8px rgba(15,107,91,.18);
}
.userinfo-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15,107,91,.08) 0%, transparent 70%);
  pointer-events: none;
}
.userinfo-card::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192,138,44,.10) 0%, transparent 70%);
  pointer-events: none;
}
.userinfo-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.userinfo-greeting {
  font-size: .9rem;
  color: var(--primary-soft);
  font-weight: 500;
  letter-spacing: .3px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(15,107,91,.12);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  margin-bottom: 4px;
}
.userinfo-greeting::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(192,138,44,.2);
}
.userinfo-name {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.5px;
  line-height: 1.2;
  margin: 4px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 60%, var(--accent) 130%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.userinfo-divider {
  width: 60px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 6px 0 4px;
}
.userinfo-meta {
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.userinfo-meta b { color: var(--primary); font-weight: 700; }
@media (max-width: 560px) {
  .userinfo-card { padding: 22px 16px; }
  .userinfo-name { font-size: 1.55rem; }
}

/* dashboard grid */
.dash-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid .col-span-2 { grid-column: span 2; }
}

/* quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (min-width: 480px) {
  .quick-actions { grid-template-columns: repeat(6, 1fr); }
}
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
  text-align: center;
}
.quick-action:hover {
  background: var(--bg-soft);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-bg);
  color: var(--primary);
}
.quick-action.action-buy .quick-action-icon  { background: var(--success-bg); color: var(--success); }
.quick-action.action-sell .quick-action-icon { background: var(--accent-bg); color: var(--accent); }
.quick-action.action-deposit .quick-action-icon { background: var(--info-bg); color: var(--info); }
.quick-action.action-withdraw .quick-action-icon { background: var(--danger-bg); color: var(--danger); }
.quick-action.action-transfer .quick-action-icon { background: var(--warning-bg); color: var(--warning); }
.quick-action-label { font-size: .8rem; color: var(--ink-soft); font-weight: 500; }

/* stats / KPI */
.kpi-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }

.kpi {
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.kpi-label { font-size: .78rem; color: var(--ink-mute); margin-bottom: 2px; }
.kpi-value { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.kpi-value.pos { color: var(--success); }
.kpi-value.neg { color: var(--danger); }
.kpi-meta { font-size: .75rem; color: var(--ink-mute); margin-top: 2px; }

/* foreign currency table */
.fx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .88rem;
}
.fx-table-wrap { overflow-x: auto; margin: 0 -4px; }
.fx-table th, .fx-table td {
  padding: 10px 8px;
  text-align: start;
  border-bottom: 1px solid var(--border);
}
.fx-table th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-mute);
  font-weight: 600;
  background: var(--surface-2);
}
.fx-table td { color: var(--ink); }
.fx-table tr:last-child td { border-bottom: none; }
.fx-currency-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-bg); color: var(--accent);
  padding: 2px 8px; border-radius: 6px;
  font-weight: 600; font-size: .78rem;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-mute);
  font-size: .9rem;
}
.empty-state svg { color: var(--ink-mute); margin-bottom: 10px; opacity: .6; }

/* ========== ACCOUNTS LIST ========== */
.toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1; min-width: 200px;
  position: relative;
}
.search-box .input { padding-inline-start: 38px; }
.search-box svg {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  inset-inline-start: 12px;
  color: var(--ink-mute);
  pointer-events: none;
}

.filter-pills {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 0 4px 6px;
  margin: 0 -4px 10px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }
.pill {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  white-space: nowrap;
  transition: all var(--t-fast);
}
.pill:hover { border-color: var(--border-strong); }
.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.accounts-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .accounts-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .accounts-grid { grid-template-columns: 1fr 1fr 1fr; } }

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  position: relative;
  transition: box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
  display: flex; flex-direction: column; gap: 12px;
}
.account-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.account-card.archived { opacity: .65; background: var(--bg-soft); }

.acc-head { display: flex; align-items: flex-start; gap: 10px; }
.acc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.acc-icon.treasury { background: var(--accent-bg); color: var(--accent); }
.acc-icon.bank     { background: var(--primary-bg); color: var(--primary); }
.acc-info { flex: 1; min-width: 0; }
.acc-name {
  font-weight: 700; color: var(--ink); font-size: 1rem;
  margin-bottom: 2px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acc-meta {
  font-size: .78rem; color: var(--ink-mute);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.acc-id-tag {
  font-family: 'Amiri', serif;
  font-size: .72rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--ink-mute);
}
.archived-tag {
  font-size: .7rem;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}
.acc-balance {
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.acc-balance-label { font-size: .72rem; color: var(--ink-mute); margin-bottom: 2px; }
.acc-balance-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.acc-balance-value.neg { color: var(--danger); }
.acc-cost-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: .78rem; color: var(--ink-mute);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.acc-actions {
  display: flex; gap: 4px;
  flex-wrap: wrap;
}
.acc-action {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .78rem;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all var(--t-fast);
  min-width: 60px;
}
.acc-action:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.acc-action.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ========== TRANSACTIONS LIST ========== */
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.tx-item:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.tx-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tx-icon.deposit { background: var(--info-bg); color: var(--info); }
.tx-icon.withdraw { background: var(--danger-bg); color: var(--danger); }
.tx-icon.transfer { background: var(--warning-bg); color: var(--warning); }
.tx-icon.buy { background: var(--success-bg); color: var(--success); }
.tx-icon.sell { background: var(--accent-bg); color: var(--accent); }
.tx-icon.cost { background: var(--primary-bg); color: var(--primary); }
.tx-body { flex: 1; min-width: 0; }
.tx-title {
  font-weight: 600; color: var(--ink); font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta { font-size: .76rem; color: var(--ink-mute); margin-top: 2px; }
.tx-amount {
  font-weight: 700;
  font-size: .95rem;
  text-align: end;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.tx-amount.pos { color: var(--success); }
.tx-amount.neg { color: var(--danger); }
.tx-amount-sub { font-size: .72rem; color: var(--ink-mute); font-weight: 400; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31,42,38,.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
  z-index: 200;
  backdrop-filter: blur(3px);
  padding: 0;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--t-base);
  display: flex; flex-direction: column;
}
.modal-overlay.open .modal { transform: translateY(0); }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 16px; }
  .modal { border-radius: var(--r-xl); transform: translateY(20px) scale(.97); max-height: 88vh; }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }
}

.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.modal-body { padding: 18px 20px; flex: 1; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0;
  background: var(--surface);
}

/* segmented control */
.segments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-2);
  padding: 5px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.segment {
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  font-size: .9rem;
  color: var(--ink-soft);
  transition: all var(--t-fast);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.segment.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ========== TOAST ========== */
.toast-stack {
  position: fixed;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300;
  pointer-events: none;
  width: min(420px, calc(100% - 32px));
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toast-in 0.3s cubic-bezier(.2,.8,.2,1);
}
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info); }
.toast.fade-out { animation: toast-out 0.3s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(20px); }
}

/* ========== CONFIRM dialog ========== */
.confirm-modal { max-width: 380px; }
.confirm-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  display: grid; place-items: center;
  margin: 0 auto 12px;
}
.confirm-icon.warning { background: var(--warning-bg); color: var(--warning); }
.confirm-icon.info { background: var(--info-bg); color: var(--info); }
.confirm-text { text-align: center; }
.confirm-title { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.confirm-message { color: var(--ink-soft); font-size: .9rem; }

/* ========== DETAILS LIST (for transaction details modal) ========== */
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .88rem;
}
.kv-key { color: var(--ink-mute); font-weight: 500; }
.kv-val { color: var(--ink); font-weight: 600; text-align: end; word-break: break-word; }
.kv-val.pos { color: var(--success); }
.kv-val.neg { color: var(--danger); }

/* misc */
.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}
.text-mute { color: var(--ink-mute); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.center { text-align: center; }
.fw-700 { font-weight: 700; }

.help-text {
  font-size: .78rem; color: var(--ink-mute); margin-top: 4px;
}

/* utility for hidden */
.hidden { display: none !important; }

/* ========== INSIGHTS CARD ========== */
.insights-card {
  background: linear-gradient(135deg, #fffaf0 0%, #fff 60%);
  border: 1px solid #f0e3c4;
}
.insights-card .card-title svg { color: var(--accent); }
.insights-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (min-width: 720px) {
  .insights-grid { grid-template-columns: repeat(4, 1fr); }
}
.insight-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.insight-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.insight-head {
  display: flex; align-items: center; gap: 8px;
}
.insight-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--primary-bg);
  color: var(--primary);
  flex-shrink: 0;
}
.insight-icon.gold    { background: var(--accent-bg); color: var(--accent); }
.insight-icon.info    { background: var(--info-bg); color: var(--info); }
.insight-icon.warning { background: var(--warning-bg); color: var(--warning); }
.insight-icon.success { background: var(--success-bg); color: var(--success); }
.insight-label {
  font-size: .75rem;
  color: var(--ink-mute);
  font-weight: 500;
  line-height: 1.2;
}
.insight-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}
.insight-value.pos { color: var(--success); }
.insight-value.neg { color: var(--danger); }
.insight-note {
  font-size: .72rem;
  color: var(--ink-mute);
  line-height: 1.3;
}

/* ========== TIPS CARD (advice ribbons) ========== */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tip-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-inline-start: 3px solid var(--primary);
}
.tip-row.gold    { border-inline-start-color: var(--accent); }
.tip-row.info    { border-inline-start-color: var(--info); }
.tip-row.warning { border-inline-start-color: var(--warning); }
.tip-row.success { border-inline-start-color: var(--success); }
.tip-icon {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: var(--primary-bg); color: var(--primary);
}
.tip-row.gold .tip-icon    { background: var(--accent-bg); color: var(--accent); }
.tip-row.info .tip-icon    { background: var(--info-bg); color: var(--info); }
.tip-row.warning .tip-icon { background: var(--warning-bg); color: var(--warning); }
.tip-row.success .tip-icon { background: var(--success-bg); color: var(--success); }
.tip-body { flex: 1; min-width: 0; }
.tip-title { font-size: .88rem; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.tip-text  { font-size: .8rem; color: var(--ink-soft); line-height: 1.5; }

/* ========== COMPACT DATE-RANGE ROW ========== */
.date-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.date-range-label {
  font-size: .8rem;
  color: var(--ink-soft);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.date-range-label svg { color: var(--ink-mute); }
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.date-chip:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.date-chip-prefix {
  font-size: .75rem;
  color: var(--ink-mute);
  font-weight: 600;
}
.date-chip input[type="date"] {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: .82rem;
  color: var(--ink);
  padding: 0;
  min-width: 110px;
  max-width: 130px;
  font-weight: 500;
}
.date-clear-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: none;
  display: grid; place-items: center;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  font-size: .9rem;
  line-height: 1;
  padding: 0;
}
.date-clear-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* =============================================================
   v2 ADDITIONS — toast actions, modal stack, search palette,
   PIN lock, idle warning, account picker, password strength,
   sub-account display, skeleton loaders, archived cards
   ============================================================= */

/* Toast stack (multi-toast support, mobile-friendly) */
.toast-stack {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: calc(100vw - 32px);
  max-width: 460px;
}
.toast {
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  border: 1px solid var(--border);
  animation: toastIn 0.25s ease-out;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  width: 100%;
  max-width: 460px;
}
.toast.success { border-right: 4px solid #2f8f5e; }
.toast.danger  { border-right: 4px solid #b3382a; }
.toast.warning { border-right: 4px solid #c08a2c; }
.toast.info    { border-right: 4px solid #2c6bb8; }
.toast.fade-out { opacity: 0; transform: translateY(8px); transition: all .2s ease; }
.toast .toast-msg { flex: 1; }
.toast .toast-action {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.toast .toast-action:hover { background: var(--primary-soft); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Navbar search button */
.navbar-search-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-mute);
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-left: 8px;
  transition: all var(--t-fast);
}
.navbar-search-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

/* PIN lock screen */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 107, 91, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .25s ease;
}
.pin-lock-overlay.visible { opacity: 1; }
.pin-lock-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 32px;
  width: calc(100vw - 32px);
  max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}
.pin-lock-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.pin-lock-icon svg { width: 32px; height: 32px; }
.pin-lock-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.pin-lock-subtitle {
  color: var(--ink-mute);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.pin-input-wrap { margin-bottom: 12px; }
.pin-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5em;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
}
.pin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
}
.pin-input.shake {
  animation: pinShake 0.4s;
  border-color: var(--danger);
}
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.pin-error {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 20px;
  margin-top: 4px;
}
.pin-attempts {
  color: var(--ink-mute);
  font-size: 0.78rem;
  margin-top: 6px;
}

/* Idle warning banner */
.idle-warning {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-right: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s ease;
  max-width: 380px;
}
.idle-warning.visible { opacity: 1; transform: translateY(0); }
.idle-warning > svg:first-child { color: var(--accent); flex-shrink: 0; }
.idle-warning-body { flex: 1; }
.idle-warning-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 2px;
}
.idle-warning-text {
  font-size: 0.8rem;
  color: var(--ink-mute);
}
.idle-warning .btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}
@media (max-width: 480px) {
  .idle-warning { left: 16px; right: 16px; max-width: none; }
}

/* Search palette */
.search-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.search-palette-overlay.visible { opacity: 1; }
.search-palette {
  background: var(--surface);
  border-radius: 16px;
  width: calc(100vw - 32px);
  max-width: 580px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  overflow: hidden;
}
.search-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.search-palette-input-wrap > svg { color: var(--ink-mute); flex-shrink: 0; }
.search-palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  background: transparent;
  color: var(--ink);
  padding: 4px 0;
}
.search-palette-kbd, kbd {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--ink-mute);
  font-weight: 500;
}
.search-palette-results {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}
.search-palette-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--ink-mute);
}
.search-palette-group-label {
  padding: 8px 18px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.sp-item.active, .sp-item:hover { background: var(--primary-bg); }
.sp-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.sp-item-icon.bank, .sp-item-icon.transfer { background: #2c6bb8; }
.sp-item-icon.treasury, .sp-item-icon.deposit { background: #2f8f5e; }
.sp-item-icon.withdraw { background: #c08a2c; }
.sp-item-icon.buy   { background: #16846f; }
.sp-item-icon.sell  { background: #b3382a; }
.sp-item-icon.cost  { background: #888; }
.sp-item-body { flex: 1; min-width: 0; }
.sp-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-item-meta {
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.sp-item-right {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.88rem;
  flex-shrink: 0;
}
.search-palette-hint {
  display: flex;
  gap: 14px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--ink-mute);
  background: var(--bg-soft);
}
.search-palette-hint kbd { padding: 1px 6px; }

/* Account Picker (custom dropdown) */
.account-picker {
  position: relative;
  width: 100%;
}
.account-picker.disabled .ap-trigger { cursor: not-allowed; opacity: 0.7; }
.ap-trigger {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  text-align: right;
  transition: border-color var(--t-fast);
  min-height: 64px;
}
.ap-trigger:hover { border-color: var(--primary); }
.ap-trigger-content {
  flex: 1;
  min-width: 0;
}
.ap-chevron {
  color: var(--ink-mute);
  display: flex;
  transition: transform 0.2s ease;
}
.account-picker.open .ap-chevron { transform: rotate(180deg); }
.ap-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 100;
  max-height: 360px;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.account-picker.open .ap-dropdown { display: flex; }
.ap-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.ap-search > svg { color: var(--ink-mute); flex-shrink: 0; }
.ap-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  background: transparent;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 4px 0;
}
.ap-list {
  overflow-y: auto;
  padding: 6px 0;
}
.ap-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--t-fast);
  border-right: 3px solid transparent;
}
.ap-card:hover { background: var(--bg-soft); }
.ap-card.selected {
  background: var(--primary-bg);
  border-right-color: var(--primary);
}
.ap-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.ap-icon.bank { background: #2c6bb8; }
.ap-icon.treasury { background: #2f8f5e; }
.ap-body { flex: 1; min-width: 0; }
.ap-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.ap-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.ap-num {
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-weight: 500;
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
}
.ap-line2 {
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.ap-bank { font-weight: 500; }
.ap-branch { color: var(--ink-mute); }
.ap-type { color: var(--ink-mute); }
.ap-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  display: inline-block;
}
.ap-badge.ap-sub { background: var(--accent-bg); color: var(--accent); }
.ap-badge.ap-fav { background: #ffe9a8; color: #b58800; padding: 1px 5px; }
.ap-right { flex-shrink: 0; padding-right: 4px; }
.ap-balance {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.92rem;
  white-space: nowrap;
  text-align: left;
  direction: ltr;
}
.ap-balance.pos { color: #2f8f5e; }
.ap-balance.neg { color: var(--danger); }
.ap-empty, .ap-empty-inline {
  padding: 16px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.88rem;
}
.ap-empty-inline {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 10px;
}
.ap-placeholder {
  color: var(--ink-mute);
  padding: 12px 4px;
}

/* Sub-account checkbox toggle */
.parent-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.92rem;
  user-select: none;
}
.parent-toggle input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Sub-account card visual indicator */
.acc-card.is-sub {
  position: relative;
  margin-right: 24px;
  background: var(--bg-soft);
  border-style: dashed;
}
.acc-card.is-sub::before {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  width: 14px;
  border-top: 2px dashed var(--border);
}
.acc-card.is-sub::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 0;
  bottom: 50%;
  border-right: 2px dashed var(--border);
}
.acc-sub-line { display: none; } /* legacy hook */

.acc-fav-mark { color: #c08a2c; margin-right: 4px; font-size: 1rem; }
.badge-sub { background: var(--accent-bg); color: var(--accent); }
.badge-warn { background: #fdf3d8; color: #c08a2c; }

/* Archived card style */
.archived-card { opacity: 0.85; border-style: dashed; }
.archived-card .acc-card-name { color: var(--ink-mute); }

/* Password strength meter */
.pwd-strength {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pwd-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.pwd-bar-fill {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 999px;
}
.pwd-label {
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

/* Skeleton loader */
.skeleton-block {
  padding: 16px;
}
.skel-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-soft) 0%, #ededed 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite;
  border-radius: 6px;
  margin-bottom: 8px;
}
.skel-line:nth-child(2) { width: 80%; }
.skel-line:nth-child(3) { width: 60%; }
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tag dot (for tags list) */
.tag-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* Error log */
.error-log {
  max-height: 360px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.78rem;
}
.error-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.error-time {
  color: var(--ink-mute);
  font-size: 0.72rem;
  margin-bottom: 2px;
}
.error-msg {
  color: var(--danger);
  font-weight: 600;
  word-break: break-word;
}
.error-info {
  margin-top: 4px;
  color: var(--ink-mute);
  background: var(--bg-soft);
  padding: 6px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.72rem;
}

/* Insight row */
.insight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--primary-bg);
  border-radius: 10px;
}
.insight-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Cur-row layout for currencies/tags */
.cur-list { display: flex; flex-direction: column; gap: 6px; }
.cur-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
}

/* Generic alert blocks */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.alert > svg:first-child { flex-shrink: 0; margin-top: 2px; }
.alert-warning { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent); }
.alert-success { background: #e7f4ec; color: #2f8f5e; border: 1px solid #2f8f5e44; }
.alert-info    { background: #e6f0fb; color: #2c6bb8; border: 1px solid #2c6bb844; }

/* Confirm dialog */
.confirm-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-bg);
  color: var(--accent);
}
.confirm-icon.danger  { background: var(--danger-bg); color: var(--danger); }
.confirm-icon.warning { background: var(--accent-bg); color: var(--accent); }
.confirm-icon.info    { background: var(--primary-bg); color: var(--primary); }
.confirm-icon svg { width: 28px; height: 28px; }
.confirm-text { text-align: center; }
.confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.confirm-message {
  font-size: 0.92rem;
  color: var(--ink-mute);
  line-height: 1.6;
}

/* Misc helpers */
.text-xs { font-size: 0.78rem; }
.hidden { display: none !important; }
.req { color: var(--danger); margin-right: 2px; }

/* Filter tabs base styles (in case missing) */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink-mute);
  transition: all var(--t-fast);
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Tx archived state */
.tx-archived { opacity: 0.7; }
.tx-archived .tx-item-title { color: var(--ink-mute); }
.tx-item-note {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 2px;
  font-style: italic;
}


/* Tx-item icon aliases (for newer markup using tx-item-icon class) */
.tx-item-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tx-item-icon.deposit  { background: var(--info-bg); color: var(--info); }
.tx-item-icon.withdraw { background: var(--danger-bg); color: var(--danger); }
.tx-item-icon.transfer { background: var(--warning-bg); color: var(--warning); }
.tx-item-icon.buy      { background: var(--success-bg); color: var(--success); }
.tx-item-icon.sell     { background: var(--accent-bg); color: var(--accent); }
.tx-item-icon.cost     { background: var(--primary-bg); color: var(--primary); }

.tx-item-body { flex: 1; min-width: 0; text-align: right; }
.tx-item-title {
  font-weight: 600; color: var(--ink); font-size: .92rem;
}
.tx-item-meta { font-size: .76rem; color: var(--ink-mute); margin-top: 2px; }
.tx-item-amt {
  font-weight: 700;
  font-size: .95rem;
  text-align: end;
  font-feature-settings: "tnum";
  white-space: nowrap;
  direction: ltr;
}

/* Make tx-item button-styled */
button.tx-item {
  width: 100%;
  font-family: inherit;
  text-align: right;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* acc-row (compact horizontal account card) */
.acc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast);
}
.acc-row:hover { border-color: var(--primary); }
.acc-row-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
}
.acc-row-icon.bank { background: #2c6bb8; }
.acc-row-icon.treasury { background: #2f8f5e; }
.acc-row-body { flex: 1; min-width: 0; }
.acc-row-name {
  font-weight: 600;
  color: var(--ink);
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-row-meta { font-size: .76rem; color: var(--ink-mute); }
.acc-row-bal {
  font-weight: 700;
  white-space: nowrap;
  direction: ltr;
}
.acc-row-bal.pos { color: var(--success); }
.acc-row-bal.neg { color: var(--danger); }

/* ============================================================
   v2 LAYOUT — markup-aligned styles for new pages
   ============================================================ */

/* Page container */
.app-container { 
  min-height: 100vh; 
  padding-top: 60px; 
}
.app-container .page { 
  max-width: 1100px;
  margin: 0 auto; 
  padding: 16px;
}
@media (min-width: 768px) {
  .app-container .page { padding: 24px; }
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title-mini {
  font-size: 0.85rem;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; min-width: 80px; justify-content: center; }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: box-shadow var(--t-fast);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-card.stat-primary { border-color: var(--primary); background: var(--primary-bg); }
.stat-card.stat-success { border-color: var(--success); background: var(--success-bg); }
.stat-card.stat-warning { border-color: var(--warning); background: var(--warning-bg); }
.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-primary .stat-card-icon { color: var(--primary); }
.stat-success .stat-card-icon { color: var(--success); }
.stat-warning .stat-card-icon { color: var(--warning); }
.stat-card-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-bottom: 4px;
  font-weight: 500;
}
.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  font-feature-settings: "tnum";
  line-height: 1.2;
  word-break: break-word;
}
.stat-foot {
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* Grid 2-column responsive */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* Panel block */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg-soft);
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title svg { color: var(--primary); }
.panel-body { padding: 16px; }
.link-action {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.link-action:hover { text-decoration: underline; }

/* Empty state */
.empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--ink-mute);
}
.empty svg {
  width: 48px; height: 48px;
  margin-bottom: 12px;
  color: var(--ink-mute);
  opacity: 0.5;
}
.empty h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty p {
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.empty-large {
  padding: 60px 20px;
}
.empty-large svg {
  width: 64px; height: 64px;
  margin-bottom: 16px;
}

/* Filters bar */
.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
}
.filter-search > svg { color: var(--ink-mute); flex-shrink: 0; }
.filter-search .input {
  border: none;
  background: transparent;
  padding: 10px 0;
  flex: 1;
}
.filter-search .input:focus { box-shadow: none; }

/* Account cards grid */
.acc-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 700px) {
  .acc-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

.acc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--t-fast);
}
.acc-card:hover { box-shadow: var(--shadow-sm); }
.acc-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.acc-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.acc-card-icon.bank { background: #2c6bb8; }
.acc-card-icon.treasury { background: #2f8f5e; }
.acc-card-titles { flex: 1; min-width: 0; }
.acc-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.acc-card-sub {
  font-size: 0.82rem;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.acc-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--ink-mute);
  padding: 2px 8px;
  border-radius: 6px;
}
.badge-local   { background: var(--primary-bg); color: var(--primary); }
.badge-foreign { background: var(--accent-bg); color: var(--accent); }
.badge-cur     { background: var(--info-bg); color: var(--info); }

.acc-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.acc-card-actions .btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-mute);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.acc-card-actions .btn-icon:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--ink);
}

.acc-card-balance {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 10px 12px;
}
.acc-bal-label {
  font-size: 0.75rem;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.acc-bal-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  font-feature-settings: "tnum";
  direction: ltr;
  text-align: right;
}
.acc-bal-value.pos { color: var(--success); }
.acc-bal-value.neg { color: var(--danger); }
.acc-bal-cost {
  font-size: 0.74rem;
  color: var(--ink-mute);
  margin-top: 4px;
  direction: ltr;
  text-align: right;
}

.acc-card-ops {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.acc-op {
  flex: 1;
  min-width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-mute);
  transition: all var(--t-fast);
}
.acc-op:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}
.acc-op svg { width: 18px; height: 18px; }
.acc-op-detail {
  background: var(--bg-soft);
}

/* Tx list with full layout */
.tx-list-full button.tx-item {
  padding: 14px;
}
.tx-list-full .tx-item-body { flex: 1; }

/* Link */
.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

/* KV list (for view tx etc.) */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
}
.kv-key {
  color: var(--ink-mute);
  font-size: 0.85rem;
}
.kv-val {
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  font-size: 0.9rem;
  word-break: break-word;
}
.kv-val.pos { color: var(--success); }
.kv-val.neg { color: var(--danger); }

/* Field-row (two columns) */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 500px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}


/* =============================================================
   v3 ADDITIONS — welcome card, hero stat, FX rows, sub-accounts accordion,
   role badges, Pro/Admin UI, search palette beautification
   ============================================================= */

/* ================ WELCOME CARD (Dashboard hero) ================ */
.welcome-card {
  position: relative;
  background: linear-gradient(135deg, #0f6b5b 0%, #16846f 50%, #c08a2c 100%);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 20px;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 107, 91, 0.25);
}
.welcome-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.15) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 40%);
  pointer-events: none;
}
.welcome-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.welcome-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.4);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.welcome-text { flex: 1; min-width: 0; }
.welcome-greet {
  font-size: 0.92rem;
  opacity: 0.9;
  font-weight: 500;
  margin-bottom: 2px;
}
.welcome-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.welcome-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.82rem;
  opacity: 0.92;
  flex-wrap: wrap;
}
.welcome-username {
  font-weight: 600;
  background: rgba(255,255,255,0.18);
  padding: 2px 8px;
  border-radius: 6px;
}
.welcome-sep { opacity: 0.5; }
.welcome-tier-badge {
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.welcome-tier-badge.tier-pro {
  background: linear-gradient(135deg, #ffd989 0%, #c08a2c 100%);
  color: #6e4d10;
  border-color: rgba(255,255,255,0.6);
}
.welcome-chips {
  position: relative;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.welcome-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
}
.welcome-chip svg { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .welcome-name { font-size: 1.2rem; }
  .welcome-avatar { width: 50px; height: 50px; font-size: 1.3rem; }
}

/* ================ QUICK ACTIONS ROW ================ */
.quick-actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .quick-actions-row .btn span { display: none; }
}

/* ================ HERO STAT CARD (LYD total) ================ */
.hero-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 4px solid var(--primary);
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.hero-stat-icon {
  width: 56px; height: 56px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.hero-stat-icon svg { width: 28px; height: 28px; }
.hero-stat-body { flex: 1; min-width: 200px; }
.hero-stat-label {
  font-size: 0.85rem;
  color: var(--ink-mute);
  margin-bottom: 4px;
  font-weight: 500;
}
.hero-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  font-feature-settings: "tnum";
  word-break: break-word;
}
.hero-stat-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: 10px;
  flex-wrap: wrap;
}
.hss-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.hss-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  font-feature-settings: "tnum";
}
.hss-label {
  font-size: 0.7rem;
  color: var(--ink-mute);
  font-weight: 500;
}
.hss-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}
@media (max-width: 600px) {
  .hero-stat-card { padding: 14px; }
  .hero-stat-value { font-size: 1.4rem; }
  .hero-stat-summary {
    width: 100%;
    justify-content: space-around;
  }
}

/* ================ FX WALLET ROWS ================ */
.panel-head-meta {
  font-size: 0.85rem;
  color: var(--ink-mute);
}
.panel-head-meta strong { color: var(--ink); font-feature-settings: "tnum"; }

.fx-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fx-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  flex-wrap: wrap;
}
.fx-row-cur {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 110px;
}
.fx-cur-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.fx-cur-meta { display: flex; flex-direction: column; }
.fx-cur-code {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}
.fx-cur-count {
  font-size: 0.75rem;
  color: var(--ink-mute);
}
.fx-cells {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.fx-cell {
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.fx-cell.highlight {
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--accent-bg) 100%);
  border-color: var(--primary);
}
.fx-cell-label {
  font-size: 0.68rem;
  color: var(--ink-mute);
  margin-bottom: 2px;
  font-weight: 500;
}
.fx-cell.highlight .fx-cell-label { color: var(--primary); font-weight: 600; }
.fx-cell-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
  direction: ltr;
}
.fx-cell-unit {
  font-size: 0.66rem;
  color: var(--ink-mute);
  margin-top: 1px;
  direction: ltr;
}
@media (max-width: 600px) {
  .fx-row { flex-direction: column; padding: 10px; }
  .fx-cells { width: 100%; }
  .fx-cell-val { font-size: 0.82rem; }
}

/* ================ SUB-ACCOUNTS ACCORDION ================ */
/* Override the old .is-sub::before/after */
.acc-card.is-sub::before,
.acc-card.is-sub::after { display: none !important; }
.acc-card.is-sub {
  margin-right: 0;
  background: var(--surface);
  border-style: solid;
  border-right: 4px solid var(--accent);
}

.subs-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: var(--primary-bg);
  border: 1px dashed var(--primary);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 4px;
  transition: all var(--t-fast);
}
.subs-toggle:hover { background: var(--primary); color: #fff; }
.subs-toggle svg { transition: transform 0.25s ease; }
.subs-toggle.open svg { transform: rotate(180deg); }

.acc-subs-container {
  grid-column: 1 / -1;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}
.acc-subs-container.expanded {
  max-height: 5000px;
  opacity: 1;
}
.acc-subs-inner {
  padding: 10px 0 4px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  position: relative;
}
.acc-subs-inner::before {
  content: "";
  position: absolute;
  right: 8px;
  top: 0; bottom: 12px;
  border-right: 2px dashed var(--accent);
}
@media (min-width: 700px) {
  .acc-subs-inner { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}
.acc-subs-empty {
  padding: 14px;
  text-align: center;
  color: var(--ink-mute);
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 0.88rem;
}

/* ================ ROLE BADGES (رئيسي / فرعي) ================ */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.role-badge svg { width: 12px; height: 12px; }
.role-badge.role-main {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  color: #fff;
}
.role-badge.role-sub {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ================ ACCOUNT BALANCE META (avg cost display) ================ */
.acc-bal-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.acc-bal-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}
.acc-bal-meta-label { color: var(--ink-mute); }
.acc-bal-meta-val {
  color: var(--ink);
  font-weight: 600;
  font-feature-settings: "tnum";
  direction: ltr;
}
.acc-bal-meta-row.highlight {
  background: linear-gradient(135deg, var(--accent-bg), transparent);
  border-radius: 6px;
  padding: 4px 6px;
}
.acc-bal-meta-row.highlight .acc-bal-meta-label { color: var(--accent); font-weight: 600; }
.acc-bal-meta-row.highlight .acc-bal-meta-val { color: var(--accent); font-weight: 700; }

/* ================ NAVBAR TIER BADGE ================ */
.navbar-tier-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  margin-left: 6px;
  margin-right: 6px;
}
.navbar-tier-badge.tier-free {
  background: var(--bg-soft);
  color: var(--ink-mute);
  border: 1px solid var(--border);
}
.navbar-tier-badge.tier-pro {
  background: linear-gradient(135deg, #ffd989 0%, #c08a2c 100%);
  color: #6e4d10;
}
.navbar-status .status-dot { display: none; }

/* ================ ADMIN UI ================ */
.admin-tag {
  display: inline-block;
  background: linear-gradient(135deg, #b3382a 0%, #d04632 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 5px;
  margin-right: 4px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.sidebar-link.admin-link {
  position: relative;
  color: #b3382a;
}
.sidebar-link.admin-link.active {
  background: linear-gradient(135deg, rgba(179,56,42,0.1), transparent);
}
.soon-pill {
  margin-right: auto;
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.upgrade-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #ffd989 0%, #c08a2c 100%);
  color: #6e4d10 !important;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 8px;
  transition: transform var(--t-fast);
}
.upgrade-link:hover { transform: translateY(-1px); }

/* ================ PRO PANEL ================ */
.pro-panel { border: 2px solid var(--accent); }
.pro-pitch-intro {
  font-size: 0.95rem;
  margin-bottom: 14px;
  color: var(--ink);
}
.pro-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 8px;
}
.pro-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--ink);
}
.pro-feature-icon {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  flex-shrink: 0;
}
.pro-feature-icon svg { width: 16px; height: 16px; }
.pro-feature-vs {
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--ink-mute);
}

/* ================ ADMIN PANEL ================ */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.admin-stat {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.admin-stat-icon {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  background: var(--surface);
  color: var(--primary);
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.admin-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
}
.admin-stat-label {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 2px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
}
.feat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
}
.feat-toggle input { accent-color: var(--primary); width: 16px; height: 16px; }

/* COMING SOON OVERLAY */
.coming-soon-panel { position: relative; }
.cs-disabled { opacity: 0.45; pointer-events: none; filter: blur(0.4px); }
.cs-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.85));
  backdrop-filter: blur(2px);
  z-index: 5;
  border-radius: var(--r-md);
}
.cs-overlay-content {
  text-align: center;
  padding: 20px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  max-width: 360px;
  border: 2px dashed var(--accent);
}
.cs-icon {
  width: 56px; height: 56px;
  margin: 0 auto 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.cs-icon svg { width: 28px; height: 28px; }
.cs-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}
.cs-desc {
  font-size: 0.85rem;
  color: var(--ink-mute);
  line-height: 1.5;
}

/* USERS LIST */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
}
.user-row.is-me {
  background: var(--primary-bg);
  border: 1px solid var(--primary);
}
.user-row-avatar {
  width: 40px; height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.user-row-body { flex: 1; min-width: 0; }
.user-row-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.user-row-meta {
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.user-row-actions { flex-shrink: 0; }

/* ================ SEARCH PALETTE BEAUTIFIED ================ */
.search-palette-overlay {
  padding-top: 8vh !important;
}
.search-palette {
  border-radius: 20px !important;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35) !important;
  border: 1px solid rgba(255,255,255,0.2);
}
.search-palette-input-wrap {
  padding: 18px 20px !important;
  border-bottom: 2px solid var(--bg-soft) !important;
  background: linear-gradient(180deg, var(--primary-bg), transparent);
}
.search-palette-input {
  font-size: 1.1rem !important;
  font-weight: 500 !important;
}
.search-palette-input::placeholder { color: var(--ink-mute); opacity: 0.7; }
.sp-item.sp-action { background: linear-gradient(90deg, var(--primary-bg), transparent); }
.sp-item.sp-action:hover { background: var(--primary-bg); }
.search-palette-empty {
  padding: 40px 20px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.search-palette-empty svg {
  width: 36px; height: 36px;
  color: var(--ink-mute);
  opacity: 0.5;
}
.search-palette-empty .empty-msg {
  color: var(--ink-mute);
  font-size: 0.92rem;
}

/* Pulse animation hint for the search button */
@keyframes pulseHint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 132, 111, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(22, 132, 111, 0); }
}
.navbar-search-btn {
  animation: pulseHint 2s ease-in-out 2;
}


/* =============================================================
   v4 ADDITIONS — Refinements per user feedback (May 2026)
   - Softer welcome card
   - 6 action buttons in equal horizontal layout
   - Dual-stat row + grand total full-width card
   - Compact FX wallet mini cards
   ============================================================= */

/* ============ SOFTER WELCOME CARD ============ */
.welcome-card-soft {
  background: linear-gradient(135deg, 
    rgba(15, 107, 91, 0.85) 0%, 
    rgba(22, 132, 111, 0.78) 50%, 
    rgba(192, 138, 44, 0.65) 100%) !important;
  box-shadow: 0 8px 24px rgba(15, 107, 91, 0.15) !important;
}
.welcome-card-soft .welcome-name {
  font-size: 1.35rem !important;
}
.welcome-card-soft .welcome-meta {
  font-size: 0.78rem !important;
}
.welcome-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.welcome-today-chip {
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 12px;
  padding: 6px 12px;
  text-align: center;
  min-width: 70px;
}
.welcome-today-num {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}
.welcome-today-label {
  font-size: 0.68rem;
  opacity: 0.92;
  margin-top: 2px;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .welcome-card-soft { padding: 18px 16px !important; }
  .welcome-today-chip { padding: 5px 10px; min-width: 64px; }
}

/* ============ 6 ACTION BUTTONS — equal horizontal ============ */
.action-buttons-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  transition: all var(--t-fast);
}
.action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(15, 107, 91, 0.12);
}
.action-btn:active { transform: translateY(0); }
.action-btn .action-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--primary);
  transition: all var(--t-fast);
}
.action-btn:hover .action-icon {
  background: var(--primary);
  color: #fff;
}
.action-btn .action-icon svg { width: 18px; height: 18px; }
.action-btn .action-label { font-size: 0.75rem; }

/* color hints by action */
.action-btn[data-act="deposit"]:hover .action-icon { background: #2f8f5e; }
.action-btn[data-act="withdraw"]:hover .action-icon { background: #c08a2c; }
.action-btn[data-act="transfer"]:hover .action-icon { background: #2c6bb8; }
.action-btn[data-act="buy"]:hover .action-icon { background: #16846f; }
.action-btn[data-act="sell"]:hover .action-icon { background: #b3382a; }
.action-btn[data-act="cost"]:hover .action-icon { background: #888; }

@media (max-width: 600px) {
  .action-buttons-row { gap: 4px; }
  .action-btn { padding: 8px 2px; font-size: 0.72rem; }
  .action-btn .action-icon { width: 24px; height: 24px; }
  .action-btn .action-icon svg { width: 14px; height: 14px; }
  .action-btn .action-label { font-size: 0.68rem; }
}

/* ============ DUAL STAT ROW (LYD + FX cost side-by-side) ============ */
.dual-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.dual-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: box-shadow var(--t-fast);
}
.dual-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.dual-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dual-stat-icon.icon-primary { background: var(--primary-bg); color: var(--primary); }
.dual-stat-icon.icon-accent  { background: var(--accent-bg);  color: var(--accent); }
.dual-stat-icon svg { width: 22px; height: 22px; }
.dual-stat-body { flex: 1; min-width: 0; }
.dual-stat-label {
  font-size: 0.74rem;
  color: var(--ink-mute);
  margin-bottom: 3px;
  font-weight: 500;
  line-height: 1.3;
}
.dual-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  font-feature-settings: "tnum";
  word-break: break-word;
  line-height: 1.2;
  direction: ltr;
  text-align: right;
}
.dual-stat-foot {
  font-size: 0.7rem;
  color: var(--ink-mute);
  margin-top: 3px;
}

@media (max-width: 480px) {
  .dual-stat-row { grid-template-columns: 1fr; gap: 8px; }
  .dual-stat-card { padding: 12px; }
  .dual-stat-value { font-size: 1.05rem; }
}

/* ============ GRAND TOTAL FULL WIDTH ============ */
.grand-total-card {
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 60%, var(--accent) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 107, 91, 0.18);
}
.gt-decoration {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 90% 30%, rgba(255,255,255,0.18) 0%, transparent 50%);
  pointer-events: none;
}
.gt-icon {
  position: relative;
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.gt-icon svg { width: 28px; height: 28px; }
.gt-body {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.gt-label {
  font-size: 0.82rem;
  opacity: 0.95;
  font-weight: 500;
  margin-bottom: 1px;
}
.gt-formula {
  font-size: 0.7rem;
  opacity: 0.78;
  margin-bottom: 6px;
}
.gt-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-feature-settings: "tnum";
  direction: ltr;
  text-align: right;
  line-height: 1.1;
}
.gt-summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  padding: 8px 12px;
  flex-shrink: 0;
}
.gt-sum-item { display: flex; flex-direction: column; align-items: center; }
.gt-sum-num {
  font-size: 1rem;
  font-weight: 800;
  font-feature-settings: "tnum";
  line-height: 1;
}
.gt-sum-lbl {
  font-size: 0.68rem;
  opacity: 0.9;
  margin-top: 2px;
  white-space: nowrap;
}
.gt-sum-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.3);
}

@media (max-width: 600px) {
  .grand-total-card { padding: 14px; }
  .gt-value { font-size: 1.3rem; }
  .gt-summary { width: 100%; justify-content: space-around; }
}

/* ============ FX MINI CARDS — compact horizontal grid ============ */
.fx-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.fx-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow var(--t-fast);
}
.fx-mini-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.fx-mini-head {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fx-mini-cur {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.fx-mini-count {
  font-size: 0.72rem;
  opacity: 0.9;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
}
.fx-mini-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.fx-mini-cell {
  background: var(--surface);
  padding: 10px 6px;
  text-align: center;
}
.fx-mini-cell.highlight {
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
}
.fx-mini-label {
  font-size: 0.66rem;
  color: var(--ink-mute);
  margin-bottom: 3px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fx-mini-cell.highlight .fx-mini-label { color: var(--primary); font-weight: 600; }
.fx-mini-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
  direction: ltr;
}


/* =========================================================
   Phase 1/2 additions: reports, dark appearance, print support
   ========================================================= */
.pos { color: var(--success) !important; }
.neg { color: var(--danger) !important; }
body.theme-dark {
  --bg: #0f1715;
  --surface: #15211f;
  --surface-2: #1c2b28;
  --ink: #edf7f3;
  --muted: #9fb5ae;
  --line: rgba(255,255,255,.10);
  --primary-bg: rgba(22,132,111,.18);
  --danger-bg: rgba(179,56,42,.16);
  --warning-bg: rgba(192,138,44,.16);
}
body.theme-dark .panel,
body.theme-dark .stat-card,
body.theme-dark .dual-stat-card,
body.theme-dark .acc-card,
body.theme-dark .modal,
body.theme-dark .sidebar,
body.theme-dark .navbar {
  box-shadow: 0 12px 35px rgba(0,0,0,.25);
}
body.theme-dark .input,
body.theme-dark .select,
body.theme-dark .textarea {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
@media print {
  .navbar, .sidebar, .sidebar-overlay, .page-actions, .filters, .toast-stack { display:none !important; }
  body { background:#fff !important; }
  .app-container { padding:0 !important; margin:0 !important; max-width:none !important; }
  .panel, .stat-card { box-shadow:none !important; break-inside: avoid; border:1px solid #ddd !important; }
}

/* =========================================================
   FinFlow update — account FX structured metrics
   ========================================================= */
.acc-card-balance-fx {
  padding: 12px;
}
.acc-fx-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.acc-fx-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
}
.acc-fx-metric.primary {
  background: rgba(22, 132, 111, 0.07);
  border-color: rgba(22, 132, 111, 0.18);
}
.acc-fx-metric-label {
  color: var(--ink-mute);
  font-size: 0.78rem;
  white-space: nowrap;
}
.acc-fx-metric-value {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  direction: ltr;
  text-align: left;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.acc-fx-metric.primary .acc-fx-metric-value {
  font-size: 1.15rem;
}
.acc-fx-metric-value.pos { color: var(--success); }
.acc-fx-metric-value.neg { color: var(--danger); }
.acc-fx-metric-value.accent { color: var(--accent); }
@media (min-width: 680px) {
  .acc-fx-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .acc-fx-metric {
    flex-direction: column;
    align-items: flex-start;
  }
  .acc-fx-metric-value {
    width: 100%;
    text-align: right;
  }
}

/* keep welcome card balanced after removing tier/daily chips */
.welcome-card .welcome-content {
  justify-content: flex-start;
}

/* === FinFlow requested updates: lock button, plans, receipts, cost hints === */
.welcome-card{position:relative;overflow:hidden}
.welcome-lock-btn{
  position:absolute; top:18px; left:18px; z-index:3;
  width:46px; height:46px; border-radius:18px;
  border:1px solid rgba(255,255,255,.55);
  background:rgba(255,255,255,.18); color:#fff;
  display:grid; place-items:center; cursor:pointer;
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  transition:transform .18s ease, background .18s ease;
}
.welcome-lock-btn:hover{transform:translateY(-1px);background:rgba(255,255,255,.26)}
.welcome-lock-btn svg{width:22px;height:22px}
.pin-recovery.hidden{display:none!important}
.plans-preview-grid,.plans-admin-grid{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); gap:10px;
}
.plan-preview-card,.plan-admin-card{
  border:1px solid var(--border); background:var(--card); border-radius:18px; padding:14px;
  box-shadow:var(--shadow-sm, 0 8px 24px rgba(0,0,0,.05));
}
.plan-preview-title,.plan-admin-title{font-weight:900;color:var(--ink);font-size:1rem}
.plan-preview-price,.plan-admin-price{font-weight:900;color:var(--primary);font-size:1.15rem;margin-top:6px}
.plan-preview-meta,.plan-admin-meta{font-size:.82rem;color:var(--ink-mute);margin-top:3px}
.plan-admin-card.is-muted{opacity:.62}
.plan-admin-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:8px}
.plan-admin-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.link-button{border:0;background:transparent;color:var(--primary);font-weight:800;cursor:pointer;padding:0;text-decoration:underline}
.receipt-preview{text-align:center}.receipt-preview img{max-width:100%;max-height:65vh;border-radius:18px;border:1px solid var(--border);object-fit:contain;background:#fff}
.field-hint{font-size:.78rem;color:var(--ink-mute);margin-top:6px;line-height:1.6}
.theme-dark .plan-preview-card,.theme-dark .plan-admin-card{background:var(--card);}
@media (max-width:520px){.welcome-lock-btn{top:14px;left:14px;width:42px;height:42px;border-radius:15px}.plans-preview-grid,.plans-admin-grid{grid-template-columns:1fr 1fr}}

/* ========== Upgrade plan dropdown and profit management refinements ========== */
.plan-select-card{
  border:1px solid var(--border);
  background:linear-gradient(135deg, rgba(22,132,111,.08), rgba(192,138,44,.08));
  border-radius:18px;
  padding:14px;
}
.plan-nice-select{
  font-weight:800;
  border-radius:16px;
  background:var(--card);
  border-color:var(--border-strong, var(--border));
}
.plan-admin-facts{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-top:10px;
}
.plan-admin-facts div{
  background:var(--soft);
  border:1px solid var(--border);
  border-radius:14px;
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.plan-admin-facts span{font-size:.74rem;color:var(--ink-mute)}
.plan-admin-facts strong{font-size:.88rem;color:var(--ink)}
.profit-filters .field{min-width:150px}
.theme-dark .plan-select-card{background:rgba(255,255,255,.04)}
@media (max-width:520px){.plan-admin-facts{grid-template-columns:1fr}.profit-filters .field-row{display:block}.profit-filters .field{margin-bottom:8px}}
