/* TechBPO Pro App Builder v2 — brand: navy #203F76, teal #018274. No external fonts or CDNs. */

/* ── Tokens ───────────────────────────────────────────────────────────────────── */
:root {
    color-scheme: light;
    --bg: #F2F5FA;
    --surface: #FFFFFF;
    --surface-2: #F6F8FC;
    --surface-3: #EDF1F7;
    --border: #E1E7F0;
    --border-strong: #C9D2E0;
    --text: #172033;
    --muted: #5A6477;
    --primary: #203F76;
    --primary-hover: #172E57;
    --on-primary: #FFFFFF;
    --primary-soft: #E9EFF9;
    --link: #203F76;
    --accent: #018274;
    --accent-hover: #016B60;
    --accent-soft: #E1F3F0;
    --danger: #BF3129;
    --danger-soft: #FDECEA;
    --warning: #8A5D00;
    --warning-soft: #FFF4D6;
    --success: #0E7A4E;
    --success-soft: #E2F5EC;
    --info-soft: #E8F1FE;
    --orange: #C25E00;
    --orange-soft: #FFEEDD;
    --focus: #018274;
    --shadow-sm: 0 1px 2px rgba(20, 32, 60, .06);
    --shadow: 0 1px 2px rgba(20, 32, 60, .05), 0 6px 20px rgba(20, 32, 60, .06);
    --shadow-lg: 0 12px 40px rgba(20, 32, 60, .18);
    --radius: 14px;
    --radius-sm: 9px;
    --sidebar-w: 268px;
    --topbar-h: 64px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0D1220;
        --surface: #151C2C;
        --surface-2: #1A2234;
        --surface-3: #212B40;
        --border: #283248;
        --border-strong: #37435D;
        --text: #E6EAF2;
        --muted: #9BA5B9;
        --primary: #3D69C2;
        --primary-hover: #4C78D0;
        --primary-soft: #1D2A46;
        --link: #93B4F4;
        --accent: #0B7A6D;
        --accent-hover: #0E8C7D;
        --accent-soft: #10332F;
        --danger: #F2837A;
        --danger-soft: #3A1A1C;
        --warning: #F0C35A;
        --warning-soft: #372B10;
        --success: #5FD3A0;
        --success-soft: #11322A;
        --info-soft: #172640;
        --orange: #FFA95C;
        --orange-soft: #3A2616;
        --focus: #4FD1BF;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0D1220;
    --surface: #151C2C;
    --surface-2: #1A2234;
    --surface-3: #212B40;
    --border: #283248;
    --border-strong: #37435D;
    --text: #E6EAF2;
    --muted: #9BA5B9;
    --primary: #3D69C2;
    --primary-hover: #4C78D0;
    --primary-soft: #1D2A46;
    --link: #93B4F4;
    --accent: #0B7A6D;
    --accent-hover: #0E8C7D;
    --accent-soft: #10332F;
    --danger: #F2837A;
    --danger-soft: #3A1A1C;
    --warning: #F0C35A;
    --warning-soft: #372B10;
    --success: #5FD3A0;
    --success-soft: #11322A;
    --info-soft: #172640;
    --orange: #FFA95C;
    --orange-soft: #3A2616;
    --focus: #4FD1BF;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

/* ── Base ─────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; min-height: 100vh; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1 { font-size: 1.55rem; margin: 0 0 .15rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1.02rem; margin: 0 0 .9rem; }
h4 { margin: 0 0 .5rem; font-size: .95rem; }
p { margin: 0 0 .7rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-3); padding: .08em .35em; border-radius: 5px; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.break { word-break: break-all; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; background: var(--primary); color: var(--on-primary); padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.js-only { display: none !important; }
.js .js-only { display: revert !important; }
.js .no-js-save { display: none; }
.inline { display: inline; }
svg.ico { flex: none; vertical-align: middle; }

/* ── Controls ─────────────────────────────────────────────────────────────────── */
label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
    width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); padding: .35rem .7rem; border-radius: 8px; margin-right: .6rem; cursor: pointer; }
input[type=color] { width: 42px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; flex: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea, [aria-invalid=true] { border-color: var(--danger) !important; }
.help { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; font-weight: 400; }
.error-text { display: block; color: var(--danger); font-size: .82rem; font-weight: 600; margin-top: .25rem; }
.error-text:empty { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2;
    padding: .55rem 1rem; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); color: #fff; }
.btn-danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: transparent; }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: .35rem .7rem; min-height: 32px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-link, .btn.btn-link { background: none; border: none; color: var(--link); padding: .2rem 0; min-height: 0; text-decoration: underline; font: inherit; cursor: pointer; }
.icon-only { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-only:hover { background: var(--surface-3); color: var(--text); }
.icon-only.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Switch */
.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 500; margin: 0; min-height: 36px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); transition: background .2s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch.small .slider { width: 34px; height: 20px; }
.switch.small .slider::after { width: 14px; height: 14px; }
.switch.small input:checked + .slider::after { transform: translateX(14px); }
.switch-label { font-size: .92rem; }

