/* ==========================================================================
   USDT Trading Dashboard — Stylesheet
   Design language: dark "trading terminal" aesthetic (TradingView/Binance
   inspired) with glassmorphism cards, a mint-green profit accent, and
   JetBrains Mono for all numeric/financial data.
   ========================================================================== */

/* ---------------------------- Design Tokens ---------------------------- */
:root {
  /* Core palette — dark (default) */
  --bg: #0A0D14;
  --bg-elevated: #10141D;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-solid: #131826;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-primary: #EDEFF4;
  --text-secondary: #9AA3B5;
  --text-muted: #626B80;

  --accent: #2FE8B0;          /* mint green — profit / primary */
  --accent-dim: rgba(47, 232, 176, 0.14);
  --accent-strong: #17C795;
  --loss: #FF5C7A;             /* coral red — loss / negative */
  --loss-dim: rgba(255, 92, 122, 0.14);
  --info: #5B8CFF;             /* blue — informational accent */
  --info-dim: rgba(91, 140, 255, 0.14);
  --warn: #FFB648;
  --warn-dim: rgba(255, 182, 72, 0.14);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.45);

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --sidebar-w: 250px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 76px;

  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg: #F4F6FA;
  --bg-elevated: #FFFFFF;
  --surface: rgba(16, 20, 30, 0.03);
  --surface-solid: #FFFFFF;
  --surface-hover: rgba(16, 20, 30, 0.045);
  --border: rgba(16, 20, 30, 0.08);
  --border-strong: rgba(16, 20, 30, 0.14);

  --text-primary: #131826;
  --text-secondary: #5B6478;
  --text-muted: #939AAC;

  --shadow-soft: 0 8px 30px rgba(20, 24, 40, 0.08);
  --shadow-lift: 0 16px 40px rgba(20, 24, 40, 0.12);
}

/* ---------------------------- Reset / Base ---------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent-dim); color: var(--accent); }

/* Subtle ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px circle at 10% -10%, rgba(47,232,176,0.08), transparent 60%),
    radial-gradient(500px circle at 100% 0%, rgba(91,140,255,0.07), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ---------------------------- App Shell ---------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.app-shell.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------------------------- Sidebar ---------------------------- */
.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width var(--transition);
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  display: flex; align-items: center; justify-content: center;
  color: #061019; font-size: 16px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(47,232,176,0.35);
}
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-text b { color: var(--accent); font-weight: 800; }
.sidebar-collapse-btn {
  margin-left: auto;
  background: none; border: none; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.sidebar-collapse-btn:hover { background: var(--surface-hover); color: var(--text-primary); }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 500; font-size: 14.5px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.holdings-mini {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.holdings-mini-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.holdings-mini-value { font-family: var(--font-mono); font-weight: 600; color: var(--accent); font-size: 14px; }

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-item span,
.app-shell.sidebar-collapsed .sidebar-footer,
.app-shell.sidebar-collapsed .sidebar-collapse-btn i { display: none; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; }

.sidebar-scrim { display: none; }

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

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
}
.topbar-title h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.topbar-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.icon-btn-sm { width: 28px; height: 28px; font-size: 12px; }
.mobile-menu-btn { display: none; }

.live-price-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-dim); border: 1px solid rgba(47,232,176,0.3);
  color: var(--accent); font-family: var(--font-mono); font-weight: 600;
  padding: 8px 14px; border-radius: 999px; font-size: 13px;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(47,232,176, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47,232,176, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(47,232,176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47,232,176, 0); }
}

/* ---------------------------- Content ---------------------------- */
.content { padding: 26px 28px 10px; flex: 1; }
.page-section { display: none; animation: fadeIn 240ms ease; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.app-footer { padding: 18px 28px 26px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* ---------------------------- Cards ---------------------------- */
.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-soft);
  transition: border-color var(--transition), transform var(--transition);
}
.card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.card-header h2 {
  font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.01em;
}
.card-header h2 i { color: var(--accent); font-size: 14px; }

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------------------------- Badges ---------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.04em; margin-left: auto;
}
.badge-live { background: var(--accent-dim); color: var(--accent); }

