:root, html[data-theme="dark"] {
    --bg: #07070d;
    --glass: rgba(255,255,255,.055);
    --glass-hover: rgba(255,255,255,.09);
    --glass-strong: rgba(255,255,255,.11);
    --border: rgba(255,255,255,.12);
    --border-bright: rgba(255,255,255,.22);
    --text: #f4f4f8;
    --muted: rgba(255,255,255,.5);
    --accent: #5b8cff;
    --accent2: #a855f7;
    --ok: #34d399;
    --ok-dim: rgba(52, 211, 153, .16);
    --warn: #fbbf24;
    --warn-dim: rgba(251, 191, 36, .16);
    --danger: #f87171;
    --radius: 20px;
    --radius-sm: 14px;
    --blur: blur(28px) saturate(160%);
    --shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.07);
    --logo-grad: linear-gradient(135deg, #fff 30%, rgba(255,255,255,.6));
    --earn-grad: linear-gradient(135deg, #fff 20%, #93b4ff);
    --body-grad:
      radial-gradient(ellipse 90% 70% at 0% 0%, rgba(91,140,255,.18), transparent 50%),
      radial-gradient(ellipse 70% 50% at 100% 10%, rgba(168,85,247,.14), transparent 45%),
      radial-gradient(ellipse 60% 40% at 50% 100%, rgba(52,211,153,.08), transparent 50%),
      var(--bg);
  }
  html[data-theme="light"] {
    --bg: #e8eef9;
    --glass: rgba(255,255,255,.62);
    --glass-hover: rgba(255,255,255,.78);
    --glass-strong: rgba(255,255,255,.88);
    --border: rgba(15,23,42,.1);
    --border-bright: rgba(15,23,42,.16);
    --text: #0f172a;
    --muted: rgba(15,23,42,.55);
    --accent: #3b6de8;
    --accent2: #8b4fd6;
    --ok: #059669;
    --ok-dim: rgba(5, 150, 105, .14);
    --warn: #d97706;
    --warn-dim: rgba(217, 119, 6, .14);
    --danger: #dc2626;
    --blur: blur(24px) saturate(140%);
    --shadow: 0 10px 32px rgba(15,23,42,.1), inset 0 1px 0 rgba(255,255,255,.85);
    --logo-grad: linear-gradient(135deg, #0f172a 20%, #3b6de8);
    --earn-grad: linear-gradient(135deg, #0f172a 10%, #3b6de8);
    --body-grad:
      radial-gradient(ellipse 90% 70% at 0% 0%, rgba(91,140,255,.22), transparent 55%),
      radial-gradient(ellipse 70% 50% at 100% 10%, rgba(168,85,247,.12), transparent 50%),
      radial-gradient(ellipse 60% 40% at 50% 100%, rgba(52,211,153,.1), transparent 55%),
      var(--bg);
  }
  * { box-sizing: border-box; margin: 0; }
  body {
    min-height: 100vh; color: var(--text);
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--body-grad);
    padding: 0;
    transition: background .35s ease, color .25s ease;
  }
  .studio-card,.of-native-shell,.settings-section,.earn-card,.stat {
    background-image:linear-gradient(145deg,rgba(59,130,246,.055),rgba(168,85,247,.04) 46%,rgba(16,185,129,.035));
    transition:transform .22s ease,border-color .22s ease,box-shadow .22s ease;
  }
  .studio-card:hover,.earn-card:hover,.stat:hover { border-color:rgba(91,140,255,.26); box-shadow:0 16px 38px rgba(0,0,0,.16); }
  .shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(4, 6, 14, .5);
    z-index: 200;
    pointer-events: none;
  }
  .sidebar-backdrop:not([hidden]) {
    display: block;
    pointer-events: auto;
  }
  body.sidebar-open { overflow: hidden; }
  .sidebar {
    position: sticky; top: 0; align-self: start;
    height: 100vh; max-height: 100vh; padding: 20px 14px;
    background: var(--glass);
    border-right: 1px solid var(--border);
    backdrop-filter: var(--blur);
    display: flex; flex-direction: column; gap: 16px;
    z-index: 40;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-brand { padding: 4px 8px 8px; flex-shrink: 0; }
  .sidebar-brand-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  }
  .sidebar-close {
    display: none;
    flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--glass-strong);
    color: var(--text); cursor: pointer; font-size: 16px; line-height: 1;
  }
  .sidebar-close:hover { background: var(--glass-hover); }
  .sidebar-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
  .sidebar-nav button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left;
    padding: 11px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: transparent;
    color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
  }
  .sidebar-nav button:hover { background: var(--glass-hover); color: var(--text); }
  .sidebar-nav button.active {
    background: linear-gradient(135deg, rgba(91,140,255,.22), rgba(168,85,247,.12));
    border-color: rgba(91,140,255,.35); color: var(--text);
  }
  .topbar-login { flex-shrink: 0; }
  .link-btn {
    background: none; border: none; padding: 0; color: var(--accent);
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline;
  }
  .nav-icon { width: 20px; text-align: center; font-size: 14px; }
  .plat-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
  .plat-row.ok span:last-child { color: var(--ok); }
  .plat-row.bad span:last-child { color: var(--danger); }
  .main { padding: 20px 20px 40px; min-width: 0; }
  .app { max-width: 1100px; margin: 0 auto; }
  .sidebar-toggle {
    display: none;
    align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--glass-strong);
    color: var(--text); cursor: pointer; font-size: 18px; line-height: 1;
    flex-shrink: 0;
  }
  .sidebar-toggle:hover { background: var(--glass-hover); }

  /* ── Top bar ── */
  .topbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 16px 20px; margin-bottom: 16px;
    background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .logo { font-size: 22px; font-weight: 700; letter-spacing: -.03em;
    background: var(--logo-grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }
  .logo-badge {
    font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px;
    background: linear-gradient(135deg, rgba(91,140,255,.35), rgba(168,85,247,.28));
    border: 1px solid rgba(91,140,255,.45);
    -webkit-text-fill-color: var(--text);
    color: var(--text);
    box-shadow: 0 0 20px rgba(91,140,255,.2);
  }
  .theme-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--glass-strong); border: 1px solid var(--border);
    color: var(--text); cursor: pointer;
    transition: background .2s, border-color .2s;
  }
  .theme-toggle:hover { background: var(--glass-hover); border-color: var(--border-bright); }
  .theme-toggle .icon { font-size: 14px; line-height: 1; }
  .logo-sub { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
  .topbar-spacer { flex: 1; }
  .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--glass-strong); border: 1px solid var(--border);
  }
  .pill.active { border-color: rgba(91,140,255,.5); color: #93b4ff; }
  .pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
  .pill.off .dot { background: var(--muted); }

  /* ── Profile switcher ── */
  .profile-switch {
    appearance: none;
    background: var(--glass-strong);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-width: 160px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }
  .profile-switch:focus { outline: 2px solid rgba(91,140,255,.4); outline-offset: 2px; }

  /* ── Earnings hero ── */
  .earnings-hero {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }
  .earn-card {
    padding: 18px 16px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(91,140,255,.12), rgba(168,85,247,.08));
    border: 1px solid rgba(91,140,255,.22);
    box-shadow: var(--shadow);
  }
  .earn-card b {
    display: block;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 4px;
    background: var(--earn-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .earn-card span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
  .earn-meta {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
    font-size: 12px; color: var(--muted); align-items: center;
  }
  .earn-meta .tag {
    padding: 5px 10px; border-radius: 999px;
    background: var(--glass-strong); border: 1px solid var(--border);
  }

  .sys-bar {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--glass-strong); border: 1px solid var(--border);
    font-size: 12px; color: var(--muted);
  }
  .sys-bar .meter {
    flex: 1; min-width: 100px;
  }
  .sys-bar .meter b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
  .sys-bar .bar {
    height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden;
  }
  .sys-bar .bar i {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
  }
  .sys-bar .bar i.warn { background: linear-gradient(90deg, var(--warn), #f97316); }
  .sys-bar .bar i.danger { background: linear-gradient(90deg, var(--danger), #ef4444); }
  .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .data-table th, .data-table td {
    padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
  }
  .data-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .data-table tr:hover td { background: var(--glass-hover); }
  .data-table tr.clickable { cursor: pointer; }
  .crm-detail {
    margin-top: 12px; padding: 14px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,.2); border: 1px solid var(--border); font-size: 13px;
  }
  .crm-detail h4 { margin-bottom: 8px; font-size: 14px; }
  .issue-list { margin: 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
  .issue-list li { margin: 4px 0; }
  .fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
  .fleet-grid-card {
    padding: 14px; border-radius: var(--radius-sm);
    background: var(--glass-strong); border: 1px solid var(--border);
  }
  .fleet-grid-card h3 { font-size: 15px; margin-bottom: 6px; }
  .fleet-grid-card .meta { font-size: 12px; color: var(--muted); line-height: 1.5; }
  .crm-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

  @media (max-width: 720px) {
    .earnings-hero { grid-template-columns: 1fr; }
    .crm-metrics { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); }
  }
  #auth-box {
    position: fixed; inset: 0; z-index: 400; display: none;
    background: rgba(0,0,0,.65); backdrop-filter: blur(12px);
    align-items: center; justify-content: center; padding: 20px;
  }
  #auth-box.show { display: flex; }
  .auth-card {
    width: 100%; max-width: 400px; padding: 28px;
    background: var(--glass-strong); backdrop-filter: var(--blur);
    border: 1px solid var(--border-bright); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .auth-card h2 { font-size: 20px; margin-bottom: 6px; }
  .auth-card p { font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }

  /* ── In-panel login (xpra) ── */
  #login-overlay {
    position: fixed; inset: 0; z-index: 300; display: none; flex-direction: column;
    background: #1a1d24;
  }
  #login-overlay.show { display: flex; }
  #login-overlay:fullscreen { background: #000; }
  #login-overlay:fullscreen #login-frame { height: 100vh; }
  #login-overlay .login-head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px;
    background: #f3f4f6; border-bottom: 1px solid #d1d5db; color: #111827;
    flex-shrink: 0;
  }
  #login-overlay .login-head strong {
    font-size: 14px; color: #111827; white-space: nowrap;
  }
  #login-overlay .login-head span {
    flex: 1; min-width: 120px; font-size: 13px; color: #374151; line-height: 1.35;
  }
  #login-overlay .login-head .btn {
    background: #fff; border-color: #d1d5db; color: #111827;
  }
  #login-overlay .login-head .btn.primary {
    background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; border-color: transparent;
  }
  #login-overlay .login-head .btn:hover { background: #e5e7eb; }
  #login-overlay .login-head .btn.primary:hover { filter: brightness(1.05); }
  #login-overlay .login-paste {
    display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px;
    background: #e5e7eb; border-bottom: 1px solid #d1d5db;
    align-items: center; flex-shrink: 0;
  }
  #login-overlay .login-paste.collapsed { display: none; }
  #login-overlay .login-paste input {
    flex: 1; min-width: 140px; margin: 0; padding: 8px 10px; font-size: 13px;
    background: #fff; border-color: #d1d5db; color: #111827;
  }
  #login-paste-status {
    width: 100%; font-size: 13px; margin: 0; padding: 0 2px;
    color: #374151; min-height: 1.2em;
  }
  #login-paste-status.ok { color: #047857; }
  #login-paste-status.err { color: #b91c1c; }
  #login-frame {
    flex: 1; width: 100%; min-height: 0; border: none; background: #0f1117;
  }

  /* ── Status banner ── */
  .status-bar {
    padding: 14px 18px; margin-bottom: 16px; font-size: 14px; font-weight: 500; line-height: 1.45;
    background: rgba(91,140,255,.1); border: 1px solid rgba(91,140,255,.25);
    border-radius: var(--radius-sm);
  }
  .status-bar.error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); }

  /* ── Nav tabs ── */
  .nav {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
    padding: 6px; background: var(--glass); border: 1px solid var(--border);
    border-radius: 999px; backdrop-filter: var(--blur);
  }
  .nav button {
    flex: 1; min-width: 90px; padding: 10px 16px; border: none; border-radius: 999px;
    background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: .2s;
  }
  .nav button.active {
    background: linear-gradient(135deg, rgba(91,140,255,.35), rgba(168,85,247,.25));
    color: #fff; box-shadow: 0 2px 12px rgba(91,140,255,.2);
  }
  .nav button:hover:not(.active) { color: var(--text); background: var(--glass-hover); }

  /* ── Panels ── */
  .panel { display: none; }
  .panel.active { display: block; animation: panel-reveal .24s ease-out both; }
  @keyframes panel-reveal { from { opacity: 0; transform: translateY(5px); } }
  .card {
    background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px 22px; margin-bottom: 14px;
  }
  .card-title {
    font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 14px;
  }
  .card-title span { font-weight: 400; letter-spacing: 0; text-transform: none; color: rgba(255,255,255,.35); }

  /* ── Stats grid ── */
  .stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 16px; }
  .stat {
    padding: 14px; text-align: center; border-radius: var(--radius-sm);
    background: var(--glass-strong); border: 1px solid var(--border);
  }
  .stat b { display: block; font-size: 22px; font-weight: 700; margin-bottom: 2px; }
  .stat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

  /* ── Buttons ── */
  .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .btn {
    appearance: none; border: 1px solid var(--border); background: var(--glass-strong);
    color: var(--text); padding: 10px 18px; border-radius: 999px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: .18s; white-space: nowrap;
  }
  .btn:hover { background: var(--glass-hover); transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  .btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
  .btn.success { background: linear-gradient(135deg, #059669, var(--ok)); border-color: transparent; }
  .btn.danger { background: linear-gradient(135deg, #dc2626, var(--danger)); border-color: transparent; }
  .btn.ghost { background: transparent; }
  .btn.sm { padding: 7px 14px; font-size: 12px; }
  .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

  /* ── Form elements ── */
  label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
  label:first-child { margin-top: 0; }
  input, textarea, select {
    width: 100%; background: rgba(0,0,0,.3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px;
    outline: none; transition: border-color .15s; font-family: inherit;
  }
  input:focus, textarea:focus, select:focus { border-color: rgba(91,140,255,.5); }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
  .hint code { background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 6px; font-size: 11px; }

  /* ── iOS-style settings toggles ── */
  .settings-group {
    background: rgba(0,0,0,.28); border-radius: var(--radius-sm);
    border: 1px solid var(--border); overflow: hidden; margin-bottom: 14px;
  }
  .settings-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 11px 16px; min-height: 52px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .settings-row:last-child { border-bottom: none; }
  .settings-label { flex: 1; min-width: 0; }
  .settings-label > span { font-size: 15px; font-weight: 400; display: block; }
  .settings-label small { font-size: 12px; color: var(--muted); display: block; margin-top: 3px; line-height: 1.35; }
  .settings-label small.on { color: #34c759; }
  .settings-label small.off { color: rgba(255,255,255,.35); }
  .settings-section-title {
    font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
    padding: 8px 16px 6px; margin-top: 4px;
  }
  .switch-row, .settings-row .switch { flex-shrink: 0; }
  .switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
  .switch input { opacity: 0; width: 0; height: 0; position: absolute; }
  .switch .slider {
    position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
    background: rgba(120,120,128,.36); transition: background .25s, border-color .25s;
  }
  .switch .slider::before {
    content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px;
    border-radius: 50%; background: #fff; transition: transform .25s;
    box-shadow: 0 3px 8px rgba(0,0,0,.25);
  }
  .switch input:checked + .slider { background: #34c759; }
  .switch input:focus-visible + .slider { outline: 2px solid rgba(91,140,255,.5); outline-offset: 2px; }
  .switch input:checked + .slider::before { transform: translateX(20px); }
  .switch input:disabled + .slider { opacity: .4; cursor: not-allowed; }

  /* legacy switch-row wrapper */
  .switch-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,.2); border: 1px solid var(--border); margin-bottom: 8px;
  }
  .switch-row span { font-size: 14px; }
  .switch-row small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

  /* ── Profile cards ── */
  .profile-card {
    padding: 16px 18px; border-radius: var(--radius-sm); margin-bottom: 10px;
    background: rgba(0,0,0,.25); border: 1px solid var(--border); transition: .2s;
  }
  .profile-card.active { border-color: rgba(91,140,255,.45); box-shadow: 0 0 0 1px rgba(91,140,255,.15); }
  .profile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .avatar {
    width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
    background: linear-gradient(135deg, rgba(91,140,255,.3), rgba(168,85,247,.3));
    border: 1px solid var(--border);
  }
  .profile-name { font-size: 15px; font-weight: 600; }
  .profile-meta { font-size: 11px; color: var(--muted); }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
  .chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
    border-radius: 999px; font-size: 11px; font-weight: 600;
    background: var(--glass); border: 1px solid var(--border); cursor: pointer; transition: .15s;
    user-select: none;
  }
  .chip.on { background: rgba(91,140,255,.2); border-color: rgba(91,140,255,.4); color: #93b4ff; }
  .chip input { display: none; }

  /* ── Fleet strip (multi-profile) ── */
  .fleet-strip {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
  }
  .fleet-strip-card {
    flex: 1 1 160px; min-width: 150px; max-width: 240px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,.22); border: 1px solid var(--border);
    cursor: pointer; transition: border-color .15s, box-shadow .15s;
  }
  .fleet-strip-card:hover { border-color: rgba(91,140,255,.35); }
  .fleet-strip-card.focus { border-color: rgba(91,140,255,.55); box-shadow: 0 0 0 1px rgba(91,140,255,.2); }
  .fleet-strip-card .fc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .fleet-strip-card .fc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .fleet-strip-card .fc-dot.ok { background: #34c759; }
  .fleet-strip-card .fc-dot.warn { background: #ffb86c; }
  .fleet-strip-card .fc-dot.off { background: #666; }
  .fleet-strip-card .fc-name { font-size: 13px; font-weight: 600; }
  .fleet-strip-card .fc-meta { font-size: 10px; color: var(--muted); line-height: 1.35; }
  .fleet-summary { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
  .profile-runtime { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
  .rt-badge {
    font-size: 10px; padding: 2px 6px; border-radius: 999px;
    background: rgba(255,255,255,.08); color: var(--muted);
  }
  .rt-badge.ok { background: var(--ok-dim); color: var(--ok); }
  .rt-badge.warn { background: var(--warn-dim); color: var(--warn); }
  .rt-badge.off { background: rgba(255,255,255,.05); color: #666; }

  /* ── Chat bubble ── */
  .bubble {
    padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.5;
    background: rgba(0,0,0,.3); border: 1px solid var(--border); min-height: 48px;
    margin-bottom: 10px; word-break: break-word;
  }
  .bubble.fan { border-left: 3px solid var(--accent); }

  /* ── Action groups ── */
  .action-group { margin-bottom: 16px; }
  .action-group h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

  /* ── Log ── */
  .log {
    font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; line-height: 1.55;
    background: rgba(0,0,0,.35); border-radius: var(--radius-sm); padding: 14px;
    max-height: 260px; overflow-y: auto; border: 1px solid var(--border); color: rgba(255,255,255,.65);
  }
  .log .warn { color: var(--warn); } .log .error { color: var(--danger); }

  /* ── Collapsible ── */
  details summary {
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent);
    padding: 8px 0; list-style: none;
  }
  details summary::-webkit-details-marker { display: none; }
  details[open] summary { margin-bottom: 12px; }

  /* ── Queue badge ── */
  .queue-info {
    display: flex; gap: 10px; margin-bottom: 14px;
  }
  .queue-badge {
    flex: 1; padding: 10px 14px; border-radius: var(--radius-sm); text-align: center;
    background: var(--glass-strong); border: 1px solid var(--border);
  }
  .queue-badge b { font-size: 18px; display: block; }
  .queue-badge span { font-size: 10px; color: var(--muted); text-transform: uppercase; }

  /* ── Insights ── */
  .money-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
  .money-grid.periods .money-card b { color: #93b4ff; }
  .money-card {
    padding: 16px; border-radius: var(--radius-sm); text-align: center;
    background: linear-gradient(135deg, rgba(91,140,255,.12), rgba(168,85,247,.08));
    border: 1px solid var(--border);
  }
  .money-card b { display: block; font-size: 24px; font-weight: 700; margin-bottom: 4px; color: var(--ok); }
  .money-card span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
  .data-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
  }
  .data-table th {
    text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
  }
  .data-table td {
    padding: 10px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: top;
  }
  .data-table tr { cursor: pointer; transition: .15s; }
  .data-table tbody tr:hover { background: var(--glass-hover); }
  .data-table tr.active { background: rgba(91,140,255,.12); }
  .badge-unread {
    display: inline-block; min-width: 18px; padding: 2px 7px; border-radius: 999px;
    font-size: 10px; font-weight: 700; background: rgba(91,140,255,.35); color: #fff;
  }
  .msg-thread {
    max-height: 320px; overflow-y: auto; margin-top: 12px; padding: 12px;
    background: rgba(0,0,0,.25); border-radius: var(--radius-sm); border: 1px solid var(--border);
  }
  .msg-line { margin-bottom: 10px; font-size: 13px; line-height: 1.45; }
  .msg-line.me { text-align: right; color: rgba(255,255,255,.75); }
  .msg-line.them { border-left: 2px solid var(--accent); padding-left: 10px; }
  .msg-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
  .vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 8px; }
  .vault-item {
    padding: 12px; border-radius: var(--radius-sm); background: rgba(0,0,0,.25);
    border: 1px solid var(--border); text-align: center;
  }
  .vault-item b { display: block; font-size: 18px; margin-bottom: 4px; }
  .vault-item span { font-size: 11px; color: var(--muted); }
  .insights-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
  .search-box { margin-bottom: 12px; }

  @media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
      position: fixed; left: 0; top: 0; bottom: 0;
      width: min(288px, 86vw);
      height: 100vh; max-height: none;
      transform: translate3d(-110%, 0, 0);
      transition: transform .28s cubic-bezier(.4, 0, .2, 1);
      box-shadow: var(--shadow);
      z-index: 210;
      visibility: hidden;
      pointer-events: none;
      background: #0c0d15;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      touch-action: manipulation;
    }
    html[data-theme="light"] .sidebar {
      background: #eef2fa;
    }
    body.sidebar-open .sidebar {
      transform: translate3d(0, 0, 0);
      visibility: visible;
      pointer-events: auto;
    }
    body.sidebar-open .sidebar-nav button,
    body.sidebar-open .sidebar-close {
      pointer-events: auto;
      touch-action: manipulation;
    }
    .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar-toggle { display: inline-flex; }
    body.sidebar-open .sidebar-toggle {
      position: relative;
      z-index: 220;
    }
    .main { padding: 16px 12px 32px; }
  }
  @media (min-width: 901px) {
    body.sidebar-open { overflow: auto; }
    .sidebar-backdrop { display: none !important; }
  }
  @media (max-width: 640px) {
    .stats { grid-template-columns: repeat(2,1fr); }
    .money-grid { grid-template-columns: 1fr; }
    .grid2 { grid-template-columns: 1fr; }
    .nav button { min-width: 70px; font-size: 12px; padding: 8px 12px; }
  }

/* ═══ Sidebar header profile avatar ═══ */
.sidebar-brand-left {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-profile-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--glass-strong); border: 2px solid var(--border-bright);
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.sidebar-profile-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(91,140,255,.3);
}
.sidebar-profile-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.sidebar-profile-avatar .avatar-initial {
  font-size: 16px; font-weight: 700; color: var(--accent);
}
/* Profile dropdown with blur */
.profile-dropdown-backdrop {
  position: fixed; inset: 0; z-index: 290;
  background: rgba(4,6,14,.55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
}
.profile-dropdown-backdrop.show { display: block; }
.profile-dropdown {
  position: fixed; top: 64px; left: 16px; z-index: 310;
  background: rgba(12,14,22,.94); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-bright); border-radius: 16px;
  padding: 6px; min-width: 200px; max-height: 320px; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  display: none; flex-direction: column; gap: 2px;
}
.profile-dropdown.show { display: flex; }
.profile-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background .16s ease; border: none; background: transparent;
  color: var(--text); font-size: 13px; text-align: left; font-family: inherit;
  width: 100%;
}
.profile-dropdown-item:hover { background: var(--glass-hover); }
.profile-dropdown-item.active { background: var(--glass-strong); }
.profile-dropdown-item .dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.profile-dropdown-item .dot.online { background: var(--ok); }
.profile-dropdown-item .dot.offline { background: var(--danger); }
.profile-dropdown-item .handle { font-weight: 600; }
.profile-dropdown-item .status-text { font-size: 10px; color: var(--muted); margin-left: auto; }

/* ═══ OnlyFans sidebar dropdown category ═══ */
.sidebar-category {
  margin-top: 4px;
}
.onlyfans-logo-badge {
  width:24px; height:24px; flex:0 0 24px; display:grid; place-items:center;
  overflow:hidden; border-radius:50%; background:linear-gradient(145deg,#10b9f1,#087ec5);
  box-shadow:0 4px 14px rgba(0,175,240,.3),inset 0 1px 0 rgba(255,255,255,.45);
}
.onlyfans-logo-badge img { width:19px; height:19px; object-fit:contain; filter:brightness(0) invert(1); }
.onlyfans-logo-header { width:34px; height:34px; flex-basis:34px; }
.onlyfans-logo-header img { width:27px; height:27px; }
.sidebar-category-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 14px; border: none; border-radius: 12px;
  background: transparent; color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .18s ease, color .18s ease;
  text-align: left; font-family: inherit;
}
.sidebar-category-btn:hover {
  background: var(--glass-hover);
}
.sidebar-category-btn .chevron {
  margin-left: auto; font-size: 10px; opacity: 0.5;
  transition: transform .22s ease;
}
.sidebar-category-btn.open .chevron {
  transform: rotate(180deg);
}
.sidebar-subnav {
  overflow: hidden;
  transition: max-height .28s ease, opacity .22s ease;
  max-height: 0; opacity: 0;
  padding-left: 6px;
}
.sidebar-subnav.open {
  max-height: 600px; opacity: 1;
}
.sidebar-subnav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px 9px 24px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 13px; cursor: pointer; transition: all .16s ease;
  text-align: left; font-family: inherit;
}
.sidebar-subnav button:hover {
  background: var(--glass-hover); color: var(--text);
}
.sidebar-subnav button .nav-icon { font-size: 12px; width: 18px; text-align: center; }
.sidebar-subnav button .badge {
  margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: var(--accent); color: #fff; font-weight: 600;
}


/* ═══ OnlyFans content panel (embed view) ═══ */
.of-content-panel {
  position: relative; width: 100%; min-height: calc(100vh - 120px);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--glass); border: 1px solid var(--border);
}
.of-content-panel iframe {
  width: 100%; height: calc(100vh - 140px); border: none;
}
.of-content-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 400px; text-align: center; gap: 16px;
}
.of-content-placeholder .icon { font-size: 48px; opacity: 0.4; }
.of-content-placeholder h3 { font-size: 18px; color: var(--text); }
.of-content-placeholder p { color: var(--muted); font-size: 13px; max-width: 400px; }
.of-launch-btn { margin-top: 8px; }

/* ═══ OnlyFans iframe proxy panels ═══ */
.of-iframe-wrap {
  width: 100%; min-height: calc(100vh - 120px);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--glass); border: 1px solid var(--border);
}
.of-iframe-wrap iframe {
  width: 100%; height: calc(100vh - 120px); border: none;
  background: #0a0a0c;
}

/* ═══ Native data list items (messages, notifications) ═══ */
.of-data-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 200px); overflow-y: auto;
}
.of-list-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: 8px;
  background: var(--glass); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.of-list-item:hover { background: var(--card-bg); border-color: var(--border); }
.of-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.of-item-content { flex: 1; min-width: 0; }
.of-item-name { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.of-item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.of-item-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ═══ Statistics grid ═══ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-top: 12px;
}
.stat-card {
  text-align: center; padding: 20px 12px;
  background: var(--glass); border-radius: 12px;
  border: 1px solid var(--border);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ═══ Vault grid ═══ */
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.vault-thumb {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  border-radius: 8px; background: var(--glass); border: 1px solid var(--border);
}
.vault-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vault-video-tag {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.7); color: #fff; font-size: 12px;
  padding: 2px 6px; border-radius: 4px; pointer-events: none;
}
.vault-dl-toolbar { flex-wrap: wrap; }

/* ═══ Vault download panel ═══ */
.vault-dl-card {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px;
}

/* Native OnlyFans workspace */
.of-native-shell { min-height: calc(100vh - 120px); }
.of-native-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:4px 0 18px; border-bottom:1px solid var(--border); }
.of-native-header > div { display:flex; align-items:center; gap:12px; }
.of-native-header > div > span { display:grid; place-items:center; width:38px; height:38px; border-radius:8px; background:var(--glass); color:var(--accent); font-size:19px; }
.of-native-header h2 { margin:0; font-size:20px; }
.of-native-header p { margin:2px 0 0; color:var(--muted); font-size:12px; }
.of-native-content { padding-top:18px; }
.of-native-loading, .of-native-empty { min-height:240px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; color:var(--muted); text-align:center; }
.owner-messages-frame { width:100%; height:calc(100dvh - 150px); min-height:620px; display:block; border:0; border-radius:8px; background:#090b10; }
@media (max-width:900px) { .owner-messages-frame { height:calc(100dvh - 130px); min-height:520px; } }
.of-native-loading::before {
  content:""; width:28px; height:28px; border-radius:50%;
  border:2px solid var(--border); border-top-color:var(--accent);
  animation:of-loading-spin .7s linear infinite;
}
@keyframes of-loading-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .panel.active, .of-native-loading::before { animation:none; }
}
.of-native-empty strong { color:var(--text); font-size:15px; }
.of-native-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); gap:10px; margin-bottom:16px; }
.of-native-metric { min-height:92px; padding:16px; border:1px solid var(--border); border-radius:8px; background:var(--glass); display:flex; flex-direction:column; justify-content:center; }
.of-native-metric strong { color:var(--text); font-size:21px; }
.of-native-metric span { color:var(--muted); font-size:11px; margin-top:5px; text-transform:capitalize; }
.of-native-metric.ok strong { color:var(--ok); }
.of-native-metric.warn strong { color:var(--warn); }
.of-native-metric.money strong { color:#34d399; }
.of-native-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:12px; }
.of-native-grid section { padding:18px; border:1px solid var(--border); border-radius:8px; background:var(--glass); }
.of-native-grid h3 { margin:0 0 14px; font-size:14px; }
.of-native-grid dl { margin:0; display:grid; grid-template-columns:1fr auto; gap:10px 16px; font-size:13px; }
.of-native-grid dt { color:var(--muted); }.of-native-grid dd { margin:0; color:var(--text); }
.of-native-list { display:flex; flex-direction:column; gap:4px; }
.of-native-list article { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; padding:13px 14px; border-bottom:1px solid var(--border); }
.of-native-list article:hover { background:var(--glass); }
.of-native-chat-row { width:100%; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; padding:13px 14px; border:0; border-bottom:1px solid var(--border); border-radius:0; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.of-native-chat-row:hover,.of-native-chat-row:focus-visible { background:var(--glass); outline:none; }
.of-native-chat-row strong { display:block; font-size:13px; }.of-native-chat-row p { margin:3px 0 0; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }.of-native-chat-row > span { color:var(--muted); font-size:11px; }
.of-chat-toolbar { min-height:52px; display:flex; align-items:center; gap:12px; padding:0 0 12px; border-bottom:1px solid var(--border); }
.of-chat-history { max-height:calc(100vh - 230px); overflow:auto; display:flex; flex-direction:column; gap:8px; padding:18px 4px; }
.of-chat-bubble { align-self:flex-start; max-width:min(620px,82%); padding:10px 12px; border-radius:8px; background:var(--glass); white-space:pre-wrap; }
.of-chat-bubble.mine { align-self:flex-end; background:var(--accent); color:#fff; }.of-chat-bubble small { display:block; margin-top:5px; font-size:11px; opacity:.72; }
.of-native-list strong { display:block; font-size:13px; color:var(--text); }
.of-native-list p { margin:3px 0 0; color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.of-native-list time, .of-native-list article > span { color:var(--muted); font-size:11px; }
.of-native-avatar { display:grid; place-items:center; width:38px; height:38px; border-radius:50%; background:#2563eb; color:white; font-weight:700; }
.of-vault-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 0 14px; color:var(--muted); font-size:12px; }
.of-vault-filters { display:flex; gap:4px; flex-wrap:wrap; }
.of-vault-filters button { min-width:72px; padding:7px 10px; border:1px solid var(--border); border-radius:6px; background:transparent; color:var(--muted); cursor:pointer; }
.of-vault-filters button.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.of-vault-download-actions { display:flex; gap:6px; }
.of-vault-export-status { min-height:18px; margin:-4px 0 10px; display:flex; align-items:center; justify-content:space-between; gap:10px; color:var(--muted); font-size:12px; }
.vault-dl-progress .bar { height:100%; width:0; background:var(--accent); transition:width .2s ease; }
.vault-dl-progress > span { margin-right:10px; color:var(--muted); font-size:11px; }
.of-native-albums { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; }
.of-vault-media { width:100%; aspect-ratio:1; padding:0; border:1px solid var(--border); border-radius:8px; background:var(--glass); overflow:hidden; position:relative; cursor:pointer; color:inherit; text-align:left; }
.of-vault-media[hidden] { display:none!important; }
.of-vault-media:hover, .of-vault-media:focus-visible { border-color:var(--accent); outline:none; }
.of-native-albums img { width:100%; height:100%; display:block; object-fit:cover; }
.of-vault-media > div { position:absolute; inset:auto 0 0; padding:26px 10px 9px; background:linear-gradient(transparent,rgba(0,0,0,.78)); color:#fff; }
.of-native-albums span { color:var(--muted); font-size:11px; margin-top:5px; }
.vault-media-modal { position:fixed; inset:0; z-index:5000; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.82); }
.vault-media-dialog { width:min(1100px,96vw); height:min(820px,92vh); display:grid; grid-template-rows:minmax(0,1fr) auto; position:relative; background:var(--bg); border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.vault-media-stage { min-width:0; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; padding:12px; background:#080808; }
.vault-media-stage img, .vault-media-stage video { display:block; width:auto; height:auto; max-width:100%; max-height:100%; object-fit:contain; }
.vault-media-stage video { background:#000; }
.vault-media-actions { min-height:52px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 12px; border-top:1px solid var(--border); }
.vault-media-counter { color:var(--muted); font-size:12px; }
.vault-media-close { position:absolute; z-index:2; top:10px; right:10px; width:36px; height:36px; padding:0; border:0; border-radius:50%; background:rgba(0,0,0,.72); color:#fff; font-size:25px; line-height:1; cursor:pointer; }
.vault-media-nav { position:absolute; z-index:2; top:50%; transform:translateY(-50%); width:44px; height:58px; padding:0; border:1px solid rgba(255,255,255,.16); border-radius:6px; background:rgba(0,0,0,.66); color:#fff; font-size:36px; line-height:1; cursor:pointer; }
.vault-media-nav.prev { left:10px; }.vault-media-nav.next { right:10px; }
.of-stat-rank { margin-bottom:14px; padding:18px; border:1px solid var(--border); background:var(--glass); border-radius:8px; }
.of-stat-rank strong,.of-stat-rank span { display:block; }.of-stat-rank strong { font-size:24px; }.of-stat-rank span { color:var(--muted); font-size:12px; }
@media (max-width:640px) { .of-vault-toolbar { align-items:flex-start; flex-direction:column; } .vault-media-modal { padding:8px; } .vault-media-dialog { width:100%; height:94vh; } .vault-media-nav { width:38px; height:50px; } }
.of-native-profile { display:flex; align-items:center; gap:18px; padding:20px; border:1px solid var(--border); border-radius:8px; background:var(--glass); }
.of-native-profile-avatar { width:82px; height:82px; border-radius:50%; overflow:hidden; display:grid; place-items:center; background:#2563eb; color:white; font-size:30px; font-weight:700; flex:0 0 auto; }
.of-native-profile-avatar img { width:100%; height:100%; object-fit:cover; }
.of-native-profile h2 { margin:0; font-size:20px; }.of-native-profile p { margin:4px 0 10px; color:var(--muted); }
.of-native-tags { display:flex; flex-wrap:wrap; gap:6px; }.of-native-tags span { padding:4px 7px; border:1px solid var(--border); border-radius:6px; color:var(--muted); font-size:11px; }
.of-native-settings { max-width:680px; border-top:1px solid var(--border); }
.of-native-settings > div { display:flex; justify-content:space-between; padding:14px 4px; border-bottom:1px solid var(--border); text-transform:capitalize; }
.of-native-settings strong.on { color:var(--ok); }.of-native-settings strong.off { color:var(--muted); }
.vault-dl-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 16px 0;
}
.vault-dl-stat {
  text-align: center; padding: 14px 8px;
  background: rgba(0,0,0,.2); border-radius: 12px;
  border: 1px solid var(--border);
}
.vault-dl-stat b { display: block; font-size: 22px; margin-bottom: 4px; }
.vault-dl-stat span { font-size: 11px; color: var(--muted); }
.vault-dl-progress {
  margin-top: 16px; display: none;
}
.vault-dl-progress.show { display: block; }
.vault-dl-progress .bar-wrap {
  background: var(--card-bg); border-radius: 10px; height: 8px;
  overflow: hidden; margin-bottom: 4px;
}

/* Unified shell controls */
.sidebar-tools { display:grid; gap:8px; padding-top:10px; border-top:1px solid var(--border); }
.sidebar-tools .profile-switch,.sidebar-tools .pill { width:100%; border-radius:7px; }
.sidebar-tool-row { display:grid; grid-template-columns:1fr auto; gap:7px; }
.sidebar-tools .theme-toggle { width:100%; justify-content:center; border-radius:7px; }
.sidebar-brand-row { gap:8px; }
.theme-toggle-header { width:36px; height:36px; padding:0; justify-content:center; border-radius:6px; margin-left:auto; flex:0 0 36px; }
.theme-toggle-header .icon { font-size:16px; }
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.floating-menu { position:fixed; z-index:205; top:12px; left:12px; box-shadow:var(--shadow); }
@media (min-width:901px) { .floating-menu { display:none!important; } }
@media (max-width:900px) { .main { padding-top:64px; } }

/* Light mode uses white work surfaces instead of grey translucent fields. */
html[data-theme="light"] {
  --bg:#f7f9fc;
  --glass:#fff;
  --glass-hover:#f2f6ff;
  --glass-strong:#fff;
  --border:#dbe3ef;
  --border-bright:#b8c6da;
  --body-grad:#f7f9fc;
  --shadow:0 8px 24px rgba(15,23,42,.07);
}
html[data-theme="light"] body,
html[data-theme="light"] .sidebar { background:#f7f9fc; }
html[data-theme="light"] .card,
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .settings-group,
html[data-theme="light"] .stat,
html[data-theme="light"] .msg-thread,
html[data-theme="light"] .vault-item,
html[data-theme="light"] .platform-card { background:#fff; backdrop-filter:none; -webkit-backdrop-filter:none; }
html[data-theme="light"] .card-title span,
html[data-theme="light"] .msg-line.me { color:#64748b; }
.vault-dl-progress .bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 10px; transition: width .3s ease;
  width: 0%;
}
.vault-dl-progress .bar-label {
  font-size: 11px; color: var(--muted); display: flex; justify-content: space-between;
}

/* Automatic phone layout. Coarse-pointer tablets use this through data-layout. */
@media (max-width:700px), (pointer:coarse) and (max-width:900px) {
  html, body { width:100%; max-width:100%; overflow-x:hidden; }
  body { min-height:100dvh; }
  .main { width:100%; padding:60px 8px calc(24px + env(safe-area-inset-bottom)); }
  .app, .panel, .studio-wrap, .of-native-shell, .of-native-content { width:100%; min-width:0; max-width:100%; }
  .floating-menu { top:max(10px, env(safe-area-inset-top)); left:max(10px, env(safe-area-inset-left)); width:44px; height:44px; }
  .sidebar { width:min(320px,92vw); padding:calc(14px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)); }
  .sidebar-nav button, .sidebar-subnav button { min-height:44px; }
  .platform-card { display:none; }

  input, select, textarea { max-width:100%; font-size:16px; }
  button, .btn, a.btn { min-height:44px; touch-action:manipulation; }
  .btn.sm { padding:9px 12px; }
  .card, .studio-card, .settings-group, .vault-dl-card { padding:14px; border-radius:8px; }
  .row { align-items:stretch; }
  .row > input, .row > select, .row > textarea { flex:1 1 100%; width:100%; }
  .row > button, .row > .btn { flex:1 1 auto; }

  .studio-top { align-items:stretch; }
  .studio-top-left, .studio-top-actions { width:100%; }
  .studio-top-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .studio-top-actions .btn { width:100%; }
  .studio-kpis-simple, .stats, .crm-metrics, .of-native-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .studio-kpi, .stat, .of-native-metric { min-width:0; padding:12px; }
  .studio-inbox-row { grid-template-columns:minmax(0,1fr) auto; gap:4px 10px; padding:12px; }
  .studio-inbox-handle { grid-column:1; }
  .studio-inbox-name { grid-column:1; font-weight:700; }
  .studio-inbox-preview { grid-column:1 / -1; grid-row:3; }
  .studio-unread { grid-column:2; grid-row:1 / span 2; align-self:center; }
  .studio-table-wrap { margin-inline:-14px; width:calc(100% + 28px); overflow-x:auto; overscroll-behavior-inline:contain; }
  .studio-table { min-width:560px; }
  .studio-vault-toolbar { display:grid; grid-template-columns:1fr; }
  .studio-vault-toolbar > * { width:100%; }

  .of-native-header { align-items:flex-start; gap:8px; padding-bottom:12px; }
  .of-native-header > div { min-width:0; }
  .of-native-header h2 { font-size:18px; }
  .of-native-content { padding-top:12px; }
  .of-native-grid { grid-template-columns:1fr; }
  .of-native-grid section { padding:14px; }
  .of-native-list article, .of-native-chat-row { gap:9px; padding:12px 4px; }
  .of-native-avatar { width:36px; height:36px; }
  .of-chat-history { max-height:calc(100dvh - 190px); padding:12px 0; }
  .of-chat-bubble { max-width:90%; }

  .of-vault-toolbar, .of-vault-download-actions, .of-vault-export-status { width:100%; align-items:stretch; }
  .of-vault-filters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .of-vault-filters button { min-width:0; min-height:40px; }
  .of-vault-download-actions .btn, .of-vault-export-status .btn { width:100%; }
  .of-vault-export-status { flex-direction:column; }
  .of-native-albums { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .of-vault-media > div { padding:22px 8px 7px; }
  .vault-media-modal { padding:0; }
  .vault-media-dialog { width:100vw; height:100dvh; max-height:none; border:0; border-radius:0; }
  .vault-media-stage { padding:0; }
  .vault-media-actions { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
  .vault-media-nav { top:auto; bottom:calc(64px + env(safe-area-inset-bottom)); width:44px; height:44px; }
  .vault-media-close { top:max(10px,env(safe-area-inset-top)); right:10px; width:44px; height:44px; }

  .auth-card { max-height:calc(100dvh - 24px); overflow-y:auto; padding:20px 16px; border-radius:8px; }
}

@media (max-width:380px) {
  .studio-kpis-simple, .stats, .crm-metrics, .of-native-metrics { grid-template-columns:1fr; }
  .of-native-albums { gap:4px; }
}
