/* admin dashboard */
.adm-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* sidebar */
.adm-side {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.adm-logo { display: flex; align-items: center; gap: 8px; color: var(--ink); padding: 0 8px 4px; font-size: 15px; }
.adm-side-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.adm-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.adm-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  font-size: 13px; color: var(--ink-2);
  border-radius: 8px;
  text-align: left;
}
.adm-nav-item:hover { background: var(--bg-2); color: var(--ink); }
.adm-nav-item.active { background: var(--ink); color: var(--bg); }
.adm-nav-item.active .adm-ico { color: var(--accent); }
.adm-ico { width: 18px; height: 18px; display: flex; color: var(--ink-3); }
.adm-ico svg { width: 18px; height: 18px; }
.adm-badge {
  font-size: 10px; padding: 2px 7px;
  background: var(--bg-2); color: var(--ink-3);
  border-radius: 999px; font-weight: 500;
}
.adm-nav-item.active .adm-badge { background: rgba(255,255,255,0.15); color: var(--bg); }
.adm-badge.accent { background: var(--accent); color: white; }

.adm-side-foot { padding: 12px 6px 0; border-top: 1px solid var(--border); }
.adm-side-me { display: flex; align-items: center; gap: 10px; }

/* main */
.adm-main { padding: 32px 40px; min-width: 0; }
.adm-page { max-width: 1280px; }

/* header */
.adm-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 28px;
}
.adm-h-title { font-size: 36px; line-height: 1.1; margin: 0 0 4px; letter-spacing: -0.01em; }
.adm-h-sub { color: var(--ink-3); font-size: 14px; max-width: 720px; }

/* stats row */
.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.adm-bigstat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.adm-bigstat.alert { border-color: var(--accent); background: var(--accent-soft); }
.adm-bigstat-k { font-size: 38px; line-height: 1; margin-bottom: 6px; letter-spacing: -0.02em; }
.adm-bigstat-l { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }

/* cols */
.adm-cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
.adm-card { display: flex; flex-direction: column; min-width: 0; }
.adm-card-h {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.adm-card-h > span:first-child { white-space: nowrap; min-width: 0; }

/* queue rows */
.adm-q-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  width: 100%; text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.adm-q-row:last-child { border-bottom: none; }
.adm-q-row:hover { background: var(--bg-2); }

/* account controls (Basic / Advanced tabs) */
.ac-tabs { display: inline-flex; gap: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.ac-tab {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 500; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s;
}
.ac-tab:hover { color: var(--ink); }
.ac-tab.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.ac-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600;
}

.ac-warn {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 16px 18px;
}
.ac-warn-h { display: flex; align-items: center; gap: 10px; }
.ac-warn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px;
}
.ac-warn-list { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }

.ac-section-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.ac-section-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 999px; background: var(--panel-2); color: var(--ink-2);
  font-size: 10px; font-weight: 600; letter-spacing: 0;
}
.ac-tbl-wrap { border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ac-tbl-wrap .tbl { margin: 0; min-width: 760px; }
.ac-tbl-wrap .tbl input.input { padding: 6px 8px; font-size: 12px; }

/* auto-sync toggle bar */
.ac-sync-bar {
  margin: 0 0 18px; padding: 12px 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
.ac-sync-toggle {
  display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
}
.ac-sync-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ac-sync-track {
  position: relative; width: 36px; height: 20px; flex-shrink: 0;
  background: var(--border); border-radius: 999px; transition: background 0.18s ease;
}
.ac-sync-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: white; border-radius: 50%; transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ac-sync-toggle input:checked + .ac-sync-track { background: var(--accent); }
.ac-sync-toggle input:checked + .ac-sync-track .ac-sync-thumb { transform: translateX(16px); }
.ac-sync-label { font-size: 13px; line-height: 1.5; color: var(--ink); }
.ac-sync-label strong { font-weight: 600; }
.ac-sync-label .muted-2 { font-size: 12px; }

/* god mode */
.adm-godmode { border-color: var(--accent); }
.adm-godmode .adm-card-h { background: var(--accent-soft); border-bottom-color: rgba(230,57,70,0.20); }
.adm-godmode-section { padding: 16px 0; border-top: 1px solid var(--border); }
.adm-godmode-section:first-child { border-top: none; padding-top: 8px; }
.adm-godmode-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); margin-bottom: 10px; font-weight: 500;
}
.adm-godmode-row { display: flex; gap: 8px; align-items: stretch; }
.adm-godmode-row .input { flex: 1; }
.adm-godmode-quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }

/* key-value list */
.adm-kv {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.adm-kv:last-child { border-bottom: none; }
.adm-kv-k { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.adm-kv-v { color: var(--ink-2); }

@media (max-width: 1100px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
  .adm-cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .adm-shell { grid-template-columns: 1fr; }
  .adm-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .adm-nav { flex-direction: row; flex-wrap: wrap; }
  .adm-main { padding: 24px 20px; }
}

/* ───── lead workflow controls ───── */
.adm-lead-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.adm-lead-cell { background: var(--bg-2); border-radius: 8px; padding: 10px 12px; }
.adm-lead-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 6px; }
.adm-lead-val { font-size: 14px; color: var(--ink); padding: 4px 0; }
.adm-lead-kyc { margin-top: 16px; }
.adm-lead-kyc .input { font-family: inherit; }

/* advanced filters dropdown panel */
.adm-adv-filters { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.adm-adv-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* creds reveal modal rows */
.adm-creds-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.adm-creds-row:last-child { border-bottom: 0; }
.adm-creds-row b { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.adm-creds-row .mono { font-size: 13px; }

.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 24px; border-top: 1px solid var(--border);
}

/* ───── inline status editor (used in Users table) ───── */
.inline-status {
  font-size: 11px; font-weight: 500;
  padding: 4px 22px 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-2);
  color: var(--ink-3);
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%238a91a0' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  min-width: 110px; max-width: 160px;
}
.inline-status:hover { border-color: var(--ink-3); }
.inline-status.set { color: var(--ink); background: var(--panel); }
.inline-status.ftd { color: white; background: var(--success); border-color: var(--success); }
.inline-status.ftd { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='white' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }

/* ───── compact tables in admin pages — show ALL values, no truncation ───── */
.adm-page .tbl {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}
.adm-page .tbl th, .adm-page .tbl td {
  padding: 8px 10px;
  font-size: 12.5px;
  white-space: nowrap;       /* keep every value on one line, no ellipsis by default */
  vertical-align: middle;
}
.adm-page .tbl th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--ink-3);
  text-align: left;
}
.adm-page .tbl th.num { text-align: right; }
.adm-page .tbl td.mono, .adm-page .tbl td .mono { font-size: 12px; }
.adm-page .tbl td.num { text-align: right; }
.adm-page .tbl tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.adm-page .tbl tbody tr:hover td { background: var(--bg-2); }

/* Email is the only column that can be very long — let it ellipsis at a cap */
.adm-page .tbl td.email-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1400px) {
  .adm-page .tbl td.email-cell { max-width: 200px; }
  .adm-page .tbl th, .adm-page .tbl td { padding: 7px 8px; }
}

/* Compact inline status dropdowns — don't balloon the columns */
.adm-page .tbl .inline-status {
  min-width: 108px; max-width: 150px;
  padding: 3px 20px 3px 8px;
  font-size: 11px;
}

/* Copyable text (phone, email, anything) — click anywhere on it to copy */
.copyable {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
  position: relative;
}
.copyable .copy-icon {
  opacity: 0.32; transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.copyable:hover .copy-icon { opacity: 1; color: var(--accent); }
.copyable.copied .copy-icon { opacity: 1; color: var(--success); }
.copyable .copy-flash {
  font-size: 10px; color: var(--success); margin-left: 4px;
  opacity: 0; transition: opacity 0.15s;
}
.copyable.copied .copy-flash { opacity: 1; }

/* P&L control panel */
.adm-lead-pnl { margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: var(--bg-2); }
.adm-pnl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.adm-pnl-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* ───── Users table — fit-to-frame layout ───── */
/* Container: no clipping. Lets the table self-size; we control width via
   column hiding + tighter cells below. Stays inside the card visually. */
.adm-users-card { overflow: visible; }
.tbl-users { width: 100%; }

/* Tighter padding + smaller cell content so all columns fit on a 1280 frame */
.tbl-users th, .tbl-users td { padding: 7px 8px; font-size: 12px; }
.tbl-users th { font-size: 10px; }

/* Inline-status dropdowns — slimmer in user list */
.tbl-users .inline-status {
  min-width: 96px; max-width: 130px;
  padding: 3px 18px 3px 7px;
  font-size: 10.5px;
}

/* Email column adapts to free space */
.tbl-users td.email-cell { max-width: 220px; }

/* Progressive column hiding as the frame narrows. Order = least important first.
   Each breakpoint matches when the natural width starts to exceed the .adm-main
   width on common screen sizes (1440 / 1366 / 1280 / 1200 / 1100). */
@media (max-width: 1440px) {
  .tbl-users [data-col="source"] { display: none; }
}
@media (max-width: 1320px) {
  .tbl-users [data-col="acc"] { display: none; }
}
@media (max-width: 1220px) {
  .tbl-users [data-col="joined"] { display: none; }
  .tbl-users td.email-cell { max-width: 180px; }
}
@media (max-width: 1120px) {
  .tbl-users [data-col="balance"] { display: none; }
  .tbl-users td.email-cell { max-width: 150px; }
}

/* Also tighten the page padding so the table has more room */
@media (max-width: 1440px) {
  .adm-main { padding: 28px 28px; }
}
@media (max-width: 1280px) {
  .adm-main { padding: 24px 20px; }
}
