:root {
  --bg: #0c0f16;
  --sidebar: #10141d;
  --card: #161b26;
  --card-hi: #1c2230;
  --input: #0f131c;
  --row: #131824;
  --row-alt: #171d2a;
  --border: #242b3a;
  --border-hi: #36405a;
  --fg: #e9edf5;
  --fg-dim: #a6b0c3;
  --fg-muted: #6c7790;
  --accent: #2f6bff;
  --accent-dim: #1f4bc4;
  --accent-bg: #16224a;
  --green: #26c281;
  --green-bg: #0f2a22;
  --red: #f2555a;
  --red-bg: #2e1518;
  --yellow: #f5b84f;
  --yellow-bg: #2e2513;
  --cyan: #2bc4e8;
  --purple: #9d7bff;
  --inferno: #ff7a1a;
  --teal: #0e6b73;
  --teal-line: #26c6da;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  height: 100%;
}

.mono {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* --- Login Screen -------------------------------------------------------- */
/* --- Login Screen: Animated Hero Canvas & Frosted Auth Card --------------- */
@keyframes orbFloatA {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, -30px, 0) scale(1.09); }
}

@keyframes orbFloatB {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-44px, 34px, 0) scale(1.12); }
}

@keyframes gridPan {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(48px, 48px, 0); }
}

@keyframes candleBreathe {
  0%, 100% { transform: translateY(0) scaleY(1); opacity: .22; }
  50% { transform: translateY(-10px) scaleY(1.14); opacity: .45; }
}

@keyframes logoHalo {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 122, 26, .35), 0 0 28px rgba(255, 122, 26, .24); }
  50% { box-shadow: 0 0 0 3px rgba(47, 107, 255, .42), 0 0 42px rgba(47, 107, 255, .32); }
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(38, 194, 129, .65); }
  70% { box-shadow: 0 0 0 7px rgba(38, 194, 129, 0); }
}

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

@keyframes titleGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 18% 15%, #17233f 0%, #0a0e16 55%, #070a10 100%);
  padding: 28px 20px;
  overflow-x: hidden;
  overflow-y: auto;
}

.login-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cyber-grid {
  position: absolute;
  inset: -48px;
  background-image:
    linear-gradient(rgba(47, 107, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 107, 255, .07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, .85) 15%, transparent 78%);
  animation: gridPan 14s linear infinite;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(75px);
  opacity: .38;
  will-change: transform;
}

.aurora-orb.orb-1 {
  width: 440px;
  height: 440px;
  top: -110px;
  left: -80px;
  background: radial-gradient(circle, rgba(255, 122, 26, .65), transparent 70%);
  animation: orbFloatA 11s ease-in-out infinite;
}

.aurora-orb.orb-2 {
  width: 480px;
  height: 480px;
  bottom: -140px;
  right: -90px;
  background: radial-gradient(circle, rgba(47, 107, 255, .65), transparent 70%);
  animation: orbFloatB 13s ease-in-out infinite;
}

.aurora-orb.orb-3 {
  width: 320px;
  height: 320px;
  top: 40%;
  left: 42%;
  background: radial-gradient(circle, rgba(38, 198, 218, .35), transparent 72%);
  animation: orbFloatA 15s ease-in-out infinite reverse;
}

.candle-stage {
  position: absolute;
  inset: auto 0 0 0;
  height: 220px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 5%;
  opacity: .5;
}

.bg-candle {
  position: relative;
  width: 10px;
  height: var(--h, 70px);
  margin-bottom: var(--y, 20%);
  border-radius: 3px;
  animation: candleBreathe 4.2s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.bg-candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18px;
  bottom: -18px;
  width: 2px;
  transform: translateX(-50%);
  background: inherit;
  opacity: .65;
}

.bg-candle.up {
  background: linear-gradient(180deg, rgba(38, 194, 129, .75), rgba(38, 194, 129, .2));
  box-shadow: 0 0 18px rgba(38, 194, 129, .22);
}

.bg-candle.dn {
  background: linear-gradient(180deg, rgba(242, 85, 90, .7), rgba(242, 85, 90, .18));
  box-shadow: 0 0 18px rgba(242, 85, 90, .2);
}

.login-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 440px;
  gap: 36px;
  align-items: center;
}

