:root {
  /* Owner direction (2026-11-04): white + light blue design; header stays dark. */
  --bg: #f4f8fd;
  --bg-soft: #eaf2fb;
  --card: #ffffff;
  --card-raised: #ffffff;
  --border: #cfdfef;
  --border-soft: #e0ebf6;
  --text: #122a44;
  --muted: #5c748c;
  --accent: #1f7ae0;
  --accent-soft: rgba(31, 122, 224, 0.1);
  --btc-orange: #f7931a; /* Bitcoin logo color (owner direction 2026-11-04) */
  --green: #0f9d58;
  --green-soft: rgba(15, 157, 88, 0.1);
  --red: #d64545;
  --ring: rgba(31, 122, 224, 0.3);
  --shadow: 0 1px 2px rgba(18, 42, 68, 0.08), 0 8px 24px rgba(18, 42, 68, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #dcebf9 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header / brand ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, #0b1120 0%, #090d18 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #16203a;
  box-shadow: 0 8px 26px rgba(8, 12, 22, 0.32);
}

/* Thin gold-to-blue accent stripe under the header — a serious, bank-like finish. */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, #f7931a 0%, rgba(247, 147, 26, 0.35) 38%, rgba(31, 122, 224, 0.35) 72%, rgba(31, 122, 224, 0.08) 100%);
}

.site-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #f2f5fb; /* header stays dark */
  text-decoration: none;
}

/* Two-line institutional lockup: name above, quiet uppercase tagline below. */
.brand .brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.brand .name {
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.01em;
  color: #f5f7fc; /* header stays dark */
}

.brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(160deg, #f7931a, #d97e08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 19px;
  line-height: 1;
  flex: none;
  box-shadow: 0 2px 12px rgba(247, 147, 26, 0.22);
}

.brand [data-brand-logo] {
  padding: 3px;
  background: #ffffff;
  object-fit: contain;
  box-shadow: 0 2px 12px rgba(8, 12, 22, 0.22);
}

