/* ==========================================================================
   Sotto v2 — dashboard shell + components
   ========================================================================== */

.app { display: flex; min-height: 100vh; position: relative; }

/* Ambient background glow */
.amb { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.amb span { position: absolute; border-radius: 50%; filter: blur(120px); }
.amb .a1 { width: 380px; height: 380px; top: -140px; left: -120px; background: radial-gradient(circle, rgba(196,162,101,0.30), transparent 70%); opacity: 0.4; }
.amb .a2 { width: 380px; height: 380px; top: 33%; right: -140px; background: radial-gradient(circle, rgba(99,102,241,0.30), transparent 70%); opacity: 0.3; }

/* ── Sidebar ───────────────────────────────────────────── */
.sb { width: 256px; flex-shrink: 0; border-right: 1px solid var(--line); background: rgba(11,17,32,0.6); backdrop-filter: blur(8px); display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.sb-logo { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; display: block; box-shadow: 0 6px 20px rgba(196,162,101,0.3); }
.sb-brand .bt { font-weight: 800; font-size: 0.95rem; line-height: 1.1; }
.sb-brand .bs { font-size: 0.68rem; color: var(--dim); }
.sb-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.sb-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; font-size: 0.86rem; font-weight: 500; color: var(--mid); transition: background 0.15s, color 0.15s; }
.sb-nav a:hover { background: rgba(255,255,255,0.05); color: var(--ink); }
.sb-nav a.active { background: rgba(255,255,255,0.07); color: var(--ink); }
.sb-nav a.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--gold); }
.sb-nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.sb-nav a.active svg { color: var(--gold-2); }
.sb-foot { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }
.sb-user { padding: 0 8px 12px; }
.sb-user .ue { font-size: 0.82rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .ur { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.sb-logout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 11px; font-size: 0.84rem; color: var(--mid); background: none; border: none; cursor: pointer; font-family: inherit; }
.sb-logout:hover { background: rgba(255,255,255,0.05); color: var(--ink); }

/* ── Main column ───────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(7,11,22,0.7); backdrop-filter: blur(14px); }
.topbar h1 { font-size: 1.05rem; font-weight: 700; }
.tb-burger { display: none; background: none; border: none; color: var(--mid); cursor: pointer; padding: 6px; }
.tb-search { margin-left: auto; display: flex; align-items: center; gap: 8px; width: 260px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 11px; background: rgba(255,255,255,0.03); color: var(--dim); cursor: pointer; font-family: inherit; font-size: 0.84rem; transition: border-color 0.15s, background 0.15s; }
.tb-search:hover { border-color: rgba(255,255,255,0.22); color: var(--mid); }
.tb-search .sp { flex: 1; text-align: left; }
.tb-search kbd { font-size: 0.66rem; border: 1px solid var(--line2); border-radius: 5px; padding: 1px 6px; background: rgba(255,255,255,0.04); }
.tb-ic { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line2); background: rgba(255,255,255,0.03); color: var(--mid); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.tb-ic:hover { color: var(--ink); }
.tb-ic .nd { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.tb-avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #0a0e1a; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; cursor: pointer; }

.content-area { flex: 1; display: flex; overflow: hidden; }
.content { flex: 1; min-width: 0; padding: 26px 28px; overflow-y: auto; }
.content-in { max-width: 1080px; margin: 0 auto; }

/* Page header */
.ph { margin-bottom: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ph h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.ph p { font-size: 0.88rem; color: var(--mid); margin-top: 2px; }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2,1fr); }
.g3 { grid-template-columns: repeat(3,1fr); }
.g4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2,1fr); } .g3 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .g2 { grid-template-columns: 1fr; } }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .span2 { grid-column: span 1; } }

/* ── Stat cards ────────────────────────────────────────── */
.stat { position: relative; overflow: hidden; padding: 18px; }
.stat .glow { position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; filter: blur(40px); opacity: 0; transition: opacity 0.3s; }
.stat:hover .glow { opacity: 0.9; }
.stat .st-top { display: flex; align-items: center; justify-content: space-between; }
.stat .st-l { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.stat .st-ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat .st-v { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; }
.stat .st-sub { font-size: 0.74rem; color: var(--dim); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.spark { margin: 8px -6px -6px; height: 40px; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 100px; }
.trend.up { background: rgba(52,211,153,0.15); color: var(--green); }
.trend.down { background: rgba(248,113,113,0.15); color: var(--red); }

/* Rows / lists */
.kv { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--mid); } .kv .v { font-weight: 600; }

/* Progress bar */
.prog { height: 8px; border-radius: 100px; background: rgba(255,255,255,0.06); overflow: hidden; }
.prog > span { display: block; height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--gold), var(--gold-3)); transition: width 0.8s var(--ease); }
.setup-item { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; padding: 4px 0; }
.setup-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Tables ────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl thead th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); font-weight: 600; padding: 13px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.015); position: sticky; top: 0; cursor: pointer; white-space: nowrap; }
.tbl thead th:hover { color: var(--mid); }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.025); }
.tbl .title-cell { font-weight: 600; color: var(--ink); max-width: 320px; }
.tbl .title-cell a:hover { color: var(--gold-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 180px; }
.search-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line2); border-radius: 11px; background: var(--bg); padding: 0 12px; }
.search-box svg { color: var(--dim); flex-shrink: 0; }
.search-box input { flex: 1; border: none; background: none; outline: none; color: var(--ink); font-family: inherit; font-size: 0.86rem; padding: 10px 0; }

/* Listing cards grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.lcard { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lcard .lc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lcard .lc-title { font-size: 0.9rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard .lc-price { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.lcard .lc-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.74rem; color: var(--dim); }
.lcard .lc-actions { display: flex; gap: 8px; margin-top: 2px; }

/* ── Chart wrapper ─────────────────────────────────────── */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.legend { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.legend .li { display: flex; align-items: center; justify-content: space-between; font-size: 0.84rem; }
.legend .li .lab { display: flex; align-items: center; gap: 8px; color: var(--mid); }
.legend .li .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut-wrap { position: relative; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center .dc-v { font-size: 1.5rem; font-weight: 800; }
.donut-center .dc-l { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }

/* ── Live feed ─────────────────────────────────────────── */
.feed { width: 320px; flex-shrink: 0; border-left: 1px solid var(--line); background: rgba(11,17,32,0.4); display: flex; flex-direction: column; }
.feed-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; }
.feed-head .fh-l { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 700; }
.feed-list { flex: 1; overflow-y: auto; padding: 0 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.fev { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); padding: 11px 12px 11px 14px; display: flex; gap: 10px; align-items: flex-start; animation: fevIn 0.4s var(--ease) both; }
@keyframes fevIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.fev .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 2px; }
.fev .fic { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fev .ft { flex: 1; min-width: 0; }
.fev .ft .fr1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fev .ft b { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fev .ft .fts { font-size: 0.66rem; color: var(--dim); flex-shrink: 0; }
.fev .ft span.body { font-size: 0.74rem; color: var(--mid); display: block; margin-top: 2px; }
.ic-gold { background: rgba(196,162,101,0.16); color: var(--gold-2); }
.ic-green { background: rgba(52,211,153,0.16); color: var(--green); }
.ic-red { background: rgba(248,113,113,0.16); color: var(--red); }
.ic-amber { background: rgba(251,191,36,0.16); color: var(--amber); }
.ic-idg { background: rgba(99,102,241,0.16); color: var(--accent-2); }
.bar-gold { background: var(--gold); } .bar-green { background: var(--green); } .bar-red { background: var(--red); } .bar-amber { background: var(--amber); } .bar-idg { background: var(--accent-2); }

/* ── Settings two-pane ─────────────────────────────────── */
.set-wrap { display: grid; grid-template-columns: 224px 1fr; gap: 24px; }
.set-nav { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.set-nav .grp { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); padding: 12px 12px 4px; }
.set-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; font-size: 0.86rem; font-weight: 500; color: var(--mid); background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; width: 100%; position: relative; }
.set-nav button:hover { background: rgba(255,255,255,0.05); color: var(--ink); }
.set-nav button.active { background: rgba(255,255,255,0.07); color: var(--ink); }
.set-nav button.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--gold); }
.set-nav button svg { width: 17px; height: 17px; flex-shrink: 0; }
.set-nav button.active svg { color: var(--gold-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 4px 20px 8px; }
.form-grid .field.full { grid-column: span 2; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); margin-bottom: 16px; }
.toggle-row .tl { font-size: 0.86rem; }
.card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
@media (max-width: 820px) { .form-grid { grid-template-columns: 1fr; } .form-grid .field.full { grid-column: span 1; } }