.hero-showcase {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeSlideUp .45s cubic-bezier(.16, 1, .3, 1);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(22, 27, 38, .8);
  border: 1px solid rgba(54, 64, 90, .7);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .9px;
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}

.live-dot.sm { width: 6px; height: 6px; }
.live-dot.sm.blue { background: var(--accent); box-shadow: none; animation: none; }
.live-dot.sm.teal { background: var(--cyan); box-shadow: none; animation: none; }

.hero-brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-logo-ring {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  padding: 4px;
  background: linear-gradient(135deg, rgba(255, 122, 26, .45), rgba(47, 107, 255, .45));
  animation: logoHalo 4.5s ease-in-out infinite;
  flex-shrink: 0;
}

.hero-logo-ring img {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
  display: block;
}

.hero-title {
  margin: 0;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.05;
  background: linear-gradient(90deg, #ff7a1a 0%, #ffc46b 35%, #7db1ff 70%, #26c6da 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  color: transparent;
  animation: titleGradient 7s ease infinite;
}

.hero-title span { font-weight: 700; opacity: .9; }

.hero-tagline {
  margin: 6px 0 0;
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.5;
  max-width: 480px;
}

.hero-tickers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ticker-chip {
  background: rgba(20, 26, 39, .75);
  border: 1px solid rgba(54, 64, 90, .55);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.ticker-chip:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 107, 255, .65);
  background: rgba(28, 36, 54, .88);
}

.tk-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tk-sym {
  font-family: Consolas, monospace;
  font-weight: 800;
  font-size: 13px;
  color: var(--fg);
}

.tk-tf {
  font-size: 10px;
  font-weight: 700;
  color: var(--inferno);
  background: rgba(255, 122, 26, .12);
  padding: 2px 6px;
  border-radius: 4px;
}

.tk-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-muted);
}

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

.feat-tile {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: rgba(18, 24, 36, .72);
  border: 1px solid rgba(36, 43, 58, .9);
  border-radius: 10px;
  padding: 12px;
  backdrop-filter: blur(8px);
  animation: fadeSlideUp .45s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: var(--stagger, 0ms);
  transition: transform .18s ease, border-color .18s ease;
}

.feat-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 26, .45);
}

.feat-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(47, 107, 255, .14);
  border: 1px solid rgba(47, 107, 255, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.feat-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 2px;
}

.feat-sub {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.4;
}

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgba(20, 26, 39, .88);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(54, 64, 90, .8);
  border-radius: 16px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .65), 0 0 40px rgba(47, 107, 255, .08);
  animation: fadeSlideUp .5s cubic-bezier(.16, 1, .3, 1);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--inferno), var(--accent), var(--teal-line));
}

