


/* ============================================================ */
/* Trading-platform polish v2 — buttons / forms / tags /          */
/* numbers / tables / charts / modal-toast / loading / nav        */
/* ============================================================ */

:root {
  --radius-btn: 7px;
  --radius-input: 7px;
  --tag-radius: 5px;
  --btn-shadow-sm: 0 1px 0 rgba(255,255,255,0.6) inset, 0 1px 2px rgba(15,42,86,0.08);
}

html[data-theme="dark"] {
  --btn-shadow-sm: 0 1px 0 rgba(255,255,255,0.05) inset, 0 1px 2px rgba(0,0,0,0.4);
}

/* ---------- 1. Button system ---------- */

.btn {
  border-radius: var(--radius-btn);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease, box-shadow 0.18s ease,
              background-color 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, opacity 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.btn:active { transform: translateY(1px); }

.btn-sm {
  border-radius: 6px;
  min-height: 30px;
  padding-inline: 10px;
  font-size: 0.82rem;
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1f63d4);
  border-color: #1851b8;
  color: #ffffff;
  box-shadow: var(--btn-shadow-sm), 0 6px 14px rgba(20, 82, 173, 0.18);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: linear-gradient(180deg, #4d8df8, #2a72e0);
  border-color: #1648a8;
  color: #ffffff;
}

.btn-outline-primary {
  border-color: var(--surface-border-strong);
  background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background: rgba(59, 130, 246, 0.08);
  border-color: #5e95df;
  color: var(--brand-700);
}

.btn-outline-secondary {
  border-color: var(--surface-border-strong);
  color: var(--text-700);
  background: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  background: rgba(120, 145, 178, 0.10);
  color: var(--text-900);
  border-color: var(--surface-border-strong);
}

/* Ghost button — flat, low-stakes secondary action */
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-700);
  box-shadow: none;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(120, 145, 178, 0.10);
  color: var(--text-900);
  border-color: rgba(120, 145, 178, 0.20);
}

