    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #0a0a0f;
      --surface: #12121a;
      --surface-hover: #1a1a25;
      --border: #2a2a3a;
      --text: #e4e4ef;
      --text-dim: #8888a0;
      --accent: #7c5cfc;
      --accent-hover: #9478ff;
      --green: #34d399;
      --yellow: #fbbf24;
      --red: #f87171;
      --blue: #60a5fa;
      --radius: 10px;
      --modal-backdrop: rgba(0,0,0,0.6);
      --shadow: 0 1px 3px rgba(0,0,0,0.4);
    }

    [data-theme="light"] {
      --bg: #f4f5f7;
      --surface: #ffffff;
      --surface-hover: #edeef1;
      --border: #d8dae0;
      --text: #1a1a2e;
      --text-dim: #6b7085;
      --accent: #6944e0;
      --accent-hover: #5835c7;
      --green: #16a364;
      --yellow: #ca8a04;
      --red: #dc2626;
      --blue: #2563eb;
      --modal-backdrop: rgba(0,0,0,0.35);
      --shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
    }

    #root { min-height: 100vh; display: flex; }

    input, select, textarea {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 10px 14px;
      border-radius: var(--radius);
      font-size: 14px;
      outline: none;
      width: 100%;
      transition: border-color 0.2s;
      font-family: inherit;
    }
    input:focus, select:focus, textarea:focus { border-color: var(--accent); }
    select { cursor: pointer; }
    textarea { resize: vertical; min-height: 80px; }

    button {
      background: var(--accent);
      color: #fff;
      border: none;
      padding: 10px 20px;
      border-radius: var(--radius);
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s;
    }
    button:hover { background: var(--accent-hover); }
    button:disabled { opacity: 0.5; cursor: not-allowed; }

    .btn-ghost {
      background: transparent;
      color: var(--text-dim);
      border: 1px solid var(--border);
    }
    .btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

    .btn-sm { padding: 6px 14px; font-size: 12px; }

    .btn-danger {
      background: rgba(248,113,113,0.15);
      color: var(--red);
      border: 1px solid rgba(248,113,113,0.3);
    }
    .btn-danger:hover { background: rgba(248,113,113,0.25); }

    .btn-green {
      background: rgba(52,211,153,0.15);
      color: var(--green);
      border: 1px solid rgba(52,211,153,0.3);
    }
    .btn-green:hover { background: rgba(52,211,153,0.25); }

    /* ── Login ─────────────────────────────────── */
    .login-wrap {
      display: flex; align-items: center; justify-content: center;
      min-height: 100vh; width: 100%;
    }
    .login-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 40px;
      width: 100%;
      max-width: 400px;
    }
    .login-card h1 { font-size: 28px; margin-bottom: 4px; }
    .login-card .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
    .login-card .field { margin-bottom: 16px; }
    .login-card label {
      display: block; font-size: 12px; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.05em;
      color: var(--text-dim); margin-bottom: 6px;
    }
    .login-card button { width: 100%; margin-top: 8px; }
    .login-card .error {
      background: rgba(248,113,113,0.1); border: 1px solid var(--red);
      color: var(--red); padding: 8px 12px; border-radius: var(--radius);
      font-size: 13px; margin-bottom: 16px;
    }

    /* ── Dashboard ─────────────────────────────── */
    .dash { display: flex; width: 100%; min-height: 100vh; }

    .sidebar {
      width: 240px; background: var(--surface);
      border-right: 1px solid var(--border);
      padding: 24px 16px; display: flex; flex-direction: column;
    }
    .sidebar .logo { font-size: 22px; font-weight: 700; margin-bottom: 32px; padding-left: 8px; }
    .sidebar .logo span { color: var(--accent); }
    .sidebar .nav-section {
      font-size: 10px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.08em; color: var(--text-dim);
      padding: 16px 12px 6px; opacity: 0.6;
    }
    .sidebar nav a {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 12px; border-radius: var(--radius);
      color: var(--text-dim); text-decoration: none;
      font-size: 14px; font-weight: 500; margin-bottom: 4px;
      transition: background 0.15s, color 0.15s; cursor: pointer;
    }
    .sidebar nav a:hover { background: var(--surface-hover); color: var(--text); }
    .sidebar nav a.active { background: rgba(124,92,252,0.12); color: var(--accent); }
    .sidebar .spacer { flex: 1; }
    .sidebar .user-pill {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 12px; border-radius: var(--radius);
      background: var(--surface-hover); font-size: 13px;
    }
    .sidebar .user-pill .avatar {
      width: 32px; height: 32px; border-radius: 50%;
      background: var(--accent); display: flex; align-items: center; justify-content: center;
      font-weight: 700; font-size: 14px; color: #fff;
    }

    .main { flex: 1; padding: 32px 40px; overflow-y: auto; }
    .main h2 { font-size: 24px; margin-bottom: 4px; }
    .main .page-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

    /* ── Cards ──────────────────────────────────── */
    .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
    .card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 14px; padding: 24px; transition: border-color 0.2s;
    }
    .card:hover { border-color: var(--accent); }
    .card .card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .card .card-header h3 { font-size: 16px; }
    .badge {
      font-size: 11px; font-weight: 600; text-transform: uppercase;
      letter-spacing: 0.05em; padding: 3px 10px; border-radius: 20px;
    }
    .badge-active  { background: rgba(52,211,153,0.15); color: var(--green); }
    .badge-planned { background: rgba(251,191,36,0.15); color: var(--yellow); }
    .badge-admin   { background: rgba(124,92,252,0.15); color: var(--accent); }
    .badge-user    { background: rgba(136,136,160,0.15); color: var(--text-dim); }
    .card p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
    .card .card-url { font-size: 12px; color: var(--accent); text-decoration: none; word-break: break-all; }

    /* ── Profile ───────────────────────────────── */
    .profile-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 14px; padding: 32px; max-width: 500px;
    }
    .profile-card + .profile-card { margin-top: 20px; }
    .profile-card h3 { font-size: 16px; margin-bottom: 20px; }
    .profile-card .field { margin-bottom: 20px; }
    .profile-card label {
      display: block; font-size: 12px; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.05em;
      color: var(--text-dim); margin-bottom: 6px;
    }
    .profile-card .actions { display: flex; gap: 10px; margin-top: 8px; }
    .save-msg { color: var(--green); font-size: 13px; margin-top: 12px; }

    /* ── Webhooks ──────────────────────────────── */
    .wh-tabs { display: flex; gap: 2px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
    .wh-tab {
      padding: 10px 20px; font-size: 13px; font-weight: 600;
      color: var(--text-dim); cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: color 0.15s, border-color 0.15s;
      background: none; border-radius: 0;
    }
    .wh-tab:hover { color: var(--text); background: none; }
    .wh-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }

    .wh-toolbar {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 16px; gap: 12px;
    }
    .wh-toolbar h3 { font-size: 16px; font-weight: 600; }

    .wh-table { width: 100%; border-collapse: collapse; }
    .wh-table th {
      text-align: left; font-size: 11px; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.06em;
      color: var(--text-dim); padding: 8px 12px;
      border-bottom: 1px solid var(--border);
    }
    .wh-table td {
      padding: 12px; font-size: 13px;
      border-bottom: 1px solid var(--border); vertical-align: middle;
    }
    .wh-table tr:hover td { background: var(--surface); }

    .wh-empty { text-align: center; color: var(--text-dim); padding: 48px 20px; font-size: 14px; }
    .wh-empty p:first-child { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

    .wh-form {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 14px; padding: 24px; margin-bottom: 20px;
    }
    .wh-form .field { margin-bottom: 16px; }
    .wh-form label {
      display: block; font-size: 12px; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.05em;
      color: var(--text-dim); margin-bottom: 6px;
    }
    .wh-form .form-row { display: flex; gap: 12px; align-items: flex-end; }
    .wh-form .form-row .field { flex: 1; margin-bottom: 0; }

    .wh-url { font-family: 'SF Mono','Menlo','Consolas',monospace; font-size: 12px; color: var(--blue); word-break: break-all; }

    .wh-api-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 14px; padding: 24px; margin-bottom: 20px;
    }
    .wh-api-card h4 { font-size: 14px; margin-bottom: 12px; color: var(--text); }
    .wh-api-card pre {
      background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
      padding: 16px; font-size: 12px;
      font-family: 'SF Mono','Menlo','Consolas',monospace;
      color: var(--text-dim); overflow-x: auto; white-space: pre-wrap; word-break: break-all;
    }
    .wh-api-card code {
      font-family: 'SF Mono','Menlo','Consolas',monospace;
      background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent);
    }

    .wh-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
    .wh-status-success { background: var(--green); }
    .wh-status-fail { background: var(--red); }
    .wh-status-sending { background: var(--yellow); }

    .error-banner {
      background: rgba(248,113,113,0.1); border: 1px solid var(--red);
      color: var(--red); padding: 12px 16px; border-radius: var(--radius);
      font-size: 13px; margin-bottom: 16px;
    }

    /* ── Modals ───────────────────────────────── */
    .modal-overlay {
      position: fixed; inset: 0; z-index: 100;
      background: var(--modal-backdrop); backdrop-filter: blur(4px);
      display: flex; align-items: center; justify-content: center;
      padding: 24px;
    }
    .modal-box {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 16px; padding: 32px; width: 100%;
      max-width: 520px; max-height: 80vh; overflow-y: auto;
      position: relative;
    }
    .modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
    .modal-close {
      position: absolute; top: 16px; right: 16px;
      background: none; border: none; color: var(--text-dim);
      font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1;
    }
    .modal-close:hover { color: var(--text); background: none; }
    .modal-footer {
      display: flex; justify-content: flex-end; gap: 8px;
      margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
    }

    .option-card {
      border: 2px solid var(--border); border-radius: 12px;
      padding: 16px 20px; cursor: pointer;
      transition: border-color 0.15s, background 0.15s;
      margin-bottom: 10px;
    }
    .option-card:hover { border-color: var(--text-dim); background: var(--surface-hover); }
    .option-card.selected { border-color: var(--accent); background: rgba(124,92,252,0.08); }
    .option-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
    .option-card p { color: var(--text-dim); font-size: 12px; line-height: 1.4; margin: 0; }
    .option-card code { font-size: 12px; font-family: 'SF Mono','Menlo','Consolas',monospace; color: var(--accent); }

    .pill-group { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
    .pill-btn {
      padding: 6px 14px; font-size: 12px; font-weight: 600;
      background: none; border: none; border-right: 1px solid var(--border);
      color: var(--text-dim); cursor: pointer; border-radius: 0;
      transition: background 0.15s, color 0.15s;
    }
    .pill-btn:last-child { border-right: none; }
    .pill-btn:hover { background: var(--surface-hover); color: var(--text); }
    .pill-btn.active { background: rgba(124,92,252,0.15); color: var(--accent); }

    .mono { font-family: 'SF Mono','Menlo','Consolas',monospace; }

    /* ── Toggle switch ─────────────────────────── */
    .toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
    .toggle input { opacity: 0; width: 0; height: 0; }
    .toggle .slider {
      position: absolute; cursor: pointer; inset: 0;
      background: var(--border); border-radius: 22px; transition: 0.2s;
    }
    .toggle .slider::before {
      content: ''; position: absolute; height: 16px; width: 16px;
      left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
    }
    .toggle input:checked + .slider { background: var(--accent); }
    .toggle input:checked + .slider::before { transform: translateX(18px); }

    /* ── Service chips (users table) ─────────── */
    .svc-grid {
      display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px;
    }
    .svc-chip {
      display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
      padding: 3px 9px 3px 7px; border-radius: 20px;
      background: var(--bg); border: 1px solid var(--border);
      font-size: 11px; font-weight: 500; color: var(--text-dim);
      transition: all 0.2s; user-select: none; white-space: nowrap;
      opacity: 0.55;
    }
    .svc-chip:hover { border-color: var(--text-dim); opacity: 0.8; }
    .svc-chip-on {
      border-color: var(--accent); background: rgba(124,92,252,0.1);
      color: var(--text); opacity: 1;
    }
    .svc-chip-on:hover { border-color: var(--accent); opacity: 1; }
    .svc-chip-dot {
      width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
      background: var(--border); transition: background 0.2s;
    }
    .svc-chip-on .svc-chip-dot { background: var(--accent); }
    .svc-chip-label { line-height: 1; }

    /* ── Modal ─────────────────────────────────── */
    .modal-overlay {
      position: fixed; inset: 0; background: var(--modal-backdrop);
      display: flex; align-items: center; justify-content: center; z-index: 1000;
    }
    .modal {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 16px; padding: 32px; width: 100%;
      max-width: 520px; max-height: 90vh; overflow-y: auto;
    }
    .modal h3 { font-size: 18px; margin-bottom: 20px; }
    .modal .field { margin-bottom: 16px; }
    .modal label {
      display: block; font-size: 12px; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.05em;
      color: var(--text-dim); margin-bottom: 6px;
    }
    .modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

    .svc-toggles { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
    .svc-toggle-row {
      display: flex; align-items: center; gap: 12px;
      padding: 8px 12px; border-radius: var(--radius);
      background: var(--bg);
    }
    .svc-toggle-row .svc-name { font-size: 13px; font-weight: 500; flex: 1; }

    /* ── CodeMirror theme (vibey) ──────────────── */
    .cm-wrapper { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
    .cm-wrapper .CodeMirror {
      background: var(--bg);
      color: var(--text);
      font-family: 'SF Mono', Menlo, Consolas, monospace;
      font-size: 13px;
      line-height: 1.6;
      height: auto;
      min-height: var(--cm-min-h, 80px);
      max-height: var(--cm-max-h, 240px);
      padding: 4px 0;
    }
    .cm-wrapper .CodeMirror-focused { outline: none; }
    .cm-wrapper .CodeMirror-gutters {
      background: var(--surface);
      border-right: 1px solid var(--border);
      min-width: 32px;
    }
    .cm-wrapper .CodeMirror-linenumber { color: var(--text-dim); font-size: 11px; padding: 0 6px; }
    .cm-wrapper .CodeMirror-cursor { border-left-color: var(--accent); }
    .cm-wrapper .CodeMirror-selected { background: rgba(124,92,252,0.2); }
    .cm-wrapper .CodeMirror-matchingbracket { color: var(--green) !important; text-decoration: underline; }
    .cm-wrapper .cm-keyword { color: #c792ea; }
    .cm-wrapper .cm-def { color: #82aaff; }
    .cm-wrapper .cm-variable { color: var(--text); }
    .cm-wrapper .cm-variable-2 { color: #f78c6c; }
    .cm-wrapper .cm-property { color: #82aaff; }
    .cm-wrapper .cm-operator { color: #89ddff; }
    .cm-wrapper .cm-string { color: #c3e88d; }
    .cm-wrapper .cm-string-2 { color: #c3e88d; }
    .cm-wrapper .cm-number { color: #f78c6c; }
    .cm-wrapper .cm-atom { color: #f78c6c; }
    .cm-wrapper .cm-comment { color: var(--text-dim); font-style: italic; }
    .cm-wrapper .cm-bracket { color: #89ddff; }
    .cm-wrapper .cm-tag { color: #f07178; }
    .cm-wrapper .cm-attribute { color: #c792ea; }
    .cm-wrapper .CodeMirror-activeline-background { background: rgba(255,255,255,0.03); }
    .cm-wrapper .CodeMirror-scrollbar-filler { background: transparent; }
    .cm-wrapper .CodeMirror-placeholder { color: var(--text-dim); font-style: italic; }
    .cm-label { display: flex; align-items: center; justify-content: space-between; }
    .cm-label .cm-hint { font-size: 10px; font-weight: 400; color: var(--text-dim); text-transform: none; letter-spacing: 0; }

    /* ── Theme toggle ────────────────────────── */
    .theme-toggle {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 12px; border-radius: var(--radius);
      background: none; border: 1px solid var(--border);
      color: var(--text-dim); font-size: 13px; font-weight: 500;
      cursor: pointer; width: 100%; transition: background 0.15s, color 0.15s;
    }
    .theme-toggle:hover { background: var(--surface-hover); color: var(--text); }
    .theme-toggle .theme-icon { font-size: 16px; line-height: 1; }

    @keyframes renderPulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    @media (max-width: 768px) {
      .dash { flex-direction: column; }
      .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
      .sidebar nav { display: flex; gap: 4px; flex-wrap: wrap; }
      .sidebar .spacer { display: none; }
      .sidebar .nav-section { display: none; }
      .main { padding: 20px; }
    }