.lg-btn {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.login-brand img {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(255, 122, 26, .25);
}

/* --- Shell Layout: Top Header + Left Sidebar + Scrollable Content -------- */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: minmax(60px, auto) 1fr;
  grid-template-areas:
    "hdr hdr"
    "sb  main";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.top-header {
  grid-area: hdr;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 8px 14px;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 30;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
}

.brand-title {
  color: var(--inferno);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .8px;
  line-height: 1.1;
}

.brand-sub {
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-top: 2px;
}

.hdr-center {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.hdr-chips {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-right: 18px;
  border-right: 1px solid var(--border);
}

.chip-lbl {
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.chip-val {
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  font-family: Consolas, monospace;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-btn {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}

/* --- Left Sidebar -------------------------------------------------------- */
.sidebar {
  grid-area: sb;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  z-index: 25;
}

.nav-group-lbl {
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .9px;
  padding: 18px 22px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 12px 2px 10px;
  padding: 9px 14px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  color: var(--fg-dim);
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
  user-select: none;
}

.nav-item:hover {
  background: var(--card);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--fg);
  border-left-color: var(--accent);
}

.sidebar-foot {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.mt5-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  margin-bottom: 6px;
}

.dot {
  font-size: 12px;
  color: var(--fg-muted);
}

.dot.ok {
  color: var(--green);
  text-shadow: 0 0 8px rgba(38, 194, 129, .65);
}

/* --- Main Content -------------------------------------------------------- */
.main-content {
  grid-area: main;
  overflow-y: auto;
  padding: 20px 22px;
  background: radial-gradient(circle at 85% 0%, rgba(47, 107, 255, .05), transparent 45%), var(--bg);
}

.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  animation: fadeSlideUp .22s cubic-bezier(.16, 1, .3, 1);
}

.page.full-h {
  height: calc(100vh - 104px);
}

/* --- Widgets: Cards, StatCards, Badges, Buttons, Segmented, Switches ----- */
.sec-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sec-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .2px;
  background: linear-gradient(90deg, #fff 0%, #9fb9ff 100%);
  -webkit-background-clip: text;
  color: transparent;
}

.card {
  background: linear-gradient(180deg, rgba(25, 31, 44, .96) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.card:hover {
  border-color: rgba(54, 64, 90, .95);
}

.card-head {
  padding: 13px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
}

.card-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-left: 8px;
}

.card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-body {
  padding: 6px 16px 14px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.kpi-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.kpi-grid.cols-5 {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.stat-card {
  background: linear-gradient(180deg, rgba(25, 31, 45, .95) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-top: 2px solid var(--bar-col, var(--accent));
  border-radius: 9px;
  padding: 11px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .28);
}

.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.stat-val {
  font-size: 21px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 11px;
  color: var(--fg-dim);
}

.prog-track {
  height: 4px;
  background: var(--input);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 3px;
}

.prog-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
  transition: width .3s;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  background: var(--card-hi);
  color: var(--fg-dim);
  white-space: nowrap;
}

.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.accent { background: var(--accent-bg); color: var(--accent); }
.badge.muted { background: var(--card-hi); color: var(--fg-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card-hi);
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s ease, filter .14s ease, box-shadow .14s ease, background .14s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: scale(.98);
}

.btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(47, 107, 255, .28); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(38, 194, 129, .24); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--fg-dim); }
.btn.ghost:hover:not(:disabled) { background: var(--card-hi); color: var(--fg); }
.btn.sm { padding: 4px 9px; font-size: 11px; }

.seg {
  display: inline-flex;
  background: var(--input);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: 5px;
  gap: 2px;
}

.seg-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

.seg-btn.active.green { background: var(--green); }
.seg-btn.active.red { background: var(--red); }

/* Toggle Switch */
.sw {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

.sw input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sw-slider {
  position: absolute;
  inset: 0;
  background: var(--border-hi);
  border-radius: 99px;
  cursor: pointer;
  transition: .16s;
}

.sw-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .16s;
}

.sw input:checked + .sw-slider {
  background: var(--accent);
}

.sw input:checked + .sw-slider::before {
  transform: translateX(20px);
}

/* Inputs & Selects */
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea {
  background: var(--input);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  color-scheme: dark;
  max-width: 100%;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.65);
  z-index: 22;
}

.custom-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .18);
}

/* --- Grids --------------------------------------------------------------- */
.grid-dash-mid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
}

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

.grid-3-2 {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
}

/* --- Tables & LogView ---------------------------------------------------- */
.table-wrap,
.tbl-wrap {
  overflow: auto;
  background: var(--row);
  border-radius: 7px;
  border: 1px solid #1b2232;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  background: var(--card);
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid #1a2130;
  font-family: Consolas, monospace;
}

tr:nth-child(even) td { background: var(--row-alt); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--card-hi); }
tr.selected td { background: var(--accent-bg) !important; }

.c-buy, .c-good, .c-profit, .c-ok { color: var(--green); font-weight: 700; }
.c-sell, .c-bad, .c-loss { color: var(--red); font-weight: 700; }
.c-warn { color: var(--yellow); }
.c-muted { color: var(--fg-muted); }

.empty-row {
  text-align: center;
  color: var(--fg-muted);
  padding: 26px !important;
  font-family: inherit !important;
}

.log-box {
  background: var(--input);
  border-radius: 5px;
  padding: 10px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  min-height: 220px;
  max-height: 310px;
  flex: 1;
}

.log-ln {
  padding: 2px 0;
  line-height: 1.4;
}

/* --- Setup Detail -------------------------------------------------------- */
.det-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.det-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
}

.det-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: .6px;
}

.det-val {
  font-size: 13px;
  font-family: Consolas, monospace;
  margin-top: 2px;
}