/* ---------------------------- Price Card ---------------------------- */
.price-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-currency-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.price-value {
  font-family: var(--font-mono); font-size: 40px; font-weight: 700;
  letter-spacing: -0.02em; transition: color var(--transition);
}
.price-value.up { color: var(--accent); }
.price-value.down { color: var(--loss); }
.price-change {
  font-family: var(--font-mono); font-size: 15px; font-weight: 600; padding: 3px 10px;
  border-radius: 8px;
}
.price-change.up { color: var(--accent); background: var(--accent-dim); }
.price-change.down { color: var(--loss); background: var(--loss-dim); }

.price-secondary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin: 20px 0 6px; padding-top: 18px; border-top: 1px solid var(--border);
}
.price-sub-item { display: flex; flex-direction: column; gap: 4px; }
.price-sub-item .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.price-sub-item .value { font-family: var(--font-mono); font-weight: 600; font-size: 14.5px; }

.price-alert-row {
  display: flex; align-items: center; gap: 10px; margin-top: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.price-alert-row i { color: var(--warn); }
.price-alert-row input {
  flex: 1; background: none; border: none; color: var(--text-primary); font-family: var(--font-mono); font-size: 13px; outline: none;
}
.active-alert-text { font-size: 12px; color: var(--accent); white-space: nowrap; }
.api-error-text { color: var(--loss); font-size: 12.5px; margin: 12px 0 0; display: none; }
.api-error-text.show { display: block; }

/* ---------------------------- Skeleton loaders ---------------------------- */
.skeleton {
  display: inline-block; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.skeleton-price { width: 160px; height: 38px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------------------------- Market grid ---------------------------- */
.market-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.market-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.market-item .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.market-item .value { font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.market-item .value.up { color: var(--accent); }
.market-item .value.down { color: var(--loss); }

/* ---------------------------- Stats grid ---------------------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat-card {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 20px; box-shadow: var(--shadow-soft);
  transition: transform var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.stat-card .stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; font-size: 14px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .stat-value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.stat-card .stat-value.up { color: var(--accent); }
.stat-card .stat-value.down { color: var(--loss); }
.stat-icon.tone-accent { background: var(--accent-dim); color: var(--accent); }
.stat-icon.tone-info { background: var(--info-dim); color: var(--info); }
.stat-icon.tone-warn { background: var(--warn-dim); color: var(--warn); }
.stat-icon.tone-loss { background: var(--loss-dim); color: var(--loss); }

/* ---------------------------- Calendar ---------------------------- */
.calendar-nav { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 700; padding-bottom: 6px; }
.cal-day {
  aspect-ratio: 1; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); cursor: default;
  transition: all var(--transition); gap: 3px;
}
.cal-day.has-trades { cursor: pointer; border-color: var(--border-strong); }
.cal-day.has-trades:hover { background: var(--surface-hover); transform: scale(1.05); }
.cal-day.empty { visibility: hidden; }
.cal-day .cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-day .cal-dot.loss { background: var(--loss); }

/* ---------------------------- Forms ---------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-wide { grid-column: span 3; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.form-group label .hint-inline { font-size: 10.5px; font-weight: 500; text-transform: none; color: var(--text-muted); letter-spacing: 0; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text-primary); font-size: 14px; outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); background: var(--surface-hover);
}
.form-group textarea { resize: vertical; font-family: inherit; }

.calc-panel {
  margin-top: 22px; padding: 20px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-dim), transparent 70%);
  border: 1px solid rgba(47,232,176,0.25);
}
.calc-panel h3 { margin: 0 0 14px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.calc-item { display: flex; flex-direction: column; gap: 4px; }
.calc-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.calc-item .value { font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.calc-item .value.up { color: var(--accent); }
.calc-item .value.down { color: var(--loss); }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }

/* ---------------------------- Buttons ---------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #052018;
  box-shadow: 0 6px 18px rgba(47,232,176,0.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(47,232,176,0.36); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.btn-danger { background: var(--loss); color: #2a0410; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(255,92,122,0.32); }

/* Ripple */
.btn::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.35);
  width: 8px; height: 8px; opacity: 0; transform: scale(1);
  top: var(--ripple-y, 50%); left: var(--ripple-x, 50%); translate: -50% -50%;
}
.btn.rippling::after { animation: ripple 500ms ease-out; }
@keyframes ripple { 0% { opacity: 0.5; transform: scale(0); } 100% { opacity: 0; transform: scale(22); } }

/* ---------------------------- Orders Toolbar / Table ---------------------------- */
.orders-toolbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.import-label { position: relative; }
.orders-toolbar { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.search-box {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.search-box i { color: var(--text-muted); }
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 14px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-row select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-secondary); font-size: 13px; outline: none;
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.data-table th {
  text-align: left; padding: 12px 14px; color: var(--text-muted); font-weight: 600;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none;
}
.data-table th i { margin-left: 5px; font-size: 10px; opacity: 0.5; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); white-space: nowrap; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table td.profit-up { color: var(--accent); font-weight: 600; }
.data-table td.profit-down { color: var(--loss); font-weight: 600; }
.col-actions { text-align: right; }

.pill { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; font-family: var(--font-display); }
.pill-buy { background: var(--info-dim); color: var(--info); }
.pill-sell { background: var(--accent-dim); color: var(--accent); }
.pill-completed { background: var(--accent-dim); color: var(--accent); }
.pill-pending { background: var(--warn-dim); color: var(--warn); }
.pill-cancelled { background: var(--loss-dim); color: var(--loss); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.row-actions button:hover { color: var(--text-primary); border-color: var(--border-strong); }
.row-actions .edit-btn:hover { color: var(--info); }
.row-actions .delete-btn:hover { color: var(--loss); }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination button {
  min-width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); font-size: 13px; font-family: var(--font-mono);
}
.pagination button.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(47,232,176,0.3); }
.pagination button:hover:not(.active) { background: var(--surface-hover); }

/* ---------------------------- Empty States ---------------------------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 40px; margin-bottom: 14px; color: var(--text-muted); opacity: 0.6; }
.empty-state h3 { margin: 0 0 6px; color: var(--text-secondary); font-size: 16px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------------------------- Charts ---------------------------- */
.chart-box { height: 280px; position: relative; }
.chart-box-sm { height: 220px; }

/* ---------------------------- Reports ---------------------------- */
.report-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.report-tab {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13.5px; transition: all var(--transition);
}
.report-tab.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(47,232,176,0.3); }

