/* ============================================================================
   Duuliye Exchange — Design System
   Premium fintech UI · dark/light themes · responsive
   ============================================================================ */

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

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 999px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .18s;

  --sidebar-w: 264px;
  --bottomnav-h: 66px;
  --topbar-h: 64px;
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #060a14;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(79, 125, 255, .16), transparent 55%),
             radial-gradient(1000px 500px at -10% 10%, rgba(139, 92, 246, .14), transparent 55%);
  --bg-soft: #0a101d;
  --bg-elev: #0d1526;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .065);
  --surface-solid: #111a2c;
  --surface-solid-2: #16213a;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);

  --text: #e9eef8;
  --text-2: #a8b3c7;
  --text-3: #6b7789;

  --primary: #4f7dff;
  --primary-strong: #3b68f2;
  --primary-soft: rgba(79, 125, 255, .14);
  --violet: #8b5cf6;
  --accent: #22d3ee;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);

  --grad: linear-gradient(135deg, #4f7dff 0%, #7c5cff 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(79,125,255,.16), rgba(168,85,247,.14));
  --glass: rgba(255, 255, 255, .04);
  --glass-strong: rgba(17, 26, 44, .72);
  --ring: rgba(79, 125, 255, .45);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.55);

  --backdrop: rgba(4, 7, 14, .7);
}

/* Light theme */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(79, 125, 255, .12), transparent 55%),
             radial-gradient(1000px 500px at -10% 10%, rgba(139, 92, 246, .10), transparent 55%);
  --bg-soft: #e7ebf4;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --surface-solid: #ffffff;
  --surface-solid-2: #f1f4fa;
  --border: rgba(15, 23, 42, .08);
  --border-strong: rgba(15, 23, 42, .16);

  --text: #0f172a;
  --text-2: #45536b;
  --text-3: #8a94a6;

  --primary: #3b68f2;
  --primary-strong: #2f55d6;
  --primary-soft: rgba(59, 104, 242, .12);
  --violet: #7c3aed;
  --accent: #0891b2;
  --success: #059669;
  --success-soft: rgba(5, 150, 105, .12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, .12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .10);

  --grad: linear-gradient(135deg, #3b68f2 0%, #6d4df0 55%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(59,104,242,.10), rgba(168,85,247,.10));
  --glass: rgba(255, 255, 255, .7);
  --glass-strong: rgba(255, 255, 255, .82);
  --ring: rgba(59, 104, 242, .35);

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 12px 30px rgba(15,23,42,.10);
  --shadow-lg: 0 30px 70px rgba(15,23,42,.18);

  --backdrop: rgba(15, 23, 42, .4);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-soft); }

h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------- Icons ------------------------- */
.ic { width: 20px; height: 20px; flex: none; }
.ic-lg { width: 26px; height: 26px; }
.ic-sm { width: 16px; height: 16px; }

