:root,
[data-theme="dark"] {
  --bg: #06110e;
  --bg-elevated: #0b1a15;
  --panel: rgba(14, 36, 28, 0.72);
  --panel-border: rgba(94, 234, 180, 0.14);
  --text: #e8f5ef;
  --muted: #8eaea0;
  --teal: #2dd4a8;
  --teal-deep: #0f9f78;
  --amber: #d6b35c;
  --danger: #f07167;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar-bg: rgba(5, 16, 13, 0.92);
  --input-bg: rgba(4, 14, 11, 0.7);
  --chip-bg: rgba(255, 255, 255, 0.03);
  --nav-hover: rgba(45, 212, 168, 0.08);
  --body-bg:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 212, 168, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 159, 120, 0.16), transparent 45%),
    linear-gradient(180deg, #040c0a 0%, #071410 45%, #050f0c 100%);
  --link-hover: #7cf0cd;
  --btn-ghost-bg: rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f7f5;
  --bg-elevated: #ffffff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(15, 80, 60, 0.12);
  --text: #0f241c;
  --muted: #5f746a;
  --teal: #0f9f78;
  --teal-deep: #0b7a5c;
  --amber: #b8923d;
  --danger: #d6453d;
  --shadow: 0 14px 40px rgba(15, 36, 28, 0.08);
  --sidebar-bg: rgba(255, 255, 255, 0.96);
  --input-bg: #f7fbf9;
  --chip-bg: rgba(15, 36, 28, 0.03);
  --nav-hover: rgba(15, 159, 120, 0.08);
  --body-bg:
    radial-gradient(1000px 500px at 0% -10%, rgba(15, 159, 120, 0.12), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, rgba(214, 179, 92, 0.1), transparent 45%),
    linear-gradient(180deg, #f7fbf9 0%, #eef5f1 100%);
  --link-hover: #0b7a5c;
  --btn-ghost-bg: rgba(15, 36, 28, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { transition: background-color .25s ease, color .25s ease; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--body-bg);
  transition: background .25s ease, color .25s ease;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--link-hover); }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.4rem 1rem;
  border-inline-end: 1px solid var(--panel-border);
  background: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}
.brand .menu-close { margin-inline-start: auto; }
.brand strong { display: block; font-size: 1rem; }
.brand small { color: var(--muted); }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #04221a;
  box-shadow: 0 8px 24px rgba(45, 212, 168, 0.28);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.side-nav a {
  position: relative;
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  border: 1px solid transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}
.side-nav a::before {
  content: "";
  position: absolute;
  inset-block: 22%;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.2s ease, transform 0.2s ease;
  transform: scaleY(0.4);
}
.side-nav a:hover {
  color: var(--text);
  background: var(--nav-hover);
  border-color: rgba(45, 212, 168, 0.14);
  transform: translateX(2px);
}
[dir="rtl"] .side-nav a:hover { transform: translateX(-2px); }
.side-nav a.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(45, 212, 168, 0.14), rgba(45, 212, 168, 0.05));
  border-color: rgba(45, 212, 168, 0.22);
  box-shadow: 0 8px 20px rgba(4, 20, 14, 0.18);
}
.side-nav a.active::before {
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
  transform: scaleY(1);
}
.side-nav a.nav-accent {
  background: rgba(45, 212, 168, 0.12);
  color: var(--teal);
  font-weight: 600;
}
.side-nav a.nav-accent:hover,
.side-nav a.nav-accent.active {
  background: linear-gradient(135deg, rgba(45, 212, 168, 0.2), rgba(45, 212, 168, 0.08));
  border-color: rgba(45, 212, 168, 0.28);
}
.side-nav a.nav-accent.alt {
  background: rgba(214, 179, 92, 0.12);
  color: var(--amber);
}
.side-nav a.nav-accent.alt:hover,
.side-nav a.nav-accent.alt.active {
  background: linear-gradient(135deg, rgba(214, 179, 92, 0.2), rgba(214, 179, 92, 0.08));
  border-color: rgba(214, 179, 92, 0.28);
}
.side-nav a:active {
  transform: scale(0.985);
}

.sidebar-foot { margin-top: auto; display: grid; gap: 0.8rem; }

.main-wrap { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.4rem 1.6rem 0.4rem;
  position: relative;
  z-index: 2;
  overflow: visible;
}
.topbar-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 0;
  flex: 1 1 auto;
}
.topbar-title-row > div {
  min-width: 0;
  max-width: 100%;
}
.topbar h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.topbar .muted {
  margin: 0.35rem 0 0;
  line-height: 1.4;
}
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
  max-width: 100%;
  position: relative;
  z-index: 1;
}
.topbar-action {
  white-space: nowrap;
  flex: 0 0 auto;
}
.topbar-action__short { display: none; }
.topbar-action__full { display: inline; }
.content { padding: 1rem 1.6rem 5.5rem; }

