/* ================================================================
   Almo AI — All Styles
   Sections: Tokens · Reset · Base · Scrollbars · Sidebar · Header
             Chat · Welcome · Messages · Code · Input · Login
             Admin · Mobile · Responsive
================================================================ */

/* ─── TOKENS ─────────────────────────────────────────── */
  :root {
    --black:      #080808;
    --black2:     #0f0f0f;
    --black3:     #161616;
    --gold:       #c9a84c;
    --gold-light: #e4c97e;
    --gold-dark:  #7a5e28;
    --gold-glow:  rgba(201,168,76,0.18);
    --white:      #f2ede3;
    --white2:     #d9d2c4;
    --muted:      rgba(242,237,227,0.35);
    --border:     rgba(201,168,76,0.12);
    --border-mid: rgba(201,168,76,0.25);
    --sidebar-w:  272px;
    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
  }

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

  /* ─── BASE ───────────────────────────────────────────── */
  body {
    background: var(--black);
    color: var(--white);
    font-family: 'Syne', sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
  }

  /* Ambient background glow */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(ellipse 70% 45% at 50% -10%, rgba(201,168,76,0.07) 0%, transparent 65%),
      radial-gradient(ellipse 35% 35% at 92% 95%,  rgba(201,168,76,0.05) 0%, transparent 55%),
      radial-gradient(ellipse 25% 25% at 5%  80%,  rgba(201,168,76,0.03) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
  }

  /* ─── SCROLLBARS ─────────────────────────────────────── */
  ::-webkit-scrollbar { width: 3px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.18); border-radius: 10px; }

  /* ─── SIDEBAR ────────────────────────────────────────── */
  .sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--black2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    position: relative;
  }
  /* subtle inner glow on the sidebar */
  .sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 1px; height: 100%;
    background: linear-gradient(180deg, transparent, rgba(201,168,76,0.2) 40%, rgba(201,168,76,0.2) 60%, transparent);
    pointer-events: none;
  }

  .sidebar-header { padding: 22px 18px 16px; border-bottom: 1px solid var(--border); }

  .sidebar-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
  .sidebar-logo-icon {
    width: 34px; height: 34px;
    border: 1px solid rgba(201,168,76,0.5);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.03));
    box-shadow: 0 0 12px rgba(201,168,76,0.1), inset 0 1px 0 rgba(201,168,76,0.15);
    flex-shrink: 0;
  }
  .sidebar-logo-icon svg { width: 16px; height: 16px; fill: var(--gold); }
  .sidebar-logo-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px; font-weight: 600; letter-spacing: 2.5px;
  }
  .sidebar-logo-name span { color: var(--gold); }

  .new-chat-btn {
    width: 100%;
    display: flex; align-items: center; gap: 9px;
    padding: 11px 15px;
    background: linear-gradient(135deg, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--gold);
    font-family: 'Syne', sans-serif;
    font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative; overflow: hidden;
  }
  .new-chat-btn::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(201,168,76,0.12), transparent);
    opacity: 0;
    transition: opacity 0.25s;
  }
  .new-chat-btn:hover { border-color: rgba(201,168,76,0.5); box-shadow: 0 2px 14px rgba(201,168,76,0.12); }
  .new-chat-btn:hover::after { opacity: 1; }
  .new-chat-btn svg { width: 14px; height: 14px; fill: var(--gold); flex-shrink: 0; position:relative; z-index:1; }
  .new-chat-btn span { position: relative; z-index: 1; }

  .sidebar-search { padding: 10px 16px 4px; }
  .sidebar-search input {
    width: 100%;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--white2);
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .sidebar-search input:focus { border-color: rgba(201,168,76,0.4); box-shadow: 0 0 0 2px rgba(201,168,76,0.06); }
  .sidebar-search input::placeholder { color: rgba(201,168,76,0.22); }

  .sidebar-actions { display: flex; gap: 6px; padding: 6px 16px 8px; }
  .sidebar-action-btn {
    flex: 1; padding: 7px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: rgba(201,168,76,0.3);
    font-family: 'Syne', sans-serif;
    font-size: 10px; letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
  }
  .sidebar-action-btn:hover { border-color: rgba(201,168,76,0.3); color: var(--gold); background: rgba(201,168,76,0.05); }
  .sidebar-action-btn.danger:hover { border-color: rgba(255,80,80,0.3); color: #ff6b6b; background: rgba(255,80,80,0.05); }

  .sidebar-section-title {
    font-size: 9px;
    color: rgba(201,168,76,0.28);
    letter-spacing: 2.5px; text-transform: uppercase;
    padding: 14px 18px 7px;
  }

  .chats-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }

  .chat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 10px 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    gap: 8px;
    border: 1px solid transparent;
  }
  .chat-item:hover { background: rgba(255,255,255,0.035); border-color: var(--border); }
  .chat-item.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
    border-color: rgba(201,168,76,0.2);
    box-shadow: inset 2px 0 0 var(--gold);
  }
  .chat-item-text { flex: 1; overflow: hidden; }
  .chat-item-title { font-size: 13px; color: var(--white2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
  .chat-item.active .chat-item-title { color: var(--gold-light); }
  .chat-item-date { font-size: 10px; color: rgba(201,168,76,0.28); }

  .chat-item-pin {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; background: none; border: none;
    color: rgba(201,168,76,0.22); cursor: pointer; font-size: 11px;
    opacity: 0; transition: all 0.2s; flex-shrink: 0;
  }
  .chat-item:hover .chat-item-pin { opacity: 1; }
  .chat-item-pin.pinned { opacity: 1; color: var(--gold); }
  .chat-item.pinned-item { border-left: 2px solid var(--gold) !important; }

  .chat-item-del {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; background: none; border: none;
    color: rgba(255,255,255,0.18); cursor: pointer; font-size: 15px;
    opacity: 0; transition: all 0.2s; flex-shrink: 0;
  }
  .chat-item:hover .chat-item-del { opacity: 1; }
  .chat-item-del:hover { background: rgba(255,80,80,0.15); color: #ff6b6b; }

  .sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
  .user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    transition: border-color 0.2s;
  }
  .user-info:hover { border-color: var(--border-mid); }
  .user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.06));
    border: 1px solid rgba(201,168,76,0.35);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: var(--gold);
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(201,168,76,0.1);
  }
  .user-details { flex: 1; overflow: hidden; }
  .user-name { font-size: 13px; color: var(--white2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  .user-email { font-size: 10px; color: rgba(201,168,76,0.3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
  .logout-btn {
    width: 100%; padding: 9px;
    background: transparent;
    border: 1px solid rgba(245,240,232,0.07);
    border-radius: var(--radius-sm);
    color: rgba(245,240,232,0.28);
    font-family: 'Syne', sans-serif; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
    cursor: pointer; transition: all 0.2s;
  }
  .logout-btn:hover { border-color: rgba(245,240,232,0.15); color: var(--white2); background: rgba(255,255,255,0.02); }

  /* ─── HEADER ─────────────────────────────────────────── */
  .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

  header {
    position: relative; z-index: 10;
    padding: 0 24px;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(8,8,8,0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  /* gold line under header */
  header::after {
    content: '';
    position: absolute; bottom: -1px; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(201,168,76,0.3) 30%, rgba(201,168,76,0.3) 70%, transparent 100%);
  }

  .header-left { display: flex; align-items: center; gap: 12px; }
  .chat-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px; color: var(--white2);
    letter-spacing: 0.5px; opacity: 0.55;
    max-width: 340px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .status {
    display: flex; align-items: center; gap: 7px;
    font-size: 10px; color: rgba(201,168,76,0.45);
    letter-spacing: 2px; text-transform: uppercase;
  }
  .status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76,175,80,0.6);
    animation: pulse 2.5s ease infinite;
  }
  @keyframes pulse {
    0%,100% { opacity:1; transform:scale(1); box-shadow:0 0 6px rgba(76,175,80,0.6); }
    50%      { opacity:0.5; transform:scale(0.8); box-shadow:0 0 2px rgba(76,175,80,0.3); }
  }

  /* ─── CHAT CONTAINER ─────────────────────────────────── */
  .chat-container {
    flex: 1; overflow-y: auto; padding: 0;
    position: relative; z-index: 1;
    scroll-behavior: smooth;
    display: flex; flex-direction: column; align-items: center;
  }
  .chat-inner { width: 100%; max-width: 740px; padding: 36px 28px 20px; }

  /* ─── WELCOME ────────────────────────────────────────── */
  .welcome {
    text-align: center;
    padding: 70px 24px 44px;
    animation: fadeUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
  }
  .welcome-icon {
    width: 72px; height: 72px;
    border: 1px solid rgba(201,168,76,0.45);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 28px;
    background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(201,168,76,0.02));
    box-shadow: 0 0 32px rgba(201,168,76,0.1), 0 0 80px rgba(201,168,76,0.05), inset 0 1px 0 rgba(201,168,76,0.2);
    position: relative;
  }
  /* spinning ring */
  .welcome-icon::before {
    content: '';
    position: absolute; inset: -6px;
    border-radius: 26px;
    border: 1px solid transparent;
    border-top-color: rgba(201,168,76,0.3);
    border-right-color: rgba(201,168,76,0.1);
    animation: spin 6s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .welcome-icon svg { width: 30px; height: 30px; fill: var(--gold); filter: drop-shadow(0 0 8px rgba(201,168,76,0.4)); }

  .welcome-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 44px; font-weight: 300;
    color: var(--white); letter-spacing: 4px;
    margin-bottom: 6px;
    line-height: 1.1;
  }
  .welcome-title span { color: var(--gold); font-weight: 600; }

  .welcome-line {
    width: 60px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 18px auto;
    position: relative;
  }
  .welcome-line::before {
    content: '';
    position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--gold);
  }

  .welcome-sub {
    font-size: 10px; color: rgba(201,168,76,0.35);
    letter-spacing: 3.5px; text-transform: uppercase;
    margin-bottom: 44px;
  }

  .suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
  .suggestion-chip {
    padding: 10px 18px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(201,168,76,0.14);
    border-radius: 24px;
    font-size: 12px; color: var(--white2);
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
  }
  .suggestion-chip:hover {
    background: rgba(201,168,76,0.08);
    border-color: rgba(201,168,76,0.35);
    color: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201,168,76,0.1);
  }

  /* ─── MESSAGES ───────────────────────────────────────── */
  .message {
    display: flex; gap: 14px;
    margin-bottom: 28px;
    animation: fadeUp 0.35s cubic-bezier(0.22,1,0.36,1) forwards;
    opacity: 0;
    align-items: flex-start;
  }
  @keyframes fadeUp {
    from { opacity:0; transform:translateY(14px); }
    to   { opacity:1; transform:translateY(0); }
  }
  .message.user { flex-direction: row-reverse; }

  .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .message.ai .avatar {
    background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.06));
    border: 1px solid rgba(201,168,76,0.35);
    color: var(--gold);
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    box-shadow: 0 0 12px rgba(201,168,76,0.12);
  }
  .message.user .avatar {
    background: rgba(201,168,76,0.08);
    border: 1px solid rgba(201,168,76,0.2);
    color: var(--gold); font-size: 11px;
  }

  .msg-content { max-width: 84%; display: flex; flex-direction: column; }
  .message.user .msg-content { align-items: flex-end; }

  .message.ai .bubble {
    background: transparent; border: none;
    padding: 2px 0;
    font-size: 15px; line-height: 1.85;
    color: var(--white2);
  }
  .message.user .bubble {
    background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(201,168,76,0.06));
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 18px 18px 4px 18px;
    padding: 13px 20px;
    font-size: 15px; line-height: 1.65;
    color: var(--white);
    box-shadow: 0 2px 16px rgba(201,168,76,0.06);
  }

  /* MSG ACTIONS */
  .msg-actions { display: flex; gap: 6px; margin-top: 7px; opacity: 0; transition: opacity 0.2s; }
  .message:hover .msg-actions { opacity: 1; }
  .msg-action-btn {
    background: none;
    border: 1px solid rgba(201,168,76,0.14);
    border-radius: 6px;
    color: rgba(201,168,76,0.38);
    font-size: 10px; padding: 3px 9px;
    cursor: pointer;
    font-family: 'Syne', sans-serif; letter-spacing: 1px;
    transition: all 0.2s;
  }
  .msg-action-btn:hover { color: var(--gold); border-color: rgba(201,168,76,0.4); background: rgba(201,168,76,0.06); }

  .message-time { font-size: 10px; color: rgba(201,168,76,0.22); margin-top: 5px; }
  .message.user .message-time { text-align: right; }

  /* ─── CODE BLOCK ─────────────────────────────────────── */
  .code-block {
    background: #0d0d0d;
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: var(--radius-md);
    margin-top: 14px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  }
  .code-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 16px;
    background: rgba(201,168,76,0.04);
    border-bottom: 1px solid rgba(201,168,76,0.1);
  }
  .code-lang {
    font-size: 10px; color: var(--gold);
    letter-spacing: 2.5px; text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
  }
  .copy-btn {
    font-size: 10px; color: rgba(201,168,76,0.45);
    background: none; border: none; cursor: pointer;
    letter-spacing: 1px; text-transform: uppercase;
    padding: 3px 10px; border-radius: 4px;
    font-family: 'Syne', sans-serif;
    transition: all 0.2s;
    border: 1px solid transparent;
  }
  .copy-btn:hover { color: var(--gold); background: rgba(201,168,76,0.08); border-color: var(--border-mid); }
  .code-block pre {
    padding: 18px 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px; line-height: 1.65;
    color: #ddd0b0;
    white-space: pre-wrap; word-break: break-word;
  }

  /* ─── TYPING INDICATOR ───────────────────────────────── */
  .typing { display: flex; gap: 5px; align-items: center; padding: 10px 0; }
  .typing span {
    width: 7px; height: 7px;
    background: var(--gold);
    border-radius: 50%;
    animation: typingBounce 1.3s ease infinite;
    opacity: 0.35;
  }
  .typing span:nth-child(2) { animation-delay: 0.18s; }
  .typing span:nth-child(3) { animation-delay: 0.36s; }
  @keyframes typingBounce {
    0%,100% { opacity:0.3; transform:scale(0.75) translateY(0); }
    50%      { opacity:1;   transform:scale(1.1)  translateY(-3px); }
  }

  /* ─── INPUT AREA ─────────────────────────────────────── */
  .input-area {
    position: relative; z-index: 10;
    padding: 16px 28px 26px;
    background: rgba(8,8,8,0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center;
  }
  /* top glow line */
  .input-area::before {
    content: '';
    position: absolute; top: -1px; left: 0; width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(201,168,76,0.2) 30%, rgba(201,168,76,0.2) 70%, transparent 100%);
  }

  .input-wrapper {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 18px;
    padding: 10px 10px 10px 20px;
    transition: all 0.3s ease;
    width: 100%; max-width: 740px;
  }
  .input-wrapper:focus-within {
    border-color: rgba(201,168,76,0.5);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.06), 0 4px 24px rgba(201,168,76,0.08);
    background: rgba(255,255,255,0.035);
  }
  #user-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--white);
    font-family: 'Syne', sans-serif; font-size: 15px;
    padding: 4px 0;
  }
  #user-input::placeholder { color: rgba(201,168,76,0.22); font-size: 14px; }

  .send-btn {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none; border-radius: 12px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(201,168,76,0.2);
  }
  .send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 18px rgba(201,168,76,0.35); }
  .send-btn:active { transform: scale(0.94); }
  .send-btn svg { width: 16px; height: 16px; fill: #080808; }

  .input-hint {
    text-align: center; font-size: 10px;
    color: rgba(201,168,76,0.13);
    letter-spacing: 1.5px; text-transform: uppercase;
    margin-top: 10px;
  }

  /* ─── LOGIN SCREEN ───────────────────────────────────── */
  .login-screen {
    position: fixed; inset: 0;
    background: var(--black);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
  }
  /* animated bg grid */
  .login-screen::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
      linear-gradient(rgba(201,168,76,0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(201,168,76,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 40%, transparent 100%);
    pointer-events: none;
  }
  .login-screen::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(201,168,76,0.06) 0%, transparent 70%);
    pointer-events: none;
  }

  .login-box {
    background: rgba(15,15,15,0.9);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 24px;
    padding: 52px 44px;
    width: 90%; max-width: 420px;
    text-align: center;
    position: relative; z-index: 1;
    box-shadow: 0 0 80px rgba(201,168,76,0.06), 0 24px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
  }
  /* top gold bar */
  .login-box::before {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 60%; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    border-radius: 1px;
  }

  .login-icon {
    width: 60px; height: 60px;
    margin: 0 auto 22px;
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(201,168,76,0.12), transparent);
    box-shadow: 0 0 24px rgba(201,168,76,0.1);
  }
  .login-icon svg { width: 26px; height: 26px; fill: var(--gold); }

  .login-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 38px; font-weight: 600;
    color: var(--white); letter-spacing: 4px;
    margin-bottom: 6px;
  }
  .login-title span { color: var(--gold); }
  .login-sub {
    font-size: 10px; color: rgba(201,168,76,0.38);
    letter-spacing: 3px; text-transform: uppercase;
    margin-bottom: 38px;
  }

  .login-input {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    color: var(--white);
    font-family: 'Syne', sans-serif; font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: all 0.3s;
  }
  .login-input:focus {
    border-color: rgba(201,168,76,0.55);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.07);
    background: rgba(255,255,255,0.04);
  }
  .login-input::placeholder { color: rgba(201,168,76,0.28); letter-spacing: 0.5px; }

  .login-btn {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none; border-radius: var(--radius-md);
    color: #080808;
    font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: 2.5px; text-transform: uppercase;
    cursor: pointer; margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(201,168,76,0.2);
    position: relative; overflow: hidden;
  }
  .login-btn::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 50%);
    opacity: 0; transition: opacity 0.3s;
  }
  .login-btn:hover { box-shadow: 0 6px 28px rgba(201,168,76,0.4); transform: translateY(-1px); }
  .login-btn:hover::after { opacity: 1; }
  .login-btn:active { transform: translateY(0); }

  .login-warning {
    font-size: 10px; color: rgba(201,168,76,0.25);
    letter-spacing: 0.5px; margin-top: 22px; line-height: 1.7;
  }

  /* ─── ADMIN SCREEN ───────────────────────────────────── */
  .admin-screen {
    position: fixed; inset: 0;
    background: var(--black);
    z-index: 200;
    display: none; flex-direction: column;
    overflow-y: auto; padding: 40px 32px;
  }
  .admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(201,168,76,0.15);
    padding-bottom: 20px;
  }
  .admin-title { font-family: 'Cormorant Garamond', serif; font-size: 28px; color: var(--gold); letter-spacing: 3px; }
  .admin-close {
    padding: 8px 18px;
    background: none; border: 1px solid rgba(201,168,76,0.28);
    border-radius: var(--radius-sm);
    color: var(--gold); cursor: pointer;
    font-family: 'Syne', sans-serif; font-size: 11px; letter-spacing: 1px;
    transition: all 0.2s;
  }
  .admin-close:hover { background: rgba(201,168,76,0.06); }
  .admin-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(201,168,76,0.12);
    border-radius: var(--radius-md);
    padding: 24px; margin-bottom: 20px;
  }
  .admin-section h3 { font-size: 10px; color: var(--gold); letter-spacing: 3px; text-transform: uppercase; margin-bottom: 16px; }
  .admin-stat {
    display: flex; justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px; color: var(--white2);
  }
  .admin-stat span { color: var(--gold); }

  /* ─── DIVIDER ────────────────────────────────────────── */
  .divider { display: flex; align-items: center; gap: 14px; margin: 6px 0 28px; }
  .divider::before, .divider::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.15));
  }
  .divider::after { background: linear-gradient(90deg, rgba(201,168,76,0.15), transparent); }
  .divider span { font-size: 9px; color: rgba(201,168,76,0.25); letter-spacing: 3px; text-transform: uppercase; }

  /* ─── EDIT MESSAGE ───────────────────────────────────── */
  .msg-edit-input {
    background: rgba(201,168,76,0.06);
    border: 1px solid rgba(201,168,76,0.28);
    border-radius: var(--radius-md);
    padding: 11px 16px; color: var(--white);
    font-family: 'Syne', sans-serif; font-size: 14px;
    outline: none; width: 100%; resize: none; line-height: 1.5;
    transition: border-color 0.2s;
  }
  .msg-edit-input:focus { border-color: rgba(201,168,76,0.5); }
  .msg-edit-actions { display: flex; gap: 8px; margin-top: 8px; }
  .msg-edit-save {
    padding: 7px 16px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none; border-radius: var(--radius-sm);
    color: #080808; font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 700;
    cursor: pointer; letter-spacing: 1px;
  }
  .msg-edit-cancel {
    padding: 7px 16px;
    background: none; border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.35);
    font-family: 'Syne', sans-serif; font-size: 11px; cursor: pointer;
    transition: all 0.2s;
  }
  .msg-edit-cancel:hover { border-color: rgba(255,255,255,0.2); color: var(--white2); }

  /* ─── MOBILE TOGGLE ──────────────────────────────────── */
  .sidebar-toggle {
    display: none;
    width: 36px; height: 36px;
    background: rgba(201,168,76,0.07);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: all 0.2s;
  }
  .sidebar-toggle:hover { background: rgba(201,168,76,0.12); }
  .sidebar-toggle svg { width: 16px; height: 16px; fill: var(--gold); }

  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 15; backdrop-filter: blur(4px); }
  .sidebar-overlay.active { display: block; }

  /* ─── MOBILE INPUT (textarea auto-grow) ─────────────── */
  #user-input-mobile {
    flex: 1; background: none; border: none; outline: none;
    color: var(--white);
    font-family: 'Syne', sans-serif; font-size: 16px; /* 16px prevents iOS zoom */
    padding: 4px 0;
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    display: none; /* hidden on desktop */
  }
  #user-input-mobile::placeholder { color: rgba(201,168,76,0.22); }

  /* ─── BOTTOM NAV (mobile only) ───────────────────────── */
  .bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(10,10,10,0.97);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 30;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav::before {
    content: '';
    position: absolute; top: -1px; left: 0; width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.2), transparent);
  }
  .bnav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none;
    color: rgba(201,168,76,0.35);
    font-family: 'Syne', sans-serif; font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
    cursor: pointer; padding: 8px 16px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .bnav-btn svg { width: 20px; height: 20px; fill: currentColor; }
  .bnav-btn.active, .bnav-btn:active { color: var(--gold); }
  .bnav-btn span { font-size: 9px; }

  /* ─── RESPONSIVE ─────────────────────────────────────── */
  @media (max-width: 768px) {
    /* Sidebar slides in from left */
    .sidebar {
      position: fixed; left: 0; top: 0;
      height: 100%; height: 100dvh;
      z-index: 40;
      transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
    }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.6); }

    /* Show hamburger toggle */
    .sidebar-toggle { display: flex; }

    /* Main fills full width, account for bottom nav */
    .main {
      width: 100%;
      height: 100dvh;
      padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }

    /* Header */
    header { padding: 0 14px; }
    .chat-title { font-size: 13px; max-width: 160px; }

    /* Chat area */
    .chat-inner { padding: 16px 14px 8px; }

    /* Bigger message bubbles, easier to read */
    .message.ai .bubble  { font-size: 15px; line-height: 1.9; }
    .message.user .bubble { font-size: 15px; padding: 12px 16px; }
    .msg-content { max-width: 90%; }

    /* Avatar slightly smaller */
    .avatar { width: 30px; height: 30px; }

    /* Input area - fixed above bottom nav */
    .input-area {
      padding: 10px 14px;
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
      position: fixed;
      bottom: calc(56px + env(safe-area-inset-bottom));
      left: 0; right: 0;
      z-index: 25;
      border-top: 1px solid var(--border);
    }
    .input-wrapper { border-radius: 14px; padding: 8px 10px 8px 16px; }

    /* Show textarea, hide text input on mobile */
    #user-input { display: none; }
    #user-input-mobile { display: block; }

    /* Hint text */
    .input-hint { display: none; }

    /* Welcome screen */
    .welcome { padding: 32px 16px 28px; }
    .welcome-title { font-size: 28px; letter-spacing: 2px; }
    .welcome-icon { width: 60px; height: 60px; }
    .welcome-icon::before { inset: -5px; }
    .suggestions { gap: 8px; }
    .suggestion-chip { font-size: 11px; padding: 9px 14px; }

    /* Show bottom nav */
    .bottom-nav { display: flex; }

    /* Code block responsive */
    .code-block pre { font-size: 12px; padding: 14px; }

    /* Msg actions - always visible on mobile (no hover) */
    .msg-actions { opacity: 1; }

    /* login box */
    .login-box { padding: 36px 24px; }
    .login-title { font-size: 30px; }
  }

  /* ─── PERSONA BUTTONS ───────────────────────────────── */
  .persona-btn {
    flex: 1; padding: 6px 4px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: rgba(201,168,76,0.35);
    font-family: 'Syne', sans-serif;
    font-size: 9px; letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .persona-btn:hover { border-color: rgba(201,168,76,0.3); color: var(--gold); background: rgba(201,168,76,0.05); }
  .persona-btn.active { border-color: rgba(201,168,76,0.55); color: var(--gold); background: rgba(201,168,76,0.1); box-shadow: 0 0 8px rgba(201,168,76,0.08); }

  /* Onboarding persona cards */
  .onb-card {
    background: linear-gradient(180deg, #0f0f0f, #0a0a0a);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 12px; padding: 12px 14px; cursor: pointer;
    text-align: left; transition: all .18s; color: var(--white);
  }
  .onb-card:hover { border-color: rgba(201,168,76,0.45); transform: translateY(-1px); }
  .onb-card.sel { border-color: var(--gold); background: rgba(201,168,76,0.08); box-shadow: 0 0 14px rgba(201,168,76,0.15); }
  .onb-card .ic { font-size: 22px; margin-bottom: 4px; }
  .onb-card .nm { color: var(--gold); font-weight: 700; font-size: 13px; font-family: 'Syne', sans-serif; }
  .onb-card .ds { color: rgba(242,237,227,0.55); font-size: 11px; margin-top: 4px; line-height: 1.4; }
  /* Mic listening pulse */
  #mic-btn.listening { background: linear-gradient(135deg, #c9a84c, #e4c97e) !important; animation: pulseMic 1.1s infinite; }
  #mic-btn.listening svg { fill: #080808 !important; }
  @keyframes pulseMic { 0%,100%{box-shadow:0 0 0 0 rgba(201,168,76,.55)} 50%{box-shadow:0 0 0 10px rgba(201,168,76,0)} }
  #tts-btn.on { background: linear-gradient(135deg, #c9a84c, #e4c97e) !important; }
  #tts-btn.on svg { fill: #080808 !important; }

  /* ─── KNOWLEDGE LIST ITEMS ───────────────────────────── */
  .kb-item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .kb-item-info { flex: 1; }
  .kb-item-topic { font-size: 13px; color: var(--gold-light); font-weight: 600; margin-bottom: 3px; }
  .kb-item-content { font-size: 11px; color: var(--white2); opacity: 0.7; line-height: 1.5; }
  .kb-item-del {
    background: none; border: 1px solid rgba(255,80,80,0.2);
    border-radius: 5px; color: rgba(255,100,100,0.5);
    font-size: 12px; cursor: pointer; padding: 4px 8px;
    transition: all 0.2s; flex-shrink: 0;
  }
  .kb-item-del:hover { background: rgba(255,80,80,0.1); color: #ff6b6b; }


  /* ─── LANGUAGE SELECTION SCREEN ─────────────────────── */
  .lang-screen {
    position: fixed; inset: 0;
    background: var(--black);
    z-index: 300;
    display: flex; align-items: center; justify-content: center;
  }
  .lang-box {
    background: rgba(15,15,15,0.95);
    border: 1px solid rgba(201,168,76,0.22);
    border-radius: 24px;
    padding: 52px 44px;
    width: 90%; max-width: 440px;
    text-align: center;
    position: relative; z-index: 1;
    box-shadow: 0 0 80px rgba(201,168,76,0.06), 0 24px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(20px);
  }
  .lang-box::before {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 60%; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
  }
  .lang-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 34px; font-weight: 600;
    color: var(--white); letter-spacing: 3px;
    margin-bottom: 6px;
  }
  .lang-title span { color: var(--gold); }
  .lang-sub {
    font-size: 11px; color: rgba(201,168,76,0.38);
    letter-spacing: 2.5px; text-transform: uppercase;
    margin-bottom: 40px;
  }
  .lang-options { display: flex; gap: 16px; }
  .lang-opt-btn {
    flex: 1; padding: 20px 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(201,168,76,0.18);
    border-radius: 16px; cursor: pointer;
    transition: all 0.25s ease;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
  }
  .lang-opt-btn:hover {
    background: rgba(201,168,76,0.08);
    border-color: rgba(201,168,76,0.55);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(201,168,76,0.15);
  }
  .lang-opt-btn .flag { font-size: 38px; }
  .lang-opt-btn .lang-name {
    font-family: 'Syne', sans-serif;
    font-size: 14px; font-weight: 700;
    color: var(--gold); letter-spacing: 1.5px; text-transform: uppercase;
  }
  .lang-opt-btn .lang-desc {
    font-size: 11px; color: var(--white2); opacity: 0.65; line-height: 1.4;
  }

  /* Extra small phones */
  @media (max-width: 380px) {
    .welcome-title { font-size: 24px; }
    .suggestion-chip { font-size: 10px; padding: 8px 10px; }
    .chat-inner { padding: 12px 10px; }
  }

  /* ─── TABLET (769px – 1024px) ───────────────────────── */
  @media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-w: 230px; }
    .chat-inner { max-width: 100%; padding: 28px 20px; }
    .welcome-title { font-size: 36px; }
  }

  /* ─── LARGE DESKTOP (1400px+) ───────────────────────── */
  @media (min-width: 1400px) {
    :root { --sidebar-w: 300px; }
    .chat-inner { max-width: 820px; }
    .welcome-title { font-size: 52px; }
  }

  /* ─── GENERAL ADAPTIVE FIXES ─────────────────────────── */
  * { -webkit-tap-highlight-color: transparent; }
  input, textarea, button { touch-action: manipulation; }

  /* Lang screen mobile */
  @media (max-width: 480px) {
    .lang-box { padding: 36px 20px; }
    .lang-options { gap: 10px; }
    .lang-opt-btn { padding: 16px 10px; }
    .lang-opt-btn .flag { font-size: 30px; }
    .lang-opt-btn .lang-name { font-size: 12px; }
  }