/* GrayPay — multi-theme design system */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;650;700&display=swap");

:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius: var(--radius-md);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.36);
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-height: 60px;
  --sidebar-width: 240px;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

:root,
[data-theme="dark"] {
  --bg: #0D0E0E;
  --bg-elevated: #131517;
  --surface: #1a1c1e;
  --surface-2: #222426;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f4ff;
  --text-secondary: #9aa8c7;
  --text-muted: #6b7a9e;
  --navy: #1a1f4e;
  --accent: #5c7cfa;
  --accent-bright: #748ffc;
  --accent-dim: rgba(92, 124, 250, 0.14);
  --accent-ink: #ffffff;
  --accent-gradient: linear-gradient(135deg, #3b5bdb 0%, #5c7cfa 55%, #748ffc 100%);
  --surface-gradient: linear-gradient(160deg, rgba(59, 91, 219, 0.08) 0%, transparent 55%);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --shadow: var(--shadow-lg);
  --shadow-accent: 0 4px 20px rgba(59, 91, 219, 0.35);
  --topnav-bg: rgba(0, 0, 0, 0.85);
  --sidebar-bg: rgba(13, 18, 33, 0.5);
  --body-glow-1: rgba(92, 124, 250, 0.12);
  --body-glow-2: rgba(255, 255, 255, 0.03);
  --hero-title-gradient: linear-gradient(135deg, #f0f4ff 30%, #748ffc 100%);
  --row-hover: rgba(92, 124, 250, 0.04);
  --hint-bg: rgba(59, 91, 219, 0.08);
  --card-hover-shadow: rgba(59, 91, 219, 0.12);
  --logo-filter: none;
  --modal-overlay: rgba(0, 0, 0, 0.65);
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --navy: #1e3a8a;
  --accent: #3b5bdb;
  --accent-bright: #4263eb;
  --accent-dim: rgba(59, 91, 219, 0.12);
  --accent-ink: #ffffff;
  --accent-gradient: linear-gradient(135deg, #364fc7 0%, #4263eb 55%, #5c7cfa 100%);
  --surface-gradient: linear-gradient(160deg, rgba(59, 91, 219, 0.06) 0%, transparent 55%);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.1);
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  --shadow-accent: 0 4px 20px rgba(59, 91, 219, 0.2);
  --topnav-bg: rgba(255, 255, 255, 0.92);
  --sidebar-bg: rgba(255, 255, 255, 0.85);
  --body-glow-1: rgba(59, 91, 219, 0.08);
  --body-glow-2: rgba(59, 91, 219, 0.04);
  --hero-title-gradient: linear-gradient(135deg, #1e3a8a 30%, #4263eb 100%);
  --row-hover: rgba(59, 91, 219, 0.06);
  --hint-bg: rgba(59, 91, 219, 0.06);
  --card-hover-shadow: rgba(59, 91, 219, 0.1);
  --logo-filter: brightness(0) saturate(100%) invert(4%) sepia(12%) saturate(2500%) hue-rotate(210deg) brightness(88%);
  --modal-overlay: rgba(15, 23, 42, 0.45);
}

[data-theme="dracula"] {
  --bg: #282a36;
  --bg-elevated: #21222c;
  --surface: #343746;
  --surface-2: #44475a;
  --border: rgba(248, 248, 242, 0.08);
  --border-strong: rgba(248, 248, 242, 0.14);
  --text: #f8f8f2;
  --text-secondary: #bd93f9;
  --text-muted: #6272a4;
  --navy: #44475a;
  --accent: #bd93f9;
  --accent-bright: #d4b4ff;
  --accent-dim: rgba(189, 147, 249, 0.16);
  --accent-ink: #282a36;
  --accent-gradient: linear-gradient(135deg, #9b6dd9 0%, #bd93f9 55%, #d4b4ff 100%);
  --surface-gradient: linear-gradient(160deg, rgba(189, 147, 249, 0.1) 0%, transparent 55%);
  --warn: #ffb86c;
  --warn-dim: rgba(255, 184, 108, 0.14);
  --danger: #ff5555;
  --danger-dim: rgba(255, 85, 85, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 20px rgba(189, 147, 249, 0.35);
  --topnav-bg: rgba(33, 34, 44, 0.92);
  --sidebar-bg: rgba(40, 42, 54, 0.65);
  --body-glow-1: rgba(189, 147, 249, 0.14);
  --body-glow-2: rgba(255, 121, 198, 0.06);
  --hero-title-gradient: linear-gradient(135deg, #f8f8f2 20%, #bd93f9 55%, #ff79c6 100%);
  --row-hover: rgba(189, 147, 249, 0.08);
  --hint-bg: rgba(189, 147, 249, 0.1);
  --card-hover-shadow: rgba(189, 147, 249, 0.16);
  --logo-filter: none;
  --modal-overlay: rgba(0, 0, 0, 0.7);
}

[data-theme="binance"] {
  --bg: #181a20;
  --bg-elevated: #1e2329;
  --surface: #1e2329;
  --surface-2: #2b3139;
  --border: rgba(234, 236, 239, 0.08);
  --border-strong: rgba(234, 236, 239, 0.14);
  --text: #eaecef;
  --text-secondary: #b7bdc6;
  --text-muted: #848e9c;
  --navy: #2b3139;
  --accent: #f0b90b;
  --accent-bright: #fcd535;
  --accent-dim: rgba(240, 185, 11, 0.14);
  --accent-ink: #181a20;
  --accent-gradient: linear-gradient(135deg, #c99400 0%, #f0b90b 55%, #fcd535 100%);
  --surface-gradient: linear-gradient(160deg, rgba(240, 185, 11, 0.08) 0%, transparent 55%);
  --warn: #f0b90b;
  --warn-dim: rgba(240, 185, 11, 0.12);
  --danger: #f6465d;
  --danger-dim: rgba(246, 70, 93, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 20px rgba(240, 185, 11, 0.3);
  --topnav-bg: rgba(24, 26, 32, 0.94);
  --sidebar-bg: rgba(30, 35, 41, 0.75);
  --body-glow-1: rgba(240, 185, 11, 0.1);
  --body-glow-2: rgba(255, 255, 255, 0.02);
  --hero-title-gradient: linear-gradient(135deg, #eaecef 25%, #f0b90b 100%);
  --row-hover: rgba(240, 185, 11, 0.06);
  --hint-bg: rgba(240, 185, 11, 0.08);
  --card-hover-shadow: rgba(240, 185, 11, 0.14);
  --logo-filter: none;
  --modal-overlay: rgba(0, 0, 0, 0.72);
}

[data-theme="whitebit"] {
  --bg: #0b0e11;
  --bg-elevated: #11161c;
  --surface: #141a1f;
  --surface-2: #1c2430;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7fa;
  --text-secondary: #a8b3c4;
  --text-muted: #6d7a8c;
  --navy: #1c2430;
  --accent: #3861fb;
  --accent-bright: #5b7cff;
  --accent-dim: rgba(56, 97, 251, 0.14);
  --accent-ink: #ffffff;
  --accent-gradient: linear-gradient(135deg, #2952e3 0%, #3861fb 55%, #5b7cff 100%);
  --surface-gradient: linear-gradient(160deg, rgba(56, 97, 251, 0.1) 0%, transparent 55%);
  --warn: #f5a623;
  --warn-dim: rgba(245, 166, 35, 0.12);
  --danger: #e84a5f;
  --danger-dim: rgba(232, 74, 95, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 20px rgba(56, 97, 251, 0.35);
  --topnav-bg: rgba(11, 14, 17, 0.94);
  --sidebar-bg: rgba(17, 22, 28, 0.7);
  --body-glow-1: rgba(56, 97, 251, 0.12);
  --body-glow-2: rgba(255, 255, 255, 0.03);
  --hero-title-gradient: linear-gradient(135deg, #f5f7fa 25%, #3861fb 100%);
  --row-hover: rgba(56, 97, 251, 0.06);
  --hint-bg: rgba(56, 97, 251, 0.08);
  --card-hover-shadow: rgba(56, 97, 251, 0.14);
  --logo-filter: none;
  --modal-overlay: rgba(0, 0, 0, 0.7);
}

[data-theme="uniswap"] {
  --bg: #131313;
  --bg-elevated: #1a1a1a;
  --surface: #1b1b1b;
  --surface-2: #252525;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --text-secondary: #9b9b9b;
  --text-muted: #6f6f6f;
  --navy: #252525;
  --accent: #ff007a;
  --accent-bright: #ff4d9e;
  --accent-dim: rgba(255, 0, 122, 0.14);
  --accent-ink: #ffffff;
  --accent-gradient: linear-gradient(135deg, #e6006e 0%, #ff007a 55%, #ff4d9e 100%);
  --surface-gradient: linear-gradient(160deg, rgba(255, 0, 122, 0.08) 0%, transparent 55%);
  --warn: #ffbf00;
  --warn-dim: rgba(255, 191, 0, 0.12);
  --danger: #ff4d4d;
  --danger-dim: rgba(255, 77, 77, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 4px 20px rgba(255, 0, 122, 0.35);
  --topnav-bg: rgba(19, 19, 19, 0.94);
  --sidebar-bg: rgba(26, 26, 26, 0.7);
  --body-glow-1: rgba(255, 0, 122, 0.12);
  --body-glow-2: rgba(255, 255, 255, 0.02);
  --hero-title-gradient: linear-gradient(135deg, #ffffff 25%, #ff007a 100%);
  --row-hover: rgba(255, 0, 122, 0.06);
  --hint-bg: rgba(255, 0, 122, 0.08);
  --card-hover-shadow: rgba(255, 0, 122, 0.14);
  --logo-filter: none;
  --modal-overlay: rgba(0, 0, 0, 0.75);
}

[data-theme="graypay"] {
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --bg: #0B0E23;
  --bg-elevated: #10142e;
  --surface: #141833;
  --surface-2: #1a1f42;
  --border: rgba(139, 127, 199, 0.12);
  --border-strong: rgba(139, 127, 199, 0.24);
  --text: #ffffff;
  --text-secondary: #b8b4d4;
  --text-muted: #7a78a8;
  --navy: #0B0E23;
  --accent: #8b7fc7;
  --accent-bright: #a89ee0;
  --accent-dim: rgba(139, 127, 199, 0.16);
  --accent-ink: #0B0E23;
  --accent-gradient: linear-gradient(135deg, #6b5fa8 0%, #8b7fc7 55%, #a89ee0 100%);
  --surface-gradient: linear-gradient(160deg, rgba(139, 127, 199, 0.1) 0%, transparent 55%);
  --warn: #e8c468;
  --warn-dim: rgba(232, 196, 104, 0.14);
  --danger: #f07178;
  --danger-dim: rgba(240, 113, 120, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-accent: 0 4px 20px rgba(139, 127, 199, 0.35);
  --topnav-bg: rgba(11, 14, 35, 0.92);
  --sidebar-bg: rgba(16, 20, 46, 0.72);
  --body-glow-1: rgba(139, 127, 199, 0.14);
  --body-glow-2: rgba(107, 95, 168, 0.08);
  --hero-title-gradient: linear-gradient(135deg, #ffffff 25%, #a89ee0 100%);
  --row-hover: rgba(139, 127, 199, 0.06);
  --hint-bg: rgba(139, 127, 199, 0.1);
  --card-hover-shadow: rgba(139, 127, 199, 0.16);
  --logo-filter: none;
  --modal-overlay: rgba(5, 7, 18, 0.72);
}

html {
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--body-glow-1), transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 50%, var(--body-glow-2), transparent 50%);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: #a5b4fc; text-decoration: underline; }

/* Brand logo — filter per theme for visibility */
.brand-logo,
.topnav-brand img {
  height: 28px;
  width: 28px;
  display: block;
  filter: var(--logo-filter);
  transition: filter 0.2s ease;
}
.brand-logo-lg { height: 56px; }

/* Top navigation */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--topnav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.025em;
  color: var(--text);
  text-decoration: none;
}
.topnav-brand:hover { text-decoration: none; color: var(--text); }
.topnav-actions { display: flex; align-items: center; gap: 10px; }

/* App shell with sidebar */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--nav-height));
}
.sidebar {
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  background: var(--sidebar-bg);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.sidebar-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin: 4px 0 20px 12px;
}
.sidebar-sector {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 14px 0 4px 12px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.sidebar-nav .sidebar-sector:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  margin: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sidebar-nav button:hover { background: var(--surface); color: var(--text); }
.sidebar-nav button.active {
  background: var(--accent-dim);
  color: var(--accent-bright);
  font-weight: 600;
}

.main-content {
  padding: 28px 32px;
  max-width: 1200px;
}

/* Typography */
h1 { margin: 0 0 6px; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
h3, h4 { margin: 0 0 10px; font-weight: 600; }
.lead { color: var(--text-secondary); margin: 0 0 24px; }

/* Cards — portfolio style */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.portfolio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.portfolio-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.portfolio-card .label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
}
.portfolio-card .value {
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.portfolio-card .sub {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 0; }

/* Forms */
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.row:last-child { margin-bottom: 0; }
.row > div { flex: 1 1 160px; min-width: 0; }
.form-field { margin-bottom: 16px; }
.form-field:last-child { margin-bottom: 0; }
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: -0.01em;
}
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.35;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder { color: var(--text-muted); }
input.input-amount,
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  font-variant-numeric: tabular-nums;
}
input.input-amount::-webkit-outer-spin-button,
input.input-amount::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
select { cursor: pointer; }
textarea { min-height: 96px; resize: vertical; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; transform: none; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--accent-bright);
  filter: none;
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-bright); }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-wallet {
  background: transparent;
  color: var(--accent-bright);
  border-color: var(--accent);
  font-size: 13px;
  padding: 8px 14px;
}
.btn-wallet:hover { background: var(--accent-dim); }
.btn-wallet.connected {
  background: var(--accent-dim);
  border-color: transparent;
  color: var(--accent-bright);
}
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: var(--radius); }

/* CTA row on landing */
.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 28px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--row-hover); }
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mono { font-family: var(--mono); font-size: 12px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge.ok { background: var(--accent-dim); color: var(--accent-bright); border-color: transparent; }
.badge.warn { background: var(--warn-dim); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--danger-dim); color: var(--danger); border-color: transparent; }

/* Utility */
.hidden { display: none !important; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.ok-msg { color: var(--accent-bright); font-size: 13px; margin-top: 8px; }
.muted { color: var(--text-muted); }
.split { display: grid; grid-template-columns: 1.25fr 0.9fr; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  border-left: 2px solid var(--border-strong);
  padding: 0 0 14px 16px;
  margin-left: 6px;
  position: relative;
}
.timeline li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: -5px;
  top: 5px;
}
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs img {
  max-width: 220px;
  max-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Login centered */
.login-wrap {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 24px;
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

/* Tabs (merchant cabinet) */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs .btn { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.tabs .btn.active {
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}

/* Wallet connect row */
.wallet-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.wallet-row input { flex: 1; }
.wallet-row select { min-width: 110px; width: auto; }

.wallet-row select { min-width: 110px; width: auto; }

.wallet-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.wallet-status.connected {
  background: var(--accent-dim);
  color: var(--accent-bright);
  border-color: transparent;
}
.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-bright);
  flex-shrink: 0;
}
.network-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent-bright);
}

/* Landing */
.hero {
  text-align: center;
  padding: 56px 16px 40px;
  max-width: 720px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 36px;
  margin-bottom: 14px;
  background: var(--hero-title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 960px;
  margin: 0 auto 56px;
  padding: 0 20px;
}
.feature-card {
  background: var(--surface);
  background-image: var(--surface-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.feature-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 6px 28px var(--card-hover-shadow);
}
.feature-card h3 { font-size: 14px; margin-bottom: 8px; color: var(--accent-bright); }
.feature-card p { color: var(--text-secondary); font-size: 13px; margin: 0; line-height: 1.5; }
.nav-links { display: flex; gap: 16px; font-size: 13px; align-items: center; }
.nav-links a { color: var(--text-secondary); text-decoration: none; }
.nav-links a:hover { color: var(--accent-bright); }

/* ---- Uniswap-style topnav ---- */
.topnav-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.topnav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: min(52vw, 520px);
}
.topnav-tabs::-webkit-scrollbar { display: none; }
.topnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}
.topnav-link:hover { color: var(--text); text-decoration: none; }
.topnav-link.active {
  color: var(--text);
  background: var(--surface-2);
}
.topnav-search-wrap {
  flex: 1;
  max-width: 480px;
  margin: 0 20px;
  position: relative;
}
.topnav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.topnav-search {
  width: 100%;
  padding: 8px 12px 8px 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-sm);
  opacity: 0.92;
  transition: border-color 0.12s, background 0.12s, opacity 0.12s;
}
.topnav-search::placeholder { color: var(--text-muted); }
.topnav-search:hover { opacity: 1; border-color: var(--border); }
.topnav-search:focus {
  outline: none;
  opacity: 1;
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: var(--focus-ring);
}
.lang-select {
  width: auto;
  min-width: 100px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Wallet dropdown (Uniswap-style) */
.wallet-dropdown-wrap { position: relative; }
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.wallet-pill:hover { background: var(--surface-2); border-color: var(--accent); }
.wallet-pill.connected { border-color: var(--accent-dim); background: var(--accent-dim); }
.wallet-pill-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #3b5bdb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.wallet-pill-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-pill-chevron { opacity: 0.6; flex-shrink: 0; }
.wallet-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 150;
}
.wallet-dropdown-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.wallet-dropdown-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wallet-dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #3b5bdb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.wallet-dropdown-name { font-weight: 600; font-size: 15px; }
.wallet-dropdown-addr { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.wallet-dropdown-actions { display: flex; gap: 4px; flex-shrink: 0; }
.wallet-dropdown-icon { width: 36px; height: 36px; }
.wallet-dropdown-balance {
  font-size: 32px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.wallet-dropdown-welcome { font-size: 13px; margin: 0 0 14px; line-height: 1.45; }
.wallet-dropdown-prefs {
  display: none;
  margin: 0 0 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.wallet-dropdown-prefs:not(.hidden) { display: block; }
.wallet-dropdown-prefs .topnav-prefs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.wallet-dropdown-prefs .fiat-select,
.wallet-dropdown-prefs .lang-select {
  width: 100%;
  min-height: 44px;
}
.wallet-dropdown-prefs-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.wallet-dropdown-fixed {
  position: fixed !important;
  z-index: 210;
}
.wallet-dropdown-cards { display: flex; flex-direction: column; gap: 8px; }
.wallet-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.wallet-action-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--text);
}
.wallet-action-btn { border: 1px solid var(--border); }
.wallet-action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Settings modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-body label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.modal-body label:first-child { margin-top: 0; }
.settings-select { width: 100%; }

/* Theme picker */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.theme-option:hover { border-color: var(--border-strong); }
.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
}
.theme-swatch i {
  flex: 1;
  display: block;
  font-style: normal;
}

/* Portfolio layout */
.portfolio-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  align-items: start;
}
.portfolio-main { min-width: 0; }
.portfolio-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.profile-avatar, .wallet-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #3b5bdb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.profile-address {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-all;
}
.portfolio-tabs-row {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.portfolio-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.portfolio-tab:hover { color: var(--text); }
.portfolio-tab.active {
  background: var(--surface-2);
  color: var(--text);
}
.balance-block { margin-bottom: 32px; }
.balance-label {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.balance-amount {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 8px;
}
.balance-secondary {
  font-size: 14px;
  margin-bottom: 16px;
}
.balance-placeholder {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}
.time-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.time-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.time-pill:hover { color: var(--text); border-color: var(--border-strong); }
.time-pill.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.token-list { margin-bottom: 24px; }
.token-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.token-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.token-icon.usdt { background: rgba(38, 161, 123, 0.2); color: #50af95; }
.token-name { font-weight: 600; font-size: 15px; }
.token-symbol { color: var(--text-muted); font-size: 13px; }
.token-balance { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.token-row-active { border-color: var(--accent); background: var(--accent-dim); }
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
}
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.history-item-main { min-width: 0; }
.history-item-title { font-weight: 600; margin-bottom: 4px; }
.history-item-meta { color: var(--text-muted); font-size: 12px; }
.history-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.history-empty { padding: 32px; text-align: center; }
.panel-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* Sidebar */
.portfolio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: calc(var(--nav-height) + 16px);
}
.wallet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 6px;
}
.wallet-card-avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  font-size: 18px;
}
.wallet-card-address {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.wallet-card-balance {
  font-size: 28px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  width: 100%;
  text-align: left;
  font: inherit;
}
.action-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
}
.action-card-btn { border: 1px solid var(--border-strong); }
.action-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.action-card-icon svg { display: block; }
.wallet-action-icon svg { display: block; color: var(--text-secondary); }

.checkout-wrap { max-width: 440px; margin: 0 auto 48px; padding: 0 16px; }
.checkout-wrap .panel {
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.checkout-wrap label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.checkout-wrap input,
.checkout-wrap select {
  margin-top: 4px;
  border-radius: var(--radius-sm);
  min-height: 44px;
}
.checkout-wrap .btn-primary { width: 100%; min-height: 48px; font-size: var(--text-lg); margin-top: 8px; }
.merchant-table th {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.merchant-table td { font-variant-numeric: tabular-nums; }
.merchant-table tr:hover td { background: var(--row-hover); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat-value { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.portfolio-callout {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 20px;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary);
}
.portfolio-callout strong { color: var(--text); display: block; margin-bottom: 6px; font-size: var(--text-base); }
.portfolio-callout ol { margin: 6px 0 0 1.1em; padding: 0; }
.portfolio-callout li { margin-bottom: 4px; }
.portfolio-hero .hero-title { margin: 0 0 8px; font-size: 1.35rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.trade-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.trade-steps { margin: 8px 0 0 1.1em; padding: 0; line-height: 1.5; }
.trade-steps li { margin-bottom: 8px; }
@media (max-width: 900px) {
  .trade-grid { grid-template-columns: 1fr; }
}
.checkout-wrap .panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.checkout-wrap .panel-header h2 { margin: 0; }
.hint-box {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 10px 12px;
  background: var(--hint-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.login-help {
  font-size: 13px;
  line-height: 1.55;
  padding: 14px 16px;
  background: var(--hint-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  color: var(--text-secondary);
}
.login-help strong { color: var(--text); display: block; margin-bottom: 8px; font-size: 14px; }
.login-help ol, .login-help ul { margin: 8px 0 0 1.1em; padding: 0; }
.login-help li { margin-bottom: 6px; }
.login-help code, .login-help .mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-all;
}
.login-help a { color: var(--accent); }
.btn.is-loading { opacity: 0.7; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Legacy aliases (admin app.js) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card {
  background: var(--surface);
  background-image: var(--surface-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card .k { color: var(--text-muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }
.primary, .ghost, .danger { /* btn aliases */ }
.primary {
  display: inline-block;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  box-shadow: var(--shadow-accent);
}
.ghost {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
}
.danger {
  display: inline-block;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  background: var(--danger-dim);
  color: var(--danger);
}
.auth { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }

/* ---- Mobile nav (hamburger) ---- */
.topnav-hamburger { display: none; flex-shrink: 0; }
.topnav-brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  min-width: 0;
}
.topnav-prefs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topnav-drawer-prefs {
  display: none;
}
.topnav-drawer {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--topnav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 16px;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}
.topnav-drawer:not(.hidden) { display: flex; }
.topnav-drawer .topnav-link {
  display: block;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.fiat-select { min-width: 88px; }

/* ---- Responsive: mobile-first breakpoints ---- */
/* Base: touch-friendly tap targets */
.btn, .portfolio-tab, .time-pill, .topnav-link, .action-card, .wallet-action-card {
  min-height: 44px;
}
.icon-btn { min-width: 44px; min-height: 44px; }

/* Tablet: 640px+ */
@media (min-width: 640px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .topnav-brand-text { max-width: none; }
  .wallet-dropdown { width: 340px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
}

/* Desktop: 1024px+ — full sidebar layout */
@media (min-width: 1024px) {
  .app-shell { grid-template-columns: var(--sidebar-width) 1fr; }
  .portfolio-layout { grid-template-columns: 1fr 340px; }
  .portfolio-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .split { grid-template-columns: 1.25fr 0.9fr; }
  .topnav-tabs { display: flex; }
  .topnav-hamburger { display: none !important; }
  .topnav-drawer { display: none !important; }
}

/* Mobile & small tablet: < 1024px */
@media (max-width: 1023px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
  }
  .sidebar-nav { display: flex; flex-wrap: wrap; width: 100%; }
  .sidebar-nav button { width: auto; flex: 1 1 auto; min-width: 120px; }
  .split, .grid2 { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }
  .portfolio-layout {
    grid-template-columns: 1fr;
    padding: 20px 16px 48px;
    gap: 20px;
  }
  .topnav {
    flex-wrap: nowrap;
    height: var(--nav-height);
    min-height: var(--nav-height);
    padding: 0 12px;
    gap: 8px;
    overflow: visible;
  }
  .topnav-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    overflow: hidden;
  }
  .topnav-brand { min-width: 0; flex-shrink: 1; }
  .topnav-tabs { display: none; }
  .topnav-hamburger { display: none !important; }
  .topnav-search-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin: 0;
  }
  .topnav-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }
  .topnav-prefs { display: none; }
  .wallet-dropdown-wrap { position: relative; }
  .wallet-dropdown:not(.wallet-sheet) {
    position: absolute;
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    bottom: auto;
    width: min(340px, calc(100vw - 24px));
    max-height: calc(100dvh - var(--nav-height) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 160;
  }
  .wallet-pill-label { max-width: 72px; }
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: clamp(24px, 7vw, 32px); }
  .feature-grid { padding: 0 16px; }
  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-item-side {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }
  .login-wrap { padding: 32px 16px; }
  .content-page { padding: 20px 16px 40px; }
  .page-title { font-size: 1.5rem; }
  .checkout-wrap { padding: 0 12px; }
  .wallet-row { flex-direction: column; }
  .wallet-row select, .wallet-row .btn { width: 100%; }
  .row { flex-direction: column; align-items: stretch; }
  .row > div { width: 100%; }
  .table-wrap { margin: 0 -4px; }
  th, td { padding: 10px 8px; font-size: 12px; }
  .modal-card { max-width: 100%; }
  .theme-picker { grid-template-columns: 1fr; }
}

/* Small phones: < 640px */
@media (max-width: 639px) {
  :root { --nav-height: 56px; }
  .topnav-search-wrap { display: none !important; }
  .topnav-brand-text { display: none; }
  .brand-logo, .topnav-brand img { height: 28px; width: 28px; flex-shrink: 0; }
  .wallet-pill { padding: 4px 8px 4px 4px; gap: 6px; }
  .wallet-pill-label { display: none; }
  .wallet-pill-chevron { display: none; }
  .balance-amount { font-size: clamp(28px, 10vw, 40px); }
  .portfolio-tabs-row { gap: 4px; }
  .portfolio-tab { padding: 8px 12px; font-size: 13px; }
  .time-filters { gap: 4px; }
  .time-pill { padding: 8px 12px; font-size: 12px; }
  .wallet-card-balance { font-size: 22px; }
  .wallet-dropdown-balance { font-size: 26px; }
  .lang-select, .fiat-select { min-width: 72px; font-size: 12px; padding: 8px; }
  .cta-row .btn { width: 100%; }
  .auth-panel { padding: 16px; }
  .panel { padding: 16px; }
  .panel-flat { padding: 16px; }
}

body.nav-open { overflow: hidden; }
body.wallet-open { overflow: hidden; }
body.nav-open .rate-ticker { display: none !important; }

@media (max-width: 1023px) {
  .rate-ticker {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 12px;
    gap: 10px;
    position: relative;
    z-index: 90;
  }
  .rate-ticker::-webkit-scrollbar { display: none; }
  .rate-ticker-items {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .topnav-drawer {
    z-index: 130;
  }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .split, .grid2 { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }
  .hero h1 { font-size: 28px; }
  .portfolio-layout {
    grid-template-columns: 1fr;
    padding: 20px 16px 48px;
  }
  .portfolio-sidebar {
    position: static;
    order: 0;
  }
}

/* Auth & content pages */
.auth-panel {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 36px;
  border-radius: var(--radius-lg);
}
.auth-panel h1,
.auth-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.auth-panel .lead {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
}
.auth-panel .form-field { margin-bottom: 18px; }
.auth-panel .form-field:last-of-type { margin-bottom: 0; }
.auth-panel label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
}
.auth-panel input,
.auth-panel select {
  width: 100%;
  margin-top: 0;
}
.auth-tabs { display: flex; gap: 8px; margin: 16px 0; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer;
}
.auth-tab.active { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.auth-links { display: flex; justify-content: space-between; margin: 12px 0; font-size: 0.9rem; }
.auth-links a { color: var(--accent-bright); }
.btn-block { width: 100%; margin-top: 16px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.ok-msg { color: var(--accent-bright); margin-top: 12px; }
.content-page { max-width: 960px; margin: 0 auto; padding: 28px 20px 56px; }
.page-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.15;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn:focus-visible,
.topnav-link:focus-visible,
.news-card a:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ---- News hub ---- */
.news-page { max-width: 1120px; }
.news-page-header { margin-bottom: 32px; }
.news-page-title {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--text);
}
.news-page-lead {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  margin: 0;
  max-width: 52ch;
  line-height: 1.55;
}
.news-featured {
  position: relative;
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 0;
  margin-bottom: 36px;
  padding: 28px 28px 28px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.news-featured:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.news-featured-accent {
  background: var(--accent);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.news-featured-body { padding-left: 24px; min-width: 0; }
.news-featured-title {
  font-size: clamp(var(--text-xl), 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 12px 0 10px;
  line-height: 1.2;
}
.news-featured-title a { color: var(--text); text-decoration: none; }
.news-featured-title a:hover { color: var(--accent-bright); text-decoration: none; }
.news-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.news-card {
  grid-column: span 6;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.news-card--wide { grid-column: span 6; }
.news-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.news-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 8px;
  line-height: 1.25;
}
.news-card-title a { color: var(--text); text-decoration: none; }
.news-card-title a:hover { color: var(--accent-bright); text-decoration: none; }
.news-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: var(--text-xs);
}
.news-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.news-tag--buyers { background: var(--accent-dim); color: var(--accent-bright); }
.news-tag--providers { background: var(--warn-dim); color: var(--warn); }
.news-tag--merchants { background: rgba(56, 161, 123, 0.14); color: #50af95; }
[data-theme="light"] .news-tag--merchants { background: rgba(22, 101, 52, 0.1); color: #15803d; }
.news-tag--platform { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.news-date {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.news-read-time { color: var(--text-muted); }
.news-excerpt {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-read-link {
  display: inline-block;
  margin-top: 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-bright);
  text-decoration: none;
}
.news-read-link:hover { text-decoration: underline; }
.news-breadcrumb { margin-bottom: 20px; }
.news-breadcrumb a {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}
.news-breadcrumb a:hover { color: var(--accent-bright); }
.news-article-header { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.news-article-header h1 {
  font-size: clamp(var(--text-2xl), 4.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 14px 0 12px;
}
.news-article-lead {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  max-width: 65ch;
}
.news-article-page { max-width: 720px; }
.prose {
  max-width: 65ch;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-secondary);
}
.prose p { margin: 0 0 1em; }
.prose h3 {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 1.5em 0 0.6em;
  letter-spacing: -0.02em;
}
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.25em; }
.prose li { margin-bottom: 0.4em; }
.prose a { color: var(--accent-bright); font-weight: 500; }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.news-skeleton { animation: news-pulse 1.2s ease-in-out infinite; }
.news-skeleton-hero {
  height: 220px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  margin-bottom: 20px;
}
.news-skeleton-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.news-skeleton-card { height: 160px; border-radius: var(--radius-md); background: var(--surface-2); }
@keyframes news-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (max-width: 900px) {
  .news-grid { grid-template-columns: 1fr; }
  .news-card, .news-card--wide { grid-column: span 1; }
  .news-featured { grid-template-columns: 3px 1fr; padding: 20px 16px 20px 0; }
  .news-featured-body { padding-left: 16px; }
  .news-skeleton-grid { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .news-page { padding-left: 16px; padding-right: 16px; }
  .news-card { padding: 16px; }
}
.news-list { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.news-meta { font-size: var(--text-sm); margin-bottom: 8px; }
.news-body { font-size: var(--text-base); line-height: 1.65; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.news-body p { margin: 0 0 10px; }
.help-center { max-width: 960px; }
.help-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin: 24px 0; }
.help-quick-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  min-height: 44px;
}
.help-quick-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.help-quick-icon { display: none; }
.help-search-wrap { margin-bottom: 24px; padding: 20px; }
.help-search-label { display: block; font-weight: 700; font-size: var(--text-sm); margin-bottom: 8px; color: var(--text-secondary); }
.help-search-input { width: 100%; max-width: 100%; }
.help-section { margin-bottom: 20px; }
.help-section h2 { margin-top: 0; font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; }
.help-guide-link { font-size: var(--text-sm); margin: 0 0 12px; }
.faq-list details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface);
}
.faq-list summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list details[open] summary { margin-bottom: 8px; color: var(--accent-bright); }
.field-hint { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--border); font-size: 11px; cursor: help; vertical-align: middle; }
.field-hint-text { font-size: 12px; margin: 4px 0 0; }
.field-desc { font-size: var(--text-sm); color: var(--text-secondary); margin: 0 0 10px; line-height: 1.5; }
.field-desc code { font-size: 0.92em; }
.merchant-settings h3 { margin: 0 0 8px; font-size: var(--text-lg); }
.credential-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: var(--surface);
  margin-bottom: 8px;
}
.credential-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.credential-label { font-weight: 600; font-size: var(--text-sm); color: var(--text-secondary); }
.credential-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.credential-status.status-ok { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.credential-status.status-off { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.credential-value-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.credential-value {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  font-size: var(--text-sm);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.url-field { margin-bottom: 18px; }
.url-field label { font-weight: 600; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.settings-hint { margin-top: 14px; font-size: var(--text-sm); }
.settings-out { margin-top: 12px; font-size: var(--text-sm); }
.site-footer-guide {
  margin: 10px 0 0;
  font-size: var(--text-sm);
  line-height: 1.6;
}
.site-footer-guide a { color: var(--text-secondary); text-decoration: none; }
.site-footer-guide a:hover { color: var(--accent-bright); text-decoration: underline; }
.guide-page { max-width: 820px; }
.guide-toc h2 { margin-top: 0; font-size: var(--text-lg); }
.guide-toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.guide-toc-grid a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: border-color 0.15s, background 0.15s;
}
.guide-toc-grid a:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; color: inherit; }
.guide-section { margin-bottom: 20px; scroll-margin-top: 80px; }
.guide-section h2 { margin-top: 0; font-size: var(--text-xl); }
.guide-section h3 { margin-top: 20px; font-size: var(--text-base); }
.guide-section ol, .guide-section ul { padding-left: 1.25rem; line-height: 1.65; }
.guide-section li { margin-bottom: 6px; }
.guide-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.admin-error-list { margin: 0; padding-left: 18px; }
.admin-dash-head { margin-bottom: 12px; }
.api-hero { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0; padding: 20px; }
.api-table { width: 100%; border-collapse: collapse; }
.api-table th, .api-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.api-code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.faq-list details { margin-bottom: 12px; }
.faq-list summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.wallet-connect-row { display: flex; gap: 8px; padding: 0 16px 12px; }
.wallet-logout-row { padding: 8px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.p2p-home { max-width: 560px; margin: 0 auto; padding: 16px; }
.p2p-home .hero-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.trade-grid-simple { grid-template-columns: 1fr; }
.mobile-bottom-nav .mobile-nav-item { touch-action: manipulation; min-height: 48px; }
.topnav-tabs { flex-wrap: nowrap; gap: 2px; }

/* ---- Admin console (/internal/console/) ---- */
.admin-console { --sidebar-width: 240px; }
.admin-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--nav-height);
  border-bottom: 1px solid var(--border);
  background: var(--topnav-bg);
  position: sticky;
  top: 0;
  z-index: 110;
}
.admin-topbar-title { font-weight: 650; flex: 1; }
.admin-hamburger { min-width: 44px; min-height: 44px; padding: 10px 14px; }
.admin-topbar-logout { display: none; }
.admin-theme-select { max-width: 140px; }
.admin-shell { min-height: calc(100vh - var(--nav-height)); }
.admin-main { max-width: 1280px; }
.admin-toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}
.admin-toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  font-size: 14px;
  animation: admin-toast-in 0.2s ease;
}
.admin-toast-ok { border-color: var(--accent); color: var(--accent-bright); }
.admin-toast-err { border-color: var(--danger); color: var(--danger); }
.admin-toast-out { opacity: 0; transform: translateY(-6px); transition: 0.3s; }
@keyframes admin-toast-in { from { opacity: 0; transform: translateY(-8px); } }
.admin-settings-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 8px;
  margin-bottom: 16px;
}
.admin-settings-group legend {
  padding: 0 8px;
  font-weight: 600;
  color: var(--text-secondary);
}
.admin-info-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--hint-bg);
  border-radius: var(--radius-sm);
}
.admin-filters { flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.admin-actions { flex-wrap: wrap; gap: 10px; }
.admin-actions .btn { min-height: 44px; }
.admin-split { gap: 16px; }
.admin-row-actions { white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { width: 100%; min-width: 520px; }
.form-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 115;
}
body.admin-nav-open { overflow: hidden; }

@media (max-width: 900px) {
  .admin-topbar { display: flex; }
  .admin-hamburger { display: none !important; }
  .admin-backdrop { display: none !important; }
  .admin-console .admin-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
  }
  .admin-console .admin-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    max-height: none;
    transform: none !important;
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    z-index: 119;
    overflow: visible;
    background: var(--sidebar-bg);
  }
  .admin-console .admin-sidebar.open { transform: none; }
  .admin-console .admin-sidebar .sidebar-sub { display: none; }
  .admin-console .admin-sidebar > div:last-child { display: none; }
  .admin-console .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    gap: 6px;
    padding: 8px 10px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-console .sidebar-nav::-webkit-scrollbar { display: none; }
  .admin-console .sidebar-sector {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 10px;
    border: 0;
    border-top: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface-2);
    border-radius: 999px;
    white-space: nowrap;
    color: var(--text-muted);
  }
  .admin-console .sidebar-nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    min-height: 40px;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
    margin: 0;
    text-align: center;
  }
  .admin-console .sidebar-nav button.active {
    background: var(--accent-dim);
    color: var(--accent-bright);
  }
  .admin-topbar-logout {
    display: inline-flex;
    flex-shrink: 0;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .admin-topbar {
    position: sticky;
    top: 0;
    z-index: 122;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    min-height: var(--nav-height);
    height: auto;
    flex-wrap: nowrap;
  }
  .admin-theme-select { max-width: 108px; font-size: 13px; flex-shrink: 0; }
  .admin-toast-host {
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    max-width: none;
    z-index: 200;
    pointer-events: none;
  }
  .admin-toast { pointer-events: auto; }
  .admin-backdrop { z-index: 120; }
  .admin-console .admin-main {
    padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .admin-console .page-title,
  .admin-console h1 { font-size: 1.35rem; line-height: 1.25; }
  .admin-console .lead { font-size: 14px; margin-bottom: 12px; }
  .admin-filters { flex-direction: column; align-items: stretch; }
  .admin-filters .form-field { flex: 1 1 100% !important; min-width: 0 !important; width: 100%; }
  .admin-filters > .btn,
  .admin-filters > button { width: 100%; }
  .admin-actions { flex-direction: column; }
  .admin-actions .btn { width: 100%; }
  .admin-row-actions { display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; }
  .admin-row-actions .btn { min-height: 40px; }
  .table-scroll { margin: 0 -4px; }
  .admin-console .panel { padding: 14px 12px; }
  .admin-console .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  #loginView .login-wrap {
    padding: max(24px, env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
    min-height: 100dvh;
    box-sizing: border-box;
  }
  #loginView .panel { padding: 16px 14px; }
  #loginView .row { flex-direction: column; }
  #loginView .row .btn { width: 100%; }
}

/* Site footer (buyer / provider bot hints) */
body.site-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.site-shell > main,
body.site-shell > .content-page,
body.site-shell > .portfolio-layout,
body.site-shell > .checkout-wrap,
body.site-shell > .login-wrap {
  flex: 1 0 auto;
  position: relative;
  z-index: 1;
}
#krakenSiteFooterWrap,
#shell-footer {
  margin-top: auto;
  flex-shrink: 0;
}
.site-footer {
  margin-top: auto;
  padding: 28px 20px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.site-footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.site-footer-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}
.site-footer-sep { display: none; }
.site-footer-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 999px;
  transition: color 0.12s, background 0.12s;
}
.site-footer-role:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.site-footer-role.active {
  color: var(--text);
  background: var(--surface-2);
}
.site-footer-bots a { color: var(--accent-bright); }
.site-footer-credit {
  font-size: 0.75rem;
  margin-top: 12px;
  opacity: 0.55;
}

/* Live rate ticker (home / trade) */
.rate-ticker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 6px 16px;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.rate-ticker-label { font-weight: 600; }
.rate-ticker-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.rate-ticker-sep { color: var(--text-muted); }
.rate-ticker-updated { font-size: 0.7rem; }

/* Provider web cabinet */
.provider-page { max-width: 1000px; }
.provider-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.provider-header-actions { display: flex; align-items: center; gap: 12px; }
.provider-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.provider-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toggle-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hint-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--hint-bg);
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.data-table th { color: var(--text-muted); font-weight: 500; }
.form-grid label { display: block; margin-bottom: 7px; }
.form-grid .input,
.form-grid input,
.form-grid select,
.form-grid textarea { width: 100%; margin-bottom: 14px; }
.provider-add-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}
.provider-quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.order-cards-list { display: flex; flex-direction: column; gap: 12px; }
.order-action-card { padding: 16px; }
.order-action-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.order-action-body { margin-bottom: 12px; }
.order-action-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-sub { font-size: 0.85rem; margin-top: 4px; }

/* UI polish — admin / provider / loading */
.admin-console .admin-main {
  padding: 16px 20px 48px;
  overflow-x: hidden;
  min-width: 0;
}
.card-help-box {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--hint-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.provider-stats,
.provider-page .stat-card { min-width: 0; }
@media (max-width: 768px) {
  .provider-stats { grid-template-columns: 1fr; }
  .provider-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .admin-console .admin-main { padding: 12px 14px 32px; }
  .order-action-btns .btn { flex: 1 1 calc(50% - 8px); min-width: 120px; }
}
@media (max-width: 375px) {
  .content-page { padding-left: 12px; padding-right: 12px; }
  .provider-add-card { grid-template-columns: 1fr; }
}

/* =============================================================================
   Layout modes: mobile (simple) vs desktop (full)
   ============================================================================= */
:root {
  --bottom-nav-height: 60px;
}

.layout-mobile-only { display: none !important; }
.layout-desktop-only { display: revert; }

[data-ui="mobile"] .layout-mobile-only { display: revert !important; }
[data-ui="mobile"] .layout-desktop-only { display: none !important; }

[data-ui="mobile"] .layout-mobile-only.mobile-bottom-nav {
  display: flex !important;
}

/* Mobile top bar — minimal */
[data-ui="mobile"] .topnav {
  height: 52px;
  min-height: 52px;
  padding: 0 10px;
  gap: 6px;
}
[data-ui="mobile"] .topnav-brand-text { display: none; }
[data-ui="mobile"] .topnav-search-wrap { display: none !important; }
[data-ui="mobile"] .topnav-prefs { display: none !important; }
[data-ui="mobile"] .wallet-dropdown-wrap .wallet-pill {
  display: inline-flex;
  padding: 4px;
  min-width: 40px;
  min-height: 40px;
}
[data-ui="mobile"] .wallet-pill-label,
[data-ui="mobile"] .wallet-pill-chevron { display: none; }
[data-ui="mobile"] .rate-ticker { display: none !important; }
[data-ui="mobile"] .site-footer-roles { display: none; }

[data-ui="mobile"] body.site-shell,
[data-ui="mobile"].site-shell {
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

/* Hamburger drawer — secondary links only */
[data-ui="mobile"] .topnav-drawer-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 14px 8px;
}
[data-ui="mobile"] .topnav-drawer {
  top: 52px;
  max-height: calc(100dvh - 52px);
  z-index: 140;
  border-radius: 0 0 16px 16px;
  box-shadow: var(--shadow-md);
}

/* Bottom navigation */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 180;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  gap: 4px;
  background: var(--topnav-bg);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.mobile-nav-item {
  flex: 1 1 0;
  max-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 4px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.mobile-nav-item svg { flex-shrink: 0; opacity: 0.85; }
.mobile-nav-item.active,
.mobile-nav-item:hover {
  color: var(--accent-bright);
  background: var(--accent-dim);
  text-decoration: none;
}

/* Wallet bottom sheet (mobile) */
.wallet-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.wallet-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 0 auto 12px;
}
.wallet-sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
[data-ui="mobile"] .wallet-dropdown.wallet-sheet {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(88dvh, 640px);
  margin: 0;
  border-radius: 20px 20px 0 0;
  border-bottom: 0;
  z-index: 260;
  display: block !important;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
[data-ui="mobile"] .wallet-dropdown.wallet-sheet.wallet-sheet-visible {
  transform: translateY(0) !important;
}
[data-ui="mobile"] .wallet-dropdown-cards { display: none !important; }
[data-ui="mobile"] .wallet-dropdown-hint {
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.4;
}
[data-ui="mobile"] .wallet-dropdown-header {
  position: relative;
  z-index: 2;
  background: var(--surface);
}
[data-ui="mobile"] .wallet-dropdown-balance { font-size: 28px; }
[data-ui="mobile"] .wallet-connect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
}
[data-ui="mobile"] .wallet-connect-row .btn { flex: 1 1 calc(50% - 4px); min-height: 44px; }

.settings-shortcuts { margin-top: 16px; }
.settings-shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.settings-link-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.settings-link-row:hover {
  border-color: var(--border-strong);
  color: var(--accent-bright);
  text-decoration: none;
}

/* Mobile portfolio — simplified */
[data-ui="mobile"] .portfolio-layout {
  padding: 16px 14px 24px;
  gap: 16px;
}
[data-ui="mobile"] .portfolio-profile { display: none; }
[data-ui="mobile"] .portfolio-sidebar { display: none; }
[data-ui="mobile"] .portfolio-hero {
  padding: 16px;
  margin-bottom: 12px;
}
[data-ui="mobile"] .portfolio-hero .hero-title {
  font-size: 1.05rem;
  line-height: 1.35;
  margin-bottom: 8px;
}
[data-ui="mobile"] .portfolio-hero p.muted { display: none; }
[data-ui="mobile"] .portfolio-hero .hero-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
[data-ui="mobile"] .portfolio-hero .hero-actions .btn {
  width: 100%;
  min-height: 48px;
  justify-content: center;
}
[data-ui="mobile"] .portfolio-hero .hero-actions .btn-ghost:not(:first-of-type) {
  display: none;
}
[data-ui="mobile"] .portfolio-tabs-row {
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
[data-ui="mobile"] .portfolio-tabs-row::-webkit-scrollbar { display: none; }
[data-ui="mobile"] .portfolio-tab[data-tab="tokens"],
[data-ui="mobile"] .portfolio-tab[data-tab="activity"] {
  display: none;
}
[data-ui="mobile"] .time-filters { display: none; }
[data-ui="mobile"] .balance-amount { font-size: clamp(30px, 9vw, 40px); }
[data-ui="mobile"] .balance-block { margin-bottom: 20px; }
[data-ui="mobile"] .section-title { font-size: 1rem; }
[data-ui="mobile"] .mobile-home-card {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
[data-ui="mobile"] .mobile-home-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
[data-ui="mobile"] .btn-block { width: 100%; justify-content: center; }

/* Mobile content pages */
[data-ui="mobile"] .content-page,
[data-ui="mobile"] .login-wrap,
[data-ui="mobile"] .checkout-wrap {
  padding-left: 14px;
  padding-right: 14px;
}
[data-ui="mobile"] .page-title { font-size: 1.35rem; }
[data-ui="mobile"] .panel,
[data-ui="mobile"] .auth-panel,
[data-ui="mobile"] .panel-flat {
  padding: 14px;
  border-radius: var(--radius-md);
}
[data-ui="mobile"] .main-content { padding: 16px 14px 24px; }

/* Desktop — full layout */
[data-ui="desktop"] .mobile-bottom-nav { display: none !important; }
[data-ui="desktop"] .wallet-sheet-handle,
[data-ui="desktop"] .wallet-sheet-close { display: none !important; }
[data-ui="desktop"] .portfolio-layout {
  grid-template-columns: 1fr 340px;
}
[data-ui="desktop"] .portfolio-sidebar {
  display: flex;
}
