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

    body {
      background: #0a0a0a;
      color: #e0e0e0;
      font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
      line-height: 1.6;
      min-height: 100vh;
    }

    /* ── Nav ── */
    nav {
      display: flex; align-items: center; gap: 10px;
      padding: 14px 24px; border-bottom: 1px solid #1a1a1a; font-size: 0.82rem;
      position: sticky; top: 0; background: rgba(10,10,10,0.95);
      backdrop-filter: blur(8px); z-index: 50;
    }
    nav a { color: #555; text-decoration: none; transition: color 0.2s; }
    nav a:hover { color: #f0f0f0; }
    nav .sep { color: #333; }
    nav .current { color: #e0e0e0; }
    nav .spacer { flex: 1; }
    .nav-updated { font-size: 0.72rem; color: #2a2a2a; }
    /* ── Nav auth button ── */
    #nav-auth { position: relative; }
    #nav-auth-btn {
      background: none; border: 1px solid #252525; border-radius: 6px;
      color: #444; font-size: 0.75rem; padding: 4px 10px; cursor: pointer;
      font-family: inherit; transition: color 0.2s, border-color 0.2s;
      text-decoration: none; display: inline-block; line-height: 1.6;
    }
    #nav-auth-btn:hover { color: #888; border-color: #333; }
    #nav-auth-btn.authed { color: #4ade80; border-color: rgba(74,222,128,0.25); }
    #nav-auth-dropdown {
      display: none; position: absolute; right: 0; top: calc(100% + 6px);
      background: #0e0e0e; border: 1px solid #1e1e1e; border-radius: 8px;
      min-width: 160px; z-index: 200; overflow: hidden;
    }
    #nav-auth-dropdown.open { display: block; }
    .nav-dd-item {
      display: block; padding: 9px 14px; font-size: 0.8rem; color: #888;
      text-decoration: none; cursor: pointer; background: none; border: none;
      font-family: inherit; width: 100%; text-align: left; transition: background .15s, color .15s;
    }
    .nav-dd-item:hover { background: #161616; color: #ccc; }
    .nav-dd-item.danger:hover { color: #f87171; }

    /* ── Layout ── */
    .page { max-width: 800px; margin: 0 auto; padding: 0 24px 80px; }

    /* ── Header ── */
    .page-header {
      padding: 48px 0 40px;
      border-bottom: 1px solid #1a1a1a;
    }
    .page-eyebrow {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.16em;
      color: #4ade80;
      margin-bottom: 10px;
    }
    .page-title {
      font-size: clamp(1.8rem, 4vw, 2.6rem);
      font-weight: 800;
      letter-spacing: -0.02em;
      color: #fff;
      margin-bottom: 10px;
    }
    .page-subtitle {
      font-size: 0.92rem;
      color: #555;
      max-width: 520px;
    }

    /* ── Admin controls ── */
    #admin-controls {
      display: none;
      margin-top: 28px;
      gap: 12px;
      flex-direction: column;
    }
    body.admin-mode #admin-controls { display: flex; }

    .admin-section {
      background: #0e0e0e;
      border: 1px solid #1e1e1e;
      border-radius: 10px;
      padding: 20px 22px;
    }
    .admin-section-title {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #4ade80;
      margin-bottom: 14px;
    }
    .upload-row {
      display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    }
    #upload-input {
      flex: 1; min-width: 0;
      background: #151515; border: 1px solid #2a2a2a; border-radius: 6px;
      color: #e0e0e0; font-size: 0.82rem; padding: 7px 10px;
      font-family: inherit; outline: none;
    }
    .btn-green {
      background: rgba(74,222,128,0.1);
      border: 1px solid rgba(74,222,128,0.3);
      border-radius: 6px;
      color: #4ade80;
      font-size: 0.78rem;
      font-weight: 600;
      padding: 7px 16px;
      cursor: pointer;
      font-family: inherit;
      white-space: nowrap;
      transition: background 0.2s;
    }
    .btn-green:hover:not(:disabled) { background: rgba(74,222,128,0.18); }
    .btn-green:disabled { opacity: 0.4; cursor: not-allowed; }

    #text-content {
      width: 100%; min-height: 100px; resize: vertical;
      background: #151515; border: 1px solid #2a2a2a; border-radius: 6px;
      color: #e0e0e0; font-size: 0.82rem; padding: 10px 12px;
      font-family: inherit; outline: none; margin-bottom: 10px;
      transition: border-color 0.2s;
    }
    #text-content:focus { border-color: #333; }
    #text-filename {
      background: #151515; border: 1px solid #2a2a2a; border-radius: 6px;
      color: #e0e0e0; font-size: 0.82rem; padding: 7px 10px;
      font-family: inherit; outline: none; width: 240px;
      margin-bottom: 10px;
    }
    .text-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
    #admin-status {
      font-size: 0.78rem;
      color: #4ade80;
      min-height: 1.2em;
    }
    #admin-status.error { color: #f87171; }

    /* ── File list ── */
    #files-section {
      margin-top: 36px;
    }
    .section-label {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.14em;
      color: #333;
      margin-bottom: 16px;
    }
    #loading {
      text-align: center;
      padding: 48px 0;
      color: #333;
      font-size: 0.88rem;
    }
    #empty-state {
      display: none;
      text-align: center;
      padding: 48px 0;
      color: #333;
      font-size: 0.88rem;
    }
    #files-list {
      display: flex;
      flex-direction: column;
      gap: 1px;
      background: #1a1a1a;
      border: 1px solid #1a1a1a;
      border-radius: 10px;
      overflow: hidden;
    }
    .file-row {
      background: #0e0e0e;
      padding: 18px 20px;
      display: flex;
      gap: 16px;
      align-items: flex-start;
      transition: background 0.15s;
    }
    .file-row:hover { background: #111; }
    .file-icon {
      flex-shrink: 0;
      width: 32px; height: 32px;
      border-radius: 6px;
      background: #151515;
      border: 1px solid #222;
      display: flex; align-items: center; justify-content: center;
      color: #333; font-size: 0.7rem; font-weight: 700;
      text-transform: uppercase;
      margin-top: 1px;
    }
    .file-icon.txt  { color: #4ade80; border-color: rgba(74,222,128,0.2); }
    .file-icon.pdf  { color: #f87171; border-color: rgba(248,113,113,0.2); }
    .file-icon.docx { color: #60a5fa; border-color: rgba(96,165,250,0.2); }
    .file-body { flex: 1; min-width: 0; }
    .file-name {
      font-size: 0.9rem;
      font-weight: 600;
      color: #e0e0e0;
      margin-bottom: 4px;
      word-break: break-all;
    }
    .file-meta {
      font-size: 0.72rem;
      color: #333;
      margin-bottom: 6px;
    }
    .file-preview {
      font-size: 0.8rem;
      color: #444;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .delete-btn {
      display: none;
      flex-shrink: 0;
      background: none;
      border: 1px solid #2a1515;
      border-radius: 6px;
      color: #5a2020;
      font-size: 0.72rem;
      padding: 5px 10px;
      cursor: pointer;
      font-family: inherit;
      align-self: flex-start;
      transition: color 0.2s, border-color 0.2s, background 0.2s;
    }
    .delete-btn:hover { color: #f87171; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.05); }
    body.admin-mode .delete-btn { display: block; }

    /* ── Search overlay ── */
    #search-overlay {
      display: none; position: fixed; inset: 0; z-index: 1000;
      background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
      align-items: flex-start; justify-content: center; padding-top: 80px;
    }
    #search-overlay.open { display: flex; }
    #search-box {
      background: #111; border: 1px solid #2a2a2a; border-radius: 10px;
      width: 100%; max-width: 580px; overflow: hidden;
      box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    }
    #search-input {
      width: 100%; padding: 16px 20px; background: none; border: none; outline: none;
      color: #e0e0e0; font-size: 1rem; font-family: inherit; box-sizing: border-box;
    }
    #search-input::placeholder { color: #444; }
    #search-divider { height: 1px; background: #1e1e1e; }
    #search-results { max-height: 400px; overflow-y: auto; }
    .search-result {
      display: block; padding: 12px 20px; text-decoration: none; color: inherit;
      border-bottom: 1px solid #151515; transition: background 0.15s;
    }
    .search-result:hover, .search-result.active { background: #161616; }
    .search-result-title { color: #e0e0e0; font-size: 0.9rem; margin-bottom: 3px; }
    .search-result-snippet { color: #555; font-size: 0.78rem; line-height: 1.4; }
    .search-result-snippet mark { background: none; color: #4ade80; font-style: normal; }
    #search-empty { padding: 20px; text-align: center; color: #333; font-size: 0.85rem; }
    #search-hint {
      padding: 8px 20px; color: #2a2a2a; font-size: 0.72rem;
      border-top: 1px solid #151515; display: flex; gap: 16px;
    }

    /* ── Floating chat ── */
    #chat-bubble {
      position: fixed; bottom: 24px; right: 24px; z-index: 900;
      width: 48px; height: 48px; border-radius: 50%;
      background: #1a1a1a; border: 1px solid #2a2a2a;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; color: #555; transition: color 0.2s, border-color 0.2s, transform 0.2s;
      box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }
    #chat-bubble:hover { color: #4ade80; border-color: rgba(74,222,128,0.3); transform: scale(1.05); }
    #chat-panel {
      position: fixed; bottom: 84px; right: 24px; z-index: 901;
      width: 340px; max-height: 480px;
      background: #111; border: 1px solid #1e1e1e; border-radius: 12px;
      display: none; flex-direction: column;
      box-shadow: 0 8px 40px rgba(0,0,0,0.6);
      overflow: hidden;
    }
    #chat-panel.open { display: flex; }
    #chat-panel-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 12px 16px; border-bottom: 1px solid #1a1a1a;
      font-size: 0.82rem; color: #888;
    }
    #chat-messages {
      flex: 1; overflow-y: auto; padding: 12px 16px;
      display: flex; flex-direction: column; gap: 10px;
      min-height: 200px; max-height: 320px;
      font-size: 0.82rem; line-height: 1.5;
    }
    .chat-msg-user {
      align-self: flex-end; background: #1a1a1a; border-radius: 10px 10px 2px 10px;
      padding: 8px 12px; color: #d0d0d0; max-width: 85%;
    }
    .chat-msg-ai {
      align-self: flex-start; color: #aaa; max-width: 90%;
    }
    .chat-msg-ai.streaming::after {
      content: '▋'; animation: blink 0.8s step-end infinite;
    }
    @keyframes blink { 50% { opacity: 0; } }
    #chat-input-row {
      display: flex; padding: 10px 12px; gap: 8px; border-top: 1px solid #1a1a1a;
    }
    #chat-input {
      flex: 1; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px;
      color: #e0e0e0; font-size: 0.82rem; padding: 8px 10px; outline: none; font-family: inherit;
    }
    #chat-input:focus { border-color: #333; }
    #chat-send {
      background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px;
      color: #555; padding: 8px 12px; cursor: pointer; font-size: 1rem;
      transition: color 0.2s;
    }
    #chat-send:hover { color: #4ade80; border-color: rgba(74,222,128,0.2); }

/* Phase 4 – extracted inline styles */
._p4-6d414d {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.82rem;
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
}

._p4-91bab1 {
  font-size: 0.78rem;
  color: #444;
  margin-bottom: 10px;
}

._p4-b02f36 {
  margin-top: 32px;
}

._p4-b4f0ef {
  font-size: 0.72rem;
  color: #333;
  margin-top: 8px;
}
