/* ============================================================
   ApexPoster admin — Apex Technology Group brand
   deep-space background + indigo→violet→magenta gradient glass
   ============================================================ */
:root {
    --indigo: #6366f1;
    --violet: #8b5cf6;
    --violet-light: #a78bfa;
    --magenta: #c026d3;
    --bg: #0a0a0f;
    --surface: #12121c;
    --surface-raised: #1a1a28;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #fb7185;
    --info: #38bdf8;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #c026d3 100%);
    --glow: 0 0 40px rgba(139, 92, 246, 0.25);
    --border: rgba(139, 92, 246, 0.14);
    --border-strong: rgba(139, 92, 246, 0.45);
    --radius: 14px;
    /* Amazon orange — reserved for the recommended plan and nothing else.
       Text on this must be --bg, never white: white fails contrast on it. */
    --orange: #FF9900;
    --orange-deep: #F08C00;
    --orange-glow: rgba(255, 153, 0, 0.28);
    --orange-ring: rgba(255, 153, 0, 0.55);
    --font: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--violet-light); text-decoration: none; }
button { font-family: var(--font); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); }
::selection { background: rgba(139, 92, 246, 0.4); }

/* ---- background orbs ---- */
.orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.3; }
.orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, var(--indigo), transparent 70%); top: -220px; right: -120px; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, var(--violet), transparent 70%); bottom: -180px; left: -120px; }
.orb-3 { width: 420px; height: 420px; background: radial-gradient(circle, var(--magenta), transparent 70%); top: 45%; left: 55%; opacity: 0.12; }

/* ---- helpers ---- */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.glass {
    background: rgba(18, 18, 28, 0.6);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
}
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.12em; }

/* ---- buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-raised);
    color: var(--text); font-weight: 600; font-size: 0.92rem; cursor: pointer;
    transition: border-color .2s, transform .1s, background .2s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gradient); border: none; color: #fff; box-shadow: 0 6px 20px rgba(139,92,246,.35); }
.btn-primary:hover { box-shadow: 0 8px 28px rgba(139,92,246,.5); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--error); border-color: rgba(251,113,133,.3); background: transparent; }
.btn-danger:hover { border-color: var(--error); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- forms ---- */
label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input, select {
    width: 100%; padding: 11px 14px; border-radius: var(--radius);
    background: rgba(10,10,15,.6); border: 1px solid rgba(148,163,184,.25);
    color: var(--text); font-size: 0.95rem; font-family: var(--font);
}
input:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
/* A field shown for reference rather than for editing (Profile's email) has to *look*
   uneditable, or the only feedback is a text caret that never appears. */
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
.field { margin-bottom: 16px; }

/* ---- public top bar (landing + pricing) ---- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; border-bottom: 1px solid transparent; transition: background .2s, border-color .2s; }
.topbar.scrolled { background: rgba(10, 10, 15, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom-color: var(--border); }
.topbar-inner { max-width: 1200px; margin: 0 auto; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; }
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.topbar-brand img { height: 26px; display: block; }
.topbar-nav { display: flex; align-items: center; gap: 26px; font-size: .92rem; }
.topbar-nav a { color: var(--text-dim); font-weight: 600; }
.topbar-nav a:hover { color: var(--text); }
.topbar-nav a.active { color: var(--text); font-weight: 700; position: relative; padding: 4px 0; }
.topbar-nav a.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px; background: var(--gradient); }

/* ---- landing (signed out) ---- */
.landing { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 84px 24px 40px; }
.landing-inner { width: 100%; max-width: 1120px; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 64px; align-items: center; }