.det-sep {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.det-reason {
  font-size: 12px;
  color: var(--fg-dim);
  white-space: pre-wrap;
  line-height: 1.45;
  overflow-y: auto;
  max-height: 190px;
}

/* --- Settings Rows ------------------------------------------------------- */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.form-row:last-child { margin-bottom: 0; }
.form-lbl { font-size: 13px; font-weight: 600; color: var(--fg); }
.form-hint { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

.warn-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  white-space: pre-wrap;
}

.settings-footer {
  position: sticky;
  bottom: 0;
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- ProChart Shell ------------------------------------------------------ */
.card.chart-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 95 !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.card.chart-fullscreen .card-head {
  padding: 8px 12px 6px;
}

.card.chart-fullscreen .card-body {
  padding: 0 8px 8px;
}

.tf-pills {
  display: inline-flex;
  align-items: center;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}

.tf-btn {
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 700;
  font-family: Consolas, monospace;
  border-radius: 4px;
  cursor: pointer;
}

.tf-btn:hover { background: var(--card-hi); color: var(--fg); }
.tf-btn.active { background: var(--accent); color: #fff; }

.prochart-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 440px;
  background: var(--row);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.pc-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  flex-wrap: wrap;
}

.pc-btn {
  padding: 5px 8px;
  font-size: 12px;
  background: var(--card);
  color: var(--fg-dim);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.pc-btn:hover { background: var(--card-hi); color: var(--fg); }
.pc-btn.on { background: var(--card-hi); color: var(--accent); }
.pc-btn.off { text-decoration: line-through; color: var(--fg-muted); }

.pc-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.pc-hint {
  margin-left: auto;
  color: var(--fg-muted);
  font-size: 11px;
}

.pc-body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

.pc-sidetools {
  width: 38px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  gap: 2px;
  overflow-y: auto;
  flex-shrink: 0;
}

.pc-tool {
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: var(--card);
  color: var(--fg-dim);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.pc-tool:hover { background: var(--card-hi); color: var(--fg); }
.pc-tool.active { background: var(--accent); color: #fff; }

.pc-canvas-host {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 360px;
}

.pc-canvas-host canvas, .mini-canvas-host canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mini-canvas-host {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 340px;
}

/* Dropdown Menus in ProChart (viewport-safe + scrollable) */
.dd-wrap { position: relative; display: inline-block; }
.dd-menu {
  position: fixed;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: min(460px, calc(100vh - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 6px 0;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .65);
  z-index: 120;
}

.dd-menu::-webkit-scrollbar { width: 6px; }
.dd-menu::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; }

.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--fg);
  cursor: pointer;
}

.dd-item:hover { background: var(--accent); color: #fff; }
.dd-hr { height: 1px; background: var(--border); margin: 4px 0; }

/* --- Modals -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, .78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 18px;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  max-width: 1050px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .65);
  animation: fadeSlideUp .2s cubic-bezier(.16, 1, .3, 1);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  flex: 1;
}

.cal-hdr {
  text-align: center;
  font-size: 10px;
  color: var(--fg-muted);
  padding: 2px 0;
  font-weight: 700;
}

.cal-cell {
  background: var(--card-hi);
  border-radius: 4px;
  padding: 5px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cal-cell.up { background: var(--green-bg); }
.cal-cell.dn { background: var(--red-bg); }
.cal-day { font-size: 10px; color: var(--fg-muted); }
.cal-val { font-size: 11px; font-weight: 700; font-family: Consolas, monospace; text-align: center; }

.insights-box {
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--fg);
}

/* --- Responsive Breakpoints ---------------------------------------------- */
@media (max-width: 1220px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-dash-mid, .grid-2col, .grid-3-2 { grid-template-columns: 1fr; }
  .hdr-center { gap: 12px; }
  .hdr-chips { gap: 12px; padding-right: 12px; }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hdr"
      "main";
  }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 235px;
    transform: translateX(-105%);
    transition: transform .18s ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .top-header { padding: 8px 12px; gap: 8px; }
  .hdr-center { margin-left: 0; order: 3; width: 100%; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 6px; gap: 8px; }
  .hdr-chips { border-right: none; padding-right: 0; gap: 12px; }
  .main-content { padding: 14px 12px; }
  .page.full-h { height: auto; min-height: calc(100dvh - 120px); }
  .prochart-wrap { min-height: 480px; }
}

@media (max-width: 640px) {
  .kpi-grid, .kpi-grid.cols-4, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-val { font-size: 18px; }
  .det-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .form-row input[type="text"], .form-row input[type="password"], .form-row input[type="number"], .form-row select {
    width: 100% !important;
  }
  .card-head { padding: 10px 12px 6px; }
  .card-body { padding: 6px 12px 12px; }
  .card-sub { margin-left: 0; display: block; margin-top: 2px; }
  .seg { flex-wrap: wrap; }
  .hdr-actions .btn { padding: 6px 10px; font-size: 11px; }
  #hdr_clock { display: none; }
  .pc-hint { display: none; }
  .pc-body { flex-direction: column-reverse; }
  .pc-sidetools {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 4px 6px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .pc-sidetools .dd-hr { width: 1px !important; height: 22px; margin: 0 3px; }
  .pc-canvas-host { min-height: 320px; }
  .mini-canvas-host { min-height: 260px; }
  .calendar-grid { gap: 2px; }
  .cal-cell { min-height: 38px; padding: 3px; }
}

@media (max-width: 400px) {
  .kpi-grid, .kpi-grid.cols-4, .kpi-grid.cols-5 { grid-template-columns: 1fr; }
  .chip-val { font-size: 12px; }
}

/* --- SaaS Auth, Billing & Owner Portal ----------------------------------- */
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--fg-dim);
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.auth-tab:hover:not(.active) {
  color: var(--fg);
  background: rgba(255, 255, 255, .04);
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 107, 255, .32);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeSlideUp .22s cubic-bezier(.16, 1, .3, 1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fld {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--accent-soft, #7db1ff);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { text-decoration: underline; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-muted);
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: #111827;
  border: 1px solid #d1d5db;
  font-weight: 600;
}

.google-btn:hover { background: #f3f4f6; }

.auth-banner {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(239, 68, 68, .14);
  color: #fca5a5;
}

.auth-banner.ok {
  background: rgba(16, 185, 129, .14);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, .35);
}

.owner-env-pill {
  font-size: 11px;
  color: var(--fg-dim);
  background: var(--card-hi);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
}

#nav_bot_groups.locked .nav-item {
  opacity: 0.58;
}

#nav_bot_groups.locked .nav-item::after {
  content: "🔒";
  margin-left: auto;
  font-size: 10px;
  opacity: .75;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.plan-card {
  background: linear-gradient(180deg, rgba(30, 37, 52, .92) 0%, var(--card-hi) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.plan-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
}

.plan-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 28px rgba(47, 107, 255, .18);
}

.plan-price {
  font-size: 24px;
  font-weight: 800;
  font-family: Consolas, monospace;
}

.plan-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-dim);
}

.method-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.method-btn {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-hi);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .12s ease;
}