.glass,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel { padding: 1.1rem 1.2rem; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.page-actions { margin-bottom: 1rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.kpi-card {
  padding: 1rem 1.1rem;
  animation: kpi-rise 0.55s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 212, 168, 0.35);
}
.kpi-wide { grid-column: 1 / -1; }
.kpi-label { color: var(--muted); font-size: 0.85rem; }
.kpi-value { display: block; margin-top: 0.35rem; font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.kpi-sub { display: block; margin-top: 0.25rem; font-size: 0.85rem; }
.kpi-currency-list {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.kpi-currency-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.kpi-currency-list li span {
  color: var(--muted);
  font-size: 0.9rem;
}
@keyframes kpi-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.chart-panel { margin-bottom: 1rem; }
#activity-chart { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.chart-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 0.35rem;
}
.chart-legend .dot.buy { background: var(--teal); }
.chart-legend .dot.sell { background: var(--amber); }
.tx-list { display: grid; gap: 0.65rem; }
.tx-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.tx-card:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 212, 168, 0.28);
}
.tx-card.buy { border-inline-start: 3px solid var(--teal); }
.tx-card.sell { border-inline-start: 3px solid var(--amber); }
.tx-amounts { display: grid; gap: 0.2rem; text-align: end; }
[dir="rtl"] .tx-amounts { text-align: start; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--btn-ghost-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition:
    transform 0.18s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.98);
}
.btn:focus-visible {
  outline: 2px solid rgba(45, 212, 168, 0.45);
  outline-offset: 2px;
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; border-radius: 12px; }
.btn-primary {
  background: linear-gradient(160deg, #3de0b4 0%, var(--teal) 42%, var(--teal-deep) 100%);
  color: #04221a;
  border-color: rgba(45, 212, 168, 0.35);
  box-shadow:
    0 10px 22px rgba(15, 159, 120, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.28) inset;
}
.btn-primary:hover {
  box-shadow:
    0 14px 28px rgba(15, 159, 120, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.32) inset;
}
.btn-primary:active {
  box-shadow:
    0 6px 14px rgba(15, 159, 120, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
.btn-secondary {
  background: linear-gradient(160deg, #edd083 0%, #e2c270 45%, #b8923d 100%);
  color: #2a1f08;
  border-color: rgba(214, 179, 92, 0.4);
  box-shadow:
    0 10px 22px rgba(184, 146, 61, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.28) inset;
}
.btn-secondary:hover {
  box-shadow:
    0 14px 28px rgba(184, 146, 61, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.32) inset;
}
.btn-ghost {
  border-color: var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.btn-ghost:hover {
  border-color: rgba(45, 212, 168, 0.28);
  background: linear-gradient(180deg, rgba(45, 212, 168, 0.1), rgba(255, 255, 255, 0.03));
}
.btn-danger {
  background: linear-gradient(160deg, rgba(240, 113, 103, 0.22), rgba(240, 113, 103, 0.12));
  color: #ffb4ad;
  border-color: rgba(240, 113, 103, 0.3);
  box-shadow: 0 8px 18px rgba(240, 113, 103, 0.12);
}
[data-theme="light"] .btn-ghost {
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.86));
  box-shadow: 0 4px 14px rgba(15, 36, 28, 0.06);
}
[data-theme="light"] .btn-primary {
  color: #fff;
}
@media (prefers-reduced-motion: reduce) {
  .btn,
  .side-nav a,
  .mobile-nav__item {
    transition: none !important;
  }
  .btn:hover,
  .side-nav a:hover,
  .mobile-nav__item:active {
    transform: none !important;
  }
}

.form-stack { display: grid; gap: 0.9rem; }
.form-wide { max-width: 820px; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
label span { color: var(--muted); }
input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(142, 174, 160, 0.28);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(45, 212, 168, 0.35);
  border-color: var(--teal);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  grid-template-columns: none;
}
.check-row input { width: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 0.7rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.92rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(45, 212, 168, 0.14);
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 700;
}
.inline-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

.flash {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
}
.flash ul { margin: 0; padding-inline-start: 1.1rem; }
.flash-success {
  background: rgba(45, 212, 168, 0.12);
  border-color: rgba(45, 212, 168, 0.3);
}
.flash-error {
  background: rgba(240, 113, 103, 0.12);
  border-color: rgba(240, 113, 103, 0.3);
  color: #ffc7c2;
}

.card-list { display: grid; gap: 0.9rem; }
.balance-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.balance-chips li {
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: var(--chip-bg);
  border: 1px solid var(--panel-border);
  display: grid;
  gap: 0.15rem;
}
.balance-chips span { color: var(--muted); font-size: 0.8rem; }

.currency-fieldset {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.9rem;
}
.currency-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.currency-row:last-child { border-bottom: 0; }

.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 1rem;
  align-items: start;
}
.trade-summary dl { margin: 0; display: grid; gap: 0.8rem; }
.trade-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.trade-summary dt { color: var(--muted); }
.trade-summary dd { margin: 0; font-family: var(--mono); text-align: end; }

.notify-list { list-style: none; margin: 0; padding: 0; }
.notify-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.notify-list li.unread { border-inline-start: 3px solid var(--teal); padding-inline-start: 0.7rem; }
.empty-state { color: var(--muted); padding: 1.2rem; }

.locale-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
}
.locale-switch-form { margin: 0; }
.locale-switch a,
.locale-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, transform 0.16s ease;
}
.locale-switch a:active,
.locale-switch button:active { transform: scale(0.96); }
.locale-switch a.active,
.locale-switch a:hover,
.locale-switch button.active,
.locale-switch button:hover {
  background: rgba(45, 212, 168, 0.16);
  color: var(--text);
}