/* Money banner */
.money-banner { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; }
.money-banner .mb-glow { position: absolute; inset: 0; background: radial-gradient(400px 200px at 90% 0%, rgba(196,162,101,0.14), transparent 70%); }
.money-banner .mb-l { position: relative; display: flex; align-items: center; gap: 12px; }
.money-banner .mb-ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(196,162,101,0.15); color: var(--gold-2); border: 1px solid rgba(196,162,101,0.25); display: flex; align-items: center; justify-content: center; }
.money-banner .lab { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.money-banner .val { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }

/* ── Command palette ───────────────────────────────────── */
.cmdk-ov { position: fixed; inset: 0; z-index: 200; background: rgba(7,11,22,0.7); backdrop-filter: blur(4px); display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmdk-ov.open { display: flex; }
.cmdk { width: 100%; max-width: 560px; background: rgba(16,26,46,0.97); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); overflow: hidden; animation: cmdkIn 0.2s var(--ease); }
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-14px) scale(0.98); } to { opacity: 1; transform: none; } }
.cmdk-in { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-in svg { color: var(--dim); }
.cmdk-in input { flex: 1; height: 54px; background: none; border: none; outline: none; color: var(--ink); font-family: inherit; font-size: 0.95rem; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-grp { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); padding: 8px 12px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 11px; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 0.88rem; color: var(--mid); text-align: left; }
.cmdk-item .ci-ic { width: 32px; height: 32px; border-radius: 9px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--mid); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmdk-item.active { background: rgba(255,255,255,0.07); color: var(--ink); }
.cmdk-item.active .ci-ic { background: rgba(196,162,101,0.15); color: var(--gold-2); border-color: rgba(196,162,101,0.25); }
.cmdk-item .ci-l { flex: 1; }
.cmdk-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.7rem; color: var(--dim); }
.cmdk-foot kbd { border: 1px solid var(--line2); border-radius: 5px; padding: 1px 6px; background: rgba(255,255,255,0.04); }

/* ── Mobile drawers ────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(7,11,22,0.7); backdrop-filter: blur(4px); z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.scrim.open { opacity: 1; pointer-events: all; }

@media (max-width: 1200px) { .feed { display: none; } }
@media (max-width: 920px) {
  .sb { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .sb.open { transform: translateX(0); }
  .tb-burger { display: block; }
  .tb-search { width: auto; }
  .tb-search .sp, .tb-search kbd { display: none; }
  .set-wrap { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .set-nav .grp { display: none; }
  .set-nav button { white-space: nowrap; }
  .content { padding: 20px 16px; }
}

/* ── Landing-page embed (hero preview iframe) ─────────── */
html:has(body[data-embed="1"]),
body[data-embed="1"] {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  position: relative;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body[data-embed="1"] .app {
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-x: clip;
  touch-action: pan-y;
}
body[data-embed="1"] .main {
  min-height: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-x: clip;
  touch-action: pan-y;
}
body[data-embed="1"] .topbar { position: relative; flex-shrink: 0; }
body[data-embed="1"] .content-area {
  min-height: 0;
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-x: clip;
  touch-action: pan-y;
}
body[data-embed="1"] .amb { display: none; }
body[data-embed="1"] .feed { display: none !important; }
body[data-embed="1"] .cmdk-ov { display: none !important; }
body[data-embed="1"] .embed-tabs { display: none; }
body[data-embed="1"] #content,
body[data-embed="1"] .content-in {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
  touch-action: pan-y;
}
body[data-embed="1"] .content {
  overflow-x: clip !important;
  touch-action: pan-y;
}
body[data-embed="1"] #content {
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
body[data-embed="1"] #content.embed-out {
  opacity: 0;
  transform: translateY(8px) scale(0.994);
  pointer-events: none;
}
body[data-embed="1"] #content.embed-in {
  animation: embedPageIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes embedPageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
body[data-embed="1"] .sb-nav a { transition: background 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
body[data-embed="1"] .topbar h1 { transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1); }

/* Embed wide: sidebar layout (desktop hero frame) */
body[data-embed="1"][data-embed-layout="wide"] .embed-tabs { display: none !important; }
body[data-embed="1"][data-embed-layout="wide"] .sb { position: relative; height: 100%; min-height: 0; flex-shrink: 0; }
body[data-embed="1"][data-embed-layout="wide"] .content { padding: 18px 20px; overflow-y: auto; }
body[data-embed="1"][data-embed-layout="wide"] .tb-search kbd { display: none; }