/* Danger — for irreversible actions */
.btn-danger {
  background: linear-gradient(180deg, #ef4444, #c12d2d);
  border-color: #a82424;
  color: #ffffff;
  box-shadow: var(--btn-shadow-sm), 0 6px 14px rgba(193, 45, 45, 0.22);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: linear-gradient(180deg, #f56565, #d12f2f);
  border-color: #9c1f1f;
  color: #ffffff;
}

.btn-outline-danger {
  background: transparent;
  border-color: rgba(220, 38, 38, 0.45);
  color: #c12d2d;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
  background: rgba(220, 38, 38, 0.08);
  border-color: #c12d2d;
  color: #a82424;
}

/* Icon-only buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Spinner inside busy buttons */
.btn .spinner-border-sm {
  width: 0.85rem;
  height: 0.85rem;
  border-width: 0.16em;
  vertical-align: -0.12em;
}

html[data-theme="dark"] .btn-outline-primary {
  border-color: rgba(123, 184, 255, 0.35);
  color: #b9dbff;
}

html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:focus-visible {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(123, 184, 255, 0.55);
  color: #ffffff;
}

html[data-theme="dark"] .btn-outline-secondary {
  border-color: rgba(180, 198, 224, 0.32);
  color: #cdddf0;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus-visible {
  background: rgba(180, 198, 224, 0.10);
  color: #ffffff;
}

html[data-theme="dark"] .btn-ghost {
  color: #cfdcef;
}

html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-ghost:focus-visible {
  background: rgba(180, 200, 230, 0.08);
  color: #ffffff;
  border-color: rgba(180, 200, 230, 0.18);
}

html[data-theme="dark"] .btn-outline-danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

html[data-theme="dark"] .btn-outline-danger:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
  border-color: #fca5a5;
}

/* ---------- 2. Forms — sharper, terminal feel ---------- */

.form-control,
.form-select,
textarea.form-control {
  border-radius: var(--radius-input);
  border-color: var(--surface-border-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: #4d8df8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.20);
}

/* Numeric inputs get monospace */
.form-control[type="number"],
.form-control[inputmode="decimal"],
.form-control[inputmode="numeric"],
.form-control--mono,
input.amount-input,
input[name*="amount"],
input[name*="lots"],
input[name*="cash"] {
  font-family: var(--mono-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-500);
  margin-bottom: 0.25rem;
}

.form-select-sm,
.form-control-sm {
  border-radius: 6px;
  font-size: 0.82rem;
}

/* Input prefix/suffix slot */
.input-affix {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-input);
  background: var(--surface-strong);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-affix:focus-within {
  border-color: #4d8df8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.20);
}

.input-affix > .form-control {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.input-affix > .form-control:focus {
  box-shadow: none;
}

.input-affix__prefix,
.input-affix__suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.55rem;
  background: var(--surface-muted);
  color: var(--text-500);
  font-size: 0.78rem;
  font-weight: 600;
}

.input-affix__suffix {
  border-left: 1px solid var(--surface-border);
}

.input-affix__prefix {
  border-right: 1px solid var(--surface-border);
}

/* Checkbox / radio refinements */
.form-check-input {
  border-radius: 4px;
  border-color: var(--surface-border-strong);
}

.form-check-input:checked {
  background-color: var(--brand-600);
  border-color: var(--brand-700);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control {
  background-color: rgba(15, 25, 41, 0.92);
  border-color: rgba(120, 152, 196, 0.32);
  color: var(--text-900);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.30);
}

html[data-theme="dark"] .input-affix {
  background: rgba(15, 25, 41, 0.92);
  border-color: rgba(120, 152, 196, 0.32);
}

html[data-theme="dark"] .input-affix__prefix,
html[data-theme="dark"] .input-affix__suffix {
  background: rgba(8, 16, 28, 0.92);
  color: #a8bfdc;
  border-color: rgba(120, 152, 196, 0.22);
}

/* ---------- 3. Tag system ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  padding: 0.12rem 0.46rem;
  border-radius: var(--tag-radius);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  background: rgba(120, 145, 178, 0.12);
  color: var(--text-700);
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag--neutral { background: rgba(120, 145, 178, 0.12); color: var(--text-700); }
.tag--info    { background: rgba(59, 130, 246, 0.12); color: #1f63d4; }
.tag--success { background: rgba(22, 163, 74, 0.14); color: #137a3f; }
.tag--warn    { background: rgba(245, 158, 11, 0.16); color: #a86509; }
.tag--danger  { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }

.tag--outline {
  background: transparent;
  border-color: currentColor;
}

.tag--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

html[data-theme="dark"] .tag--neutral { color: #cfdcef; background: rgba(180, 200, 230, 0.10); }
html[data-theme="dark"] .tag--info    { background: rgba(96, 165, 250, 0.18); color: #b9dbff; }
html[data-theme="dark"] .tag--success { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
html[data-theme="dark"] .tag--warn    { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
html[data-theme="dark"] .tag--danger  { background: rgba(248, 113, 113, 0.18); color: #fecaca; }

/* Bootstrap badge fallback — make legacy badges visually consistent */
.badge {
  border-radius: var(--tag-radius);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.28em 0.5em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 4. Number presentation ---------- */

.kpi-positive::before,
.num-up::before {
  content: "▲ ";
  font-size: 0.78em;
  letter-spacing: 0;
}

.kpi-negative::before,
.num-down::before {
  content: "▼ ";
  font-size: 0.78em;
  letter-spacing: 0;
}

/* Allow opt-out from arrow when needed */
.kpi-positive.no-arrow::before,
.kpi-negative.no-arrow::before,
.num-up.no-arrow::before,
.num-down.no-arrow::before {
  content: "";
}

.num-flat {
  color: var(--text-500);
}

/* Hero asset card: bigger, change inline */
.summary-strip__item--asset .summary-strip__value--asset-compact {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
}

.live-position-control-strip .summary-strip__item,
.live-position-control-strip .summary-strip__item--asset {
  min-width: 150px;
  flex: 1 0 150px;
}

.live-position-control-strip .summary-strip__value,
.live-position-control-strip .summary-strip__item--asset .summary-strip__value,
.live-position-control-strip .summary-strip__item--asset .summary-strip__value--asset-compact {
  font-size: 0.86rem;
  line-height: 1.2;
  letter-spacing: normal;
  font-weight: 400;
}

.summary-strip__cash-line {
  font-family: var(--mono-font);
}