/* ============================================================
   FX Signals - shared styles  (Black + Blue, touch of Gold)
   ============================================================ */
:root {
  --bg: #060a12;
  --surface: #0c1322;
  --surface-2: #131c2e;
  --border: #1e2b44;
  --text: #e6edf7;
  --muted: #8fa0b8;
  --brand: #0c1322;
  --brand-2: #16233f;
  --accent: #3b82f6;
  --accent-strong: #1d4ed8;
  --blue-bg: rgba(59, 130, 246, .12);
  --gold: #d4af37;
  --gold-dim: rgba(212, 175, 55, .5);
  --gold-bg: rgba(212, 175, 55, .14);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, .12);
  --amber: #f5a524;
  --amber-bg: rgba(245, 165, 36, .14);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 10px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

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

.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- Top nav ---------- */
.topnav { background: var(--brand); color: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.topnav-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 800; letter-spacing: .4px; color: #fff;
}
.brand img.brand-logo { width: 560px; height: 150px; display: block; max-width: 100%; }
.brand:hover { text-decoration: none; }

.navuser { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.navuser-name { font-size: 18px; color: #dbe4f0; }
.navuser-role {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 6px 12px; border-radius: 999px;
}
.navuser-role.admin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  background: var(--surface-2); border: 1px solid var(--gold-dim);
  color: var(--gold);
}
.navuser-role.admin svg { width: 13px; height: 13px; flex: none; }
.navuser-role.customer { background: #3a4a63; color: #fff; }
.btn-nav {
  color: #b6c4d9; font-size: 17px; padding: 12px 20px; border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
}
.btn-nav:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.08); }
.settings-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
}
.settings-btn svg { width: 12px; height: 12px; flex: none; }