/* ── Shell ────────────────────────────────────────────────────────────────────── */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 0 1.1rem; height: var(--topbar-h); border-bottom: 1px solid var(--border); flex: none; }
.brand-link { display: flex; align-items: center; border-radius: 8px; }
.brand-logo { height: 36px; width: auto; display: block; }
:root[data-theme="dark"] .brand-logo { background: #fff; border-radius: 8px; padding: 3px 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { background: #fff; border-radius: 8px; padding: 3px 6px; } }
.brand-sub { font-weight: 700; font-size: .78rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; border-left: 2px solid var(--border); padding-left: .6rem; }
.side-nav { flex: 1; overflow-y: auto; padding: .8rem .7rem 1rem; }
.side-group { margin: 1rem .6rem .35rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-link { position: relative; display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; font-size: .93rem; }
.side-link svg { color: var(--muted); }
.side-link:hover { background: var(--surface-3); color: var(--text); }
.side-link.active { background: var(--primary-soft); color: var(--link); font-weight: 650; }
.side-link.active svg { color: var(--link); }
.side-link.active::before { content: ""; position: absolute; left: -.7rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.side-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.back-link { color: var(--muted); font-size: .88rem; }
.side-app { display: flex; align-items: center; gap: .7rem; padding: .7rem; margin: .3rem 0 .2rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.side-app-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-app-text strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-app-text small { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-app-link span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot { display: flex; flex-direction: column; gap: .45rem; padding: .6rem .7rem .75rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .74rem; }
.side-foot-meta { padding: 0 .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 35; }

.main-col { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .6rem; padding: 0 1.4rem;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-spacer { flex: 1; }
.hamburger { display: none; }
.content { padding: 1.6rem clamp(1rem, 2vw, 2rem); flex: 1; width: 100%; max-width: 2200px; margin: 0 auto; }
.content:focus { outline: none; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .35rem .6rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; min-height: 40px; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { background: var(--surface-2); }
.dropdown[open] > summary { border-color: var(--accent); }
.switcher-name { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 50; }
.menu-right { left: auto; right: 0; min-width: 200px; }
.menu-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.menu-item small { display: block; color: var(--muted); font-size: .74rem; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); color: var(--text); }
.menu-item.current { background: var(--primary-soft); }
.menu-item.accent { color: var(--accent); font-weight: 650; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: .3rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.user-menu > summary { padding: .25rem .6rem .25rem .3rem; }
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .when-dark { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle .when-light { display: none; }
}
.theme-toggle.floating { position: fixed; top: 1rem; right: 1rem; background: var(--surface); border-color: var(--border); }

.save-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; color: var(--success); padding: .3rem .7rem; border-radius: 999px; background: var(--success-soft); white-space: nowrap; }
.save-status[data-state="saving"] { color: var(--muted); background: var(--surface-3); }
.save-status[data-state="dirty"] { color: var(--warning); background: var(--warning-soft); }
.save-status[data-state="error"] { color: var(--danger); background: var(--danger-soft); }
.save-status:not([data-state="saved"]) svg { display: none; }
.save-status[data-state="saving"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.save-status[data-state="error"]::before, .save-status[data-state="dirty"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ── Alerts & badges ─────────────────────────────────────────────────────────── */
.flashes:empty { display: none; }
.flashes { display: grid; gap: .6rem; margin-bottom: 1.2rem; }
.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem 1rem; border-radius: 12px; border: 1px solid transparent; font-size: .92rem; margin-bottom: .6rem; }
.flashes .alert { margin: 0; }
.alert > svg { margin-top: 1px; }
.alert > span { flex: 1; }
.alert-close { width: 28px; height: 28px; margin: -.2rem -.4rem -.2rem 0; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--text); border-color: var(--border); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-failed { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-running, .badge-preparing { background: var(--info-soft); color: var(--link); }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--primary-soft); color: var(--link); font-size: .74rem; font-weight: 650; }

/* ── Layout helpers ──────────────────────────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head p { margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.8rem 0 .9rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.search { max-width: 260px; }
.row, .row-end { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack-sm { display: flex; flex-direction: column; gap: .35rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.2rem; }
.stack-lg > .card { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1.2rem; align-items: start; }
.two-col > .card { margin: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.2rem; align-items: start; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow-sm); margin-bottom: 1.2rem; }
.card h3 { display: flex; align-items: center; gap: .5rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.info-card { background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); }

/* Stats */
.content-editor .stats { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.content-editor .stat { padding: .9rem 1rem; gap: .8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.stat > div { display: flex; flex-direction: column; min-width: 0; }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.c-navy { background: var(--primary-soft); color: var(--link); }
.c-teal { background: var(--accent-soft); color: var(--accent); }
.c-green { background: var(--success-soft); color: var(--success); }
.c-orange { background: var(--orange-soft); color: var(--orange); }
:root[data-theme="dark"] .c-teal { color: #4FD1BF; }
.stat-num { font-size: 1.9rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.stat-num.sm { font-size: 1.15rem; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-sub { font-weight: 650; }
.score-ring { --v: 0; width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--surface-3) 0); }
.score-ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 750; font-size: .95rem; }

/* App cards */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s, border-color .2s; }
.app-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.app-card-main { display: flex; gap: .9rem; padding: 1.1rem 1.2rem .6rem; text-decoration: none; color: var(--text); align-items: center; }
.app-card-text { display: flex; flex-direction: column; min-width: 0; }
.app-card-text strong { font-size: 1.05rem; }
.app-card-text small { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tags { display: flex; gap: .35rem; flex-wrap: wrap; padding: 0 1.2rem .6rem; min-height: 1.4rem; }
.app-card-foot { display: flex; align-items: center; gap: .5rem; padding: .7rem 1.2rem; border-top: 1px solid var(--border); margin-top: auto; }
.app-card-foot .btn { margin-left: auto; }
.app-icon { width: 56px; height: 56px; border-radius: 14px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.app-icon img { width: 80%; height: 80%; object-fit: contain; }
.app-icon.lg { width: 72px; height: 72px; border-radius: 18px; }
.app-icon.sm { width: 40px; height: 40px; border-radius: 11px; }
.app-icon.xs { width: 26px; height: 26px; border-radius: 7px; }
.empty { text-align: center; padding: 3rem 1rem; }
.empty img { margin-bottom: .6rem; }

/* Modal */
.modal { border: none; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(8, 12, 24, .55); backdrop-filter: blur(2px); }
.modal > form { padding: 1.4rem 1.5rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; }
.modal-foot { margin-top: .6rem; padding-top: 1rem; border-top: 1px solid var(--border); }
dialog[open]:not(:modal) { position: fixed; top: 8vh; z-index: 60; margin: 0 auto; }
.wizard-steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.wizard-steps li { flex: 1; padding: .35rem .6rem; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-size: .8rem; font-weight: 650; counter-increment: s; }
.wizard-steps li::before { content: counter(s) ". "; }
.wizard-steps li.active { background: var(--primary-soft); color: var(--link); }
.input-group { display: flex; gap: .5rem; }
.input-group input { flex: 1; }
.wizard-found { display: flex; gap: 1rem; align-items: center; padding: .9rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }

/* Settings */
.checks, .checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.checks li, .checklist li { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem .3rem; border-bottom: 1px dashed var(--border); }
.checks li:last-child, .checklist li:last-child { border-bottom: 0; }
.checklist li { align-items: center; }
.checks .mark, .checklist .mark { display: grid; }
.ok .mark { color: var(--success); }
.bad .mark { color: var(--danger); }
.warn .mark { color: var(--warning); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }

/* ── Editor ───────────────────────────────────────────────────────────────────── */
.content-editor { max-width: none; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.6rem; align-items: start; }
.editor-main { min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.3rem; }
.panel-head p { margin: 0; }
.panel-head .badge { margin-left: auto; }
.panel-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; flex: none; box-shadow: var(--shadow); }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem 1.3rem; }
.field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-bool { padding: .1rem 0; }
.color-row { display: flex; gap: .5rem; }
.color-row input[type=text] { max-width: 140px; text-transform: uppercase; }
.panel-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.contrast-box:empty { display: none; }

/* Icon picker */
.icon-pick { display: inline-flex; }
.icon-btn { width: 42px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-popover { position: absolute; z-index: 80; width: 336px; max-width: calc(100vw - 1rem); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .7rem; }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .25rem; max-height: 260px; overflow-y: auto; margin-top: .5rem; }
.icon-cell { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text); cursor: pointer; padding: 0; }
.icon-cell span { display: none; }
.icon-cell:hover, .icon-cell:focus-visible { background: var(--primary-soft); color: var(--link); }
.icon-cell.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* List editors */
.list-editor { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: .6rem; }
.list-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.list-row { display: flex; align-items: flex-start; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem; }
.list-row.dragging { opacity: .45; }
.list-row.drag-over { border-color: var(--accent); box-shadow: 0 -3px 0 var(--accent); }
.drag-handle { cursor: grab; color: var(--muted); padding: .55rem .15rem; user-select: none; letter-spacing: -2px; font-weight: 700; }
.row-fields { display: flex; gap: .5rem; flex: 1; min-width: 0; flex-wrap: wrap; }
.row-fields.column { flex-direction: column; }
.row-field { min-width: 120px; flex: 0 1 180px; }
.row-field.grow { flex: 1 1 220px; }
.row-fields.column .row-field { flex: none; width: 100%; }
.row-tools { display: flex; gap: 0; flex: none; }
.row-tools .icon-only { width: 32px; height: 38px; }
.list-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.list-empty { margin: .4rem .3rem; }
.list-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; align-items: center; }
.list-chips > span { font-size: .78rem; color: var(--muted); margin-right: .2rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.slide-media { display: flex; flex-direction: column; gap: .4rem; align-items: center; }
.slide-thumb { width: 42px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.image-field { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.image-field input { flex: 1; min-width: 160px; }
.image-field .error-text { width: 100%; }

/* Upload cards */
.upload-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.upload-card { display: flex; gap: 1.2rem; align-items: flex-start; }
.upload-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); flex: none; }
.upload-thumb.tall { height: 160px; }
.notif-preview { width: 64px; height: 64px; border-radius: 50%; background: #5F6368; display: grid; place-items: center; flex: none; }
.notif-preview img { width: 36px; height: 36px; filter: brightness(0) invert(1); }
.icon-card { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; }
.icon-previews { display: flex; gap: 1rem; }
.launcher { width: 84px; height: 84px; display: grid; place-items: center; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.launcher img { width: 54%; }
.launcher.circle { border-radius: 50%; }
.launcher.squircle { border-radius: 30%; }
.launcher.rounded { border-radius: 18%; }

/* Presets */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.preset { display: flex; flex-direction: column; gap: .4rem; padding: .5rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; text-align: left; transition: border-color .15s, transform .1s; }
.preset:hover { border-color: var(--accent); transform: translateY(-1px); }
.preset.applied { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.preset-swatch { display: flex; height: 34px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.preset-swatch span { flex: 1; background: var(--surface-3); }
.preset-swatch span:first-child { flex: 2; }
.preset-name { font-size: .8rem; font-weight: 650; }

/* Overview */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.qa-form { display: contents; }
.qa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; min-height: 92px; padding: .7rem .4rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .82rem; font-weight: 650; text-align: center; text-decoration: none; cursor: pointer; }
.qa svg { color: var(--accent); }
.qa:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.mini-list li { display: flex; align-items: center; gap: .6rem; }

/* Lists, code, tables */
.steps { margin: 0 0 1rem; padding-left: 1.3rem; }
.steps li { margin-bottom: .35rem; }
.hint-list { margin: .6rem 0 0; padding-left: 1.2rem; }
.hint-list li { margin-bottom: .3rem; }
.perm-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.code, .log { font-family: var(--mono); font-size: .8rem; background: #0F1629; color: #D7E0F2; border-radius: 10px; padding: .9rem 1rem; overflow: auto; margin: 0 0 .8rem; }
.code.wrap { white-space: pre-wrap; word-break: break-all; }
.log { max-height: 460px; white-space: pre-wrap; word-break: break-word; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 650; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.files a { margin-right: .5rem; white-space: nowrap; }
.build-buttons { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
details > summary { cursor: pointer; font-weight: 650; }
.danger-zone > summary { color: var(--danger); }
.danger-zone[open] > summary { margin-bottom: .8rem; }
details.danger-zone:not(.card) { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.progress-indeterminate { height: 4px; border-radius: 4px; overflow: hidden; background: var(--surface-3); position: relative; margin: .4rem 0 .8rem; }
.progress-indeterminate::after { content: ""; position: absolute; inset: 0 60% 0 0; background: var(--accent); animation: indet 1.2s ease-in-out infinite; border-radius: 4px; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Phone preview ─────────────────────────────────────────────────────────────── */
.preview { position: sticky; top: calc(var(--topbar-h) + 1rem); display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.preview-head { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; }
.preview-toggles { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.chip-toggle { display: inline-flex; align-items: center; margin: 0; cursor: pointer; font-weight: 600; font-size: .8rem; }
.chip-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-toggle span { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.chip-toggle input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-toggle input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.preview-close { display: none; }
.preview-fab { display: none; }

.phone { --pv-tb: #203F76; --pv-tb2: #203F76; --pv-tf: #fff; --pv-pc: #018274; --pv-bg: #F7F8FC; --pv-text: #1A1B20; --pv-line: #DDE2EC; --pv-primary: #203F76; --pv-secondary: #018274;
    --pv-fab-bg: #018274; --pv-fab-fg: #fff; --pv-dh-bg: #203F76; --pv-dh-bg2: #203F76; --pv-dh-fg: #fff; --pv-sp: #fff; --pv-sp2: #fff; --pv-sp-title: #203F76; --pv-status-fg: #fff;
    width: 300px; padding: 10px; border-radius: 42px; background: #111318; box-shadow: var(--shadow-lg), inset 0 0 0 2px #2A2D35; }
.phone-screen { position: relative; height: 610px; border-radius: 33px; overflow: hidden; background: var(--pv-bg); color: var(--pv-text); display: flex; flex-direction: column; font-size: 12px; }
.pv-status { height: 26px; flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; font-size: 11px; font-weight: 600; color: var(--pv-status-fg); background: var(--pv-tb); }
.phone.gradient .pv-status { background: linear-gradient(90deg, var(--pv-tb), var(--pv-tb2)); }
.pv-toolbar { height: 50px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: var(--pv-tb); color: var(--pv-tf); position: relative; }
.phone.gradient .pv-toolbar { background: linear-gradient(90deg, var(--pv-tb), var(--pv-tb2)); }
.pv-left { width: 32px; height: 32px; border: 0; background: none; color: inherit; display: grid; place-items: center; border-radius: 50%; padding: 0; cursor: pointer; }
.pv-left:empty { display: none; }
.pv-left:hover { background: rgba(255, 255, 255, .15); }
.pv-logo { width: 26px; height: 26px; border-radius: 6px; background: #fff; object-fit: contain; padding: 2px; }
.pv-title { flex: 1; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.phone.align-center .pv-title { text-align: center; position: absolute; left: 60px; right: 60px; padding: 0; }
.phone.align-center .pv-right { margin-left: auto; }
.pv-right { display: flex; gap: 2px; }
.pv-right svg { width: 20px; height: 20px; margin: 0 4px; }
.pv-more { font-size: 18px; font-weight: 700; padding: 0 6px; }
.phone.no-toolbar .pv-toolbar, .phone.no-toolbar .pv-tabs { display: none; }
.phone.fullscreen .pv-status { display: none; }
.pv-tabs { display: none; flex: none; height: 38px; background: var(--pv-tb); color: var(--pv-tf); overflow: hidden; white-space: nowrap; }
.phone.gradient .pv-tabs { background: linear-gradient(90deg, var(--pv-tb), var(--pv-tb2)); }
.phone.has-tabs .pv-tabs { display: flex; }
.pv-tabs span { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; opacity: .75; border-bottom: 3px solid transparent; }
.pv-tabs span:first-child { opacity: 1; border-color: currentColor; }
.pv-progress { height: 3px; flex: none; background: transparent; position: relative; overflow: hidden; }
.pv-progress span { position: absolute; inset: 0 45% 0 0; background: var(--pv-pc); }
.phone:not(.prog-linear):not(.prog-both) .pv-progress span { display: none; }
.pv-spinner { position: absolute; top: 40%; left: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--pv-pc) 25%, transparent); border-top-color: var(--pv-pc); animation: spin 1s linear infinite; display: none; }
.phone.prog-circular .pv-spinner, .phone.prog-both .pv-spinner { display: block; }
.pv-web { flex: 1; overflow: hidden; position: relative; }
.pv-site { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pv-site-host { font-size: 10px; color: color-mix(in srgb, var(--pv-text) 55%, transparent); }
.pv-hero { height: 90px; border-radius: 12px; background: linear-gradient(135deg, var(--pv-primary), var(--pv-secondary)); opacity: .85; }
.pv-line { height: 9px; border-radius: 5px; background: var(--pv-line); }
.w90 { width: 90%; } .w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; }
.pv-cards { display: flex; gap: 8px; }
.pv-cards span { flex: 1; height: 60px; border-radius: 10px; background: var(--pv-line); }
.pv-banner { display: none; flex: none; height: 34px; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #5F6368; background: repeating-linear-gradient(45deg, #FFF7D6, #FFF7D6 8px, #FFEFB0 8px, #FFEFB0 16px); border-top: 1px solid #E8D98F; border-bottom: 1px solid #E8D98F; }
.phone.banner-top .pv-banner[data-pv-banner="top"], .phone.banner-bottom .pv-banner[data-pv-banner="bottom"] { display: flex; }
.pv-bottom { display: none; flex: none; height: 56px; background: var(--pv-bg); border-top: 1px solid var(--pv-line); align-items: stretch; }
.phone.has-bottom .pv-bottom { display: flex; }
.pv-bottom span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 9.5px; color: color-mix(in srgb, var(--pv-text) 65%, transparent); min-width: 0; }
.pv-bottom span b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.pv-bottom span.on { color: var(--pv-primary); }
.pv-bottom span.on svg { background: color-mix(in srgb, var(--pv-primary) 16%, transparent); border-radius: 12px; padding: 2px 12px; width: 44px; box-sizing: content-box; }
.pv-navbar { height: 30px; flex: none; display: flex; justify-content: space-around; align-items: center; background: var(--pv-bg); border-top: 1px solid var(--pv-line); }
.pv-navbar button { width: 48px; height: 26px; border: 0; border-radius: 13px; background: none; color: color-mix(in srgb, var(--pv-text) 60%, transparent); font-size: 15px; line-height: 1; cursor: pointer; }
.pv-navbar button:hover { background: color-mix(in srgb, var(--pv-text) 10%, transparent); color: var(--pv-text); }
.pv-fab { position: absolute; bottom: 30px; right: 16px; display: none; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 3; }
.phone.has-bottom .pv-fab { bottom: 86px; }
.phone.fab-on .pv-fab { display: flex; }
.phone.fab-start .pv-fab { right: auto; left: 16px; align-items: flex-start; }
.phone.fab-center .pv-fab { right: 50%; transform: translateX(50%); align-items: center; }
.pv-fab-btn { width: 52px; height: 52px; border-radius: 16px; border: 0; background: var(--pv-fab-bg); color: var(--pv-fab-fg); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); cursor: pointer; padding: 0; transition: transform .2s; }
.pv-dial { display: none; flex-direction: column; gap: 8px; align-items: inherit; }
.phone.fab-open .pv-dial { display: flex; }
.pv-dial span { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.phone.fab-start .pv-dial span { flex-direction: row-reverse; }
.pv-dial b { background: var(--pv-bg); color: var(--pv-text); padding: 3px 8px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); font-weight: 600; }
.pv-dial i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--pv-bg); color: var(--pv-fab-bg); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.pv-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 5; }
.pv-drawer { position: absolute; top: 0; bottom: 0; left: 0; width: 78%; background: var(--pv-bg); transform: translateX(-102%); transition: transform .25s; z-index: 6; display: flex; flex-direction: column; border-radius: 0 16px 16px 0; overflow: hidden; }
.phone.drawer-open .pv-drawer { transform: none; }
.phone.drawer-open .pv-scrim { opacity: 1; pointer-events: auto; }
.pv-drawer-head { padding: 40px 16px 16px; background: linear-gradient(135deg, var(--pv-dh-bg), var(--pv-dh-bg2)); color: var(--pv-dh-fg); display: flex; flex-direction: column; gap: 3px; }
.pv-drawer-head img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 4px; margin-bottom: 6px; object-fit: contain; }
.pv-drawer-head strong { font-size: 14px; }
.pv-drawer-head small { opacity: .85; font-size: 11px; }
.pv-drawer ul { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.pv-drawer li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 24px; font-size: 12.5px; font-weight: 500; }
.pv-drawer li:first-child { background: color-mix(in srgb, var(--pv-primary) 14%, transparent); color: var(--pv-primary); }
.pv-drawer li svg { width: 20px; height: 20px; opacity: .85; }
.pv-splash, .pv-walk, .pv-exit { position: absolute; inset: 0; display: none; z-index: 10; }
.phone.splash .pv-splash { display: flex; }
.pv-splash { flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--pv-sp); }
.phone.splash-gradient .pv-splash { background: linear-gradient(180deg, var(--pv-sp), var(--pv-sp2)); }
.pv-splash-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-splash-icon { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.pv-splash-icon img { width: 100%; height: 100%; object-fit: contain; }
.phone.splash-system .pv-splash-icon { width: 110px; height: 110px; border-radius: 50%; background: var(--pv-icon-bg, #fff); overflow: hidden; }
.phone.splash-system .pv-splash-icon img { width: 60%; height: 60%; }
.pv-splash-title { position: relative; font-size: 18px; color: var(--pv-sp-title); }
.phone.walk .pv-walk { display: flex; }
.pv-walk { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 30px 22px 20px; background: var(--pv-bg); }
.pv-walk-media { width: 170px; height: 170px; border-radius: 24px; display: grid; place-items: center; background: color-mix(in srgb, var(--pv-primary) 12%, transparent); color: var(--pv-primary); overflow: hidden; }
.pv-walk-media svg { width: 84px; height: 84px; }
.pv-walk-media img { width: 100%; height: 100%; object-fit: cover; }
.pv-walk strong { font-size: 17px; }
.pv-walk p { margin: 0; font-size: 12px; opacity: .75; min-height: 2.6em; }
.pv-walk-dots { display: flex; gap: 6px; margin-top: auto; }
.pv-walk-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pv-line); cursor: pointer; }
.pv-walk-dots i.on { background: var(--pv-primary); width: 18px; border-radius: 4px; }
.pv-walk-btns { display: flex; justify-content: space-between; align-items: center; width: 100%; font-weight: 600; font-size: 12px; color: var(--pv-primary); }
.pv-walk-next { background: var(--pv-primary); color: #fff; padding: 7px 16px; border-radius: 18px; cursor: pointer; }
.phone.exit .pv-exit { display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .35); }
.phone.exit.exit-toast .pv-exit { background: transparent; align-items: flex-end; padding-bottom: 60px; }
.pv-dialog { width: 82%; background: var(--pv-bg); color: var(--pv-text); border-radius: 22px; padding: 18px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.pv-dialog strong { font-size: 15px; }
.pv-dialog p { margin: 8px 0 14px; opacity: .8; }
.pv-dialog-btns { display: flex; justify-content: flex-end; gap: 16px; font-weight: 700; color: var(--pv-primary); }
.pv-toast { background: #323232; color: #fff; padding: 8px 14px; border-radius: 18px; font-size: 11.5px; display: none; }
.phone.exit-toast .pv-toast { display: block; }
.phone.exit-toast .pv-dialog, .phone.exit-none .pv-exit { display: none; }
.phone.dark { --pv-bg: #121318; --pv-text: #E3E2E9; --pv-line: #2A2C35; }

/* ── Auth pages ────────────────────────────────────────────────────────────────── */
body.bare { background: radial-gradient(1200px 600px at 10% -10%, var(--primary-soft), transparent), radial-gradient(900px 500px at 110% 110%, var(--accent-soft), transparent), var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin-top: .8rem; }
.auth-logo { display: block; width: 88px; height: 88px; border-radius: 20px; }

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 1199px) {
    .editor { grid-template-columns: minmax(0, 1fr); }
    .preview { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(380px, 100vw); padding: 1rem; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow-y: auto; transform: translateX(105%); transition: transform .25s; justify-content: flex-start; }
    .preview.open { transform: none; }
    .preview-close { display: inline-grid; }
    .preview-fab { display: inline-flex; position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 25; border-radius: 999px; box-shadow: var(--shadow-lg); }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 959px) {
    .sidebar { transform: translateX(-102%); transition: transform .25s; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .main-col { margin-left: 0; }
    .hamburger { display: inline-grid; }
    .content { padding: 1.1rem; }
    .topbar { padding: 0 .8rem; gap: .4rem; }
}
@media (max-width: 640px) {
    .hide-sm { display: none; }
    .switcher-name { max-width: 110px; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .list-row { flex-wrap: wrap; }
    .row-tools { margin-left: auto; }
    .kv { grid-template-columns: 1fr; }
    .panel-icon { width: 42px; height: 42px; }
    .stat-num { font-size: 1.5rem; }
    .save-status span { display: none; }
    .topbar .btn { padding: .5rem .6rem; }
}
@media (max-width: 480px) {
    .app-switcher .switcher-name { display: none; }
    .topbar { gap: .25rem; }
    .user-menu > summary { padding: .2rem; border: 0; }
    .upload-card { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ── Hidden scrollbars (content still scrolls with wheel, touch and keyboard) ─── */
html, body, .side-nav, .main-col, .content, .preview, .menu, .icon-grid, .pv-drawer ul, dialog, .modal {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar, .side-nav::-webkit-scrollbar, .main-col::-webkit-scrollbar,
.content::-webkit-scrollbar, .preview::-webkit-scrollbar, .menu::-webkit-scrollbar, .icon-grid::-webkit-scrollbar,
.pv-drawer ul::-webkit-scrollbar, dialog::-webkit-scrollbar, .modal::-webkit-scrollbar { display: none; width: 0; height: 0; }
.side-nav { overscroll-behavior: contain; }

/* ── Drag & drop upload zones ───────────────────────────────────────────────── */
.dz-input { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; clip: rect(0 0 0 0); }
.dropzone { position: relative; display: grid; justify-items: center; gap: .3rem; width: 100%; min-width: 240px; padding: 1.1rem 1rem; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.dz-over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); transform: scale(1.01); }
.dropzone.dz-busy { cursor: progress; opacity: .85; }
.dz-icon { color: var(--accent); line-height: 0; }
.dz-text { color: var(--text); font-size: .92rem; }
.dz-browse { color: var(--link); text-decoration: underline; font-weight: 600; }
.dz-hint { font-size: .78rem; }
.dz-file { display: flex; align-items: center; gap: .6rem; margin-top: .3rem; padding: .35rem .6rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .82rem; max-width: 100%; }
.dz-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-file img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; flex: none; }
.dz-progress { width: 100%; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: .3rem; }
.dz-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .2s; }
.upload-form.dz-auto { display: block; flex: 1 1 auto; width: 100%; min-width: 240px; }
.stack > .upload-form.dz-auto, .upload-card .upload-form.dz-auto { flex: none; }
.upload-card > .stack { flex: 1; min-width: 0; }
[data-walk-drop] { border-radius: 10px; padding: 4px; border: 2px dashed transparent; transition: border-color .15s, background .15s; }
[data-walk-drop].dz-over { border-color: var(--accent); background: var(--accent-soft); }

/* ── SweetAlert2 (brand + light/dark) ─────────────────────────────────────── */
.swal2-container { z-index: 2000; }
.swal2-container.swal2-backdrop-show { background: rgba(8, 12, 24, .5); }
.swal2-popup.ab-swal { background: var(--surface); color: var(--text); border-radius: 18px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-family: var(--font); padding: 1.4rem 1.4rem 1.2rem; }
.ab-swal .swal2-title { color: var(--text); font-size: 1.35rem; font-weight: 700; }
.ab-swal .swal2-html-container { color: var(--muted); font-size: .98rem; line-height: 1.5; }
.ab-swal .ab-swal-sep { border: 0; border-top: 1px solid var(--border); margin: .6rem 0; }
.ab-swal .ab-swal-actions { gap: .6rem; margin-top: 1.1rem; }
.ab-swal .ab-swal-actions .btn { min-width: 110px; }
.ab-swal .swal2-timer-progress-bar { background: var(--accent); }
.ab-swal .swal2-icon.swal2-success { border-color: var(--success); color: var(--success); }
.ab-swal .swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: var(--success); }
.ab-swal .swal2-icon.swal2-success .swal2-success-ring { border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.ab-swal .swal2-icon.swal2-success .swal2-success-circular-line-left,
.ab-swal .swal2-icon.swal2-success .swal2-success-circular-line-right,
.ab-swal .swal2-icon.swal2-success .swal2-success-fix { background-color: var(--surface); }
.swal2-popup.ab-swal-toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 12px; }
.ab-swal-toast .swal2-title { color: var(--text); font-size: .92rem; font-weight: 600; }
.ab-swal-toast .swal2-timer-progress-bar { background: var(--accent); }


/* ── Live, navigable preview ─────────────────────────────────────────────────── */
.pv-frame { position: absolute; top: 0; left: 0; width: 390px; border: 0; transform-origin: 0 0; background: #fff; z-index: 1; }
.phone.live .pv-site { visibility: hidden; }
.phone.live:not(.loading) .pv-spinner { display: none !important; }
.pv-spinner { z-index: 2; }
.phone.live:not(.loading) .pv-progress span { opacity: 0; }
.phone.live.loading .pv-progress span { inset: 0 auto 0 0; width: 40%; animation: pvIndet 1.1s ease-in-out infinite; }
.pv-note { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 3; background: rgba(20, 24, 40, .9); color: #fff; font-size: 10.5px; line-height: 1.4; padding: 8px 10px; border-radius: 10px; }
.pv-toast-web { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.pv-toast-web.show { display: block; }
.pv-bottom span, .pv-tabs span, .pv-drawer li, .pv-right svg, .pv-dial span, .pv-left, .pv-fab-btn { cursor: pointer; }
.pv-tabs span.on { box-shadow: inset 0 -3px 0 var(--pv-tf); opacity: 1; }
.pv-drawer li.on { background: color-mix(in srgb, var(--pv-primary) 14%, transparent); color: var(--pv-primary); border-radius: 22px; }
.pv-right svg:hover, .pv-left:hover { opacity: .75; }
@keyframes pvIndet { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ── Splash animation + loader preview ───────────────────────────────────────── */
.pv-splash { --pv-anim-ms: 900ms; --pv-timer: 2500ms; }
.phone:not(.splash-system) .pv-splash-icon { width: var(--pv-logo, 100px); height: var(--pv-logo, 100px); }
.pv-splash.play.anim-fade .pv-splash-icon { animation: pvFade var(--pv-anim-ms) ease-out both; }
.pv-splash.play.anim-zoom .pv-splash-icon { animation: pvZoom var(--pv-anim-ms) cubic-bezier(.34, 1.56, .64, 1) both; }
.pv-splash.play.anim-bounce .pv-splash-icon { animation: pvBounce var(--pv-anim-ms) linear both; }
.pv-splash.play.anim-slide_up .pv-splash-icon { animation: pvSlideUp var(--pv-anim-ms) cubic-bezier(.16, 1, .3, 1) both; }
.pv-splash.play.anim-rotate .pv-splash-icon { animation: pvRotate var(--pv-anim-ms) cubic-bezier(.16, 1, .3, 1) both; }
.pv-splash.play.anim-flip .pv-splash-icon { animation: pvFlip var(--pv-anim-ms) cubic-bezier(.16, 1, .3, 1) both; }
.pv-splash.play.anim-pulse .pv-splash-icon { animation: pvFade .4s ease-out both, pvPulse calc(var(--pv-anim-ms) / 2) ease-in-out .4s infinite alternate; }
.pv-splash.play.anim-heartbeat .pv-splash-icon { animation: pvFade .4s ease-out both, pvHeart max(var(--pv-anim-ms), 600ms) ease-in-out .4s infinite; }
.pv-splash.play:not(.anim-none) .pv-splash-title { animation: pvTitle .5s ease-out both; animation-delay: min(calc(var(--pv-anim-ms) * .6), 1.2s); }
.pv-sp-bottom { position: absolute; left: 0; right: 0; bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.phone.splash-system .pv-sp-bottom, .phone.splash-system .pv-replay { display: none; }
.pv-sp-bar { display: none; width: 112px; height: 5px; border-radius: 4px; background: rgba(0, 0, 0, .12); overflow: hidden; }
.pv-sp-bar span { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--pv-loader); }
.pv-splash.loader-bar_timer .pv-sp-bar, .pv-splash.loader-bar .pv-sp-bar { display: block; }
.pv-splash.play.loader-bar_timer .pv-sp-bar span { animation: pvTimer var(--pv-timer) linear forwards; }
.pv-splash.loader-bar .pv-sp-bar span { width: 40%; animation: pvIndet 1.2s ease-in-out infinite; }
.pv-sp-spin { display: none; width: 24px; height: 24px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--pv-loader) 22%, transparent); border-top-color: var(--pv-loader); animation: pvSpin .8s linear infinite; }
.pv-splash.loader-spinner .pv-sp-spin { display: block; }
.pv-sp-dots { display: none; gap: 5px; height: 14px; align-items: center; }
.pv-splash.loader-dots .pv-sp-dots { display: flex; }
.pv-sp-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pv-loader); animation: pvDot .42s ease-in-out infinite alternate; }
.pv-sp-dots i:nth-child(2) { animation-delay: .14s; }
.pv-sp-dots i:nth-child(3) { animation-delay: .28s; }
.pv-sp-pct { display: none; font-size: 10px; font-weight: 600; color: var(--pv-loader); }
.pv-splash.show-pct .pv-sp-pct { display: block; }
.pv-sp-footer { font-size: 12px; font-weight: 700; color: var(--pv-footer); margin-top: 6px; text-align: center; padding: 0 12px; }
.pv-sp-footer:empty { display: none; }
.pv-replay { position: absolute; top: 34px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; font-size: 15px; cursor: pointer; z-index: 2; }
@keyframes pvFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pvZoom { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes pvBounce { 0% { opacity: 0; transform: translateY(-180px); } 40% { opacity: 1; transform: translateY(0); } 55% { transform: translateY(-40px); } 70% { transform: translateY(0); } 82% { transform: translateY(-12px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes pvSlideUp { from { opacity: 0; transform: translateY(90px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pvRotate { from { opacity: 0; transform: rotate(-270deg) scale(.4); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes pvFlip { from { opacity: 0; transform: perspective(600px) rotateY(90deg); } to { opacity: 1; transform: perspective(600px) rotateY(0); } }
@keyframes pvPulse { from { transform: scale(1); } to { transform: scale(1.1); } }
@keyframes pvHeart { 0%, 28%, 70%, 100% { transform: scale(1); } 14% { transform: scale(1.16); } 42% { transform: scale(1.12); } }
@keyframes pvTitle { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pvTimer { from { width: 0; } to { width: 100%; } }
@keyframes pvSpin { to { transform: rotate(360deg); } }
@keyframes pvDot { from { transform: translateY(0); opacity: .35; } to { transform: translateY(-6px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pv-splash *, .pv-splash { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ── Exit dialog styles (preview) ────────────────────────────────────────────── */
.pv-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pv-exit-icon { display: none; line-height: 0; color: var(--pv-text); }
.phone.exit-modern .pv-exit-icon, .phone.exit-sheet .pv-exit-icon { display: inline-flex; }
.phone.exit-modern .pv-dialog, .phone.exit-sheet .pv-dialog { border-radius: 22px; padding: 18px 18px 16px; }
.phone.exit-modern .pv-dialog-head strong, .phone.exit-sheet .pv-dialog-head strong { font-size: 18px; font-weight: 500; color: color-mix(in srgb, var(--pv-text) 62%, transparent); }
.phone.exit-modern .pv-dialog p, .phone.exit-sheet .pv-dialog p { font-size: 13.5px; font-weight: 500; opacity: 1; margin: 6px 0 18px; }
.phone.exit-modern .pv-dialog-btns, .phone.exit-sheet .pv-dialog-btns { justify-content: stretch; gap: 12px; }
.pv-dialog-btns span { cursor: pointer; }
.phone.exit-modern .pv-dialog-btns span, .phone.exit-sheet .pv-dialog-btns span { flex: 1; text-align: center; padding: 11px 0; border-radius: 12px; font-size: 13px; font-weight: 600; }
.phone.exit-modern [data-pv-exit-no], .phone.exit-sheet [data-pv-exit-no] { background: color-mix(in srgb, var(--pv-text) 4%, var(--pv-bg)); color: color-mix(in srgb, var(--pv-text) 55%, transparent); box-shadow: 0 3px 8px rgba(0, 0, 0, .16); }
.phone.exit-modern [data-pv-exit-yes], .phone.exit-sheet [data-pv-exit-yes] { background: var(--pv-exit-accent); color: var(--pv-exit-on); box-shadow: 0 3px 8px color-mix(in srgb, var(--pv-exit-accent) 40%, transparent); }
.phone.exit.exit-sheet .pv-exit { align-items: flex-end; }
.phone.exit-sheet .pv-dialog { width: calc(100% - 16px); margin-bottom: 38px; }
.phone.exit-modern .pv-dialog { width: 88%; }

/* Save buttons */
.section-save { position: sticky; bottom: 0; z-index: 5; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; margin-top: 1.2rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-save kbd { font-family: var(--mono); font-size: .75rem; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-2); }

/* Database setup screen */
.auth-card.wide { width: min(560px, 100%); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: .8rem; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }


/* ── Sidebar accordion + mini (icon rail with hover flyouts) ──────────────────── */
.brand-mark { display: none; width: 36px; height: 36px; border-radius: 10px; }
.side-accordion { display: grid; gap: 4px; margin-top: .5rem; }
.side-sec { border-radius: 12px; }
.side-sec-head { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; cursor: pointer;
    font-size: .74rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); transition: background .15s, color .15s; }
.side-sec-head:hover { background: var(--surface-3); color: var(--text); }
.side-sec-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.side-sec-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--muted); flex: none; transition: background .15s, color .15s; }
.side-sec-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-sec-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); font-size: .68rem; letter-spacing: 0; display: inline-grid; place-items: center; }
.side-sec-chev { display: inline-grid; transition: transform .2s ease; transform: rotate(-90deg); }
.side-sec.open > .side-sec-head { color: var(--text); }
.side-sec.open > .side-sec-head .side-sec-chev { transform: none; }
.side-sec.has-active > .side-sec-head .side-sec-ico, .side-sec.open > .side-sec-head .side-sec-ico { background: var(--primary-soft); color: var(--link); }
.side-sec-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.side-sec.open > .side-sec-body { grid-template-rows: 1fr; }
.side-sec-inner { min-height: 0; overflow: hidden; }
.side-sec-inner .side-list { padding: 2px 0 6px 1.1rem; margin-left: .95rem; border-left: 1px dashed var(--border-strong); }
.side-sec-inner .side-link.active::before { left: calc(-1.1rem - 2px); }
.side-fly-title { display: none; }
.side-collapse { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .7rem; width: 100%; padding: .5rem .7rem; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: .88rem; font-weight: 600; }
.side-collapse:hover { background: var(--surface-3); color: var(--text); }
.side-collapse:focus-visible { outline: 2px solid var(--focus); }
.side-collapse-ico { display: inline-grid; transition: transform .2s; }
.sidebar, .main-col { transition: width .2s ease, margin-left .2s ease; }

@media (min-width: 960px) {
    :root.sb-mini { --sidebar-w: 76px; }
    .sb-mini .sidebar-brand { justify-content: center; padding: 0; }
    .sb-mini .brand-logo, .sb-mini .brand-sub, .sb-mini .side-foot-meta, .sb-mini .side-collapse-text,
    .sb-mini .side-sec-label, .sb-mini .side-sec-count, .sb-mini .side-sec-chev,
    .sb-mini .side-nav > .side-link > span, .sb-mini .side-nav > .side-list .side-link > span:not(.app-icon), .sb-mini .side-group,
    .sb-mini .side-app-text { display: none; }
    .sb-mini .brand-mark { display: block; }
    .sb-mini .side-nav { padding: .7rem .6rem 1rem; }
    .sb-mini .side-link, .sb-mini .side-collapse, .sb-mini .side-sec-head { justify-content: center; padding: .55rem 0; }
    .sb-mini .side-app { justify-content: center; padding: .45rem 0; background: none; border: 0; }
    .sb-mini .side-collapse-ico { transform: rotate(180deg); }
    .sb-mini .side-link.active::before { left: -.6rem; }
    .sb-mini .side-sec-ico { width: 40px; height: 40px; border-radius: 12px; }
    .sb-mini .side-sec:hover .side-sec-ico, .sb-mini .side-sec.fly .side-sec-ico { background: var(--accent); color: #fff; }
    /* Flyout: the group's own list, lifted out beside the rail */
    .sb-mini .side-sec-body { display: none; position: fixed; left: calc(var(--sidebar-w) - 6px); top: var(--fly-top, 80px); z-index: 60; padding-left: 12px; }
    .sb-mini .side-sec.fly > .side-sec-body { display: block; animation: flyIn .14s ease-out; }
    .sb-mini .side-sec-inner { overflow: visible; min-width: 230px; max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .45rem; scrollbar-width: none; }
    .sb-mini .side-sec-inner::-webkit-scrollbar { display: none; }
    .sb-mini .side-fly-title { display: block; margin: .25rem .6rem .4rem; font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
    .sb-mini .side-sec-inner .side-list { padding: 0; margin: 0; border: 0; }
    .sb-mini .side-sec-inner .side-link { justify-content: flex-start; padding: .55rem .7rem; }
    .sb-mini .side-sec-inner .side-link > span { display: inline; }
    .sb-mini .side-sec-inner .side-link .side-badge[hidden] { display: none; }
    .sb-mini .side-sec-inner .side-link.active::before { display: none; }
}
@keyframes flyIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 959px) { .side-collapse { display: none; } }

/* ── Group tabs (sub-pages of the current menu group, above each panel) ───────── */
.group-tabs { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; align-items: center; gap: .75rem; margin: -.4rem 0 1.2rem; padding: .45rem .5rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.group-tabs-label { flex: none; padding: .3rem .7rem; border-radius: 9px; background: var(--primary-soft); color: var(--link); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.group-tabs-track { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; min-width: 0; }
.group-tabs-track::-webkit-scrollbar { display: none; }
.group-tab { position: relative; flex: none; display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.group-tab svg { opacity: .8; }
.group-tab:hover { background: var(--surface-3); color: var(--text); }
.group-tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.group-tab.active svg { opacity: 1; }
.group-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.group-tab .side-badge { margin-left: .1rem; }
@media (max-width: 640px) { .group-tabs-label { display: none; } .group-tabs { margin-left: -.3rem; margin-right: -.3rem; } }
.group-tabs-track.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px); mask-image: linear-gradient(90deg, transparent, #000 28px); }
.group-tabs-track.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.group-tabs-track.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.push-actions { width: 1%; white-space: nowrap; }
.push-actions .inline { display: block; margin: 0 0 .35rem; }
.push-actions .btn { width: 100%; justify-content: center; }
.push-actions small { white-space: normal; display: block; min-width: 110px; }
.push-img-check { display: flex; align-items: center; gap: .7rem; margin-top: .45rem; padding: .55rem .7rem; border-radius: 10px; font-size: .85rem; border: 1px solid var(--border); background: var(--surface-2); }
.push-img-check img { width: 96px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.push-img-check.is-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.push-img-check.is-bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.push-img-check.is-warn { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.push-img-check.is-busy { color: var(--muted); }

/* ── Download progress ─────────────────────────────────────────────────────────── */
.dl-progress { display: grid; gap: .6rem; margin-top: .4rem; }
.dl-bar { height: 10px; border-radius: 999px; background: var(--surface-3, #e9edf3); overflow: hidden; }
.dl-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .15s linear; }
.dl-bar.indeterminate i { width: 40% !important; animation: dlSlide 1.1s ease-in-out infinite; }
@keyframes dlSlide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.dl-text { margin: 0; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
a.is-loading { opacity: .7; pointer-events: none; cursor: progress; }

/* ── Notification history (full width under editor + preview) ─────────────────── */
.push-history { min-width: 0; margin-top: 1.6rem; }
.push-history[hidden] { display: none; }
.ph-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.ph-head h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .2rem; }
.ph-head p { margin: 0; }
.ph-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ph-filters select { width: auto; min-width: 140px; }
.ph-range { position: relative; display: flex; align-items: center; min-width: 290px; }
.ph-range svg { position: absolute; left: .7rem; color: var(--muted); pointer-events: none; }
.ph-filters .ph-range input { padding-left: 2.4rem !important; cursor: pointer; background: var(--surface); }
.ph-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .8rem; }
.ph-stat { padding: .3rem .75rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .84rem; color: var(--muted); }
.ph-stat b { color: var(--text); margin-right: .2rem; }
.ph-stat.ok b { color: var(--success); }
.ph-stat.bad b { color: var(--danger); }
.ph-table-wrap { overflow-x: auto; scrollbar-width: thin; }
.ph-loading { margin: .6rem 0 0; }
table.ph-table { width: 100% !important; }
.ph-table th, .ph-table td { vertical-align: top; }
.ph-table td.ph-sn, .ph-table th.ph-sn { text-align: center !important; width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ph-table td.ph-when { white-space: nowrap; }
.ph-table td.ph-title { min-width: 180px; }
.ph-table td.ph-body { min-width: 220px; max-width: 360px; }
.ph-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .88rem; }
.ph-table td.ph-link { white-space: nowrap; }
.ph-table td.ph-result { max-width: 220px; }
.ph-table td.ph-actions { width: 44px; text-align: center; }
.ph-dots { all: unset; box-sizing: border-box; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }
.ph-dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.ph-dots:hover, .ph-dots[aria-expanded="true"] { background: var(--surface-3); }
.ph-dots:focus-visible { outline: 2px solid var(--focus); }
.ph-detail { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
.ph-detail th { width: 110px; padding: .45rem .5rem; color: var(--muted); font-weight: 600; vertical-align: top; }
.ph-detail td { padding: .45rem .5rem; word-break: break-word; }
.ph-detail tr + tr { border-top: 1px solid var(--border); }

/* Floating three-dot menu with sub-menus */
.ph-menu { position: fixed; z-index: 1200; }
.ph-menu ul { list-style: none; margin: 0; padding: .35rem; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: flyIn .12s ease-out; }
.ph-menu li { position: relative; }
.ph-mi { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border-radius: 8px; cursor: pointer; font-size: .9rem; color: var(--text); white-space: nowrap; }
.ph-mi > :first-child { width: 1.2rem; text-align: center; }
.ph-mi:hover, .ph-mi:focus-visible { background: var(--surface-3); outline: none; }
.ph-mi[disabled] { opacity: .45; cursor: not-allowed; background: none; }
.ph-mi.danger { color: var(--danger); }
.ph-mi.danger:hover { background: var(--danger-soft); }
.ph-caret { margin-left: auto; color: var(--muted); }
.ph-sep { height: 1px; margin: .3rem .2rem; background: var(--border); }
.ph-sub { position: absolute; top: -.4rem; left: calc(100% - 4px); display: none; }
.ph-menu.flip .ph-sub { left: auto; right: calc(100% - 4px); }
.ph-menu li:hover > .ph-sub, .ph-menu li:focus-within > .ph-sub, .ph-menu li.open > .ph-sub { display: block; }

/* DataTables → builder theme (light + dark) */
.push-history .dt-container { color: var(--text); font-size: .92rem; }
.push-history .dt-container .dt-layout-row { margin: .6rem 0; }
.push-history .dt-search input, .push-history .dt-length select { border: 1px solid var(--border-strong) !important; border-radius: 9px !important; background: var(--surface) !important; color: var(--text) !important; padding: .45rem .7rem !important; }
.push-history .dt-search input { min-width: 260px; }
.push-history .dt-search label { display: none; }
.push-history .dt-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
.push-history div.dt-buttons > .dt-button, .push-history .dt-button { margin: 0 !important; padding: .45rem .9rem !important; border-radius: 9px !important; border: 1px solid var(--border-strong) !important; background: var(--surface) !important; color: var(--text) !important; font-weight: 600; font-size: .86rem; box-shadow: none !important; }
.push-history .dt-button:hover { background: var(--surface-3) !important; }
.push-history table.dataTable { border-collapse: collapse; }
.push-history table.dataTable thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border) !important; background: var(--surface-2); padding: .65rem .6rem; }
.push-history table.dataTable tbody td { padding: .7rem .6rem; border-top: 1px solid var(--border) !important; }
.push-history table.dataTable > tbody > tr { background: transparent !important; }
.push-history table.dataTable > tbody > tr > * { box-shadow: none !important; }
.push-history table.dataTable.hover > tbody > tr:hover > *, .push-history table.dataTable > tbody > tr:hover > * { background: var(--surface-2); }
.push-history .dt-paging .dt-paging-button { border-radius: 8px !important; border: 1px solid transparent !important; color: var(--text) !important; background: transparent !important; }
.push-history .dt-paging .dt-paging-button.current { background: var(--accent) !important; color: #fff !important; }
.push-history .dt-paging .dt-paging-button:hover:not(.disabled):not(.current) { background: var(--surface-3) !important; }
.push-history .dt-paging .dt-paging-button.disabled { opacity: .4; }
.push-history .dt-info { color: var(--muted); }
div.dt-button-info { background: var(--surface) !important; color: var(--text) !important; border-radius: 12px !important; border: 1px solid var(--border) !important; }

/* Date range picker → builder theme */
.daterangepicker { font-family: var(--font); background: var(--surface); border-color: var(--border); color: var(--text); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 1300; }
.daterangepicker::before, .daterangepicker::after { display: none; }
.daterangepicker .calendar-table { background: var(--surface); border-color: var(--surface); }
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span { border-color: var(--text); }
.daterangepicker td.available:hover, .daterangepicker th.available:hover { background: var(--surface-3); }
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date { background: transparent; color: var(--muted); opacity: .5; }
.daterangepicker td.in-range { background: var(--primary-soft); color: var(--text); }
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--accent); color: #fff; }
.daterangepicker td.disabled { color: var(--muted); opacity: .35; }
.daterangepicker select.monthselect, .daterangepicker select.yearselect { background: var(--surface); color: var(--text); border-color: var(--border); }
.daterangepicker .ranges li { border-radius: 8px; margin: 2px 6px; }
.daterangepicker .ranges li:hover { background: var(--surface-3); }
.daterangepicker .ranges li.active { background: var(--accent); color: #fff; }
.daterangepicker .drp-buttons { border-top-color: var(--border); }
.daterangepicker .drp-buttons .btn { font: inherit; padding: .4rem .9rem; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.daterangepicker .drp-buttons .btn.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.daterangepicker.show-ranges.ltr .drp-calendar.left { border-left-color: var(--border); }
@media (max-width: 640px) { .ph-range { min-width: 0; flex: 1 1 100%; } .push-history .dt-search input { min-width: 0; width: 100%; } }

/* ── Notification image row (upload + URL) ────────────────────────────────────── */
.push-image-row .label { display: block; font-weight: 600; margin-bottom: .45rem; }
.pi-grid { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.pi-drop { min-height: 190px; justify-content: center; align-content: center; }
.pi-drop[hidden] { display: none; }
.pi-drop strong { color: var(--text); }
.pi-preview { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.pi-preview[hidden] { display: none; }
.pi-preview img { display: block; width: 100%; max-height: 240px; object-fit: contain; }
.pi-img-wrap { position: relative; }
.pi-del { all: unset; box-sizing: border-box; position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
    background: rgba(12, 16, 28, .55); color: #fff; font-weight: 700; opacity: 0; cursor: pointer; transition: opacity .15s; }
.pi-del svg { width: 34px; height: 34px; padding: 6px; border-radius: 50%; background: var(--danger); }
.pi-preview:hover .pi-del, .pi-del:focus-visible { opacity: 1; }
@media (hover: none) { .pi-del { opacity: 1; inset: auto 8px auto auto; top: 8px; background: none; } .pi-del span { display: none; } }
.pi-meta { padding: .45rem .7rem; background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); }
.pi-url label { display: block; font-weight: 600; margin-bottom: .45rem; }
.pi-url .help { display: block; margin-top: .5rem; }
@media (max-width: 900px) { .pi-grid { grid-template-columns: 1fr; } }
.ph-table-wrap { overflow: visible; }
.push-history .dt-layout-table { overflow-x: auto; scrollbar-width: thin; }
.push-history .dt-layout-row:not(.dt-layout-table) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.push-history .dt-length { display: flex; align-items: center; gap: .5rem; }
.push-history .dt-length label { color: var(--muted); font-size: .88rem; }
.ph-table th.ph-sn .dt-column-order { display: none; }
.ph-table .ph-when, .ph-table th.ph-when { text-align: left !important; }
.ph-table th.ph-when .dt-column-header { flex-direction: row !important; }
.push-history .dt-length label { white-space: nowrap; }

/* ── Settings › GitHub & cPanel ─────────────────────────────────────────────── */
.deploy-card h3 { margin: 1.3rem 0 .6rem; font-size: 1.02rem; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .8rem; font-weight: 700; flex: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice-card { display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: .9rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s, background .15s, box-shadow .15s; }
.choice:hover .choice-card { border-color: var(--border-strong); }
.choice input:checked + .choice-card { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow-sm); }
.choice input:focus-visible + .choice-card { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input:disabled + .choice-card { opacity: .65; cursor: not-allowed; }
.choice-title { display: flex; align-items: center; gap: .45rem; font-weight: 700; flex-wrap: wrap; }
.choice-text { color: var(--muted); font-size: .88rem; }
.gh-fields { border: 0; padding: 0; margin: 0; min-width: 0; transition: opacity .2s; }
.deploy-card:has(input[name=build_driver][value=local]:checked) .gh-fields { opacity: .55; }
.deploy-card .input-group { display: flex; gap: .4rem; align-items: stretch; }
.deploy-card .input-group input { flex: 1; min-width: 0; }
.deploy-card .inline { display: inline-flex; align-items: center; gap: .4rem; margin-top: .3rem; font-weight: 400; }
.deploy-card .inline input { width: auto; }
.deploy-card .row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.test-results { margin-top: 1rem; padding: .4rem 1rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.test-results h3 { margin-top: .6rem; }
.howto { margin-top: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem; background: var(--surface-2); }
.howto summary { cursor: pointer; font-weight: 650; }
.howto ol { margin: .6rem 0 .2rem; padding-left: 1.2rem; display: grid; gap: .4rem; }
@media (max-width: 760px) { .deploy-card .grid-3 { grid-template-columns: 1fr; } }
.deploy-card label > input, .deploy-card .input-group input, .choice-text, .deploy-card .help { font-weight: 400; }

/* ── Settings tabs ──────────────────────────────────────────────────────────── */
.settings-tabs .tab-bar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; gap: .25rem; overflow-x: auto; overscroll-behavior-x: contain;
    margin: 0 0 1.3rem; padding: .35rem .35rem 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); scrollbar-width: none; }
.settings-tabs .tab-bar::-webkit-scrollbar { display: none; }
.settings-tabs .tab { position: relative; display: inline-flex; align-items: center; gap: .5rem; flex: none; padding: .75rem 1.05rem; margin-bottom: -1px;
    color: var(--muted); font-weight: 650; text-decoration: none; white-space: nowrap; border-radius: 10px 10px 0 0; border-bottom: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s; }
.settings-tabs .tab:hover { color: var(--text); background: var(--surface-3); }
.settings-tabs .tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.settings-tabs .tab.active { color: var(--primary); background: var(--surface); border-bottom-color: var(--primary); }
.settings-tabs .tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--surface); }
.settings-tabs .tab-panel { animation: tab-in .18s ease-out; }
.settings-tabs .tab-panel > .card:last-child, .settings-tabs .tab-panel > form.card:last-child { margin-bottom: 0; }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .settings-tabs .tab-panel { animation: none; } }
@media (max-width: 760px) { .settings-tabs .tab { padding: .65rem .8rem; } .settings-tabs .tab span:not(.tab-dot) { font-size: .9rem; } }

/* Sticky save bar: the Save button stays on screen while a settings form is being edited. */
.form-savebar { position: sticky; bottom: 0; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    margin: .9rem -1.4rem -1.3rem; padding: .8rem 1.4rem; background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(8px); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.deploy-card form .form-savebar { margin: 1rem -1.4rem 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.save-hint { display: inline-flex; align-items: center; gap: .35rem; color: var(--warning); font-weight: 650; font-size: .88rem; }
form.is-dirty .form-savebar { box-shadow: 0 -6px 18px rgba(20, 32, 60, .08); }
form.is-dirty .form-savebar .btn-primary { animation: save-pulse 1.6s ease-in-out 2; }
@keyframes save-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { form.is-dirty .form-savebar .btn-primary { animation: none; } }