.guest-body { min-height: 100vh; }
.guest-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  padding: 2rem;
  align-items: center;
}
.guest-hero { max-width: 520px; padding: 1rem; }
.guest-brand { margin-bottom: 1.4rem; }
.guest-copy { color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.guest-panel { padding: 1.6rem; max-width: 460px; width: 100%; justify-self: end; }
.guest-panel h2 { margin-top: 0; }

/* --------------------------------------------------------------------------
   Mobile bottom navigation — button-style tabs (CSS only)
   Icons via ::before masks so HTML stays unchanged.
   Order: Dashboard | Reports | History | Account
   -------------------------------------------------------------------------- */
.mobile-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  box-sizing: border-box;
  width: 100%;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.2);
  padding:
    0.45rem 0.45rem
    calc(0.45rem + env(safe-area-inset-bottom, 0px));
}

.mobile-nav__item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 3.55rem; /* keeps equal tap targets; icon + label stack */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.35rem 0.3rem 0.4rem;
  border-radius: 16px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.16s ease,
    box-shadow 0.2s ease;
}

/* Icon glyph (CSS-only) */
.mobile-nav__item::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  display: block;
  background: currentColor;
  opacity: 0.88;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 1) Dashboard */
.mobile-nav__item:nth-child(1)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E");
}

/* 2) Reports */
.mobile-nav__item:nth-child(2)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='8' y1='13' x2='16' y2='13'/%3E%3Cline x1='8' y1='17' x2='13' y2='17'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='8' y1='13' x2='16' y2='13'/%3E%3Cline x1='8' y1='17' x2='13' y2='17'/%3E%3C/svg%3E");
}

/* 3) History / Log */
.mobile-nav__item:nth-child(3)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='12 7 12 12 15 14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='12 7 12 12 15 14'/%3E%3C/svg%3E");
}

/* 4) Account */
.mobile-nav__item:nth-child(4)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.mobile-nav__item::after {
  content: "";
  position: absolute;
  top: 0.3rem;
  inset-inline: 30%;
  height: 2.5px;
  border-radius: 999px;
  background: transparent;
  opacity: 0;
  transition: opacity 0.2s ease, inset-inline 0.2s ease, background 0.2s ease;
}