/* ---------- Typography ---------- */
h1 { font-size: 26px; margin: 6px 0 4px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.money-pos { color: var(--green); font-weight: 700; }
.money-neg { color: var(--red); font-weight: 700; }

.back-link { margin: 0 0 10px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; background: var(--surface-2); color: var(--text);
  transition: filter .12s ease, transform .05s ease;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { display: block; width: 100%; text-align: center; }

.btn-big {
  display: inline-flex; align-items: center; gap: 8px; font-size: 15px;
  padding: 14px 24px; border-radius: 12px; box-shadow: var(--shadow);
}

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 18px; font-size: 14px; }
.alert-success { background: var(--green-bg); color: #86efac; border: 1px solid rgba(34, 197, 94, .35); }
.alert-error { background: var(--red-bg); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .35); }

/* ---------- Auth page ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 500px; padding: 36px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 60px 56px; box-shadow: var(--shadow);
}
.auth-logo img.brand-logo { height: 260px; width: auto; max-width: 92%; display: block; }
.auth-logo {
  font-size: 22px; font-weight: 800; margin-bottom: 24px; color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.auth-logo img.brand-logo { height: 110px; width: auto; max-width: 90%; display: block; }
.auth-card h1 { margin-bottom: 2px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.stack label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.stack input, .stack select, .stack textarea {
  display: block; width: 100%; margin-top: 6px; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface-2);
}
.stack input:focus, .stack select:focus, .stack textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent;
}
.stack .auth-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer;
}
.stack .auth-check input[type="checkbox"] {
  display: inline-block; width: 16px; height: 16px; margin: 0; flex: none;
  cursor: pointer; accent-color: var(--accent);
}
.auth-switch { margin-top: 22px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---------- Page header ---------- */
.pagehead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.pagehead h1 { margin: 0; }
.pagehead .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.daily-pl {
  font-size: 16px; font-weight: 700; padding: 8px 18px; border-radius: 12px;
}
.daily-pl.neg { background: var(--red-bg); color: var(--red); }
.daily-pl.pos { background: var(--green-bg); color: var(--green); }
.daily-pl.zero { background: var(--amber-bg); color: var(--amber); }

/* ---------- Calendar ---------- */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.cal-toolbar h1 { margin: 0; font-size: 24px; }
.cal-nav { display: flex; gap: 8px; }

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.cal-dow {
  text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); padding: 12px 4px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.cal-dow.cal-dow-week { color: var(--gold); }
.cal-week {
  background: var(--surface-2); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 8px 2px; border-bottom: 1px solid var(--border);
  border-right: none; min-height: 108px;
}
.cal-week .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cal-week .val { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-week .val.pos { color: var(--green); }
.cal-week .val.neg { color: var(--red); }
.cal-week .val.zero { color: var(--muted); }
.cal-cell {
  min-height: 108px; padding: 8px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); position: relative; background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.cal-cell:nth-child(8n) { border-right: none; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-day { color: var(--muted); }
.cal-cell.today { background: var(--blue-bg); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.today .cal-day { color: var(--accent); }

.cal-day { font-weight: 700; font-size: 15px; }
.cal-cell a.day-link { color: inherit; }
.cal-cell a.day-link:hover { text-decoration: none; }

.cal-daynum { font-size: 15px; font-weight: 700; }
.cal-daynum.empty { color: var(--muted); }

.cal-info { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.cal-count { color: var(--muted); }
.cal-pl { font-size: 13px; font-weight: 700; }
.cal-pl.pos { color: var(--green); }
.cal-pl.neg { color: var(--red); }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-dot.pos { background: var(--green); }
.cal-dot.neg { background: var(--red); }
.cal-dot.zero { background: var(--muted); }
.cal-mytrades {
  display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 800; line-height: 1.5;
  color: var(--gold); background: var(--gold-bg); border: 1px solid var(--gold-dim);
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}

.cal-legend { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Profit / Loss Gallery ---------- */
.profit-gallery { margin-top: 28px; }
.gallery-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.gallery-header h2 { margin: 0; }
.gallery-filter { position: relative; }
.gallery-select {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: filter .15s ease;
}
.gallery-select:hover { filter: brightness(1.15); }
.gallery-count { opacity: .85; }
.gallery-caret { font-size: 10px; }
.gallery-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 50; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.gallery-menu[hidden] { display: none; }
.gallery-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border: none; border-radius: 8px; background: transparent; color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.gallery-menu button:hover { background: var(--surface-2); }
.gallery-menu button.active { background: var(--blue-bg); color: var(--accent); }
.gallery-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.gallery-tile {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s ease; cursor: zoom-in;
}
.gallery-tile img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.gallery-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .82));
  padding: 28px 12px 10px; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between;
}
.gallery-pair { color: #fff; font-size: 15px; font-weight: 800; }
.gallery-verified { display: inline-flex; align-items: center; color: var(--gold); margin-left: auto; }
.gallery-verified svg { display: block; }
.gallery-levels { width: 100%; margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #d1d5db; }
.gallery-tile:hover { border-color: var(--gold-dim); }

.month-pl {
  margin-top: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.month-pl .lbl { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.month-pl .val { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.month-pl .val.pos { color: var(--green); }
.month-pl .val.neg { color: var(--red); }
.month-pl .val.zero { color: var(--muted); }

/* ---------- Signal cards ---------- */
.cards { display: flex; flex-direction: column; gap: 16px; }

.signal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; gap: 18px; padding: 16px; box-shadow: var(--shadow); align-items: stretch;
}
.signal-card:hover { border-color: var(--gold-dim); }

.signal-thumb {
  position: relative; flex: 0 0 148px; width: 148px; border-radius: 10px; overflow: hidden;
  background: #0a1120; display: flex; align-items: center; justify-content: center;
}
.signal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.signal-thumb.empty { background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.signal-thumb .tf-tag {
  position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: var(--gold);
  font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px;
  opacity: 0; transition: opacity .12s ease;
}
.signal-thumb:hover .tf-tag { opacity: 1; }

.signal-main { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.signal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.signal-pair { font-size: 18px; font-weight: 800; }
.signal-type {
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .03em;
}
.st-buy { background: rgba(16, 185, 129, .16); color: #34d399; }
.st-sell { background: var(--red-bg); color: #f87171; }
.st-limit { background: var(--blue-bg); color: #60a5fa; }

.signal-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.signal-stats .stat { display: inline-flex; gap: 5px; align-items: baseline; }
.signal-stats .stat b { font-weight: 700; }
.signal-stats .spacer { color: var(--border); }

.signal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto;
}
.signal-foot .resultline { display: flex; align-items: center; gap: 10px; }
.signal-time { font-size: 12px; color: var(--muted); }

/* ---------- Carried-over (previous-day pending) signals ---------- */
.signal-card.carried { border-left: 3px solid var(--amber); }
.carried-section { margin-top: 12px; }
.carried-section .cards { gap: 12px; }
.carried-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 18px 2px 10px;
}
.carried-title { font-size: 14px; font-weight: 800; letter-spacing: .02em; color: var(--amber); }
.carried-sub { font-size: 12px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px;
}
.badge-profit { background: var(--green-bg); color: var(--green); }
.badge-loss { background: var(--red-bg); color: var(--red); }
.badge-pending { background: var(--amber-bg); color: var(--amber); }
.badge-running { background: var(--green-bg); color: var(--green); }
.badge-sl { background: var(--red-bg); color: var(--red); }
.badge-tp { background: var(--green-bg); color: var(--green); }
.badge-closed { background: var(--gold-bg); color: var(--gold); }
.badge-missed { background: rgba(148, 163, 184, .14); color: #8fa3b8; }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.verified-star { display: inline-flex; align-items: center; color: var(--gold); }
.verified-star svg { display: block; }

.posted-by { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.posted-by b { color: var(--text); font-weight: 800; }

/* ---------- Posted by / verified / taken ---------- */
.signal-note {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin: 2px 0 18px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.signal-note-side { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.note-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.note-name { font-size: 15px; font-weight: 800; }
.note-muted { font-size: 13px; color: var(--muted); }
.taken-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-dim);
}
.taken-badge svg { display: block; }
.tick-btn { display: inline-flex; align-items: center; gap: 6px; }

.signal-note .take-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.signal-note .take-form .form-row { display: flex; gap: 10px; }
.signal-note .take-form .field { margin-bottom: 0; display: flex; flex-direction: column; gap: 3px; }
.signal-note .take-form .field label { font-size: 12px; margin-bottom: 0; }
.signal-note .take-form .field input { width: 110px; padding: 6px 8px; }

.verified-banner {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800; letter-spacing: .04em;
  padding: 8px 14px; border-radius: 999px; margin-bottom: 16px;
  background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-dim);
}
.verified-banner svg { display: block; }

/* ---------- Take-trade box (customer) ---------- */
.take-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.take-box h3 { margin: 0 0 8px; font-size: 15px; }
.take-box .take-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 8px; }
.take-box .take-form .form-row { flex: 1 1 100%; }
.take-box .your-trade .signal-stats { font-size: 14px; }

/* ---------- Signal detail / definition list ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.detail-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.detail-item .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.detail-item .v { font-size: 17px; font-weight: 700; margin-top: 4px; word-break: break-word; }

.comment-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-top: 16px;
}
.comment-box h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Charts gallery ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 8px; }
.chart-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.chart-tile .tf-label {
  background: var(--brand-2); color: #fff; text-align: center; font-weight: 800; font-size: 13px;
  padding: 8px; letter-spacing: .05em;
}
.chart-tile .tf-label.label-result { background: var(--gold); color: #141007; }
.results-section[hidden], .result-tile[hidden], #resultsPanel[hidden] { display: none !important; }
.chart-tile .img-wrap { position: relative; }
.chart-tile img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.chart-tile .tile-actions {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border);
  align-items: center;
}
.chart-tile .tile-actions select { flex: 1; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }

/* ---------- Wizard ---------- */
.wizard-steps {
  display: flex; gap: 0; margin: 0 0 24px; padding: 0; list-style: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.wizard-steps li {
  flex: 1; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted);
  padding: 14px 8px; border-right: 1px solid var(--border); background: var(--surface-2); position: relative;
}
.wizard-steps li:last-child { border-right: none; }
.wizard-steps li.active { background: var(--blue-bg); color: var(--accent); }
.wizard-steps li.done { background: var(--green-bg); color: var(--green); }
.wizard-steps .num {
  display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); margin-right: 6px; font-size: 12px;
  border: 1px solid var(--border);
}
.wizard-steps li.active .num { background: var(--accent); color: #fff; }
.wizard-steps li.done .num { background: var(--green); color: #fff; }

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=datetime-local],
.field input[type=email], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent;
}
.field textarea { min-height: 120px; resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.seg-control { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.seg-control.three { grid-template-columns: repeat(3, 1fr); }
.seg {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center;
  font-weight: 700; font-size: 15px; cursor: pointer; background: var(--surface-2); color: var(--muted);
}
.seg:hover { border-color: var(--accent); color: var(--accent); }
.seg.selected { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); }
.seg input { display: none; }

.rr-preview { text-align: center; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border); }
.rr-preview .big { font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

.wizard-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }

/* ---------- Upload zone ---------- */
.upload-zone {
  display: block;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 34px 20px; text-align: center;
  cursor: pointer; color: var(--muted); background: var(--surface-2); transition: background .12s ease;
}
.upload-zone:hover { background: var(--blue-bg); border-color: var(--accent); }
.upload-zone.dragover { background: var(--blue-bg); border-color: var(--accent); }
.upload-zone .big { font-size: 22px; font-weight: 700; color: var(--text); }

.wizard-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.wizard-img {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface);
  position: relative;
}
.wizard-img img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.wizard-img .w-uploading {
  width: 100%; aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; background: var(--surface-2);
}
.wizard-img .w-img-actions { display: flex; gap: 8px; padding: 10px; align-items: center; }
.wizard-img .w-img-actions select { flex: 1; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.wizard-img .w-remove {
  background: var(--red-bg); color: var(--red); border: none; width: 30px; height: 30px;
  border-radius: 8px; font-weight: 800; cursor: pointer;
}

.pending-upload {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); padding: 10px; margin-bottom: 10px;
}
.pending-upload img { width: 120px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; }
.pending-upload .w-img-actions { display: flex; gap: 8px; align-items: center; flex: 1; }
.pending-upload .w-img-actions select { flex: 1; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.pending-upload .btn { white-space: nowrap; }
.pending-upload .upload-spinner {
  width: 100%; text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0;
}

/* ---------- Tables (for logs / minor) ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

.footer { margin-top: 40px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Lightbox (image preview) ---------- */
.chart-tile .img-wrap img { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 12, .88); }
.lightbox-stage {
  position: relative; z-index: 1; margin: 0; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lightbox-stage img { max-width: 96vw; max-height: 76vh; border-radius: 12px; box-shadow: var(--shadow); }
.lightbox-caption { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.lightbox-trade-link { margin-top: 2px; white-space: nowrap; }
.lightbox-close, .lightbox-nav {
  position: absolute; z-index: 2; border: 1px solid var(--border); cursor: pointer; border-radius: 10px;
  color: var(--text); background: var(--surface); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.lightbox-close { top: 16px; right: 16px; width: 42px; height: 42px; font-size: 24px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 62px; font-size: 34px; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-nav:hover, .lightbox-close:hover { border-color: var(--accent); color: var(--accent); }
html[data-theme="light"] .lightbox-backdrop { background: rgba(15, 23, 42, .78); }

/* ---------- Settings dropdown ---------- */
.nav-settings { position: relative; }
.settings-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 50; padding: 8px;
}
.settings-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 4px 14px 10px;
}
.theme-opt {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  padding: 12px 14px; border-radius: 10px; font-size: 16px; font-weight: 600;
  color: var(--text); cursor: pointer;
}
.theme-opt:hover { background: var(--surface-2); }
.theme-opt.selected { color: var(--accent); background: var(--blue-bg); }
.settings-menu[hidden] { display: none; }

/* ---------- Notifications dropdown ---------- */
.nav-notif { position: relative; }
.notif-btn { display: flex; align-items: center; gap: 8px; }
.notif-btn svg { width: 16px; height: 16px; flex: none; }
.notif-dot {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(0,0,0,.35);
}
.notif-dot[hidden] { display: none; }
.notif-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 330px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 60;
}
.notif-menu[hidden] { display: none; }
.notif-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 12px 16px 8px;
}
.notif-list {
  max-height: 400px; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 0 8px 8px;
}
.notif-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px;
  border-radius: 10px; text-decoration: none; color: var(--text);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-read { opacity: .55; }
.notif-item.is-read:hover { opacity: .85; }
.notif-dot-s {
  width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px;
  background: var(--accent);
}
.notif-item.is-read .notif-dot-s { background: transparent; border: 1px solid var(--muted); }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-msg { font-size: 14px; line-height: 1.35; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-empty { padding: 18px 16px; color: var(--muted); font-size: 14px; text-align: center; }

/* ============================================================
   Light theme (original) - selectable from Settings
   ============================================================ */
html[data-theme="light"] {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e7ee;
  --text: #1b2436;
  --muted: #7a8499;
  --brand: #18233b;
  --brand-2: #18233b;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --blue-bg: #eff6ff;
  --gold: #d97706;
  --gold-dim: #cbd5e1;
  --gold-bg: #fdf3d0;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
html[data-theme="light"] .topnav { border-bottom: none; }
html[data-theme="light"] .navuser-role.customer { background: #64748b; }
html[data-theme="light"] .btn { background: #e5e7eb; color: var(--text); }
html[data-theme="light"] .btn-outline { color: var(--text); }
html[data-theme="light"] .btn-outline:hover { border-color: var(--border); color: var(--text); }
html[data-theme="light"] .alert-success { color: #14532d; border-color: #bbf7d0; }
html[data-theme="light"] .alert-error { color: #7f1d1d; border-color: #fecaca; }
html[data-theme="light"] .st-buy { background: #ecfdf5; color: #047857; }
html[data-theme="light"] .st-sell { background: #fef2f2; color: #b91c1c; }
html[data-theme="light"] .st-limit { background: #eff6ff; color: #1d4ed8; }
html[data-theme="light"] .signal-card:hover { border-color: #cbd5e1; }
html[data-theme="light"] .signal-thumb .tf-tag { color: #fff; }
html[data-theme="light"] .badge-muted { background: #f1f5f9; color: var(--muted); }
html[data-theme="light"] .chart-tile .tf-label.label-result { background: var(--green); color: #fff; }
html[data-theme="light"] .wizard-steps .num { background: #e2e8f0; color: var(--muted); border-color: transparent; }
html[data-theme="light"] .seg:hover { border-color: #cbd5e1; color: var(--muted); }
html[data-theme="light"] .cal-dot.zero { background: #cbd5e1; }
html[data-theme="light"] .cal-daynum.empty { color: #c7cfda; }

.empty-state {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; color: var(--muted);
}

@media (max-width: 720px) {
  .topnav-inner { flex-wrap: wrap; gap: 8px 14px; row-gap: 8px; }
  .brand img.brand-logo { width: 440px; height: 118px; max-width: 100%; }
  .navuser { gap: 10px; margin-left: 0; }
  .navuser-name { font-size: 15px; }
  .navuser-role { font-size: 11px; padding: 4px 8px; }
  .btn-nav { font-size: 14px; padding: 9px 14px; border-radius: 10px; }
  .settings-btn { padding: 3px 8px; font-size: 12px; border-radius: 999px; }

  .container { padding: 18px 14px 48px; }

  .signal-card { flex-direction: column; align-items: stretch; }
  .signal-thumb { flex: none; width: 100%; height: 170px; }

  .form-row { grid-template-columns: 1fr; }
  .seg-control { grid-template-columns: 1fr 1fr; }
  .seg { padding: 12px 8px; font-size: 14px; }

  .cal-toolbar { flex-wrap: wrap; gap: 10px; }
  .cal-toolbar h1 { font-size: 20px; }
  .cal-cell { min-height: 84px; padding: 6px; }
  .cal-week { min-height: 84px; }
  .cal-legend { flex-wrap: wrap; gap: 12px 18px; }
  .gallery-grid { gap: 10px; }

  .wizard-steps li { font-size: 12px; padding: 10px 4px; }
  .wizard-steps .num { width: 18px; height: 18px; line-height: 18px; font-size: 11px; margin-right: 4px; }
  .wizard-nav { flex-wrap: wrap; }
  .wizard-nav .btn { flex: 1; text-align: center; }

  .pending-upload { flex-wrap: wrap; }
  .pending-upload .w-img-actions { flex: 1 1 100%; }
  .pending-upload img { width: 100%; }

  .auth-card { padding: 44px 28px; }

  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  .pagehead { align-items: flex-start; }
  .daily-pl { font-size: 14px; padding: 6px 12px; }
}

@media (max-width: 480px) {
  .topnav-inner { padding: 10px 12px; }
  .brand img.brand-logo { width: 300px; height: 80px; }
  .navuser-name { display: none; }

  .container { padding: 14px 12px 40px; }

  .cal-dow { font-size: 10px; padding: 8px 2px; }
  .cal-cell { min-height: 74px; padding: 4px; }
  .cal-week { min-height: 74px; }
  .cal-week .val { font-size: 11px; }
  .cal-day { font-size: 13px; }
  .cal-info { font-size: 11px; }
  .cal-nav { flex-wrap: wrap; }
  .month-pl .val { font-size: 20px; }
  .gallery-header { flex-direction: column; align-items: flex-start; }
  .gallery-filter { width: 100%; }
  .gallery-select { width: 100%; justify-content: center; }
  .gallery-grid { gap: 8px; }
  .gallery-pair { font-size: 13px; }

  .signal-thumb { height: 140px; }
  .signal-pair { font-size: 16px; }
  .signal-stats { font-size: 12px; gap: 10px; }
  .signal-foot { flex-direction: column; align-items: flex-start; }

  .wizard-nav { flex-direction: column; }
  .wizard-nav .btn { flex: none; width: 100%; }

  .auth-page { padding: 20px 0; }
  .auth-card { padding: 36px 20px; border-radius: 16px; }
  .auth-logo img.brand-logo { height: 170px; }

  .lightbox-nav { width: 38px; height: 52px; font-size: 26px; }
  .lightbox-close { top: 10px; right: 10px; width: 36px; height: 36px; }
}

/* ============================================================
   Mobile & iOS responsiveness
   (iOS/mobile webkit hardening, calendar & notification sheet)
   ============================================================ */
html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; height: auto; }

a, button, label, .seg, .gallery-select, .theme-opt, .notif-item, .btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.auth-page { min-height: 100vh; min-height: 100dvh; }

@media (max-width: 720px) {
  .topnav-inner { padding-top: calc(10px + env(safe-area-inset-top)); }
  .navuser { margin-left: auto; gap: 8px; }
  .btn-nav { padding: 10px 12px; font-size: 14px; }

  /* Prevent iOS Safari auto-zoom when tapping inputs */
  input, select, textarea { font-size: 16px; }

  .cal { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-grid { grid-template-columns: repeat(8, minmax(40px, 1fr)); }
  .cal-info { font-size: 11px; }
  .cal-pl { overflow-wrap: anywhere; }

  .cal-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .cal-nav { display: flex; width: 100%; }
  .cal-nav .btn { flex: 1; text-align: center; white-space: nowrap; }
  .gallery-filter { width: 100%; }

  .gallery-menu { left: 0; right: auto; width: 100%; min-width: 0; max-width: none; }

  .container { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .topnav-inner { padding: 8px 12px; gap: 8px; }
  .brand img.brand-logo { width: 220px; height: 60px; }

  .notif-btn { padding: 10px; }
  .settings-btn { padding: 10px 12px; font-size: 12px; }
  .navuser-role.admin { width: 22px; height: 22px; }
  .navuser-role.customer { font-size: 10px; padding: 4px 7px; }

  /* Notifications -> full-width bottom sheet (native iOS feel) */
  .notif-menu {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-width: none;
    max-height: 72vh; max-height: min(72dvh, 460px);
    border-radius: 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column;
  }
  .notif-list { max-height: none; flex: 1 1 auto; min-height: 0; }
  .notif-title { font-size: 13px; padding: 14px 16px 8px; }
  .notif-msg { font-size: 15px; }
  .notif-item { padding: 12px 10px; }
  .notif-empty { padding: 28px 16px; }

  /* Settings -> full-width bottom sheet */
  .settings-menu {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-width: none; border-radius: 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .theme-opt { padding: 14px 16px; font-size: 16px; }

  /* Calendar */
  .cal-toolbar { margin-bottom: 12px; }
  .cal-nav .btn { font-size: 13px; padding: 10px 6px; }
  .cal-dow { font-size: 9px; padding: 7px 1px; letter-spacing: .03em; }
  .cal-cell { min-height: 66px; padding: 3px; gap: 2px; }
  .cal-week { min-height: 66px; padding: 6px 2px; gap: 1px; }
  .cal-week .lbl { font-size: 8px; }
  .cal-week .val { font-size: 10px; }
  .cal-daynum { font-size: 12px; }
  .cal-cell a.day-link {
    display: flex; flex-direction: column; gap: 2px; flex: 1;
  }
  .cal-info { font-size: 9.5px; gap: 1px; }
  .cal-count, .cal-pl { font-size: 9.5px; }
  .cal-pl { overflow-wrap: anywhere; }
  .cal-dot { width: 7px; height: 7px; }
  .cal-mytrades { font-size: 9px; padding: 1px 5px; margin-top: 2px; }
  .cal-legend { font-size: 12px; gap: 10px 16px; }

  .month-pl { padding: 12px 14px; }
  .month-pl .lbl { font-size: 12px; }
  .month-pl .val { font-size: 18px; }

  .pagehead { flex-direction: column; align-items: stretch; gap: 8px; }

  .signal-foot { flex-direction: column; align-items: stretch; }
  .signal-foot > div { justify-content: space-between; }
  .signal-foot .btn { flex: 1; text-align: center; }

  .wizard-steps { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wizard-steps li { flex: 0 0 auto; min-width: 76px; }

  .gallery-select { width: 100%; justify-content: center; }
  .gallery-levels { font-size: 10px; }
}

@media (max-width: 380px) {
  .brand img.brand-logo { width: 190px; height: 52px; }
  .settings-btn { font-size: 0; gap: 0; padding: 10px; }
  .settings-btn svg { width: 15px; height: 15px; }
  .cal-nav .btn { font-size: 12px; padding: 9px 4px; }
}

/* ---------- PWA install prompt ---------- */
.pwa-install {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 22px rgba(29, 78, 216, .45);
  animation: pwa-in .35s ease;
}
.pwa-install:hover { filter: brightness(1.12); }
.pwa-install.is-ios { background: var(--surface-2); box-shadow: var(--shadow); }
@keyframes pwa-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.pwa-toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 70;
  transform: translate(-50%, 12px); opacity: 0;
  padding: 10px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; max-width: 86vw; text-align: center;
  box-shadow: var(--shadow); transition: opacity .3s ease, transform .3s ease;
}
.pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }