  :root {
    --ink: #f4f7f7;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #dce3e4;
    --border-soft: #e7ecec;
    --text: #142023;
    --text-muted: #5b6c70;
    --accent: #1f8a9e;
    --accent-soft: #e2f1f3;
    --accent-ink: #ffffff;
    --warn: #9a6a17;
    --warn-soft: #f7ecd7;
    --danger: #b5372f;
    --danger-soft: #fbe6e4;
    --success: #227e57;
    --success-soft: #e2f4ec;
    --shadow: 0 1px 2px rgba(20, 32, 35, 0.06), 0 8px 24px rgba(20, 32, 35, 0.06);
    --mono: "SFMono-Regular", "Cascadia Code", "Consolas", "Liberation Mono", "Courier New", monospace;
    --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --ink: #0e1416;
      --surface: #161d20;
      --surface-raised: #1c2427;
      --border: #28323c;
      --border-soft: #202a2e;
      --text: #e7ecee;
      --text-muted: #8b9ca3;
      --accent: #4fc1d6;
      --accent-soft: #17333a;
      --accent-ink: #052024;
      --warn: #d9a441;
      --warn-soft: #382d16;
      --danger: #e0605a;
      --danger-soft: #3a1e1c;
      --success: #5fb88a;
      --success-soft: #163227;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
    }
  }

  :root[data-theme="dark"] {
    --ink: #0e1416;
    --surface: #161d20;
    --surface-raised: #1c2427;
    --border: #28323c;
    --border-soft: #202a2e;
    --text: #e7ecee;
    --text-muted: #8b9ca3;
    --accent: #4fc1d6;
    --accent-soft: #17333a;
    --accent-ink: #052024;
    --warn: #d9a441;
    --warn-soft: #382d16;
    --danger: #e0605a;
    --danger-soft: #3a1e1c;
    --success: #5fb88a;
    --success-soft: #163227;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  }

  :root[data-theme="light"] {
    --ink: #f4f7f7;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #dce3e4;
    --border-soft: #e7ecec;
    --text: #142023;
    --text-muted: #5b6c70;
    --accent: #1f8a9e;
    --accent-soft: #e2f1f3;
    --accent-ink: #ffffff;
    --warn: #9a6a17;
    --warn-soft: #f7ecd7;
    --danger: #b5372f;
    --danger-soft: #fbe6e4;
    --success: #227e57;
    --success-soft: #e2f4ec;
    --shadow: 0 1px 2px rgba(20, 32, 35, 0.06), 0 8px 24px rgba(20, 32, 35, 0.06);
  }

  * { box-sizing: border-box; }

  html, body {
    background: var(--ink);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
  }

  body {
    display: flex;
    min-height: 100vh;
  }

  a { color: inherit; }

  ::selection { background: var(--accent); color: var(--accent-ink); }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* ---------- Sidebar ---------- */

  .sidebar {
    width: 244px;
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
    gap: 24px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: linear-gradient(155deg, var(--accent), var(--accent) 40%, transparent);
    background-color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-ink);
    flex: none;
  }

  .brand-text {
    font-family: var(--mono);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  .brand-sub {
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  nav.groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
  }

  .nav-group-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px;
    margin-bottom: 6px;
  }

  .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
  }

  .nav-link:hover { background: var(--border-soft); color: var(--text); }

  .nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }

  .nav-ic {
    width: 16px;
    text-align: center;
    font-size: 13px;
  }

  .nav-badge {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 10.5px;
    background: var(--danger-soft);
    color: var(--danger);
    padding: 1px 6px;
    border-radius: 20px;
    font-variant-numeric: tabular-nums;
  }

  .sidebar-foot {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 8px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    flex: none;
  }

  .sidebar-foot-text { display: flex; flex-direction: column; line-height: 1.3; }
  .sidebar-foot-name { font-size: 12.5px; font-weight: 600; }
  .sidebar-foot-role { font-size: 11px; color: var(--text-muted); }

  /* ---------- Main ---------- */

  .main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--ink) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text-muted);
    font-size: 13px;
    width: 320px;
    max-width: 40vw;
  }

  .search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 13px;
    width: 100%;
    font-family: var(--sans);
  }

  .search input::placeholder { color: var(--text-muted); }

  .env-badge {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    padding: 4px 9px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .env-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
  }

  .topbar-spacer { flex: 1; }

  .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.12s ease, border-color 0.12s ease;
  }

  .icon-btn:hover { color: var(--text); border-color: var(--accent); }

  .content {
    padding: 26px 28px 80px;
    display: flex;
    flex-direction: column;
    gap: 44px;
    max-width: 1180px;
  }

  /* Data-heavy pages (campaigns / analytics / creatives) need the full viewport width —
     a 1180px cap wastes the right side once a dozen metric columns are on. */
  .content.content-wide { max-width: none; }

  /* ---------- Date-range picker (presets + two-month calendar) ---------- */
  .dr-wrap { position: relative; display: inline-block; }
  .dr-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--sans); font-size: 13px;
    background: var(--ink); border: 1px solid var(--border); border-radius: 8px;
    padding: 7px 12px; color: var(--text); cursor: pointer;
  }
  .dr-trigger:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .dr-ico { opacity: .7; }
  .dr-caret { color: var(--text-muted); font-size: 10px; }

  .dr-pop {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
    display: none; background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
    padding: 12px;
  }
  .dr-pop.open { display: flex; gap: 14px; }

  .dr-presets { display: flex; flex-direction: column; gap: 2px; min-width: 150px;
    border-right: 1px solid var(--border); padding-right: 12px; }
  .dr-preset {
    text-align: left; font-family: var(--sans); font-size: 13px;
    background: transparent; border: 1px solid transparent; border-radius: 7px;
    padding: 7px 10px; color: var(--text-muted); cursor: pointer;
  }
  .dr-preset:hover { background: var(--border-soft); color: var(--text); }
  .dr-preset.active { background: var(--accent-soft, var(--border-soft)); color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

  .dr-cal { display: flex; flex-direction: column; gap: 10px; }
  .dr-cal-nav { display: flex; align-items: flex-start; gap: 8px; }
  .dr-nav { background: transparent; border: 1px solid var(--border); border-radius: 7px;
    color: var(--text-muted); cursor: pointer; padding: 4px 9px; font-size: 14px; align-self: center; }
  .dr-nav:hover { color: var(--accent); border-color: var(--accent); }
  .dr-months { display: flex; gap: 18px; }
  .dr-month-title { font-size: 13px; margin-bottom: 8px; text-align: center; }
  .dr-wd, .dr-grid { display: grid; grid-template-columns: repeat(7, 30px); }
  .dr-wd span { font-family: var(--mono); font-size: 10px; color: var(--text-muted);
    text-align: center; padding-bottom: 4px; }
  .dr-day { height: 28px; display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; border-radius: 6px; cursor: pointer; color: var(--text); }
  .dr-day.empty { cursor: default; }
  .dr-day:not(.empty):not(.future):hover { background: var(--border-soft); }
  .dr-day.future { color: var(--text-muted); opacity: .35; cursor: default; }
  .dr-day.inrange { background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 0; }
  .dr-day.sel { background: var(--accent); color: #fff; }
  .dr-day.sel.start { border-radius: 6px 0 0 6px; }
  .dr-day.sel.end { border-radius: 0 6px 6px 0; }
  .dr-day.sel.start.end { border-radius: 6px; }

  .dr-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border-top: 1px solid var(--border); padding-top: 10px; }
  .dr-draft { font-size: 12px; color: var(--text-muted); }
  .dr-foot-btns { display: flex; gap: 8px; }
  .dr-btn { font-family: var(--sans); font-size: 12.5px; border-radius: 7px; padding: 7px 14px; cursor: pointer;
    border: 1px solid var(--border); background: var(--ink); color: var(--text); }
  .dr-btn.dr-apply { background: var(--accent); border-color: var(--accent); color: #fff; }
  .dr-btn:hover { opacity: .9; }

  .view { display: none; }
  .view.active { display: flex; flex-direction: column; gap: 20px; animation: view-in 0.14s ease; }

  @keyframes view-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @media (prefers-reduced-motion: reduce) {
    .view.active { animation: none; }
  }

  .section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }

  .section-title {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .section-title .n {
    color: var(--accent);
  }

  h1 {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
    text-wrap: balance;
  }

  .page-sub {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 0;
    max-width: 62ch;
  }

  .btn {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.06s ease;
  }

  .btn:hover { border-color: var(--accent); }
  .btn:active { transform: translateY(1px); }

  .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
  }

  .btn-primary:hover { border-color: var(--accent); filter: brightness(1.06); }

  .btn-ghost { background: transparent; }

  /* ---------- Stat tiles ---------- */

  .stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }

  .stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
  }

  .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .stat-value {
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .stat-delta {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .stat-delta.up { color: var(--success); }
  .stat-delta.warn { color: var(--warn); }
  .stat-delta.down { color: var(--danger); }

  .spark {
    width: 100%;
    height: 30px;
  }

  /* ---------- Cards / tables ---------- */

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  /* overflow:hidden (for rounded table corners) otherwise clips an open custom dropdown that
     extends past the card's bottom edge — lift the clipping only while a dropdown is open. */
  .card:has(.cselect.open),
  .panel:has(.cselect.open) { overflow: visible; }

  .table-wrap { overflow-x: auto; }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 720px;
  }

  thead th {
    text-align: left;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }

  tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
  }

  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: var(--border-soft); }

  .cell-primary { font-weight: 600; }
  .cell-muted { color: var(--text-muted); }
  .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px 3px 7px;
    border-radius: 20px;
    white-space: nowrap;
  }

  .chip::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  .chip-success { background: var(--success-soft); color: var(--success); }
  .chip-warn { background: var(--warn-soft); color: var(--warn); }
  .chip-danger { background: var(--danger-soft); color: var(--danger); }
  .chip-neutral { background: var(--border-soft); color: var(--text-muted); }

  .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

  .link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
  }
  .link-btn:hover { background: var(--accent-soft); }

  .card-foot {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
  }

  /* ---------- Bulk-select toolbar / checkbox table ---------- */

  .toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
  .toolbar-spacer { flex: 1; }

  .counter-pill {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }

  .counter-pill b { color: var(--accent); font-weight: 700; }

  input[type="checkbox"].rowcheck {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: none;
  }

  input[type="checkbox"].rowcheck:checked {
    background: var(--accent);
    border-color: var(--accent);
  }

  input[type="checkbox"].rowcheck:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid var(--accent-ink);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }

  td.checkcell { width: 34px; }

  tr.row-disabled { opacity: 0.55; }

  .pixel-flow-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 4px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .pixel-flow-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* ---------- Asset map ---------- */

  .asset-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
  }

  .asset-selector label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
  }

  .asset-selector select { min-width: 260px; }

  .asset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .asset-grid.two { grid-template-columns: 1fr 1fr; margin-top: 14px; }

  .asset-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .asset-card-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .asset-card-head h4 {
    margin: 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .asset-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }

  .asset-list { display: flex; flex-direction: column; }

  .asset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-soft);
  }

  .asset-row:last-child { border-bottom: none; }

  .asset-row-name { font-size: 12.5px; font-weight: 600; }
  .asset-row-id { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }

  .asset-empty {
    padding: 22px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
  }

  /* ---------- RK popover (linked ad accounts) ---------- */

  .rk-pop-wrap { position: relative; display: inline-block; }

  .rk-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 12px;
    background: var(--border-soft);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 20px;
    padding: 4px 10px 4px 9px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
  }

  .rk-badge-btn:hover { border-color: var(--accent); color: var(--accent); }
  .rk-pop-wrap.open .rk-badge-btn { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .rk-badge-btn .chev { font-size: 9px; transition: transform 0.14s ease; }
  .rk-pop-wrap.open .rk-badge-btn .chev { transform: rotate(180deg); }

  .rk-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 260px;
    max-width: calc(100vw - 24px);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 40;
    display: none;
    overflow: hidden;
    box-sizing: border-box;
  }

  .rk-pop-head {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
  }

  .rk-pop-search {
    padding: 7px;
    border-bottom: 1px solid var(--border);
  }

  .rk-pop-search input {
    width: 100%;
    font-size: 12.5px;
    background: var(--ink);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 9px;
    color: var(--text);
  }

  .rk-pop-list { max-height: 220px; overflow-y: auto; }

  .rk-pop-row {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 12.5px;
  }

  .rk-pop-row:last-child { border-bottom: none; }
  .rk-pop-row:hover { background: var(--border-soft); }
  .rk-pop-row .id { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }

  .rk-pop-foot {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    text-align: center;
  }

  .rk-pop-foot a { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600; }

  /* ---------- Invite link preview ---------- */

  .link-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .link-row input {
    flex: 1;
    font-family: var(--mono);
    font-size: 12px;
    background: var(--ink);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 11px;
    color: var(--accent);
  }

  .preview-frame {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--ink);
  }

  .preview-chrome {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .preview-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }

  .preview-url {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 46px 20px;
  }

  .preview-card {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .preview-card .brand-mark { margin: 0 auto; }

  .preview-card h5 {
    text-align: center;
    margin: 0;
    font-size: 15px;
  }

  .preview-card p {
    text-align: center;
    margin: -8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
  }

  /* ---------- Confirm modal ---------- */

  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 12, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
  }

  .modal-overlay.open { display: flex; }

  .modal-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 20px;
    animation: view-in 0.14s ease;
  }

  .modal-card .ic-warn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--danger-soft);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 12px;
  }

  .modal-card h4 { margin: 0 0 6px; font-size: 15px; }
  .modal-card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.55; }
  .modal-card .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

  /* ---------- Custom select ---------- */

  .cselect {
    position: relative;
    width: 100%;
  }

  .cselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--sans);
    font-size: 13.5px;
    background: var(--ink);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 11px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
  }

  .cselect-trigger:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .cselect.open .cselect-trigger { border-color: var(--accent); }
  .cselect-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .cselect-value { overflow: hidden; text-overflow: ellipsis; }

  .cselect-chevron {
    flex: none;
    color: var(--text-muted);
    font-size: 10px;
    transition: transform 0.14s ease, color 0.14s ease;
  }

  .cselect.open .cselect-chevron { transform: rotate(180deg); color: var(--accent); }

  .cselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: min(360px, 80vw);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 5px;
    z-index: 30;
    display: none;
    max-height: 280px;
    overflow-y: auto;
  }

  .cselect.open .cselect-menu { display: block; animation: view-in 0.12s ease; }

  .cselect-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
  }

  .cselect-option:hover { background: var(--border-soft); }

  .cselect-option.selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }

  .cselect-option .tick { font-size: 11px; opacity: 0; }
  .cselect-option.selected .tick { opacity: 1; }

  .asset-selector .cselect { min-width: 260px; width: auto; }

  /* ---------- Toggle switch ---------- */

  .switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 38px;
    height: 22px;
    flex: none;
  }

  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .switch-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .switch-track::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: var(--surface-raised);
    border-radius: 50%;
    transition: transform 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }

  .switch input:checked + .switch-track { background: var(--accent); }
  .switch input:checked + .switch-track::before { transform: translateX(16px); background: var(--accent-ink); }
  .switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

  .switch-cell { display: flex; align-items: center; gap: 8px; }
  .switch-label { font-size: 11.5px; color: var(--text-muted); }

  /* ---------- Add partner panel ---------- */

  .panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-top: 14px;
  }

  .panel.open { display: block; }

  .panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .field { display: flex; flex-direction: column; gap: 6px; }
  .field.full { grid-column: 1 / -1; }

  .field label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  .field input, .field select {
    font-family: var(--sans);
    font-size: 13.5px;
    background: var(--ink);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 11px;
    color: var(--text);
    outline: none;
  }

  .field input:focus, .field select:focus { border-color: var(--accent); }

  .field.token input { font-family: var(--mono); font-size: 12.5px; }

  .token-row { display: flex; gap: 8px; }
  .token-row input { flex: 1; }

  .field-hint { font-size: 11.5px; color: var(--text-muted); }

  .panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
  }

  /* ---------- Two column layout for share/invite ---------- */

  .split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .form-card { padding: 18px 20px; }
  .form-card h3 {
    font-size: 14.5px;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .form-card .form-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 16px;
  }

  .field-stack { display: flex; flex-direction: column; gap: 12px; }

  .inline-note {
    display: flex;
    gap: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.5;
  }

  .security-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .sec-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
  }

  .sec-card .ic {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
  }

  .sec-card h4 { margin: 0; font-size: 13.5px; }
  .sec-card p { margin: 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

  footer.page-foot {
    color: var(--text-muted);
    font-size: 11.5px;
    font-family: var(--mono);
    padding: 4px 2px 0;
  }

  @media (max-width: 980px) {
    .sidebar { display: none; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-grid, .split, .security-grid, .asset-grid, .asset-grid.two { grid-template-columns: 1fr; }
    .asset-selector { flex-wrap: wrap; }
  }