/* ------------------------- Buttons ------------------------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 13px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: 14.5px; letter-spacing: -.01em;
  cursor: pointer; white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: var(--grad); --btn-fg: #fff; --btn-bd: transparent;
  box-shadow: 0 8px 22px rgba(79, 125, 255, .28);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(79, 125, 255, .4); }

.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary); --btn-bd: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-2); --btn-bd: var(--border); }
.btn-ghost:hover { --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn-success { --btn-bg: var(--success); --btn-fg: #06251b; --btn-bd: transparent; box-shadow: 0 8px 22px rgba(52,211,153,.25); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 8px 22px rgba(248,113,113,.25); }
.btn-outline { --btn-bg: transparent; --btn-fg: var(--primary); --btn-bd: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 22px; font-size: 15.5px; border-radius: 15px; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
  position: relative;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); transform: translateY(-1px); }
.icon-btn .dot {
  position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--bg-elev);
}

/* ------------------------- Forms ------------------------- */
.field { display: block; margin-bottom: 18px; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.field-label .req { color: var(--danger); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic, .input-wrap > .lead {
  position: absolute; left: 15px; color: var(--text-3); pointer-events: none;
}
.input-wrap > .trail { position: absolute; right: 10px; }

.input {
  width: 100%; padding: 13px 15px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 15px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.has-icon { padding-left: 44px; }
.input.has-trail { padding-right: 46px; }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.input.is-valid { border-color: var(--success); }

.field-hint { font-size: 12px; color: var(--text-3); margin-top: 7px; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 7px; display: flex; gap: 6px; align-items: center; }

.pw-toggle {
  position: absolute; right: 8px; width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); background: transparent; border: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }

select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; }

/* ------------------------- Cards ------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; position: relative;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.card-pad-sm { padding: 16px; }
.card-hover { transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card-hover:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.section-title .ic { color: var(--primary); }
.section-link { font-size: 13px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }
.section-link:hover { text-decoration: underline; }

/* ------------------------- Badges & pills ------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; letter-spacing: .01em; line-height: 1.4;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-full);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ------------------------- App shell layout ------------------------- */
.app { display: flex; min-height: 100vh; }

/* Sidebar (desktop) */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  display: flex; flex-direction: column; gap: 8px; padding: 22px 16px;
  background: var(--glass-strong); border-right: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: transform .28s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: var(--grad); display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff;
  box-shadow: 0 8px 20px rgba(79, 125, 255, .35);
}
.brand-text { line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

.nav-group-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; padding: 10px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14.5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}
.nav-link .ic { color: var(--text-3); transition: color var(--dur) var(--ease); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .ic { color: var(--text-2); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link.active .ic { color: var(--primary); }
.nav-link.active::before {
  content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-card {
  display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.user-card .meta { min-width: 0; }
.user-card .name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .phone { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main column */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--glass-strong); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.topbar .page-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }

.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--bottomnav-h); padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--glass-strong); border-top: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.bottom-nav-inner { display: flex; height: 100%; max-width: 480px; margin: 0 auto; }
.bottom-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600;
  transition: color var(--dur) var(--ease);
}
.bottom-link .ic { transition: transform var(--dur) var(--ease); }
.bottom-link.active { color: var(--primary); }
.bottom-link.active .ic { transform: translateY(-1px); }

/* ------------------------- Grid helpers ------------------------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 8px; }
.gap-lg { gap: 20px; }
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mt-6{margin-top:24px}.mt-8{margin-top:32px}
.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono { font-family: var(--mono); }

/* ------------------------- Balance / hero card ------------------------- */
.hero-card {
  position: relative; overflow: hidden; border-radius: var(--radius-xl);
  background: var(--grad); color: #fff; padding: 28px;
  box-shadow: 0 24px 60px rgba(79, 125, 255, .35);
}
.hero-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px 200px at 90% -10%, rgba(255,255,255,.28), transparent 60%),
              radial-gradient(300px 200px at 0% 100%, rgba(255,255,255,.12), transparent 60%);
}
.hero-card > * { position: relative; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-label { font-size: 13px; font-weight: 600; opacity: .85; letter-spacing: .02em; }
.hero-balance { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 10px 0 4px; }
.hero-sub { font-size: 13px; opacity: .82; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius-full);
  background: rgba(255,255,255,.16); backdrop-filter: blur(8px); font-size: 12.5px; font-weight: 600;
}
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-action {
  flex: 1; min-width: 90px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 10px; border-radius: 14px; background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 12.5px; font-weight: 600;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.hero-action:hover { background: rgba(255,255,255,.22); transform: translateY(-2px); }
.hero-action .ic { width: 22px; height: 22px; }

/* ------------------------- Stat tiles ------------------------- */
.stat-tile {
  display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }

/* ------------------------- Quick actions grid ------------------------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.quick-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: left;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.quick-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.quick-card .ic-box {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.quick-card .t { font-weight: 700; font-size: 14.5px; }
.quick-card .s { font-size: 12px; color: var(--text-3); }

/* ------------------------- Wallet currency card ------------------------- */
.wallet-card {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 22px;
  background: var(--surface-solid); border: 1px solid var(--border); color: var(--text);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.wallet-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.wallet-card .glow { position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--grad); opacity: .14; filter: blur(30px); }
.wallet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; position: relative; }
.wallet-cur { display: flex; align-items: center; gap: 11px; }
.cur-badge {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 16px;
}
.cur-badge.green { background: linear-gradient(135deg, #10b981, #059669); }
.cur-badge.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.wallet-amt { font-size: 26px; font-weight: 800; letter-spacing: -.02em; position: relative; }
.wallet-sub { font-size: 12px; color: var(--text-3); position: relative; }

/* ------------------------- Transactions ------------------------- */
.txn {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px;
  transition: background var(--dur) var(--ease);
}
.txn:hover { background: var(--surface-2); }
.txn + .txn { border-top: 1px solid var(--border); border-radius: 0; }
.txn-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
}
.txn-icon.in { background: var(--success-soft); color: var(--success); }
.txn-icon.out { background: var(--danger-soft); color: var(--danger); }
.txn-main { flex: 1; min-width: 0; }
.txn-title { font-weight: 600; font-size: 14.5px; }
.txn-meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.txn-amt { text-align: right; }
.txn-amt .v { font-weight: 700; font-size: 15px; }
.txn-amt .v.in { color: var(--success); }
.txn-amt .v.out { color: var(--danger); }
.txn-amt .s { font-size: 11.5px; color: var(--text-3); }

/* ------------------------- Detail rows ------------------------- */
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-3); font-size: 13.5px; }
.detail-row .v { font-weight: 600; font-size: 13.5px; text-align: right; word-break: break-all; }