.marketing .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.76rem; font-weight: 700; color: var(--violet-light); margin-bottom: 18px; }
.hero { font-size: clamp(2.4rem, 4.6vw, 3.8rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 20px; }
.lede { font-size: 1.08rem; color: var(--text-dim); line-height: 1.6; max-width: 30em; margin: 0 0 32px; }

.features { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 18px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature-ic { font-size: 1.4rem; line-height: 1.3; width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: rgba(139,92,246,.12); border: 1px solid var(--border); }
.feature strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.feature p { margin: 0; color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }

.mk-foot { display: flex; align-items: center; gap: 12px; padding-top: 22px; border-top: 1px solid var(--border); }
.mk-foot img { height: 22px; opacity: 0.9; }
.mk-foot span { color: var(--text-dim); font-size: 0.86rem; }

.auth { display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; padding: 34px 30px; border-radius: 22px; }
.auth-card h2 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; }
.auth-sub { text-align: left; color: var(--text-dim); margin: 0 0 24px; font-size: 0.9rem; }

.provider-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); font-weight: 600; font-size: 0.95rem; cursor: pointer; margin-bottom: 12px; border: 1px solid transparent; transition: transform .1s, filter .2s, border-color .2s; }
.provider-btn:active { transform: translateY(1px); }
.provider-google { background: #fff; color: #1f1f1f; }
.provider-google:hover { filter: brightness(0.96); }
.provider-apple { background: #000; color: #fff; border-color: rgba(255,255,255,.18); }
.provider-apple:hover { border-color: rgba(255,255,255,.4); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 0.8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.toggle-line { text-align: center; color: var(--text-dim); font-size: 0.88rem; margin: 18px 0 0; }
.toggle-line a { cursor: pointer; font-weight: 600; }
.toggle-line a:hover, .label-row a:hover { text-decoration: underline; }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row a { cursor: pointer; font-size: 0.78rem; font-weight: 600; }
.hint { margin: 6px 0 0; font-size: 0.76rem; color: var(--text-dim); }
.ok-text { color: var(--success); font-size: 0.85rem; margin-top: 10px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 66px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: var(--text-dim);
    font-size: 0.78rem; font-weight: 700; cursor: pointer; padding: 6px 8px;
}
.pw-toggle:hover { color: var(--violet-light); }

/* Anything mid-request goes quiet and unclickable so nobody double-submits. */
.is-busy { opacity: .6; pointer-events: none; }

@media (max-width: 900px) {
  .landing-inner { grid-template-columns: 1fr; gap: 36px; max-width: 460px; }
  .marketing { text-align: center; }
  .feature { text-align: left; }
  .features { max-width: 420px; margin-inline: auto; }
  .mk-foot { justify-content: center; }
  .auth-sub { text-align: center; }
}

/* ---- app shell ---- */
.app { position: relative; z-index: 1; min-height: 100vh; display: flex; }
.sidebar {
    width: 240px; flex-shrink: 0; padding: 26px 18px;
    border-right: 1px solid var(--border); background: rgba(18,18,28,.5);
    backdrop-filter: blur(18px); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; padding: 0 8px; }
.brand img { height: 30px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    border-radius: 12px; color: var(--text-dim); font-weight: 600; cursor: pointer;
    border: 1px solid transparent; font-size: 0.92rem;
}
.nav-item:hover { color: var(--text); background: rgba(139,92,246,.08); }
.nav-item.active { color: var(--text); background: rgba(139,92,246,.14); border-color: var(--border); }
.nav-icon { width: 20px; text-align: center; }
/* ---- sidebar footer ----
   Takeover, then one identity row: avatar + name/role + a sign-out icon button.
   Three full-width stacked controls read as three unrelated things; this reads as
   "who you are, and the way out". */
.sidebar-foot { font-size: 0.8rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 14px; }
.sidebar-takeover { width: 100%; justify-content: center; gap: 7px; margin-bottom: 12px; }

/* The whole row is the link to Profile — it always had the hover state for it and,
   until Profile existed, nowhere to go. */
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 12px; cursor: pointer;
    border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.sidebar-user:hover { background: rgba(139,92,246,.07); border-color: var(--border); }
.sidebar-user:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.sidebar-avatar {
    width: 30px; height: 30px; flex: none; border-radius: 50%;
    background: var(--gradient); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: .82rem; line-height: 1;
}

/* min-width:0 is what lets the ellipsis actually apply inside a flex row. */
.sidebar-who { flex: 1; min-width: 0; }
.sidebar-name {
    font-weight: 700; color: var(--text); font-size: .84rem; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-role { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }

.sidebar-signout {
    flex: none; width: 30px; height: 30px; display: grid; place-items: center;
    border-radius: 9px; cursor: pointer;
    background: transparent; border: 1px solid transparent; color: var(--text-dim);
    transition: color .15s, background .15s, border-color .15s;
}
.sidebar-signout:hover { color: var(--error); background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.3); }

.main { flex: 1; padding: 32px 40px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.7rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 0.9rem; }

/* ---- cards / grids ---- */
.card {
    background: linear-gradient(180deg, rgba(26,26,40,.85), rgba(18,18,28,.85));
    border: 1px solid var(--border); border-radius: 16px; padding: 20px;
}
.grid { display: grid; gap: 16px; }
.grid-screens { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-media { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.screen-card { display: flex; flex-direction: column; gap: 12px; }
.screen-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.screen-name { font-weight: 700; font-size: 1.05rem; }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; }
.dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.dot.online { color: var(--success); }
.dot.online::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
.dot.offline { color: var(--text-dim); }
.screen-meta { font-size: 0.82rem; color: var(--text-dim); line-height: 1.7; }
.screen-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.media-tile { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); position: relative; }
.media-tile img, .media-tile video { width: 100%; height: 130px; object-fit: cover; display: block; background: #000; }
.media-info { padding: 8px 10px; font-size: 0.78rem; }
.media-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.media-kind { color: var(--text-dim); text-transform: uppercase; font-size: 0.68rem; letter-spacing: .08em; }
.media-del { position: absolute; top: 6px; right: 6px; background: rgba(10,10,15,.7); border: 1px solid var(--border); color: var(--error); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.media-tile:hover .media-del { opacity: 1; }
/* PDF page rendering runs as a background job, so a fresh upload is briefly "not ready".
   The tile says so rather than showing a silent placeholder icon. */
.media-status { display: flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 600; color: var(--violet-light); }
.media-status.is-failed { color: var(--error); }
.spinner-dot {
    width: 8px; height: 8px; border-radius: 50%; flex: none;
    border: 2px solid rgba(167, 139, 250, .3); border-top-color: var(--violet-light);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- compact plan strip (Billing view) ----
   The "Your plan" marker sits in the flow, not absolutely over the card's top border —
   floating it there clipped the corner and let the border show through the translucent
   pill. Every card reserves the same tag row, so names and prices stay on one baseline. */
.plan-mini {
    flex: 1; min-width: 158px; padding: 12px 14px 14px;
    border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
    background: rgba(255,255,255,.02);
}
.plan-mini.is-current { border-color: var(--violet); background: rgba(124,92,246,.08); }
.plan-mini-tag { height: 20px; margin-bottom: 4px; }
.plan-mini-tag span {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    background: var(--violet); color: #fff;
}
.plan-mini-name { font-weight: 700; }
.plan-mini-price { margin: 4px 0; }
.plan-mini-price b { font-size: 1.25rem; font-weight: 800; }
.plan-mini-range { font-size: .75rem; margin-bottom: 8px; }
.plan-mini-feat { display: flex; gap: 6px; align-items: center; font-size: .76rem; margin-top: 5px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: .04em; }
.badge-code { background: rgba(139,92,246,.16); color: var(--violet-light); border: 1px solid var(--border); font-size: 0.95rem; padding: 6px 14px; }
.badge-admin { background: rgba(192,38,211,.16); color: #e879f9; }
.badge-owner { background: rgba(99,102,241,.16); color: var(--violet-light); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---- playlist editor ----
   One grid template drives both the header and every row, so the column
   labels always sit over the controls they name. */
.pl-head, .pl-item {
    display: grid;
    grid-template-columns: 20px 74px minmax(120px, 1fr) 148px 190px auto;
    grid-template-areas: "drag prev name dur trans act";
    align-items: center;
    gap: 12px;
}
.pl-head {
    padding: 0 10px 8px;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-dim);
}
.pl-item {
    padding: 10px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); margin-bottom: 8px;
}
.pl-item.pl-off { opacity: .45; }
.pl-item.pl-off .pl-prev { filter: grayscale(1); }

.c-drag { grid-area: drag; cursor: grab; color: var(--text-dim); text-align: center; }
.c-prev { grid-area: prev; }
.c-name { grid-area: name; min-width: 0; }
.c-dur  { grid-area: dur; display: flex; gap: 6px; }
.c-trans { grid-area: trans; }
.c-act  { grid-area: act; display: flex; align-items: center; gap: 6px; }

.pl-prev, .pl-item img, .pl-item video {
    width: 74px; height: 46px; object-fit: cover; border-radius: 8px;
    background: #000; display: block;
}
.pl-prev.pl-glyph { display: grid; place-items: center; background: var(--surface-raised); font-size: 1.3rem; }
.c-name .nm { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-name .meta { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.c-dur input { width: 62px; padding: 8px 6px; text-align: center; font-size: 0.85rem; }
.c-dur select, .c-trans { padding: 8px 10px; font-size: 0.85rem; }
.pl-item .btn-sm { padding: 5px 9px; }

.pl-reorder { display: flex; flex-direction: column; gap: 2px; }
.pl-reorder button { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.9rem; padding: 0 4px; line-height: 1.1; }
.pl-reorder button:hover { color: var(--violet-light); }

/* Save stays reachable however long the slide list gets. */
.pl-bar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(10, 10, 15, .93);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    margin: -32px -40px 18px; padding: 20px 40px 14px;
}
.pl-dirty { color: var(--warning); font-size: 0.8rem; font-weight: 700; }

/* PDF page picker */
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.pg-tile { border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface); position: relative; opacity: .45; }
.pg-tile.sel { border-color: var(--violet); opacity: 1; }
.pg-tile img { width: 100%; height: 92px; object-fit: contain; display: block; background: #000; }
.pg-tile .pgn { font-size: 0.72rem; font-weight: 700; padding: 4px 6px; text-align: center; }
.pg-tile .pgtick { position: absolute; top: 5px; right: 6px; font-size: 0.85rem; }

@media (max-width: 1040px) {
    .pl-head { display: none; }
    .pl-item {
        grid-template-columns: 20px 74px minmax(0, 1fr);
        grid-template-areas: "drag prev name" "drag dur trans" "drag act act";
        row-gap: 8px;
    }
    .c-drag { align-self: start; padding-top: 14px; }
}

.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px; }
.picker-tile { border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface); }
.picker-tile.sel { border-color: var(--violet); }
.picker-tile img, .picker-tile video { width: 100%; height: 78px; object-fit: cover; display: block; background: #000; }
.picker-tile .pn { font-size: 0.7rem; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(5,5,10,.72); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal { width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; border-radius: 20px; padding: 28px; background: linear-gradient(180deg, #1a1a28, #12121c); border: 1px solid var(--border-strong); box-shadow: 0 24px 80px rgba(0,0,0,.7), var(--glow); }
.modal h2 { margin: 0 0 4px; font-size: 1.3rem; }
.modal .sub { color: var(--text-dim); font-size: 0.86rem; margin: 0 0 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

/* ---- empty / toast ---- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty .big { font-size: 2.4rem; margin-bottom: 10px; }
.error-text { color: var(--error); font-size: 0.85rem; margin-top: 10px; min-height: 1.2em; }

#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 12px; background: var(--surface-raised); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 0.9rem; font-weight: 600; animation: slidein .25s ease; }
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(251,113,133,.4); color: #fecdd3; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ---- phone layout ----
   A side rail costs ~20% of a phone's width for seven destinations, so below 720px
   the sidebar leaves the flow entirely and becomes a fixed bottom tab bar. The main
   column then gets the full viewport. Note that .nav-icon is itself a <span>: hiding
   labels must not be written as `.nav-item span`, or the icons go with them and the
   bar renders as a row of blank pills. */
@media (max-width: 720px) {
    .sidebar {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 40;
        width: auto; height: auto; flex-direction: row; align-items: center; gap: 8px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        border-right: none; border-top: 1px solid var(--border);
        background: rgba(12,12,20,.88);
    }
    .brand { display: none; }

    /* More tabs than fit: the row scrolls sideways rather than wrapping to two rows
       or crushing the labels to nothing. */
    .nav { flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; }
    .nav::-webkit-scrollbar { display: none; }
    .nav-item {
        flex: none; flex-direction: column; gap: 3px;
        padding: 6px 9px; border-radius: 10px;
        font-size: .62rem; letter-spacing: .01em; line-height: 1;
    }
    .nav-icon { width: auto; font-size: 1.15rem; line-height: 1.1; }

    /* Takeover and sign-out pin to the trailing edge; the name/role text has no room. */
    .sidebar-foot { flex: none; display: flex; align-items: center; gap: 6px; border-top: none; padding-top: 0; }
    .sidebar-who, .sidebar-takeover span { display: none; }
    .sidebar-takeover { width: auto; margin-bottom: 0; padding: 8px 10px; }
    .sidebar-user { gap: 6px; padding: 0; }
    .sidebar-user:hover { background: none; border-color: transparent; }

    /* Bottom padding clears the bar so the last card is never trapped under it. */
    .main { padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); max-width: 100%; }
    .pl-bar { margin: -22px -16px 14px; padding: 16px 16px 12px; }
    #toasts { right: 12px; left: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   PRICING PAGE (/pricing.html)
   Public marketing page. Breakpoints are pure CSS — the design
   drove them from JS, which a static page has no reason to do.
   ============================================================ */
.pricing { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 64px 40px 120px; display: flex; flex-direction: column; gap: 96px; }

.pr-hero { padding-top: 64px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.pr-eyebrow { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--violet-light); }
.pr-hero h1 { font-size: clamp(2.4rem, 4.6vw, 3.8rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; margin: 0; max-width: 16em; }
.pr-lede { font-size: 1.08rem; line-height: 1.6; color: var(--text-dim); max-width: 30em; margin: 0; text-wrap: pretty; }
.pr-section-head { text-align: center; }
.pr-section-head h2 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.pr-section-head p { font-size: .9rem; color: var(--text-dim); margin: 8px 0 0; }

/* billing toggle — monthly is the static default so prices render without JS */
/* Equal tracks are load-bearing: the indicator is a fixed 50% of the control, so
   if the options size to their content it lands mid-label — the Annual side is
   intrinsically wider because of the "2 months free" badge. */
.billing { display: inline-grid; grid-template-columns: 1fr 1fr; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-top: 6px; }
.billing-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--gradient); box-shadow: 0 6px 20px rgba(139, 92, 246, .35); transition: transform .18s ease; transform: translateX(0); }
.billing-opt { position: relative; z-index: 1; border: none; background: none; font-family: inherit; font-weight: 600; font-size: .92rem; color: var(--text-dim); padding: 10px 24px; border-radius: 999px; cursor: pointer; transition: color .18s; display: flex; align-items: center; justify-content: center; gap: 9px; }
.billing-opt[aria-checked="true"] { color: #fff; }
.billing-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(139, 92, 246, .4); }
.billing-save { background: var(--success); color: #04160f; font-size: .64rem; font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px; }
body.billing-annual .billing-ind { transform: translateX(100%); }
.p-annual { display: none; }
body.billing-annual .p-monthly { display: none; }
body.billing-annual .p-annual { display: inline; }

/* plan cards */
/* stretch, not start — every card runs to the height of the tallest in its row */
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; align-items: stretch; margin-top: -32px; padding-top: 20px; }
.plan-wrap { position: relative; display: flex; }
.plan-halo { position: absolute; inset: -28px; z-index: 0; background: radial-gradient(circle at 50% 22%, var(--orange-glow), transparent 68%); filter: blur(38px); opacity: .55; pointer-events: none; }
.plan {
    position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; gap: 15px;
    background: linear-gradient(180deg, rgba(26, 26, 40, .85), rgba(18, 18, 28, .85));
    border: 1px solid var(--border); border-radius: 16px; padding: 22px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35); backdrop-filter: blur(8px);
    transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}
.plan:hover { border-color: var(--border-strong); box-shadow: var(--glow), 0 10px 34px rgba(0, 0, 0, .4); transform: translateY(-3px); }
.plan.suggested { border-color: var(--orange-ring); padding: 28px; box-shadow: 0 0 60px var(--orange-glow), 0 12px 44px rgba(0, 0, 0, .45); transform: translateY(-8px); }
.plan.suggested:hover { border-color: var(--orange-ring); transform: translateY(-11px); }
.plan-badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--orange); color: var(--bg); font-size: .72rem; font-weight: 700; letter-spacing: .04em; padding: 5px 15px; border-radius: 999px; white-space: nowrap; box-shadow: 0 6px 18px var(--orange-glow); }
.plan-name { font-size: 1.15rem; font-weight: 700; }
.plan-tagline { font-size: .85rem; color: var(--text-dim); line-height: 1.5; margin-top: 5px; min-height: 2.6em; text-wrap: pretty; }
.plan-price { min-height: 82px; }
.plan-price-row { display: flex; align-items: baseline; gap: 7px; }
.plan-price-main { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.01em; }
.plan-price-unit { font-size: .85rem; font-weight: 600; color: var(--text-dim); }
.plan-price-sub { font-size: .8rem; color: var(--text-dim); margin-top: 7px; }
.plan-range { font-size: .82rem; font-weight: 600; color: var(--violet-light); letter-spacing: .01em; }
.plan-cta { display: block; text-align: center; background: var(--surface-raised); color: var(--text); font-weight: 600; font-size: .92rem; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border-strong); transition: background .15s, border-color .15s, transform .1s; }
.plan-cta:hover { background: #22223a; border-color: var(--violet); color: var(--text); }
.plan-cta:active { transform: translateY(1px); }
.plan-cta:focus-visible { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, .18); }
.plan-cta.cta-orange { background: var(--orange); color: var(--bg); font-weight: 700; border: none; box-shadow: 0 6px 20px var(--orange-glow); }
.plan-cta.cta-orange:hover { background: var(--orange-deep); color: var(--bg); }
.plan-cta.cta-orange:focus-visible { box-shadow: 0 0 0 3px var(--orange-ring); }
.plan-note { font-size: .78rem; color: var(--text-dim); text-align: center; line-height: 1.45; }
.plan-rule { height: 1px; background: var(--border); margin: 3px 0; }
.plan-heading { font-size: .9rem; font-weight: 700; }
.plan-features { display: flex; flex-direction: column; gap: 9px; }
.plan-feat { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; line-height: 1.5; }
.plan-feat svg { margin-top: 2px; flex: 0 0 auto; stroke: var(--success); }
/* Partner used to be its own card; it now hangs off the bottom of Volume. Pushed to
   the card foot so it reads as an aside, not a fifth feature. */
.plan-more { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-dim); line-height: 1.55; }
.plan-more a { color: var(--violet-light); font-weight: 600; }
.plan-more a:hover { text-decoration: underline; }
.plan.suggested .plan-feat svg { stroke: var(--orange); }

/* reassurance strip */
.reassure { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: rgba(18, 18, 28, .6); backdrop-filter: blur(18px); }
.reassure b { display: block; font-size: .95rem; margin-bottom: 6px; }
.reassure p { margin: 0; font-size: .85rem; color: var(--text-dim); line-height: 1.55; }

/* comparison table — scrolls inside itself, never the page */
.cmp-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: rgba(18, 18, 28, .6); backdrop-filter: blur(18px); }
.cmp { width: 100%; border-collapse: collapse; min-width: 900px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cmp thead th { position: sticky; top: 0; z-index: 2; padding: 15px 12px; background: #0c0c15; font-weight: 700; border-bottom: 1px solid var(--border); text-align: center; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text); }
.cmp thead th:first-child { text-align: left; padding-left: 18px; }
.cmp thead th.col-std { background: #171208; color: var(--orange); border-bottom-color: var(--orange-ring); }
.cmp tbody tr { border-top: 1px solid var(--border); }
.cmp .grp th { text-align: left; padding: 18px 18px 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; color: var(--violet-light); border-bottom: 0; }
.cmp .grp { border-top: 0; }
.cmp tbody th { text-align: left; padding: 11px 18px; font-weight: 500; color: var(--text); font-size: .9rem; text-transform: none; letter-spacing: 0; border-bottom: 0; }
.cmp td { text-align: center; padding: 11px 12px; border-bottom: 0; }
.cmp td.std { background: rgba(255, 153, 0, .05); }
.cmp .yes { color: var(--success); font-weight: 700; }
.cmp td.std .yes { color: var(--orange); }
.cmp .no { color: var(--text-dim); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* partner band */
.partner-band { padding: 36px; border: 1px solid var(--border-strong); border-radius: 20px; background: rgba(18, 18, 28, .6); backdrop-filter: blur(18px); box-shadow: var(--glow); }
.partner-band h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.12; }
.partner-band p { font-size: 1rem; line-height: 1.6; color: var(--text-dim); margin: 0; max-width: 32em; text-wrap: pretty; }
.partner-copy { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }

/* FAQ — native <details> so it works with JS off */
.faq { display: flex; flex-direction: column; align-items: center; }
.faq h2 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 18px; text-align: center; }
.faq-list { width: 100%; max-width: 46em; }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list summary { display: flex; justify-content: space-between; gap: 18px; align-items: center; font-size: 1.02rem; font-weight: 600; padding: 20px 4px; cursor: pointer; border-radius: 8px; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '⌄'; flex: 0 0 auto; color: var(--violet-light); font-size: 1.3rem; line-height: 1; transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(180deg); }
.faq-list summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(139, 92, 246, .18); }
.faq-list .ans { padding: 0 4px 22px 18px; margin-bottom: 4px; color: var(--text-dim); font-size: .95rem; line-height: 1.65; border-left: 2px solid var(--violet); text-wrap: pretty; }

/* closing CTA + footer */
.final-cta { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 40px 0; }
.final-cta h2 { font-size: clamp(2rem, 3.4vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.final-cta p { font-size: 1.05rem; color: var(--text-dim); margin: 0; }
.btn-xl { padding: 15px 34px; font-size: 1rem; }
.site-foot { position: relative; z-index: 1; border-top: 1px solid var(--border); }
.site-foot-inner { max-width: 1200px; margin: 0 auto; padding: 24px 40px; display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-dim); }
.site-foot-inner img { height: 22px; display: block; }
.site-foot nav { display: flex; gap: 24px; }
.site-foot a { color: var(--text-dim); }
.site-foot a:hover { color: var(--text); }

@media (max-width: 1199px) {
    .pricing { padding: 64px 28px 120px; gap: 80px; }
    .topbar-inner, .site-foot-inner { padding-left: 28px; padding-right: 28px; }
    .plan-grid { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
    .plan.suggested { transform: none; }
    .plan.suggested:hover { transform: translateY(-3px); }
}

@media (max-width: 899px) {
    .plan-grid { grid-template-columns: 1fr; }
    .plan-wrap.suggested-wrap { order: -1; }   /* recommendation leads on mobile */
    .reassure { grid-template-columns: 1fr; }
}

@media (max-width: 719px) {
    .pricing { padding: 56px 16px 80px; gap: 64px; }
    .pr-hero { padding-top: 40px; }
    .topbar-inner, .site-foot-inner { padding-left: 16px; padding-right: 16px; }
    .topbar-nav .nav-pricing { display: none; }
}

/* Inline consequence callout — used by the delete-account confirmation, where the warnings are the
   whole point of the dialog and must not read as body copy. */
.notice {
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 0.85rem;
    line-height: 1.5;
    border-left: 3px solid var(--muted);
    background: rgba(255, 255, 255, .04);
}
.notice-warn { border-left-color: var(--warning); color: var(--warning); }