/* ---------------------------- Notes ---------------------------- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.note-card {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px; box-shadow: var(--shadow-soft); transition: transform var(--transition);
  display: flex; flex-direction: column; gap: 10px;
}
.note-card:hover { transform: translateY(-3px); }
.note-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-card-header h4 { margin: 0; font-size: 14.5px; }
.note-card .note-category {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--info); background: var(--info-dim); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.note-card p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.note-card-footer { display: flex; justify-content: space-between; align-items: center; }
.note-card-footer time { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.note-delete-btn { background: none; border: none; color: var(--text-muted); }
.note-delete-btn:hover { color: var(--loss); }

/* ---------------------------- Settings ---------------------------- */
.backup-panel { display: flex; gap: 10px; margin-bottom: 16px; }
.hint-text { font-size: 12px; color: var(--text-muted); margin: 14px 0 0; }

/* ---------------------------- Modal ---------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,6,10,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-panel {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 640px; max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-lift); transform: translateY(14px) scale(0.98); transition: transform var(--transition);
}
.modal-overlay.open .modal-panel { transform: translateY(0) scale(1); }
.modal-panel-sm { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 22px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elevated);
}
.modal-header h3 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------------------------- Toasts ---------------------------- */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 14px 18px; min-width: 260px; max-width: 340px;
  box-shadow: var(--shadow-lift); display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; animation: toastIn 260ms ease;
}
.toast.error { border-left-color: var(--loss); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.toast.hide { animation: toastOut 220ms ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------------------------- Scrollbar ---------------------------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 1080px) {
  .grid-2col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-group-wide { grid-column: span 2; }
  .calc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 250px; transform: translateX(-100%);
    transition: transform var(--transition); z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50;
  }
  .sidebar-scrim.show { display: block; }
  .mobile-menu-btn { display: flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
  .market-grid, .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-group-wide { grid-column: span 1; }
  .calc-grid { grid-template-columns: repeat(2, 1fr); }
  .price-secondary { grid-template-columns: 1fr; }
  .topbar-subtitle { display: none; }
  .live-price-pill span:not(.pulse-dot) { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 480px) {
  .market-grid, .stats-grid { grid-template-columns: 1fr; }
  .price-value { font-size: 32px; }
}

/* Print styles for report printing */
@media print {
  .sidebar, .topbar, .app-footer, .orders-toolbar, .orders-toolbar-actions, .pagination { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