/* ------------------------- Table ------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th {
  text-align: left; padding: 13px 18px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

/* ------------------------- Modal ------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(6px); animation: fade .2s var(--ease); }
.modal-dialog {
  position: relative; width: 100%; max-width: 440px; max-height: min(86vh, 720px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column;
  animation: pop .24s var(--ease);
}
.modal-dialog.dialog-lg { max-width: 560px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 800; flex: 1; letter-spacing: -.01em; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ------------------------- Toast ------------------------- */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 360px); }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 14px 15px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: toast-in .3s var(--ease);
}
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast .ic { margin-top: 1px; }
.toast-success .ic { color: var(--success); }
.toast-error .ic { color: var(--danger); }
.toast-info .ic { color: var(--primary); }
.toast b { display: block; font-weight: 700; }
.toast span { color: var(--text-2); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ------------------------- Empty / loading ------------------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ic { width: 46px; height: 46px; margin-bottom: 14px; opacity: .4; }
.empty .t { font-weight: 700; font-size: 15px; color: var(--text-2); margin-bottom: 4px; }
.empty .s { font-size: 13px; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong);
  border-top-color: var(--primary); animation: spin .7s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.spinner-center { margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------- Alerts / notices ------------------------- */
.alert { display: flex; gap: 11px; padding: 14px 16px; border-radius: 14px; font-size: 13.5px; border: 1px solid; }
.alert .ic { flex: none; margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }

/* ------------------------- Auth layout ------------------------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-shell {
  width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
}
.auth-brand {
  position: relative; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background: var(--grad); color: #fff; overflow: hidden;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px 300px at 100% 0%, rgba(255,255,255,.25), transparent 55%),
              radial-gradient(400px 300px at 0% 100%, rgba(255,255,255,.12), transparent 55%);
}
.auth-brand > * { position: relative; }
.auth-brand .brand { padding: 0; }
.auth-brand .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.auth-hero h2 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.auth-hero p { margin-top: 12px; font-size: 15px; opacity: .85; max-width: 340px; }
.auth-points { display: flex; flex-direction: column; gap: 14px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; }
.auth-point .ic-box { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.auth-point b { display: block; font-size: 14px; }
.auth-point span { font-size: 12.5px; opacity: .8; }
.auth-foot { font-size: 12px; opacity: .7; }

.auth-form-pane { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth-form-pane .mobile-brand { display: none; }
.auth-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.auth-subtitle { color: var(--text-2); font-size: 14px; margin-top: 6px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ------------------------- Landing ------------------------- */
.landing-hero { text-align: center; padding: 48px 20px 40px; }
.landing-hero .brand-mark { width: 74px; height: 74px; border-radius: 22px; font-size: 34px; margin: 0 auto 20px; }
.landing-hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -.03em; }
.landing-hero p { color: var(--text-2); max-width: 480px; margin: 14px auto 0; font-size: 16px; }

/* ------------------------- Theme toggle ------------------------- */
.theme-toggle .ic { transition: transform .3s var(--ease); }
.theme-toggle:hover .ic { transform: rotate(18deg); }

/* ------------------------- Responsive ------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .bottom-nav { display: block; }
  .content { padding: 18px 16px calc(var(--bottomnav-h) + 20px); }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 49; background: var(--backdrop); backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .28s var(--ease);
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .auth-shell { grid-template-columns: 1fr; max-width: 460px; }
  .auth-brand { display: none; }
  .auth-form-pane .mobile-brand { display: flex; margin-bottom: 26px; padding: 0; }
}

@media (max-width: 680px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .hero-balance { font-size: 34px; }
  .hero-card { padding: 22px; }
  .content { padding: 14px 12px calc(var(--bottomnav-h) + 18px); }
  .auth { padding: 12px; }
  .auth-form-pane { padding: 30px 22px; }
  .topbar { padding: 0 14px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero-balance { font-size: 30px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
