:root {
  --rail-width: 82px;
  --header-height: 76px;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --surface-0: color-mix(in srgb, var(--bg) 84%, #05080e);
  --surface-1: color-mix(in srgb, var(--card) 87%, var(--bg));
  --surface-2: color-mix(in srgb, var(--card) 67%, var(--bg));
  --surface-3: color-mix(in srgb, var(--primary) 7%, var(--card));
  --line: color-mix(in srgb, var(--border) 76%, transparent);
  --line-strong: color-mix(in srgb, var(--primary) 34%, var(--border));
  --muted: var(--text-sec);
  --positive: #25c58c;
  --warning: #e9b14d;
  --danger: #ef6b73;
  --shadow: 0 20px 45px rgba(0, 0, 0, .22);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, .13);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body.app-body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  color: var(--text); background: var(--surface-0);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.app-body::before { content: ""; position: fixed; inset: 0; z-index: -3; pointer-events: none; background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 70%, #060a10) 0%, var(--bg) 34%, color-mix(in srgb, var(--bg) 82%, #101722) 100%); }
.app-grid { position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .36; background-image: linear-gradient(color-mix(in srgb, var(--border) 28%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--border) 28%, transparent) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(to bottom, #000, transparent 82%); }
::selection { color: var(--text); background: color-mix(in srgb, var(--primary) 42%, transparent); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .52; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.hidden { display: none !important; }

/* Application frame */
.studio-shell { min-height: 100vh; }
.command-rail {
  position: fixed; inset: 0 auto 0 0; z-index: 56; display: flex; flex-direction: column;
  width: var(--rail-width); padding: 17px 12px 14px; border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-0) 92%, #05080e); box-shadow: 14px 0 36px rgba(0,0,0,.16);
}
.rail-brand { position: relative; display: grid; width: 56px; height: 56px; place-items: center; margin: 0 auto 22px; border: 1px solid color-mix(in srgb, var(--primary) 42%, var(--line)); border-radius: 15px; background: linear-gradient(145deg, color-mix(in srgb,var(--primary) 18%,var(--surface-1)), var(--surface-1)); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), var(--shadow-soft); }
.rail-brand-mark { display:grid; width:32px; height:32px; place-items:center; color:#fff; border-radius:10px; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 7px 15px color-mix(in srgb, var(--primary) 28%, transparent); }
.rail-brand-mark i { font-size: 12px; transform: translateX(1px); }
.rail-brand-mark img { width:100%; height:100%; object-fit:cover; border-radius:inherit; display:block; }
.rail-brand-pulse { position:absolute; right:7px; bottom:7px; width:8px; height:8px; border-radius:99px; border:2px solid var(--surface-1); background:var(--positive); }
.rail-nav { display:flex; flex:1; flex-direction:column; align-items:center; gap: 10px; overflow-y:auto; scrollbar-width:none; }
.rail-nav::-webkit-scrollbar { display:none; }
.rail-group { display:grid; gap:7px; width:100%; }
.rail-caption { display:none; }
.rail-separator { width:28px; height:1px; margin:5px 0 3px; background: var(--line); }
.rail-link { position:relative; display:grid; width:56px; height:50px; place-items:center; margin:0 auto; color:color-mix(in srgb,var(--muted) 92%,transparent); border:1px solid transparent; border-radius:13px; background:transparent; transition:transform .17s ease, background .17s ease, color .17s ease, border-color .17s ease; }
.rail-link i { font-size:16px; }
.rail-link span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.rail-link:hover { color: var(--text); transform: translateY(-1px); background: color-mix(in srgb, var(--surface-1) 85%, var(--primary) 8%); border-color:var(--line); }
.rail-link.active { color:#fff; background: linear-gradient(145deg, var(--primary), var(--secondary)); border-color: color-mix(in srgb, var(--primary) 60%, transparent); box-shadow:0 10px 18px color-mix(in srgb,var(--primary) 22%,transparent); }
.rail-link::after { content: attr(data-tooltip); position:absolute; left:66px; top:50%; z-index:90; padding:6px 8px; color:var(--text); background:var(--surface-1); border:1px solid var(--line); border-radius:7px; box-shadow:var(--shadow-soft); font-size:11px; font-weight:750; letter-spacing:.01em; white-space:nowrap; opacity:0; pointer-events:none; transform:translate(-4px,-50%); transition:opacity .14s ease, transform .14s ease; }
.rail-link:hover::after { opacity:1; transform:translate(0,-50%); }
.rail-foot { display:grid; justify-items:center; gap:6px; padding-top:13px; border-top:1px solid var(--line); }
.rail-online-dot, .status-signal { display:inline-block; width:7px; height:7px; border-radius:99px; background:var(--positive); box-shadow:0 0 0 3px color-mix(in srgb,var(--positive) 15%,transparent); }
.rail-foot-label { color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }

.studio-stage { min-height:100vh; margin-left:var(--rail-width); }
.studio-header { position:sticky; top:0; z-index:40; display:flex; align-items:center; justify-content:space-between; min-height:var(--header-height); padding: 0 clamp(20px,3.1vw,44px); border-bottom:1px solid var(--line); background:color-mix(in srgb,var(--surface-0) 93%,transparent); backdrop-filter:blur(14px); }
.header-start, .header-actions { display:flex; align-items:center; gap:14px; min-width:0; }
.page-identity { display:grid; min-width:0; gap:2px; }
.page-kicker { color:color-mix(in srgb,var(--muted) 88%,transparent); font-size:9px; font-weight:850; letter-spacing:.14em; line-height:1.1; text-transform:uppercase; }
.page-identity strong { overflow:hidden; color:var(--text); font-size:16px; font-weight:800; letter-spacing:-.02em; text-overflow:ellipsis; white-space:nowrap; }
.header-icon { display:grid; width:38px; height:38px; place-items:center; border:1px solid var(--line); border-radius:11px; color:var(--text); background:var(--surface-1); box-shadow:inset 0 1px rgba(255,255,255,.04); }
.header-icon:hover { background:var(--surface-3); border-color:var(--line-strong); }
.mobile-only { display:none; }
.header-status { display:inline-flex; align-items:center; gap:8px; min-height:36px; padding:0 10px; color:var(--muted); border:1px solid var(--line); border-radius:11px; background:var(--surface-2); font-size:11px; font-weight:750; }
.profile-trigger { display:flex; align-items:center; gap:8px; min-height:38px; padding:3px 8px 3px 4px; color:var(--text); border:1px solid var(--line); border-radius:12px; background:var(--surface-1); box-shadow:inset 0 1px rgba(255,255,255,.04); }
.profile-trigger > i { color:var(--muted); font-size:10px; }
.profile-avatar { display:grid; flex:0 0 auto; width:29px; height:29px; place-items:center; color:#fff; border-radius:9px; background:linear-gradient(135deg,var(--primary),var(--secondary)); font-size:11px; font-weight:850; }
.profile-avatar.large { width:38px; height:38px; border-radius:11px; font-size:13px; }
.profile-name { max-width:120px; overflow:hidden; font-size:12px; font-weight:780; text-overflow:ellipsis; white-space:nowrap; }
.user-menu-wrap { position:relative; }
.profile-popover { position:absolute; top:calc(100% + 10px); right:0; z-index:85; width:min(318px,calc(100vw - 28px)); padding:12px; opacity:0; pointer-events:none; transform:translateY(-7px); border:1px solid var(--line); border-radius:15px; background:var(--surface-1); box-shadow:var(--shadow); transition:opacity .16s ease, transform .16s ease; }
.profile-popover.is-open { opacity:1; pointer-events:auto; transform:translateY(0); }
.profile-popover-head { display:flex; align-items:center; gap:10px; padding:5px 5px 13px; border-bottom:1px solid var(--line); }
.profile-popover-head strong { display:block; font-size:13px; }
.profile-popover-head small { display:flex; align-items:center; gap:7px; margin-top:4px; color:var(--muted); font-size:10px; font-weight:700; }
.appearance-control { display:grid; gap:7px; padding:13px 5px; border-bottom:1px solid var(--line); }
.appearance-control label { color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.1em; text-transform:uppercase; }
.select-field { position:relative; }
.select-field select { width:100%; padding:10px 32px 10px 11px; color:var(--text); border:1px solid var(--line); border-radius:10px; appearance:none; background:var(--surface-2); outline:none; }
.select-field i { position:absolute; top:50%; right:12px; color:var(--muted); pointer-events:none; font-size:11px; transform:translateY(-50%); }
.profile-menu-link { display:flex; align-items:center; gap:10px; min-height:39px; padding:0 8px; color:var(--text); border-radius:9px; font-size:12px; font-weight:720; }
.profile-menu-link:hover { background:var(--surface-3); }
.profile-menu-link i { width:16px; color:var(--muted); text-align:center; }
.profile-menu-link.danger { margin-top:4px; color:var(--danger); }
.profile-menu-link.danger i { color:var(--danger); }

.studio-main { width:min(1560px,100%); margin:0 auto; padding:clamp(22px,3vw,44px); }
.studio-footer { display:flex; justify-content:space-between; gap:16px; padding:16px clamp(20px,3.1vw,44px) 24px; color:var(--muted); border-top:1px solid color-mix(in srgb,var(--line) 66%,transparent); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }

/* Common new surface system */
.studio-page, .page-shell, .settings-shell, .access-shell, .subs-shell, .catalog-page { width:100%; }
.page-topline { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:22px; }
.page-topline > div:first-child { min-width:0; }
.page-overline { display:flex; align-items:center; gap:8px; color:var(--primary); font-size:10px; font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
.page-overline i { font-size:11px; }
.page-title { margin:7px 0 0; color:var(--text); font-size:clamp(26px,3vw,38px); font-weight:850; letter-spacing:-.048em; line-height:1.05; }
.page-subtitle { max-width:720px; margin:9px 0 0; color:var(--muted); font-size:13px; line-height:1.6; }
.surface, .glass-panel, .glass-card, .section-panel, .tool-card, .page-hero, .settings-card, .catalog-card, .modal-glass, dialog .glass-panel, .table-shell { border:1px solid var(--line) !important; border-radius:var(--radius-xl) !important; background:var(--surface-1) !important; box-shadow:inset 0 1px rgba(255,255,255,.025), var(--shadow-soft); }
.surface-pad { padding:clamp(16px,2.4vw,28px); }
.section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; margin-bottom:16px; }
.section-heading h2, .section-heading h3 { margin:0; color:var(--text); font-size:16px; font-weight:800; letter-spacing:-.02em; }
.section-heading p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.metric-card, .stat-card, .stat-box { position:relative; min-width:0; padding:16px; overflow:hidden; border:1px solid var(--line); border-radius:var(--radius-lg); background:linear-gradient(145deg,var(--surface-2),color-mix(in srgb,var(--surface-1) 87%,var(--primary) 3%)); }
.metric-card::after, .stat-card::after { content:""; position:absolute; right:-26px; bottom:-31px; width:86px; height:86px; border:1px solid color-mix(in srgb,var(--primary) 26%,transparent); border-radius:99px; }
.metric-icon { display:grid; width:34px; height:34px; place-items:center; margin-bottom:14px; color:var(--primary); border-radius:10px; background:color-mix(in srgb,var(--primary) 13%,transparent); }
.metric-card .metric-label, .stat-label, .stat-box .l { color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.105em; text-transform:uppercase; }
.metric-card .metric-value, .stat-value, .stat-box .v { margin-top:4px; color:var(--text); font-size:20px; font-weight:850; letter-spacing:-.035em; }
.metric-note { margin-top:2px; color:var(--muted); font-size:10px; }

/* Forms and controls */
label, .field-label, .s-label, .modal-field label { color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.09em; text-transform:uppercase; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select, .glass-input, .glass-select, .field-input, .field-select, .s-input {
  width:100%; min-height:42px; color:var(--text) !important; border:1px solid var(--line) !important; border-radius:10px !important; background:var(--surface-2) !important; box-shadow:inset 0 1px rgba(255,255,255,.02) !important; outline:none; transition:border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
textarea { min-height:112px; padding:11px 12px; resize:vertical; }
input:not([type="checkbox"]):not([type="radio"]), select, .glass-input, .glass-select, .field-input, .field-select, .s-input { padding:0 12px; }
input:focus, textarea:focus, select:focus, .glass-input:focus, .glass-select:focus, .field-input:focus, .s-input:focus { border-color:var(--line-strong) !important; box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 14%,transparent) !important; background:color-mix(in srgb,var(--surface-2) 91%,var(--primary) 4%) !important; }
input::placeholder, textarea::placeholder { color:color-mix(in srgb,var(--muted) 78%,transparent) !important; opacity:1; }
input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus { -webkit-text-fill-color:var(--text)!important; box-shadow:0 0 0 1000px var(--surface-2) inset!important; }
button, .btn, .btn-ui, .glass-btn, .action-chip, .mini-tab { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:39px; padding:0 13px; color:var(--text); border:1px solid var(--line); border-radius:10px !important; background:var(--surface-2); font-size:12px; font-weight:800; line-height:1; transition:transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease; }
button:hover, .btn:hover, .btn-ui:hover, .glass-btn:hover, .action-chip:hover, .mini-tab:hover { transform:translateY(-1px); border-color:var(--line-strong); background:var(--surface-3); }
button:active, .btn:active, .btn-ui:active, .glass-btn:active { transform:translateY(0) scale(.985); }
.btn-primary, .glass-btn-primary, .action-chip.primary { color:#fff !important; border-color:color-mix(in srgb,var(--primary) 78%,transparent)!important; background:linear-gradient(135deg,var(--primary),var(--secondary)) !important; box-shadow:0 8px 16px color-mix(in srgb,var(--primary) 22%,transparent); }
.btn-primary:hover, .glass-btn-primary:hover { filter:brightness(1.07); }
.btn-danger, .glass-btn-danger { color:#fff!important; border-color:color-mix(in srgb,var(--danger) 65%,transparent)!important; background:linear-gradient(135deg,var(--danger),color-mix(in srgb,var(--danger) 67%,#9e1f2c))!important; }
.btn-success, .glass-btn-success { color:#fff!important; border-color:color-mix(in srgb,var(--positive) 65%,transparent)!important; background:linear-gradient(135deg,var(--positive),color-mix(in srgb,var(--positive) 64%,#097b53))!important; }
.btn-warning { color:#241b05!important; border-color:color-mix(in srgb,var(--warning) 70%,transparent)!important; background:linear-gradient(135deg,var(--warning),#f4c852)!important; }
.btn-ghost, .glass-btn:not(.glass-btn-primary):not(.glass-btn-success):not(.glass-btn-danger) { background:var(--surface-2)!important; }
.icon-action { display:grid; width:35px; height:35px; min-height:35px; padding:0; place-items:center; }

/* Tables, lists, dialogs */
.table-shell, .desktop-table-wrap { overflow:hidden; }
table { width:100%; border-collapse:collapse; }
thead th { color:var(--muted)!important; background:color-mix(in srgb,var(--surface-2) 88%,var(--primary) 3%); border-bottom:1px solid var(--line)!important; font-size:10px!important; font-weight:850!important; letter-spacing:.095em; text-transform:uppercase; }
tbody td { border-bottom:1px solid color-mix(in srgb,var(--line) 74%,transparent)!important; }
tbody tr:last-child td { border-bottom:0!important; }
tbody tr:hover { background:color-mix(in srgb,var(--primary) 5%,transparent)!important; }
.status-pill, .pill, .badge, .status-chip { display:inline-flex; align-items:center; gap:6px; min-height:23px; padding:0 8px; color:var(--muted); border:1px solid var(--line); border-radius:999px; background:var(--surface-2); font-size:10px; font-weight:850; letter-spacing:.05em; text-transform:uppercase; }
.status-idle { color:var(--muted); }
.status-running, .status-live, .badge-success { color:var(--positive); border-color:color-mix(in srgb,var(--positive) 37%,var(--line)); background:color-mix(in srgb,var(--positive) 9%,var(--surface-2)); }
.status-error, .badge-danger { color:var(--danger); border-color:color-mix(in srgb,var(--danger) 40%,var(--line)); background:color-mix(in srgb,var(--danger) 8%,var(--surface-2)); }
.status-warning, .badge-warning { color:var(--warning); border-color:color-mix(in srgb,var(--warning) 40%,var(--line)); background:color-mix(in srgb,var(--warning) 8%,var(--surface-2)); }
.progress-track { height:7px; overflow:hidden; border:1px solid var(--line); border-radius:99px; background:color-mix(in srgb,var(--surface-0) 76%,var(--card)); }
.progress-fill { position:relative; height:100%; width:0; border-radius:inherit; background:linear-gradient(90deg,var(--primary),var(--accent)); box-shadow:0 0 14px color-mix(in srgb,var(--primary) 50%,transparent); transition:width .24s ease; }
.progress-fill.indeterminate { width:40% !important; background-size:200% 100%; animation:progress-indeterminate 1.2s ease-in-out infinite, progress-shimmer 1.6s linear infinite; }
.progress-fill.indeterminate::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg,transparent,rgba(255,255,255,.22),transparent); animation:progress-shimmer 1.2s linear infinite; }
@keyframes progress-indeterminate { 0% { transform:translateX(-120%); } 100% { transform:translateX(260%); } }
@keyframes progress-shimmer { 0% { background-position:200% 0; } 100% { background-position:-200% 0; } }
.empty-state { border:1px dashed color-mix(in srgb,var(--line) 88%,transparent); border-radius:var(--radius-lg); background:color-mix(in srgb,var(--surface-2) 65%,transparent); color:var(--muted); }
.modal-backdrop, [id$="-modal"].fixed { background:rgba(2,4,8,.76)!important; backdrop-filter:blur(8px); }
.modal-glass, dialog .glass-panel { width:min(560px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:22px; overflow:auto; border-radius:16px!important; background:var(--surface-1)!important; box-shadow:0 28px 70px rgba(0,0,0,.46)!important; }
dialog { color:var(--text); }
dialog::backdrop { background:rgba(2,4,8,.72); backdrop-filter:blur(7px); }

/* Toast */
.toast-container { position:fixed; top:16px; right:16px; z-index:130; display:grid; width:min(360px,calc(100vw - 32px)); gap:9px; pointer-events:none; }
.toast { display:flex; gap:10px; padding:11px; color:var(--text); border:1px solid var(--line); border-radius:13px; background:var(--surface-1); box-shadow:var(--shadow); pointer-events:auto; animation:toast-in .18s ease-out; }
.toast-icon { display:grid; flex:0 0 auto; width:28px; height:28px; place-items:center; color:var(--primary); border-radius:9px; background:color-mix(in srgb,var(--primary) 13%,transparent); }
.toast.success .toast-icon { color:var(--positive); background:color-mix(in srgb,var(--positive) 13%,transparent); }
.toast.error .toast-icon { color:var(--danger); background:color-mix(in srgb,var(--danger) 13%,transparent); }
.toast-copy { display:grid; min-width:0; gap:2px; font-size:12px; }
.toast-copy strong { font-size:12px; font-weight:850; }
.toast-copy span { color:var(--muted); line-height:1.35; }
.toast-leave { animation:toast-out .18s ease-in forwards; }
@keyframes toast-in { from { opacity:0; transform:translateY(-7px); } to { opacity:1; transform:translateY(0); } }
@keyframes toast-out { to { opacity:0; transform:translateY(-7px); } }

/* Login */
.public-shell { display:flex; min-height:100vh; flex-direction:column; }
.public-header { display:flex; align-items:center; justify-content:space-between; min-height:72px; padding:0 clamp(18px,4vw,52px); border-bottom:1px solid var(--line); }
.public-brand { display:flex; align-items:center; gap:10px; }
.public-brand > span:last-child { display:grid; gap:1px; }
.public-brand strong { font-size:14px; letter-spacing:-.025em; }
.public-brand small, .public-secure { color:var(--muted); font-size:10px; font-weight:750; }
.public-secure { display:inline-flex; align-items:center; gap:8px; text-transform:uppercase; letter-spacing:.08em; }
.public-main { display:flex; flex:1; width:min(100%,1100px); margin:0 auto; padding:clamp(32px,7vh,88px) 20px; }

/* Mobile navigation: top menu + side drawer only */
.mobile-panel { display:none; }
.app-overlay { position:fixed; inset:0; z-index:75; pointer-events:none; opacity:0; background:rgba(0,0,0,.55); backdrop-filter:blur(2px); transition:opacity .17s ease; }
.app-overlay.is-visible { opacity:1; pointer-events:auto; }

@media (max-width: 900px) {
  .command-rail { display:none; }
  .studio-stage { margin-left:0; }
  .studio-header { min-height:67px; padding:0 14px; }
  .mobile-only { display:grid; }
  .header-status { display:none; }
  .profile-name, .profile-trigger > i { display:none; }
  .profile-trigger { padding:3px; border-radius:11px; }
  .page-identity strong { font-size:15px; }
  .studio-main { padding:18px 14px 28px; }
  .studio-footer { display:none; }

  .mobile-panel {
    position:fixed; top:0; bottom:0; left:0; z-index:86;
    display:flex; width:min(86vw,348px); flex-direction:column;
    overflow:hidden; opacity:0; pointer-events:none; transform:translateX(-106%);
    border-right:1px solid var(--line); border-radius:0 20px 20px 0;
    background:var(--surface-1); box-shadow:20px 0 52px rgba(0,0,0,.36);
    transition:opacity .2s ease, transform .2s ease;
  }
  .mobile-panel.is-open { opacity:1; pointer-events:auto; transform:translateX(0); }
  .mobile-panel-head { display:flex; align-items:center; justify-content:space-between; min-height:72px; padding:0 14px 0 18px; border-bottom:1px solid var(--line); }
  .mobile-panel-brand { display:flex; align-items:center; gap:10px; color:var(--text); }
  .mobile-panel-brand > span:last-child { display:grid; gap:1px; }
  .mobile-panel-brand strong { font-size:14px; font-weight:850; letter-spacing:-.025em; }
  .mobile-panel-brand small { color:var(--muted); font-size:10px; font-weight:700; }
  .mobile-panel-user { display:flex; align-items:center; gap:11px; margin:14px; padding:12px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); }
  .mobile-panel-user > div { display:grid; gap:2px; min-width:0; }
  .mobile-panel-user strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
  .mobile-panel-user small { display:inline-flex; align-items:center; gap:6px; color:var(--muted); font-size:10px; font-weight:700; }
  .mobile-panel-nav { flex:1; overflow-y:auto; padding:4px 12px 16px; scrollbar-width:thin; }
  .mobile-panel-caption { margin:13px 8px 7px; color:var(--muted); font-size:9px; font-weight:850; letter-spacing:.13em; text-transform:uppercase; }
  .mobile-panel-caption.control-caption { margin-top:19px; }
  .mobile-panel-link { display:flex; align-items:center; min-height:44px; gap:12px; margin:3px 0; padding:0 11px; color:var(--muted); border:1px solid transparent; border-radius:11px; font-size:12px; font-weight:790; }
  .mobile-panel-link i { width:17px; color:var(--primary); font-size:15px; text-align:center; }
  .mobile-panel-link.active { color:var(--text); border-color:var(--line-strong); background:var(--surface-3); }
  .mobile-panel-link.active i { color:var(--text); }
  .mobile-panel-link.danger, .mobile-panel-link.danger i { color:var(--danger); }
  .mobile-panel-foot { padding:10px 12px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); }
}

@media (max-width:640px) {
  .studio-main { padding:15px 10px 24px; }
  .page-topline { align-items:flex-start; flex-direction:column; gap:13px; margin-bottom:17px; }
  .page-title { font-size:27px; }
  .page-subtitle { font-size:12px; }
  .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .metric-card, .stat-card, .stat-box { padding:13px; border-radius:12px; }
  .metric-icon { width:30px; height:30px; margin-bottom:11px; }
  .metric-card .metric-value, .stat-value, .stat-box .v { font-size:18px; }
  .surface-pad { padding:14px; }
  .sheet-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .public-header { min-height:65px; padding:0 16px; }
  .public-secure { display:none; }
  .public-main { padding:30px 14px; }
  .toast-container { top:10px; right:10px; width:calc(100vw - 20px); }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; animation-iteration-count:1!important; }
}

/* v3.5.4 · mobile audit and overlay reliability */
html, body { max-width: 100%; }
body.app-body { min-width: 320px; }
.studio-main, .studio-page, .page-shell, .settings-shell, .access-shell, .subs-shell, .catalog-page,
.studio-main > *, .studio-page > *, .page-shell > *, .settings-shell > *, .access-shell > *, .subs-shell > *, .catalog-page > * { min-width: 0; }
.app-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }
.studio-header.menu-open { z-index: 90; }

@media (max-width: 900px) {
  .profile-popover {
    position: fixed;
    top: 77px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 92px);
    overflow: auto;
  }
  .mobile-panel { padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 640px) {
  body.app-body { font-size: 14px; }
  .studio-header { min-height: 66px; padding: 0 10px; }
  .header-start { gap: 10px; }
  .header-actions { gap: 8px; }
  .header-icon { width: 39px; height: 39px; }
  .page-kicker { font-size: 8px; letter-spacing: .1em; }
  .page-identity strong { font-size: 15px; }
  .profile-trigger { width: 39px; min-width: 39px; height: 39px; justify-content: center; }
  .studio-main { padding: 14px 10px 28px; }
  .page-overline { font-size: 9px; letter-spacing: .1em; }
  .page-title { font-size: 26px; }
  .page-subtitle { line-height: 1.5; }
  .surface, .glass-panel, .glass-card, .section-panel, .tool-card, .page-hero, .settings-card, .catalog-card, .modal-glass, dialog .glass-panel, .table-shell { border-radius: 15px !important; }
}


/* v3.5.7 · helper sheet dialogs and custom choice controls */
.ui-choice-field{position:relative;min-width:0}.ui-choice-select{position:absolute!important;inset:0!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}.ui-choice-trigger{width:100%;min-height:40px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2);color:var(--text);font:inherit;font-size:13px;font-weight:760;box-shadow:inset 0 1px rgba(255,255,255,.02);transition:border-color .18s ease,transform .18s ease,background .18s ease}.ui-choice-trigger:hover{transform:translateY(-1px);border-color:var(--line-strong)}.ui-choice-trigger span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.ui-choice-trigger i{flex:0 0 auto;color:var(--muted);font-size:12px}.app-helper-shell{position:fixed;inset:0;z-index:140;display:none;align-items:flex-end;justify-content:center;padding:12px;background:rgba(5,10,19,.58);backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}.app-helper-shell.is-open{display:flex}.app-helper-card{width:min(560px,100%);max-height:min(86dvh,760px);overflow:auto;border:1px solid var(--line);border-radius:24px;background:var(--surface-1);box-shadow:var(--shadow)}.app-helper-card::-webkit-scrollbar{width:10px}.app-helper-handle{display:none;width:42px;height:4px;border-radius:999px;background:var(--line);margin:10px auto 0}.app-helper-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:18px 18px 10px}.app-helper-head h3{margin:6px 0 0;font-size:24px;line-height:1.08;letter-spacing:-.04em;color:var(--text)}.app-helper-kicker{display:block;color:var(--muted);font-size:10px;font-weight:850;letter-spacing:.14em;text-transform:uppercase}.app-helper-copy{margin:6px 0 0;color:var(--muted);font-size:13px;line-height:1.5}.app-helper-close{display:grid;place-items:center;width:42px;height:42px;border:1px solid var(--line);border-radius:14px;background:var(--surface-2);color:var(--text)}.app-choice-list{display:grid;padding:0 0 10px}.app-choice-item{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:19px 18px;border:0;border-top:1px solid color-mix(in srgb,var(--line) 80%,transparent);background:transparent;color:var(--text);text-align:left;font:inherit}.app-choice-item:first-child{border-top:1px solid color-mix(in srgb,var(--line) 80%,transparent)}.app-choice-item strong{display:block;font-size:16px;font-weight:760;line-height:1.3}.app-choice-item small{display:block;margin-top:3px;color:var(--muted);font-size:12px;line-height:1.4}.app-choice-mark{flex:0 0 auto;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;border:2px solid color-mix(in srgb,var(--text) 70%,transparent);color:transparent}.app-choice-item.is-active .app-choice-mark{border-color:#ffb979;color:#ffb979}.app-confirm-body{padding:0 18px 8px}.app-confirm-body p{margin:0;color:var(--text);font-size:15px;line-height:1.6;word-break:break-word}.app-confirm-note{margin-top:14px;color:var(--muted)!important;font-size:13px!important}.app-confirm-actions{display:flex;justify-content:flex-end;gap:10px;padding:14px 18px 18px}.app-confirm-btn{min-height:44px;padding:0 18px;border:1px solid var(--line);border-radius:14px;background:var(--surface-2);color:var(--text);font:inherit;font-size:14px;font-weight:780}.app-confirm-btn.primary{background:var(--primary);border-color:color-mix(in srgb,var(--primary) 45%,transparent);color:#fff;box-shadow:0 10px 22px color-mix(in srgb,var(--primary) 22%,transparent)}.app-confirm-btn.danger{background:color-mix(in srgb,var(--danger) 11%,transparent);border-color:color-mix(in srgb,var(--danger) 30%,transparent);color:var(--danger)}@media (max-width:640px){.app-helper-shell{padding:0;align-items:flex-end}.app-helper-card{width:100%;max-height:min(88dvh,820px);border-radius:24px 24px 0 0;padding-bottom:calc(14px + env(safe-area-inset-bottom))}.app-helper-handle{display:block}.app-helper-head{padding:14px 16px 8px}.app-helper-head h3{font-size:18px}.app-helper-copy{font-size:12px}.app-choice-item{padding:17px 16px}.app-choice-item strong{font-size:15px}.app-confirm-actions{padding:12px 16px 16px;flex-direction:column-reverse}.app-confirm-btn{width:100%}}


/* v3.5.8 · mobile helper dialog refinements */
.ui-choice-trigger{min-height:44px}.ui-choice-trigger:focus-visible,.app-helper-close:focus-visible,.app-confirm-btn:focus-visible,.app-choice-item:focus-visible{outline:none;border-color:var(--line-strong);box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 15%,transparent)}.app-helper-shell{padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));background:rgba(5,10,19,.72)}.app-helper-card{background:linear-gradient(180deg,color-mix(in srgb,var(--surface-1) 96%,rgba(255,255,255,.015)),color-mix(in srgb,var(--surface-1) 92%,var(--bg)));box-shadow:0 28px 70px rgba(0,0,0,.36);scrollbar-width:thin;color:var(--text)}.app-helper-head{position:sticky;top:0;z-index:2;background:linear-gradient(180deg,color-mix(in srgb,var(--surface-1) 97%,transparent),color-mix(in srgb,var(--surface-1) 88%,transparent));backdrop-filter:blur(8px)}.app-choice-list{padding-bottom:12px}.app-choice-item{min-height:72px}.app-choice-item:hover{background:color-mix(in srgb,var(--surface-2) 82%,var(--primary) 5%)}.app-choice-item.is-active{background:color-mix(in srgb,var(--primary) 8%,var(--surface-1))}.app-choice-mark{width:36px;height:36px;background:color-mix(in srgb,var(--surface-2) 90%,transparent)}.app-choice-item.is-active .app-choice-mark{background:color-mix(in srgb,var(--primary) 9%,transparent)}.app-confirm-body{padding-bottom:12px}.app-confirm-actions{padding-top:0}.app-confirm-btn{min-height:46px}.app-confirm-btn.primary{background:linear-gradient(135deg,var(--primary),var(--secondary))}@media (max-width:640px){.app-helper-shell{padding:0;align-items:flex-end}.app-helper-card{width:100%;max-height:min(82dvh,720px);border-radius:28px 28px 0 0;padding-bottom:calc(18px + env(safe-area-inset-bottom));border-bottom-left-radius:0;border-bottom-right-radius:0}.app-helper-head{padding:16px 16px 10px}.app-helper-close{width:40px;height:40px;border-radius:12px}.app-choice-list{padding-bottom:8px}.app-choice-item{min-height:68px;padding:18px 16px}.app-choice-mark{width:32px;height:32px}.app-confirm-actions{padding:8px 16px 0;display:grid;grid-template-columns:1fr 1fr;gap:10px}.app-confirm-btn{width:100%}}


/* v3.5.9 · force app pickers instead of Android native select sheets */
.ui-choice-select{display:none!important}.ui-choice-field{display:block}.ui-choice-trigger{position:relative;z-index:1}.app-helper-shell{z-index:220}.app-helper-card{border-color:var(--line-strong)}


/* v3.6.0 · one popup language: square-rounded, bottom-center */
.modal-backdrop,
.app-helper-shell,
.subtitle-modal-shell,
.speed-modal {
  align-items:flex-end !important;
  justify-content:center !important;
  padding:0 14px max(14px, env(safe-area-inset-bottom)) !important;
}
.modal-glass,
.app-dialog,
.app-helper-card {
  width:min(580px, calc(100vw - 28px)) !important;
  max-height:min(76dvh, 720px) !important;
  margin:0 !important;
  border-radius:16px !important;
  border:1px solid var(--line-strong) !important;
  box-shadow:0 26px 70px rgba(0,0,0,.44) !important;
}
.app-helper-card { overflow:auto; }
.app-helper-handle,
.dialog-handle { display:none !important; }
.app-helper-head { padding:16px 18px 11px; }
.app-helper-close { border-radius:10px; }
.app-choice-item { min-height:64px; padding:16px 18px; }
.app-confirm-actions { padding:12px 18px 18px; }
.app-confirm-btn { min-height:44px; border-radius:10px; }
@media (max-width:640px) {
  .modal-backdrop,
  .app-helper-shell,
  .subtitle-modal-shell,
  .speed-modal { padding:0 10px max(10px, env(safe-area-inset-bottom)) !important; }
  .modal-glass,
  .app-dialog,
  .app-helper-card { width:calc(100vw - 20px) !important; max-height:min(76dvh, 660px) !important; border-radius:14px !important; }
  .app-helper-head { padding:14px 15px 8px; }
  .app-choice-item { min-height:60px; padding:15px; }
  .app-confirm-actions { display:grid; grid-template-columns:1fr 1fr; padding:10px 15px 15px; }
}

/* v3.6.10 · quiet current-page state */
@media (max-width:900px) {
  .mobile-panel-link.active {
    min-height:44px;
    padding-left:11px;
    color:var(--text);
    border-color:transparent;
    background:color-mix(in srgb,var(--primary) 7%,transparent);
    box-shadow:none;
  }
  .mobile-panel-link.active i { color:var(--primary); }
  .mobile-panel-link.active > span:not(.nav-current) { font-weight:790; }
  .mobile-panel-link .nav-current { display:none !important; }
}