.brand .tag {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8b9ab8; /* header stays dark */
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.language-label { color: #8b9ab8; font-size: 0.75rem; font-weight: 600; }

.language-select {
  width: auto;
  min-width: 102px;
  min-height: 36px;
  padding: 6px 30px 6px 10px;
  border-color: #2b3550;
  background-color: #111a2c;
  color: #f5f7fc;
  font-size: 0.78rem;
}

.language-select:hover { border-color: #3d4a6b; }
.language-select:focus { border-color: #f7931a; box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.20); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #c3cddc; /* header stays dark */
}

.user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1c2438;
  border: 1px solid #2b3550;
  display: grid;
  place-items: center;
  color: #eef1f8;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ---------- Layout ---------- */

main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 48px; }

.page-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }

.page-sub { color: var(--muted); margin: 0 0 24px; font-size: 0.9rem; }

h1, h2, h3 { margin: 0 0 12px; letter-spacing: -0.01em; }

h2 { font-size: 1.05rem; font-weight: 650; }

.card {
  background: linear-gradient(180deg, var(--card-raised), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h2 { margin-bottom: 16px; }

/* ---------- Identity row (dashboard) ---------- */

.identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.identity .greeting { font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -0.015em; }

.identity .acct {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.85rem;
}

#wallet-line-wrap { flex-wrap: wrap; }

.identity .acct .value {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

#wallet-address { word-break: break-all; }

/* ---------- Stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: linear-gradient(180deg, var(--card-raised), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat .label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat .value { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.stat .value.accent { color: var(--accent); }

.stat .sub { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.badge-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.badge-live.stale { color: var(--muted); background: var(--border-soft); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Wallet layout ---------- */

.wallet-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: stretch;
}

.wallet-square {
  --coin-color: #c26a00;
  background: linear-gradient(160deg, #dfeefc 0%, var(--card) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coin-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.coin-icon {
  width: 40px;
  height: 40px;
  flex: none;
}

/* Balance title stays consistent while the amount follows the selected coin. */
.wallet-square .label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.wallet-square .btc {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--coin-color);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.wallet-square .eur {
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.wallet-square .price-line {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
}

.wallet-square .price-line span:first-of-type { color: var(--text); font-weight: 600; }

.chart-card { display: flex; flex-direction: column; }

.chart-card .graph-head {
  display: flex;
  align-items: flex-start;
  gap: 12px 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chart-title-block { margin-right: auto; min-width: 220px; }

.chart-card .graph-head h2 { margin: 0; }

.chart-quote {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.chart-last-price {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.chart-change { font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-change.positive { color: var(--green); }
.chart-change.negative { color: var(--red); }
.chart-change.neutral { color: var(--muted); }

.chart-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.chart-stats > div { display: flex; flex-direction: column; gap: 2px; }

.chart-stats span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-stats strong {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Range selector — compact segmented control. */
.range-buttons {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.range-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  min-height: 32px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 6px 13px;
  cursor: pointer;
}

.range-btn + .range-btn { border-left: 1px solid var(--border); }

.range-btn:hover { color: var(--text); background: var(--bg-soft); }

.range-btn.active,
.range-btn.active:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Coin selector tabs in the balance square — same segmented look as ranges. */
.coin-tabs {
  display: inline-flex;
  align-self: flex-start;
  max-width: 100%;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  margin-bottom: 10px;
}

.coin-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  cursor: pointer;
}

.coin-tab-icon { width: 16px; height: 16px; }

.coin-btn + .coin-btn { border-left: 1px solid var(--border); }

.coin-btn:hover { color: var(--text); }

.coin-btn.active {
  background: var(--coin-color);
  color: #ffffff;
}

/* ---------- Graph ---------- */

.graph-wrap { width: 100%; position: relative; min-height: 260px; }

canvas {
  width: 100%;
  height: 260px;
  display: block;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: pan-y;
}

canvas:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.chart-tooltip {
  position: absolute;
  z-index: 2;
  width: 170px;
  padding: 9px 11px;
  border: 1px solid #2b3550;
  border-radius: 8px;
  background: #0b1120;
  color: #f5f7fc;
  box-shadow: 0 8px 24px rgba(8, 12, 22, 0.22);
  pointer-events: none;
}

.chart-tooltip span { display: block; color: #c3cddc; font-size: 0.72rem; }
.chart-tooltip strong { display: block; margin-top: 3px; font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.chart-footnote {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

/* ---------- Floating support contact ---------- */

.support-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(18, 42, 68, 0.28);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.support-fab.whatsapp { background: #1fae59; }
.support-fab.viber { background: #665cac; }
.support-fab.telegram { background: #229ed9; }
.support-fab img { width: 28px; height: 28px; filter: brightness(0) invert(1); }
.support-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(18, 42, 68, 0.32); }
.support-fab:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

@media (max-width: 640px) {
  .support-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .support-fab { transition: none; }
}

/* ---------- Actions (fee / identity / contract) ---------- */

/* One serious, even bar: single card, boxes separated by a divider line. */
.actions.card {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  padding: 18px 22px;
  align-items: center;
}

.action-box {
  flex: 1 1 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.action-box + .action-box { border-left: 1px solid var(--border-soft); }

.action-box:first-child { padding-left: 0; }

.action-box:last-child { padding-right: 0; justify-content: flex-end; }

@media (max-width: 640px) {
  .actions.card { flex-wrap: wrap; gap: 14px; }
  .action-box { flex-basis: 100%; padding: 0; }
  .action-box + .action-box { border-left: none; }
  .action-box:last-child { justify-content: flex-start; }
}

.action-box .hint { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; }

#fee-amount {
  margin-bottom: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.fee-box { display: flex; flex-direction: column; align-items: flex-start; }

/* Fee button stays a normal-width button (owner: not stretched full-width). */
.fee-box #fee-btn { align-self: flex-start; }

/* Contract + Confirm identity buttons sit side by side in their box. */
.action-box button + button, .action-box button + div, .action-box div + button { margin-left: 12px; }

/* Contract wrapper only displays when visible; keeps flex layout clean when hidden. */
#contract-box-wrap { display: inline-flex; }
#contract-box-wrap.hidden { display: none !important; }

/* Admin contract cell: compact stacked upload controls. */
.contract-cell { min-width: 170px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.contract-cell input[type="file"] { width: 150px; padding: 4px 6px; font-size: 0.75rem; border: none; background: transparent; box-shadow: none; }

.contract-cell a { color: var(--accent); font-weight: 600; }

/* ---------- Forms & inputs ---------- */

label { display: block; margin: 12px 0 5px; color: var(--muted); font-size: 0.8rem; font-weight: 500; }

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background-color: #ffffff;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  color-scheme: light;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c748c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

input:hover,
select:hover { border-color: #a9c7e4; }

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

input::placeholder { color: #758da4; }

button {
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

button:hover { background: #3d8fe8; }

button:active { transform: translateY(1px); }

button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

button.block { width: 100%; }

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.secondary:hover { background: var(--accent-soft); }

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.ghost:hover { color: var(--text); border-color: #2e3752; }

/* Ghost buttons inside the dark header keep header-appropriate colors. */
.site-header button.ghost { color: #c3cddc; border-color: #2b3550; }

.site-header button.ghost:hover { color: #ffffff; border-color: #3d4a6b; }

button.danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(255, 92, 92, 0.4);
}

button.danger:hover { background: rgba(255, 92, 92, 0.1); }

button.small { padding: 6px 12px; font-size: 0.8rem; border-radius: 7px; }

.error { color: var(--red); min-height: 1.2em; margin-top: 12px; font-size: 0.85rem; }

.muted { color: var(--muted); font-size: 0.85rem; }

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  background: #eaf2fb url("/assets/media/login-background-poster.jpg") center / cover fixed no-repeat;
}

.login-background-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.login-page .site-header { position: relative; z-index: 1; }

.login-page main,
.login-page .site-footer { position: relative; z-index: 1; }

.login-page .login-card {
  background: linear-gradient(180deg, rgba(11, 17, 32, 0.97), rgba(9, 13, 24, 0.97));
  border-color: #2b3550;
  box-shadow: 0 20px 56px rgba(8, 12, 22, 0.42);
  backdrop-filter: blur(14px);
}

.login-page .site-footer {
  background: #090d18;
  border-top-color: #16203a;
  color: #8b9ab8;
  backdrop-filter: blur(8px);
}

.login-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--card-raised), var(--card));
  border: 1px solid #c4d5e6;
  border-radius: 12px;
  padding: 36px 34px 24px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid #2b3550;
  text-align: left;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.login-brand-lockup .logo { margin: 0 auto; }

.portal-label {
  color: #8b9ab8;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-brand .logo {
  width: 42px;
  height: 42px;
  padding: 4px;
  border: 1px solid #3b4763;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

.login-brand [data-brand-fallback] {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(160deg, #f7931a, #d97e08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.login-brand h1 { margin: 0; color: #f5f7fc; font-size: 1.45rem; letter-spacing: -0.025em; }
.login-brand p { margin: 0; color: #8b9ab8; }

#login-form label { color: #e8edf6; font-weight: 600; }
#login-form input { min-height: 46px; border-color: #3b4763; border-radius: 7px; background: #111a2c; color: #f5f7fc; }
#login-form input::placeholder { color: #8b9ab8; }
#login-form input:hover { border-color: #6b7794; }
#login-form input:focus { border-color: #f7931a; box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.22); }
.login-submit { margin-top: 22px; }
.login-submit button { min-height: 46px; border-radius: 7px; background: linear-gradient(160deg, #f7931a, #d97e08); color: #0b1120; }
.login-submit button:hover { background: #ffab3d; }
#login-error { color: #ff9b9b; }

.login-security {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid #2b3550;
  color: #8b9ab8;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

/* ---------- Tables (admin) ---------- */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(31, 122, 224, 0.05); }

td input { min-width: 90px; }

td .username { color: var(--muted); font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

th:last-child,
td.actions-cell {
  position: sticky;
  right: 0;
  background: var(--card);
  background-clip: padding-box;
  box-shadow: -14px 0 20px -20px rgba(18, 42, 68, 0.65);
}

th:last-child { z-index: 4; }

td.actions-cell {
  z-index: 2;
  width: 220px;
  min-width: 220px;
  white-space: normal;
}

tbody tr:hover td.actions-cell { background: #f3f7fc; }

td.center-cell { text-align: center; }

td input[type="checkbox"] { width: auto; accent-color: var(--accent); }

td input[placeholder] { min-width: 180px; }

.primary-actions { display: flex; gap: 8px; }
.primary-actions button { flex: 1; }

.password-reset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.password-reset label {
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 650;
}

td.actions-cell .pass-input {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.password-reset button { width: 100%; }

/* Coins & amounts editor (admin create form + per-client table cell). */
td.holdings-cell { min-width: 210px; }

.holdings-editor { display: flex; flex-direction: column; gap: 6px; }

.holding-row { display: flex; gap: 6px; align-items: center; }

.holding-row select { width: 128px; flex: none; }

.holding-row input[type="number"] { width: 96px; flex: none; }

.holdings-editor > button { align-self: flex-start; }

form.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; align-items: end; }

form.user-form label { margin: 0 0 7px; }

.form-field { min-width: 0; }

.form-actions { display: flex; align-items: end; min-height: 44px; }

.form-intro { margin: -6px 0 18px; color: var(--muted); font-size: 0.88rem; }

.branding-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr) auto;
  gap: 20px;
  align-items: end;
}

.branding-form .form-field > label { margin: 0 0 7px; color: var(--text); font-size: 0.82rem; font-weight: 650; }
.brand-logo-setting { display: flex; align-items: center; gap: 12px; }
.brand-logo-setting > div { min-width: 0; flex: 1; }

#brand-preview {
  width: 48px;
  height: 48px;
  flex: none;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

#company-logo { min-height: 44px; padding: 7px; font-size: 0.8rem; }
.brand-logo-setting .field-help { margin-top: 4px; font-size: 0.75rem; }
.branding-form .form-actions button { white-space: nowrap; }
.branding-form button:disabled { opacity: 0.65; cursor: wait; }

.support-form {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(160px, 0.6fr) minmax(260px, 1.2fr) auto;
  gap: 20px;
  align-items: end;
}

.support-toggle-control { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.support-toggle-control input { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--accent); }
.support-toggle-control label { margin: 0; color: var(--text); font-size: 0.85rem; font-weight: 650; }
.support-toggle .field-help { margin-top: 3px; font-size: 0.75rem; }
.support-form .form-field > label { margin: 0 0 7px; color: var(--text); font-size: 0.82rem; font-weight: 650; }
.support-form .form-field .field-help { margin-top: 5px; font-size: 0.75rem; }
.support-form .form-actions button { white-space: nowrap; }
.support-form button:disabled { opacity: 0.65; cursor: wait; }
.telegram-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.telegram-actions button { flex: 1; }

@media (max-width: 1100px) {
  .support-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .branding-form { grid-template-columns: minmax(0, 1fr); }
  .branding-form .form-actions button { width: 100%; }
  .support-form { grid-template-columns: minmax(0, 1fr); }
  .support-form .form-actions button { width: 100%; }
}

/* Create client: three balanced desktop rows, compact coin controls and the
   submit action aligned with fee/date instead of stranded on its own row. */
form.create-client-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.create-client-form .form-field-wide { grid-column: 1 / -1; }

.create-client-form .form-field > label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 650;
}

.create-client-form .holdings-editor { gap: 10px; }

.create-client-form .holding-row { gap: 10px; }

.create-client-form .holding-row select {
  width: 280px;
  min-width: 0;
  flex: 0 1 280px;
}

.create-client-form .holding-row input[type="number"] {
  width: 160px;
  min-width: 0;
  flex: 0 1 160px;
}

.create-client-form .holding-row button {
  min-width: 44px;
  min-height: 44px;
  flex: none;
}

.create-client-form .holdings-editor > button { margin-top: 2px; }

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.create-client-form .form-actions {
  align-self: end;
  justify-content: stretch;
  min-height: 44px;
  padding-top: 0;
}

.create-client-form .form-actions button { width: 100%; min-height: 44px; }

@media (max-width: 640px) {
  form.create-client-form { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .create-client-form .form-field-wide { grid-column: auto; }
  .create-client-form .holding-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
  }
  .create-client-form .holding-row select { grid-column: 1 / -1; width: 100%; }
  .create-client-form .holding-row input[type="number"] { width: 100%; }
  .create-client-form .form-actions { justify-content: stretch; }
  .create-client-form .form-actions button { width: 100%; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 18px 24px;
}

.site-footer .inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Misc ---------- */

/* !important so component rules like `.identity .acct { display: inline-flex }`
   cannot keep an element visible when it is hidden (wallet line bug). */
.hidden,
[hidden] { display: none !important; }

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

@media (max-width: 640px) {
  main { padding: 20px 14px 36px; }
  .site-header .inner { padding: 12px 14px; flex-wrap: wrap; }
  .site-header .header-actions { margin-left: auto; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
  .language-label { display: none; }
  .language-select { min-width: 92px; }
  .user-chip #header-user-name { display: none; }
  .brand .tag { display: none; }
  .stat .value { font-size: 1.3rem; }
  .chart-title-block { min-width: 0; }
  .chart-stats { gap: 16px; justify-content: space-between; }
  .chart-stats strong { font-size: 0.8rem; }
  .range-buttons { width: 100%; }
  .range-btn { flex: 1; min-height: 44px; padding: 6px 5px; }
  canvas { height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-background-video { display: none; }
}