/* Embed compact: phone-style bottom tabs (iframe uses parent width, not screen — set via JS) */
body[data-embed="1"][data-embed-layout="compact"] .sb,
body[data-embed="1"][data-embed-layout="compact"] .scrim { display: none !important; }
body[data-embed="1"][data-embed-layout="compact"] .tb-burger,
body[data-embed="1"][data-embed-layout="compact"] .tb-search { display: none !important; }
body[data-embed="1"][data-embed-layout="compact"] .topbar {
  height: 46px;
  padding: 0 10px;
  gap: 8px;
}
body[data-embed="1"][data-embed-layout="compact"] .topbar h1 {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-embed="1"][data-embed-layout="compact"] .tb-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.68rem;
  flex-shrink: 0;
}
body[data-embed="1"][data-embed-layout="compact"] .content {
  padding: 10px 10px 4px;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  touch-action: pan-y;
}
body[data-embed="1"][data-embed-layout="compact"] .content-in { max-width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .ph {
  margin-bottom: 10px;
  gap: 6px;
  flex-direction: column;
  align-items: flex-start;
}
body[data-embed="1"][data-embed-layout="compact"] .ph h2 { font-size: 1.05rem; }
body[data-embed="1"][data-embed-layout="compact"] .ph p { font-size: 0.74rem; display: none; }
body[data-embed="1"][data-embed-layout="compact"] .ph .btn { display: none; }
body[data-embed="1"][data-embed-layout="compact"] .grid { gap: 8px; width: 100%; max-width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body[data-embed="1"][data-embed-layout="compact"] .g2,
body[data-embed="1"][data-embed-layout="compact"] .g3 { grid-template-columns: minmax(0, 1fr); }
body[data-embed="1"][data-embed-layout="compact"] .span2 { grid-column: span 1; }
body[data-embed="1"][data-embed-layout="compact"] .stat { padding: 10px; min-width: 0; }
body[data-embed="1"][data-embed-layout="compact"] .stat .st-v { font-size: 1.05rem; margin-top: 6px; }
body[data-embed="1"][data-embed-layout="compact"] .stat .st-l { font-size: 0.58rem; }
body[data-embed="1"][data-embed-layout="compact"] .stat .spark { display: none; }
body[data-embed="1"][data-embed-layout="compact"] .card { border-radius: 11px; min-width: 0; max-width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .chart,
body[data-embed="1"][data-embed-layout="compact"] .chart svg { max-width: 100%; overflow: hidden; }
body[data-embed="1"][data-embed-layout="compact"] .toolbar { flex-wrap: wrap; gap: 6px; width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .toolbar .search-box { min-width: 0; flex: 1 1 100%; }
body[data-embed="1"][data-embed-layout="compact"] .cards { gap: 8px; grid-template-columns: minmax(0, 1fr); width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .set-wrap { gap: 10px; width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .set-nav {
  position: static;
  flex-direction: column;
  overflow: visible;
  gap: 4px;
  max-width: 100%;
}
body[data-embed="1"][data-embed-layout="compact"] .set-nav button { font-size: 0.76rem; padding: 7px 10px; width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .embed-tabs {
  display: flex !important;
  flex-shrink: 0;
  gap: 2px;
  padding: 5px 4px 7px;
  border-top: 1px solid var(--line);
  background: rgba(11, 17, 32, 0.98);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  touch-action: manipulation;
}
body[data-embed="1"][data-embed-layout="compact"] .embed-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 5px 2px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.54rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
}
body[data-embed="1"][data-embed-layout="compact"] .embed-tab svg { width: 17px; height: 17px; flex-shrink: 0; }
body[data-embed="1"][data-embed-layout="compact"] .embed-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
body[data-embed="1"][data-embed-layout="compact"] .embed-tab.active {
  color: var(--gold-2);
  background: rgba(196, 162, 101, 0.14);
}
body[data-embed="1"][data-embed-layout="compact"] .grid .span2 { display: none; }
body[data-embed="1"][data-embed-layout="compact"] .tbl-wrap { overflow-x: clip; max-width: 100%; }
body[data-embed="1"][data-embed-layout="compact"] .money-banner { flex-direction: column; align-items: flex-start; }
body[data-embed="1"][data-embed-layout="compact"] .topbar {
  height: 46px !important;
  padding-top: 0 !important;
}

@supports (padding: max(0px)) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
  .sb { padding-top: calc(20px + env(safe-area-inset-top)); }
  .content { padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
  .feed-list { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-ov { position: fixed; inset: 0; z-index: 210; background: rgba(7,11,22,0.7); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-ov.open { display: flex; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); animation: cmdkIn 0.2s var(--ease); max-height: 90vh; overflow-y: auto; }
.modal.lg { max-width: 640px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 20px 8px; }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-head .sub { font-size: 0.82rem; color: var(--mid); margin-top: 2px; }
.modal-x { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 12px 20px 20px; }
