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

    :root {
      --bg: #0f1117;
      --surface: #1a1d27;
      --surface2: #22253a;
      --border: #2e3248;
      --accent: #4f7cff;
      --accent-hover: #6b92ff;
      --success: #22c55e;
      --danger: #ef4444;
      --warn: #f59e0b;
      --text: #e2e8f0;
      --text-muted: #64748b;
      --radius: 8px;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: var(--bg);
      color: var(--text);
      height: 100vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* ── Header ── */
    header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 20px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    header h1 { font-size: 16px; font-weight: 600; letter-spacing: .3px; }
    header .badge {
      font-size: 11px;
      background: var(--accent);
      color: #fff;
      padding: 2px 8px;
      border-radius: 20px;
      margin-left: 4px;
    }
    #build-time {
      font-size: 11px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
    }
    #build-time svg { opacity: .6; flex-shrink: 0; }
    #build-version-link {
      border-left: 1px solid var(--border);
      color: var(--text-muted);
      margin-left: 2px;
      padding-left: 7px;
      text-decoration: none;
    }
    #build-version-link[href]:hover {
      color: var(--accent);
    }

    #blob-status {
      margin-left: auto;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    #blob-status .dot {
      width: 8px; height: 8px;
      border-radius: 50%;
      background: var(--text-muted);
    }
    #blob-status.ready .dot   { background: var(--success); }
    #blob-status.notready .dot { background: var(--warn); }

    /* ── Main layout ── */
    main {
      display: flex;
      flex: 1;
      overflow: hidden;
    }

    /* ── Left panel ── */
    .panel-left {
      width: 380px;
      min-width: 300px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      background: var(--surface);
      border-right: 1px solid var(--border);
      overflow-y: auto;
    }

    .panel-section {
      padding: 16px;
      border-bottom: 1px solid var(--border);
    }
    .panel-section:last-child { border-bottom: none; flex: 1; display: flex; flex-direction: column; }

    label {
      display: block;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .6px;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    select, input[type=text] {
      width: 100%;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      padding: 8px 10px;
      font-size: 13px;
      outline: none;
      appearance: none;
      -webkit-appearance: none;
      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='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      padding-right: 28px;
    }
    select:focus, input:focus { border-color: var(--accent); }
    select:disabled { opacity: .4; cursor: not-allowed; }

    .hidden { display: none !important; }
    #provider-wrap { margin-top: 10px; }
    #provider-wrap.hidden { display: none; }


    /* ── Payload textarea ── */
    .payload-section { flex: 1; display: flex; flex-direction: column; }
    .payload-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
    }
    .btn-load-sample {
      background: none;
      border: 1px solid white;
      color: white;
      border-radius: 6px;
      font-size: 11px;
      padding: 3px 8px;
      cursor: pointer;
      transition: all .15s;
    }
    .btn-load-sample:hover { border-color: var(--accent); color: var(--accent); }

    textarea {
      flex: 1;
      resize: none;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
      font-size: 12px;
      line-height: 1.6;
      padding: 10px;
      outline: none;
      min-height: 220px;
    }
    textarea:focus { border-color: var(--accent); }

    /* ── Action buttons ── */
    .actions {
      padding: 14px 16px;
      display: flex;
      gap: 8px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      flex-shrink: 0;
    }
    .btn {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 9px 6px;
      border-radius: var(--radius);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: all .15s;
      white-space: nowrap;
    }
    .btn:disabled { opacity: .35; cursor: not-allowed; }
    .btn-html   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
    .btn-html:hover:not(:disabled)   { background: var(--border); }
    .btn-pdf    { background: var(--accent); color: #fff; }
    .btn-pdf:hover:not(:disabled)    { background: var(--accent-hover); }
    .btn-upload { background: var(--success); color: #fff; }
    .btn-upload:hover:not(:disabled) { background: #16a34a; }

    /* ── HTTP Inspector ── */
    #inspector-view {
      display: none;
      flex-direction: column;
      flex: 1;
      overflow: hidden;
    }
    #inspector-view.visible { display: flex; }

    .inspector-url-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      background: var(--surface2);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .http-method {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 5px;
      background: #1c3a5e;
      color: #60a5fa;
      letter-spacing: .5px;
      white-space: nowrap;
    }
    .inspector-url {
      font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
      font-size: 12px;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1;
    }
    .http-status {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 10px;
      border-radius: 20px;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .http-status.ok  { background: #14532d; color: #86efac; }
    .http-status.err { background: #450a0a; color: #fca5a5; }
    .http-elapsed { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

    .inspector-body {
      flex: 1;
      overflow-y: auto;
      padding: 0 0 20px;
    }

    .inspector-section {
      border-bottom: 1px solid var(--border);
    }
    .inspector-section-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px;
      cursor: pointer;
      user-select: none;
      background: var(--surface);
    }
    .inspector-section-header:hover { background: var(--surface2); }
    .inspector-section-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .7px;
      color: var(--text-muted);
    }
    .inspector-section-badge {
      font-size: 10px;
      padding: 1px 7px;
      border-radius: 20px;
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text-muted);
    }
    .inspector-chevron {
      margin-left: auto;
      color: var(--text-muted);
      font-size: 12px;
      transition: transform .15s;
    }
    .inspector-section.collapsed .inspector-chevron { transform: rotate(-90deg); }
    .inspector-section.collapsed .inspector-section-content { display: none; }

    .inspector-section-content {
      padding: 0 16px 12px;
    }

    .kv-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
      margin-top: 8px;
    }
    .kv-table td { padding: 3px 0; vertical-align: top; }
    .kv-table td:first-child {
      color: var(--text-muted);
      font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
      white-space: nowrap;
      padding-right: 16px;
      width: 1%;
    }
    .kv-table td:last-child {
      font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
      color: #e2e8f0;
      word-break: break-all;
    }

    .code-block {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 10px 12px;
      margin-top: 8px;
      font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
      font-size: 12px;
      line-height: 1.6;
      white-space: pre;
      overflow-x: auto;
      color: #a5f3fc;
    }
    .code-block.response-ok  { color: #86efac; }
    .code-block.response-err { color: #fca5a5; }

    /* ── Right panel (preview) ── */
    .panel-right {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: var(--bg);
      overflow: hidden;
    }

    .preview-toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .preview-toolbar span { font-size: 12px; color: var(--text-muted); }
    #preview-label { font-size: 13px; font-weight: 600; }
    .preview-type-badge {
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 20px;
      background: var(--surface2);
      color: var(--text-muted);
      border: 1px solid var(--border);
    }
    .preview-type-badge.html { background: #1e3a5f; color: #60a5fa; border-color: #2563eb; }
    .preview-type-badge.pdf  { background: #3b1a1a; color: #f87171; border-color: #dc2626; }
    .preview-type-badge.json { background: #1a2e1a; color: #86efac; border-color: #16a34a; }

    #btn-open-tab {
      margin-left: auto;
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 11px;
      cursor: pointer;
      transition: all .15s;
      display: none;
    }
    #btn-open-tab:hover { border-color: var(--accent); color: var(--accent); }
    #btn-open-tab.visible { display: block; }

    #preview-frame {
      flex: 1;
      border: none;
      background: #fff;
    }

    .empty-state {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      color: var(--text-muted);
    }
    .empty-state svg { opacity: .3; }
    .empty-state p { font-size: 13px; }

    /* ── Spinner ── */
    #loading-overlay {
      display: none;
      position: absolute;
      inset: 0;
      background: rgba(15,17,23,.7);
      z-index: 100;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 14px;
    }
    #loading-overlay.visible { display: flex; }
    .spinner {
      width: 36px; height: 36px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    #loading-overlay p { font-size: 13px; color: var(--text-muted); }

    /* ── Login overlay ── */
    #login-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--bg);
      z-index: 1000;
      align-items: center;
      justify-content: center;
    }
    #login-overlay.visible { display: flex; }
    .login-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 36px 40px;
      width: 360px;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
    .login-logo {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .login-logo h2 { font-size: 16px; font-weight: 600; }
    .login-logo .badge { font-size: 11px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 20px; }
    .login-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
    .login-field { display: flex; flex-direction: column; gap: 6px; }
    .login-field label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: 0; }
    .login-field input[type=password] {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      padding: 10px 12px;
      font-size: 14px;
      outline: none;
      width: 100%;
      letter-spacing: .1em;
    }
    .login-field input[type=password]:focus { border-color: var(--accent); }
    .btn-login {
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: var(--radius);
      padding: 11px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: background .15s;
    }
    .btn-login:hover { background: var(--accent-hover); }
    .btn-login:disabled { opacity: .4; cursor: not-allowed; }
    #login-error {
      font-size: 12px;
      color: #fca5a5;
      text-align: center;
      display: none;
    }
    #login-error.visible { display: block; }

    /* ── Toast ── */
    #toast {
      position: fixed;
      bottom: 20px;
      right: 20px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 10px 16px;
      font-size: 13px;
      display: none;
      z-index: 200;
      max-width: 320px;
    }
    #toast.error { border-color: var(--danger); color: #fca5a5; }
    #toast.success { border-color: var(--success); color: #86efac; }
    #toast.visible { display: block; }
  
