/* ============================================================
   Stanguard & Sailors — client dashboard
   ============================================================ */

.app-body {
  background: #f4f4f1;
  min-height: 100vh;
}

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

/* ---------- sidebar ---------- */
.sidebar {
  background: #d9d9d9;
  color: #3a3a3a;
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  align-self: auto;
  font-size: 21px;
  margin: 0;
  padding: 28px 16px;
}
.sidebar .brand .amp { color: #fff; }
.sidebar nav { flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #3a3a3a;
  padding: 12px 24px;
  font-size: 15px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #1f1f1f; text-decoration: none; background: #cfcfcf; }
.sidebar nav a.active {
  color: #1f1f1f;
  border-left-color: var(--red);
  background: #c8c8c8;
  font-weight: 600;
}
.sidebar nav a .ico {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
  flex-shrink: 0;
}
.sidebar nav a .ico svg { width: 18px; height: 18px; display: block; }
.sidebar .side-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #3a3a3a;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar .side-logout:hover { color: #1f1f1f; text-decoration: none; background: #cfcfcf; }
.sidebar .side-logout .ico {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
  flex-shrink: 0;
}
.sidebar .side-logout .ico svg { width: 18px; height: 18px; display: block; }

.sidebar .side-foot {
  padding: 14px 24px 0;
  border-top: 1px solid #c2c2c2;
  font-size: 12px;
  color: #6e6e6e;
}

/* ---------- main column ---------- */
.app-main { padding: 0 36px 48px; min-width: 0; }

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.app-topbar h1 { font-size: 28px; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar-user .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user .u-name { font-weight: 600; }
.topbar-user .u-plan { color: var(--ink-soft); font-size: 12px; }

/* ---------- cards / tiles ---------- */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px;
}
.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.kpi-card .kpi-value {
  font-family: "Times New Roman", Times, serif;
  font-size: 30px;
  line-height: 1.1;
}
.kpi-card .kpi-sub { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--loss); }
.kpi-value.accent { color: var(--red); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 26px;
  margin-bottom: 28px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 21px; margin: 0; }
.panel-head .panel-actions { display: flex; gap: 10px; align-items: center; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }

/* ---------- tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
  padding: 10px 10px;
  white-space: nowrap;
}
.data-table td { padding: 12px 10px; border-bottom: 1px solid #ecece8; vertical-align: middle; white-space: nowrap; }
.data-table tr:hover td { background: #fafaf7; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }

.pnl-pos { color: var(--green); font-weight: 700; }
.pnl-neg { color: var(--loss); font-weight: 700; }

.pair-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.pair-chip .dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- pair filter chips ---------- */
.filter-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { border-color: var(--red); color: var(--red-dark); }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- admin: create signal form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 20px;
}

.btn-mini {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn-mini:hover { background: var(--ink); color: #fff; }
.btn-mini.danger { border-color: var(--loss); color: var(--loss); }
.btn-mini.danger:hover { background: var(--loss); color: #fff; }

/* ---------- affiliate: referral code ---------- */
.ref-code-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ref-code {
  font-family: "Times New Roman", Times, serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--red-deep);
  background: #fdeaea;
  border: 1px dashed var(--red);
  border-radius: 6px;
  padding: 10px 26px;
}

@media (max-width: 1080px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- custom date range ---------- */
.range-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #ecece8;
  font-size: 13px;
}
.range-custom label { font-weight: 600; color: var(--ink-soft); }
.range-custom input[type="date"] {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid #b9b9b4;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.range-custom input[type="date"]:focus {
  outline: 2px solid var(--red);
  outline-offset: 0;
  border-color: var(--red);
}
.range-custom .btn { padding: 7px 20px; font-size: 13px; }

/* ---------- signal cards ---------- */
.signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.signal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 8px;
  padding: 20px 22px;
}
.signal-card .sc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.signal-card .sc-pair { font-family: var(--serif); font-size: 20px; }
.signal-card .sc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}
.signal-card .sc-grid .lbl { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.signal-card .sc-grid .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.signal-card .sc-date { font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; }

.btn-copy {
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 0;
  cursor: pointer;
}
.btn-copy:hover { background: var(--red-dark); }
.btn-copy.copied {
  background: #fff;
  color: var(--green);
  border: 1px solid var(--green);
  cursor: pointer;
}

/* ---------- charts ---------- */
.chart-box { width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-legend {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 10px;
  flex-wrap: wrap;
}
.chart-legend .lg { display: flex; align-items: center; gap: 7px; }
.chart-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- confirmation modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 30px 34px;
  max-width: 440px;
  width: calc(100% - 48px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
  text-align: center;
}
.modal-box p {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 24px;
}
.modal-actions { display: flex; gap: 12px; justify-content: center; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state h3 { margin-bottom: 6px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }
.settings-grid .panel { margin-bottom: 0; }

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #ecece8;
  gap: 20px;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .sw-txt { font-size: 14px; }
.switch-row .sw-txt .muted { display: block; font-size: 12px; }

.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: #cfcfc9;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.danger-zone { border: 1px solid #f0b4b0; }
.danger-zone h2 { color: var(--red-deep); }

/* ---------- dashboard responsive ---------- */
@media (max-width: 1080px) {
  .cards-row { grid-template-columns: repeat(2, 1fr); }
  .two-col, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 4px;
  }
  .sidebar .brand { border: 0; padding: 6px 12px; margin: 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar nav a { padding: 8px 12px; border-left: 0; border-bottom: 3px solid transparent; }
  .sidebar nav a.active { border-bottom-color: var(--red); background: none; }
  .sidebar .side-foot { display: none; }
  .app-main { padding: 0 16px 32px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 6px; }
}
