    /* ─── Reset & Base ──────────────────────────────────────────────────── */
    *, *::before, *::after {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    :root {
      --bg-primary: #0a0e17;
      --bg-secondary: #111827;
      --bg-card: #1a2234;
      --bg-card-hover: #1f2a3f;
      --border-subtle: rgba(255, 255, 255, 0.06);
      --border-accent: rgba(56, 189, 248, 0.2);
      --text-primary: #f1f5f9;
      --text-secondary: #94a3b8;
      --text-muted: #64748b;
      --accent: #38bdf8;
      --accent-dim: rgba(56, 189, 248, 0.1);
      --accent-glow: rgba(56, 189, 248, 0.15);
      --success: #34d399;
      --warning: #fbbf24;
      --error: #f87171;
      --terminal-bg: #0c1018;
    }

    html, body {
      height: 100%;
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
      overflow: hidden;
      -webkit-font-smoothing: antialiased;
    }

    /* ─── Connect Screen ───────────────────────────────────────────────── */
    #connect-screen {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100vh;
      position: relative;
      z-index: 10;
    }

    /* Subtle grid background */
    #connect-screen::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
      background-size: 60px 60px;
      z-index: -1;
    }

    /* Top-center gradient glow */
    #connect-screen::after {
      content: '';
      position: fixed;
      top: -200px;
      left: 50%;
      transform: translateX(-50%);
      width: 800px;
      height: 500px;
      background: radial-gradient(ellipse, rgba(56, 189, 248, 0.06) 0%, transparent 70%);
      z-index: -1;
      pointer-events: none;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 8px;
    }

    .brand-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: linear-gradient(135deg, var(--accent), #0ea5e9);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
    }

    .brand h1 {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.5px;
      color: var(--text-primary);
    }

    .brand-subtitle {
      color: var(--text-muted);
      font-size: 14px;
      margin-bottom: 40px;
      font-weight: 400;
    }

    /* ─── Card ──────────────────────────────────────────────────────────── */
    .connect-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 16px;
      padding: 40px;
      width: 100%;
      max-width: 420px;
      box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    }

    .card-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 6px;
      color: var(--text-primary);
    }

    .card-description {
      font-size: 13px;
      color: var(--text-secondary);
      margin-bottom: 28px;
      line-height: 1.5;
    }

    /* ─── Code Input ────────────────────────────────────────────────────── */
    .input-group {
      margin-bottom: 20px;
    }

    .input-label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    #code-input {
      width: 100%;
      padding: 14px 16px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 22px;
      font-weight: 500;
      letter-spacing: 8px;
      text-align: center;
      background: var(--bg-primary);
      border: 1.5px solid var(--border-subtle);
      border-radius: 10px;
      color: var(--text-primary);
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
      caret-color: var(--accent);
    }

    #code-input::placeholder {
      color: var(--text-muted);
      letter-spacing: 6px;
      font-size: 18px;
    }

    #code-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-dim);
    }

    /* ─── Connect Button ────────────────────────────────────────────────── */
    #connect-btn {
      width: 100%;
      padding: 13px 24px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 600;
      background: var(--accent);
      color: #0a0e17;
      border: none;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    #connect-btn:hover:not(:disabled) {
      background: #5fc8f5;
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
    }

    #connect-btn:active:not(:disabled) {
      transform: translateY(0);
    }

    #connect-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .btn-spinner {
      display: none;
      width: 16px;
      height: 16px;
      border: 2px solid rgba(10, 14, 23, 0.3);
      border-top-color: #0a0e17;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
    }

    #connect-btn.loading .btn-spinner {
      display: block;
    }

    #connect-btn.loading .btn-text {
      display: none;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* ─── Error Message ─────────────────────────────────────────────────── */
    #error-msg {
      display: none;
      margin-top: 16px;
      padding: 10px 14px;
      font-size: 13px;
      color: var(--error);
      background: rgba(248, 113, 113, 0.08);
      border: 1px solid rgba(248, 113, 113, 0.15);
      border-radius: 8px;
      text-align: center;
    }

    #error-msg.visible {
      display: block;
      animation: shake 0.3s ease-in-out;
    }

    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-4px); }
      75% { transform: translateX(4px); }
    }

    /* ─── Security Badge ────────────────────────────────────────────────── */
    .security-badge {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      margin-top: 24px;
      padding: 8px 14px;
      background: rgba(52, 211, 153, 0.06);
      border: 1px solid rgba(52, 211, 153, 0.1);
      border-radius: 8px;
      font-size: 12px;
      color: var(--success);
    }

    .security-badge svg {
      width: 14px;
      height: 14px;
      flex-shrink: 0;
    }

    /* ─── Footer ────────────────────────────────────────────────────────── */
    .connect-footer {
      margin-top: 32px;
      font-size: 12px;
      color: var(--text-muted);
    }

    /* ─── Terminal Screen ───────────────────────────────────────────────── */
    #terminal-screen {
      display: none;
      flex-direction: column;
      height: 100vh;
      background: var(--terminal-bg);
    }

    #terminal-screen.active {
      display: flex;
    }

    /* ─── Status Bar ────────────────────────────────────────────────────── */
    .status-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 16px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border-subtle);
      font-size: 12px;
      flex-shrink: 0;
    }

    .status-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .status-brand {
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .status-brand .dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
    }

    .status-divider {
      width: 1px;
      height: 14px;
      background: var(--border-subtle);
    }

    .status-session {
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
    }

    .status-right {
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--text-secondary);
    }

    .status-right svg {
      width: 12px;
      height: 12px;
      color: var(--success);
    }

    /* terminal-container styles are in the Phase 3 section below */

    /* ─── Connecting overlay ─────────────────────────────────────────────── */
    #connecting-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(10, 14, 23, 0.85);
      backdrop-filter: blur(4px);
      z-index: 100;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 16px;
    }

    #connecting-overlay.visible {
      display: flex;
    }

    .connecting-spinner {
      width: 32px;
      height: 32px;
      border: 3px solid var(--border-subtle);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    .connecting-text {
      font-size: 14px;
      color: var(--text-secondary);
    }

    /* ─── Fingerprint Verification ───────────────────────────────────────── */
    .fingerprint-overlay {
      position: fixed;
      inset: 0;
      z-index: 140;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(10, 14, 23, 0.9);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .fingerprint-dialog {
      width: min(100%, 440px);
      padding: 28px;
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      background: var(--bg-card);
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    }

    .fingerprint-dialog h2 {
      margin-bottom: 8px;
      font-size: 18px;
      font-weight: 650;
      color: var(--text-primary);
    }

    .fingerprint-dialog p {
      margin-bottom: 18px;
      font-size: 13px;
      line-height: 1.5;
      color: var(--text-secondary);
    }

    .fingerprint-code {
      width: 100%;
      margin-bottom: 20px;
      padding: 14px 16px;
      border: 1px solid rgba(56, 189, 248, 0.22);
      border-radius: 6px;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-family: 'JetBrains Mono', monospace;
      font-size: 22px;
      font-weight: 600;
      letter-spacing: 0;
      text-align: center;
      overflow-wrap: anywhere;
    }

    .fingerprint-actions {
      display: flex;
      gap: 10px;
    }

    .fingerprint-actions button {
      min-height: 40px;
      padding: 0 14px;
      border-radius: 6px;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
    }

    .fingerprint-confirm {
      flex: 1;
      border: none;
      background: var(--accent);
      color: #0a0e17;
    }

    .fingerprint-cancel {
      border: 1px solid var(--border-subtle);
      background: transparent;
      color: var(--text-secondary);
    }

    @media (max-width: 480px) {
      .fingerprint-dialog {
        padding: 22px;
      }

      .fingerprint-actions {
        flex-direction: column;
      }
    }

    /* ─── Animations ────────────────────────────────────────────────────── */
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .connect-card {
      animation: fadeIn 0.4s ease-out;
    }

    /* ─── Connection Indicator ──────────────────────────────────────────── */
    #connection-indicator {
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 600;
      border-radius: 6px;
      background: var(--bg-primary);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* ─── View Only Badge ──────────────────────────────────────────────── */
    #readonly-badge {
      display: none;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      font-size: 11px;
      font-weight: 500;
      color: var(--warning);
      background: rgba(251, 191, 36, 0.1);
      border: 1px solid rgba(251, 191, 36, 0.2);
      border-radius: 4px;
    }
    #readonly-badge.visible { display: flex; }

    /* ─── Clipboard Buttons ────────────────────────────────────────────── */
    #copy-btn {
      display: none;
      position: fixed;
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 500;
      font-family: 'Inter', sans-serif;
      background: var(--bg-card);
      color: var(--text-primary);
      border: 1px solid var(--border-subtle);
      border-radius: 6px;
      cursor: pointer;
      z-index: 50;
      transition: background 0.15s;
    }
    #copy-btn:hover { background: var(--bg-card-hover); }
    #copy-btn.visible { display: block; }
    #copy-btn.copied {
      color: var(--success);
      border-color: rgba(52, 211, 153, 0.3);
    }

    .toolbar-btn {
      padding: 4px 8px;
      font-size: 11px;
      font-family: 'Inter', sans-serif;
      font-weight: 500;
      background: transparent;
      color: var(--text-secondary);
      border: 1px solid var(--border-subtle);
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s;
    }
    .toolbar-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
    .toolbar-btn:disabled { opacity: 0.3; cursor: not-allowed; }

    /* ─── Mobile Controls ──────────────────────────────────────────────── */
    .mobile-controls {
      display: none;
      gap: 6px;
      align-items: center;
    }
    @media (pointer: coarse) {
      .mobile-controls { display: flex; }
    }

    #mobile-input {
      position: fixed;
      top: -100px;
      left: -100px;
      width: 1px;
      height: 1px;
      opacity: 0;
      z-index: -1;
    }

    /* ─── Terminal Container ─────────── */
    #terminal-container {
      flex: 1;
      padding: 4px;
      overflow: hidden;
      position: relative;
    }

    /* ─── Clipboard Error Toast ────────────────────────────────────────── */
    #clipboard-toast {
      display: none;
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      padding: 8px 16px;
      font-size: 12px;
      color: var(--warning);
      background: var(--bg-card);
      border: 1px solid rgba(251, 191, 36, 0.2);
      border-radius: 8px;
      z-index: 60;
      animation: fadeIn 0.2s ease-out;
    }
    #clipboard-toast.visible { display: block; }

    /* ─── Toast Notification System ─────────────────────────────────── */
    #toast-container {
      position: fixed;
      bottom: 16px;
      right: 16px;
      display: flex;
      flex-direction: column-reverse;
      gap: 8px;
      z-index: 9999;
      pointer-events: none;
      max-width: 380px;
    }

    .toast {
      pointer-events: auto;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 14px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      line-height: 1.5;
      color: var(--text-primary);
      background: rgba(17, 24, 39, 0.92);
      border: 1px solid var(--border-subtle);
      border-left: 3px solid var(--text-muted);
      border-radius: 4px;
      cursor: pointer;
      animation: toastSlideIn 0.3s ease-out forwards;
      transition: opacity 0.25s ease, transform 0.25s ease;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .toast.removing {
      opacity: 0;
      transform: translateX(40px);
    }

    .toast-msg {
      flex: 1;
      min-width: 0;
      word-break: break-word;
    }

    /* Toast types */
    .toast.toast-info    { border-left-color: #64748b; }
    .toast.toast-success { border-left-color: var(--success); }
    .toast.toast-warning { border-left-color: var(--warning); }
    .toast.toast-error   { border-left-color: var(--error); }

    @keyframes toastSlideIn {
      from { opacity: 0; transform: translateX(60px); }
      to   { opacity: 1; transform: translateX(0); }
    }

    /* Mobile: full width bottom */
    @media (max-width: 480px) {
      #toast-container {
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-width: none;
      }
    }

    /* ─── File Upload Zone ──────────────────────────────────────────────── */
    .file-upload-zone {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 6px 16px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border-subtle);
      flex-shrink: 0;
    }

    /* Drag-over highlight: accent glow border */
    .file-upload-zone.drag-over {
      background: var(--accent-dim);
      border-bottom-color: var(--accent);
      box-shadow: inset 0 0 12px var(--accent-glow);
    }

    .upload-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      font-size: 11px;
      white-space: nowrap;
    }

    /* ─── Upload Progress Bar ──────────────────────────────────────────── */
    .upload-progress {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1;
      min-width: 0;
    }

    .upload-filename {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      color: var(--text-secondary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 180px;
    }

    .upload-bar-track {
      flex: 1;
      height: 4px;
      min-width: 60px;
      background: var(--bg-primary);
      border-radius: 2px;
      overflow: hidden;
    }

    .upload-bar-fill {
      height: 100%;
      width: 0%;
      background: var(--accent);
      border-radius: 2px;
      transition: width 0.15s ease;
    }

    .upload-percent {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      font-weight: 500;
      color: var(--text-muted);
      min-width: 32px;
      text-align: right;
    }