.method-btn:hover {
  border-color: var(--border-hi);
  transform: translateY(-1px);
}

.method-btn.active {
  border-color: var(--accent);
  background: rgba(47, 107, 255, .2);
  box-shadow: 0 0 0 1px rgba(47, 107, 255, .35);
}

.qr-box {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  animation: fadeSlideUp .22s cubic-bezier(.16, 1, .3, 1);
}

.qr-img {
  width: 170px;
  height: 170px;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  object-fit: contain;
}

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

.ro-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.ro-lbl {
  font-size: 10px;
  letter-spacing: .5px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.ro-val {
  font-size: 12px;
  font-family: Consolas, monospace;
  color: var(--fg);
  word-break: break-all;
}

/* Global Sleek Scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* Responsive Login Hero & SaaS Grids */
@media (max-width: 960px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 460px;
    gap: 20px;
  }
  .hero-title { font-size: 28px; }
  .hero-features { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .readonly-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .login-wrap { padding: 16px 12px; }
  .login-card { padding: 20px 16px; }
  .hero-logo-ring { width: 56px; height: 56px; border-radius: 14px; }
  .hero-title { font-size: 24px; }
  .hero-tickers { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ticker-chip { padding: 8px; }
  .candle-stage { height: 140px; opacity: .32; }
}

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