.mobile-nav__item:hover {
  color: var(--text);
  border-color: rgba(45, 212, 168, 0.18);
  background: linear-gradient(180deg, rgba(45, 212, 168, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.mobile-nav__item:active {
  transform: scale(0.96);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  font-size: clamp(0.62rem, 2.5vw, 0.74rem);
  letter-spacing: 0.01em;
}

.mobile-nav__item.is-active {
  color: var(--text);
  border-color: rgba(45, 212, 168, 0.3);
  background: linear-gradient(180deg, rgba(45, 212, 168, 0.2), rgba(45, 212, 168, 0.07));
  box-shadow:
    0 10px 22px rgba(15, 159, 120, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
.mobile-nav__item.is-active::before {
  opacity: 1;
  color: var(--teal);
  background: var(--teal);
  transform: translateY(-1px);
}
.mobile-nav__item.is-active::after {
  opacity: 1;
  inset-inline: 24%;
  background: linear-gradient(90deg, var(--teal), var(--teal-deep));
}

[data-theme="light"] .mobile-nav__item {
  background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.88));
  box-shadow: 0 4px 14px rgba(15, 36, 28, 0.07);
  border-color: rgba(15, 80, 60, 0.08);
}
[data-theme="light"] .mobile-nav__item.is-active {
  background: linear-gradient(180deg, rgba(15, 159, 120, 0.14), rgba(15, 159, 120, 0.06));
  box-shadow: 0 8px 18px rgba(15, 159, 120, 0.14);
}

.pagination-wrap { margin-top: 1rem; }

.tx-card.money_in { border-inline-start: 3px solid var(--teal); }
.tx-card.money_out { border-inline-start: 3px solid var(--amber); }

.filter-panel { margin-bottom: 1rem; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
}
.filter-grid-compact { grid-template-columns: minmax(180px, 280px) auto; }
.report-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}
.report-filter-grid .filter-actions { grid-column: 1 / -1; }
.report-generator {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem;
}
.report-generator-form {
  display: grid;
  gap: 0.9rem;
}
.report-generator-form label {
  display: grid;
  gap: 0.35rem;
}
.report-generator-form input,
.report-generator-form select {
  width: 100%;
  min-height: 2.75rem;
}
.report-generator-actions { margin-top: 0.35rem; }
.report-generator-actions .btn-lg {
  width: 100%;
  padding: 0.9rem 1.1rem;
  font-size: 1.05rem;
}
.report-generator-hint { margin: 0.9rem 0 0; font-size: 0.9rem; }
.filter-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }

.report-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}
.report-card h2 { margin: 0 0 0.75rem; font-size: 1rem; }
.report-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.report-stat-list li {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
}
.report-stat-list.compact li { padding: 0.4rem 0.55rem; }
.report-stat-list .in { color: var(--teal); }
.report-stat-list .out { color: var(--amber); }
.report-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}
.report-day-stats { margin: 0.7rem 0; display: grid; gap: 0.45rem; }
.report-day-stats > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.report-day-stats dt { color: var(--muted); }
.report-day-stats dd { margin: 0; }
.report-meta { margin-bottom: 1rem; }
.report-section { margin-bottom: 1.25rem; display: grid; gap: 1rem; }
.report-section > .panel-head { margin: 0; align-items: center; }
.export-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.report-section h2 { margin: 0; font-size: 1.15rem; }
.report-section h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.report-section .chart-panel.nested { padding: 0; background: transparent; border: 0; box-shadow: none; }
.report-chart, #report-chart { width: 100%; max-height: 220px; height: auto; display: block; }
.report-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
.report-split .report-card {
  padding: 0.85rem 0;
  border-top: 1px solid var(--panel-border);
}
.report-split .report-card:first-child { border-top: 0; padding-top: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.settings-wide { grid-column: 1 / -1; }
.theme-toggle-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.theme-option.active {
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #04221a;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(15, 159, 120, 0.25);
}
[data-theme="light"] .theme-option.active { color: #fff; }

[dir="rtl"] body { font-family: "DM Sans", "Segoe UI", Tahoma, sans-serif; }
[dir="rtl"] .trade-summary dd { text-align: start; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .hide-desktop { display: inline-flex !important; }
  .sidebar { display: none !important; }
  .mobile-nav { display: flex; }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem 1rem 0.35rem;
  }
  .topbar-title-row {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }
  .topbar h1 {
    font-size: 1.2rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
  .topbar .muted {
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
  /* 2×2 action grid — no overlap with title */
  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 0;
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-action {
    flex: none;
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding: 0.62rem 0.5rem;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-action__full { display: none; }
  .topbar-action__short { display: inline; }
  .report-generator {
    max-width: none;
    margin: 0;
    padding: 1rem;
  }
  .report-generator-hint { font-size: 0.85rem; line-height: 1.45; }
  .content {
    padding: 0.85rem 1rem 5.75rem;
  }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: 0.9rem; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-label { font-size: 0.78rem; line-height: 1.35; }
  .grid-2,
  .trade-layout,
  .guest-shell,
  .currency-row,
  .filter-grid,
  .report-cards,
  .settings-grid { grid-template-columns: 1fr; }
  .guest-panel { justify-self: stretch; max-width: none; }
}

@media (min-width: 981px) {
  .hide-desktop { display: none !important; }
  .mobile-nav { display: none !important; }
}
