/* === Scandinavian — Clean Professional Design === */

@font-face {
  font-family: "Scandinavian";
  src: url("/fonts/ScandinavianNew-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-page: #f7f8fa;
  --bg-white: #ffffff;
  --bg-subtle: #f0f2f5;
  --bg-hover: #f5f6f8;
  --bg-active: #eef2ff;
  --border: #e5e7eb;
  --border-light: #f0f1f3;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-dim: #9ca3af;
  --text-on-dark: #ffffff;
  --accent: #00106e;
  --accent-light: #eef2ff;
  --accent-bright: #3b4fcf;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --red: #dc2626;
  --red-light: #fef2f2;
  --font: "Scandinavian", "Outfit", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "DM Mono", "SF Mono", ui-monospace, monospace;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: var(--bg-page); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
#app { display: flex; flex-direction: column; height: 100dvh; }
#app-content { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* === NAV BAR === */
#app-nav { flex-shrink: 0; display: flex; justify-content: center; gap: 2px; background: var(--bg-white); border-top: 1px solid var(--border); padding: 4px 8px; padding-bottom: calc(4px + var(--safe-bottom)); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 16px; border-radius: var(--radius-sm); color: var(--text-dim); font-size: 11px; font-weight: 500; text-decoration: none; border: none; background: none; cursor: pointer; transition: all 0.15s; }
.nav-item:hover { color: var(--text-secondary); background: var(--bg-hover); text-decoration: none; }
.nav-item.active { color: var(--accent); background: var(--accent-light); }
.nav-item svg { width: 22px; height: 22px; }
.nav-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-on-dark); }
@media (min-width: 900px) {
  #app { flex-direction: row; }
  #app-nav { flex-direction: column; justify-content: flex-start; width: 72px; border-top: none; border-right: 1px solid var(--border); padding: 16px 8px; gap: 4px; }
  .nav-item { padding: 10px 8px; width: 100%; }
  .nav-user { margin-top: auto; }
}

/* === COMMON === */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--text-secondary); }
.back-link:hover { color: var(--text); text-decoration: none; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border-radius: var(--radius-sm); border: none; background: var(--accent); color: var(--text-on-dark); font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; width: 100%; }
.btn-primary:hover { background: var(--accent-bright); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-outline { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-white); color: var(--text-secondary); font-family: var(--font); font-size: 13px; cursor: pointer; transition: all 0.15s; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-link { background: none; border: none; color: var(--text-secondary); font-size: 13px; cursor: pointer; padding: 8px; font-family: var(--font); }
.btn-link:hover { color: var(--text); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dashboard-loading { display: flex; justify-content: center; align-items: center; padding: 80px; opacity: 0.5; }
.error-page { padding: 80px 24px; text-align: center; color: var(--text-secondary); }
.error-page h2 { color: var(--text); margin-bottom: 8px; font-weight: 500; }

/* === LOGIN === */
.login-scene {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f0f2f8 0%, #dde3f0 50%, #e8ecf4 100%);
  overflow: hidden;
}

#login-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

.login-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(240,242,248,0.4) 70%);
  pointer-events: none;
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; margin: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 48px 36px 36px;
  box-shadow: 0 8px 40px rgba(0, 16, 110, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  animation: loginAppear 0.6s ease-out;
}

@keyframes loginAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-area {
  text-align: center; margin-bottom: 36px;
}

.login-mark {
  color: var(--accent); margin-bottom: 12px;
  animation: markPulse 3s ease-in-out infinite;
}

@keyframes markPulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.login-brand {
  font-family: "Scandinavian", var(--font);
  font-size: 26px; font-weight: 400; color: var(--accent);
  letter-spacing: 1px;
}

.login-tagline {
  font-size: 13px; color: var(--text-dim); margin-top: 4px; letter-spacing: 0.3px;
}

.login-tagline { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.login-field { margin-bottom: 20px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.3px;
}
.login-field input {
  width: 100%; padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text); font-family: var(--font); font-size: 15px;
  outline: none; transition: all 0.2s;
}
.login-field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 16, 110, 0.08);
}
.login-field input::placeholder { color: var(--text-dim); }

.login-error {
  color: var(--red); font-size: 13px; margin-bottom: 12px; min-height: 18px;
  text-align: center;
}

.login-submit {
  width: 100%; padding: 13px 20px;
  border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-submit:hover { background: var(--accent-bright); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 16, 110, 0.2); }
.login-submit:active { transform: translateY(0); }
.login-submit:disabled { opacity: 0.6; cursor: default; transform: none; }

.login-footer {
  text-align: center; margin-top: 24px; padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.login-footer span { font-size: 12px; color: var(--text-dim); }

/* === DASHBOARD / PANEL === */
.panel { max-width: 720px; margin: 0 auto; padding: 32px 24px; }
.panel-header { margin-bottom: 28px; }
.panel-title { font-size: 24px; font-weight: 600; color: var(--text); }
.panel-sub { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.quick-chat-card { display: flex; align-items: center; gap: 16px; padding: 20px 24px; margin-bottom: 24px; background: var(--accent); color: var(--text-on-dark); border-radius: var(--radius-lg); text-decoration: none; box-shadow: 0 2px 12px rgba(0,16,110,0.2); transition: all 0.2s; }
.quick-chat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,16,110,0.3); text-decoration: none; color: var(--text-on-dark); }
.qc-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qc-text { flex: 1; }
.qc-title { display: block; font-size: 16px; font-weight: 600; }
.qc-sub { display: block; font-size: 13px; opacity: 0.7; margin-top: 2px; }
.qc-arrow { font-size: 20px; opacity: 0.5; transition: transform 0.15s; }
.quick-chat-card:hover .qc-arrow { transform: translateX(4px); opacity: 0.8; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.mini-stat { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.mini-stat-value { display: block; font-size: 22px; font-weight: 600; color: var(--accent); }
.mini-stat-label { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
@media (max-width: 600px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
.panel-section { margin-bottom: 28px; }
.panel-section-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.see-all { font-size: 13px; color: var(--text-secondary); }
.see-all:hover { color: var(--accent); text-decoration: none; }
.manual-list { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.manual-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.manual-row:last-child { border-bottom: none; }
.manual-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; flex-shrink: 0; }
.manual-badge.fcom { background: var(--blue-light); color: var(--blue); }
.manual-badge.fctm { background: var(--amber-light); color: var(--amber); }
.manual-badge.om-a { background: var(--red-light); color: var(--red); }
.manual-badge.om-c { background: var(--green-light); color: var(--green); }
.manual-name { flex: 1; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manual-meta { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
.manual-chunks { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
.recent-chats { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.recent-chat-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-light); text-decoration: none; transition: background 0.1s; }
.recent-chat-row:last-child { border-bottom: none; }
.recent-chat-row:hover { background: var(--bg-hover); text-decoration: none; }
.rch-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.rch-meta { font-size: 12px; color: var(--text-dim); flex-shrink: 0; margin-left: 12px; }
.admin-quick-grid { display: flex; gap: 12px; }
.admin-quick-card { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-sm); transition: all 0.15s; }
.admin-quick-card:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.admin-quick-card svg { color: var(--text-secondary); }
.notification-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 20px; background: var(--blue-light); border: 1px solid #bfdbfe; border-radius: var(--radius-sm); font-size: 13px; color: var(--blue); }
.notif-dismiss { margin-left: auto; background: none; border: none; color: var(--blue); cursor: pointer; font-size: 18px; opacity: 0.6; }

/* === CLAUDE-STYLE CHAT === */
.claude-layout { display: flex; height: 100dvh; width: 100vw; max-width: 100vw; overflow: hidden; position: fixed; inset: 0; }
.cl-sidebar { width: 240px; flex-shrink: 0; background: #2a2b32; color: #ececf1; display: flex; flex-direction: column; transition: width 0.2s; overflow: hidden; }
.cl-sidebar.collapsed { width: 0; }
.cl-sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; flex-shrink: 0; }
.cl-brand { font-family: "Scandinavian", var(--font); font-size: 18px; font-weight: 400; letter-spacing: 0.5px; }
.cl-sidebar-toggle { background: none; border: none; color: #8e8ea0; cursor: pointer; padding: 4px; border-radius: 4px; }
.cl-sidebar-toggle:hover { color: #ececf1; background: rgba(255,255,255,0.06); }
.cl-nav { padding: 0 8px; margin-bottom: 8px; }
.cl-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #ececf1; font-size: 14px; text-decoration: none; transition: background 0.1s; border: none; background: none; cursor: pointer; font-family: var(--font); width: 100%; text-align: left; }
.cl-nav-item:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: #fff; }
.cl-nav-item.active { background: rgba(255,255,255,0.08); }
.cl-chats-label { padding: 12px 16px 6px; font-size: 11px; font-weight: 500; color: #8e8ea0; text-transform: uppercase; letter-spacing: 0.5px; }
.cl-chat-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.cl-empty { font-size: 13px; color: #8e8ea0; padding: 8px 12px; }
.cl-chat-item { display: flex; align-items: center; width: 100%; padding: 10px 12px; border-radius: 8px; border: none; background: none; text-align: left; cursor: pointer; font-family: var(--font); transition: background 0.1s; margin-bottom: 1px; gap: 4px; }
.cl-chat-delete { display: none; flex-shrink: 0; width: 20px; height: 20px; border: none; background: none; color: #8e8ea0; font-size: 16px; cursor: pointer; border-radius: 4px; align-items: center; justify-content: center; }
.cl-chat-item:hover .cl-chat-delete { display: flex; }
.cl-chat-delete:hover { color: #f87171; background: rgba(248,113,113,0.1); }
.cl-chat-item:hover { background: rgba(255,255,255,0.06); }
.cl-chat-item.active { background: rgba(255,255,255,0.1); }
.cl-chat-title { font-size: 13px; color: #ececf1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; flex: 1; min-width: 0; }
.cl-sidebar-bottom { flex-shrink: 0; padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.cl-user { display: flex; align-items: center; gap: 10px; }
.cl-user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.cl-user-name { font-size: 13px; font-weight: 500; color: #ececf1; display: block; }
.cl-user-role { font-size: 11px; color: #8e8ea0; display: block; }
.cl-logout { background: none; border: none; color: #8e8ea0; cursor: pointer; padding: 6px; border-radius: 6px; margin-left: auto; display: flex; align-items: center; }
.cl-logout:hover { color: #ececf1; background: rgba(255,255,255,0.06); }
.cl-main { flex: 1; display: flex; flex-direction: column; background: var(--bg-page); overflow: hidden; }
.cl-topbar-mobile { display: none; align-items: center; padding: 10px 12px; background: var(--bg-white); border-bottom: 1px solid var(--border); gap: 10px; }
.cl-hamburger, .cl-new-chat-mobile { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }
.cl-topbar-title { flex: 1; text-align: center; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.cl-loading { display: flex; justify-content: center; padding: 60px; }
.cl-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; min-height: 300px; text-align: center; padding: 40px; animation: fadeIn 0.5s; }
.cl-welcome h1 { font-size: 28px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.cl-wave { color: var(--accent); }
.cl-welcome p { font-size: 16px; color: var(--text-secondary); }
.cl-msg { padding: 20px 0; }
.cl-msg-user { background: var(--bg-page); }
.cl-msg-assistant { background: var(--bg-white); border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
.cl-msg-error { background: var(--red-light); }
.cl-bubble { max-width: 720px; margin: 0 auto; padding: 0 24px; font-size: 15px; line-height: 1.75; }
.cl-bubble p { margin-bottom: 12px; }
.cl-bubble p:last-child { margin-bottom: 0; }
.cl-bubble strong { font-weight: 600; }
.cl-bubble h1, .cl-bubble h2, .cl-bubble h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.cl-bubble h1:first-child, .cl-bubble h2:first-child, .cl-bubble h3:first-child { margin-top: 0; }
.cl-bubble ul, .cl-bubble ol { padding-left: 24px; margin: 10px 0; }
.cl-bubble li { margin-bottom: 4px; }
.cl-bubble code { font-family: var(--font-mono); font-size: 13px; background: var(--bg-subtle); padding: 2px 6px; border-radius: 4px; }
.cl-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.cl-table th, .cl-table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.cl-table th { background: var(--bg-subtle); font-weight: 600; }
.cl-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.cl-source-tag { font-family: var(--font-mono); font-size: 11px; padding: 3px 10px; border-radius: 6px; background: var(--blue-light); color: var(--blue); border: 1px solid #dbeafe; }
.cl-feedback { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.cl-fb-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-white); color: var(--text-dim); font-size: 12px; font-family: var(--font); cursor: pointer; transition: all 0.15s; }
.cl-fb-btn:hover { border-color: var(--accent); color: var(--accent); }
.cl-fb-edit { margin-left: auto; }
.cl-fb-done { font-size: 12px; color: var(--text-dim); font-style: italic; animation: fadeIn 0.3s; }
.cl-fb-liked { border-color: var(--green); color: var(--green); background: var(--green-light); pointer-events: none; }
.cl-fb-disliked { border-color: var(--amber); color: var(--amber); background: var(--amber-light); pointer-events: none; }
.cl-msg-loading .cl-bubble { display: flex; }
.cl-dots { display: flex; gap: 5px; padding: 8px 0; }
.cl-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); animation: dotBounce 1.4s ease-in-out infinite; }
.cl-dots span:nth-child(2) { animation-delay: 0.16s; }
.cl-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dotBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.25; } 30% { transform: translateY(-8px); opacity: 1; } }
/* Visualizer */
.cl-visualizer .cl-bubble { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden; }
.viz-header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.viz-icon { font-size: 14px; }
.viz-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.viz-toggle { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; transition: transform 0.2s; }
.viz-collapsed .viz-steps { display: none; }
.viz-collapsed .viz-toggle { transform: rotate(-90deg); }
.viz-steps { padding: 8px 16px 12px; }
.viz-step { display: flex; gap: 10px; padding: 6px 0; animation: fadeIn 0.3s; }
.viz-step-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.viz-step-content { flex: 1; min-width: 0; }
.viz-step-text { font-size: 13px; color: var(--text-secondary); }
.viz-step-details { margin-top: 4px; }
.viz-detail { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-step-search .viz-step-text { color: var(--blue); font-weight: 500; }
.viz-step-cache .viz-step-text { color: var(--green); font-weight: 500; }
.viz-step-done .viz-step-text { color: var(--green); }

.cl-input-area { flex-shrink: 0; padding: 0 24px 24px; max-width: 768px; margin: 0 auto; width: 100%; }
.cl-filters { display: flex; gap: 6px; margin-bottom: 10px; justify-content: center; flex-wrap: wrap; }
.cl-filter { font-size: 12px; font-weight: 500; padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-white); color: var(--text-secondary); cursor: pointer; font-family: var(--font); transition: all 0.15s; }
.cl-filter:hover { border-color: var(--text-dim); color: var(--text); }
.cl-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cl-input-controls { margin-bottom: 10px; }
.cl-mode-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cl-toggle-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.cl-toggle-label input[type="checkbox"] { accent-color: var(--accent); }
.cl-cost-badge { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); background: var(--bg-subtle); padding: 2px 8px; border-radius: 4px; }

.cl-input-box { display: flex; align-items: flex-end; background: var(--bg-white); border: 1px solid var(--border); border-radius: 16px; padding: 6px 8px 6px 20px; box-shadow: var(--shadow); transition: all 0.15s; }
.cl-input-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light), var(--shadow); }
#cl-input { flex: 1; background: none; border: none; color: var(--text); font-family: var(--font); font-size: 15px; padding: 10px 0; resize: none; outline: none; max-height: 160px; line-height: 1.5; }
#cl-input::placeholder { color: var(--text-dim); }
.cl-send { width: 36px; height: 36px; border-radius: 10px; border: none; background: var(--accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.cl-send:hover { background: var(--accent-bright); }
.cl-send:disabled { opacity: 0.3; cursor: default; }
@media (max-width: 768px) {
  .cl-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 200; transform: translateX(-100%); width: 280px; }
  .cl-sidebar.mobile-open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.2); }
  .cl-topbar-mobile { display: flex; }
  .cl-bubble { padding: 0 16px; }
  .cl-input-area { padding: 0 16px 16px; }
}

/* === ADMIN === */
/* Admin uses claude-layout which is position:fixed, so it breaks out of #app-content */
.page-admin { overflow: visible !important; }
.admin-main { overflow-y: auto; }
.admin-panel { max-width: 100%; padding: 32px 40px; }
.admin-page-header { margin-bottom: 28px; }
.admin-page-header h1 { font-size: 22px; font-weight: 600; }
.admin-page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 768px) { .admin-stats { grid-template-columns: repeat(2, 1fr); } }
.a-stat { display: flex; align-items: center; gap: 12px; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.a-stat-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: var(--text-dim); flex-shrink: 0; }
.a-stat-icon.green { background: var(--green-light); color: var(--green); }
.a-stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.a-stat-icon.amber { background: var(--amber-light); color: var(--amber); }
.a-stat-value { font-size: 20px; font-weight: 600; color: var(--text); display: block; }
.a-stat-label { font-size: 12px; color: var(--text-dim); display: block; }

.admin-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-card h3 { font-size: 15px; font-weight: 600; padding: 16px 20px 12px; }
.a-card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; }
.a-card-header h3 { padding: 0; }
.a-empty { color: var(--text-dim); font-size: 13px; padding: 16px 20px; }

.a-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.a-table th, .a-table td { padding: 10px 20px; text-align: left; border-top: 1px solid var(--border-light); }
.a-table th { font-weight: 500; color: var(--text-dim); font-size: 11px; letter-spacing: 0.3px; text-transform: uppercase; background: var(--bg-subtle); border-top: none; }
.a-table tbody tr:hover { background: var(--bg-hover); }
.a-cost { font-family: var(--font-mono); font-size: 12px; }

.a-user-cell { display: flex; align-items: center; gap: 8px; }
.a-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.a-role-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--bg-subtle); color: var(--text-secondary); font-weight: 500; }
.a-dim { color: var(--text-dim); }
.a-doc-title { font-weight: 500; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.a-type-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.a-type-fcom { background: var(--blue-light); color: var(--blue); }
.a-type-fctm { background: var(--amber-light); color: var(--amber); }
.a-type-oma { background: var(--red-light); color: var(--red); }
.a-type-omc { background: var(--green-light); color: var(--green); }

.a-btn { padding: 6px 14px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--bg-white); color: var(--text-secondary); font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.a-btn:hover { border-color: var(--accent); color: var(--accent); }
.a-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.a-btn-primary:hover { background: var(--accent-bright); }
.a-btn-sm { padding: 4px 10px; font-size: 12px; }
.a-btn-danger { color: var(--red); border-color: var(--red); }
.a-btn-danger:hover { background: var(--red-light); }

.a-input { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: var(--font); font-size: 14px; color: var(--text); outline: none; flex: 1; }
.a-input:focus { border-color: var(--accent); }
.a-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg-white); }

.a-invite-form { padding: 0 20px 16px; }
.a-form-row { display: flex; gap: 8px; align-items: center; }
.a-invite-code { font-family: var(--font-mono); font-size: 13px; background: var(--bg-subtle); padding: 3px 8px; border-radius: 4px; letter-spacing: 1px; }

.a-hint { font-size: 12px; color: var(--text-dim); padding: 0 20px 12px; }

.a-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 0 20px 20px; }
.a-doc-card { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; cursor: context-menu; transition: all 0.15s; }
.a-doc-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.a-doc-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.a-aircraft-tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--bg-subtle); color: var(--text-secondary); font-weight: 500; }
.a-doc-card-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-doc-card-meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 4px; }

.a-context-menu { position: fixed; z-index: 300; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); min-width: 180px; padding: 6px 0; }
.a-ctx-group { padding: 4px 0; }
.a-ctx-label { font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 14px; display: block; }
.a-ctx-item { display: block; width: 100%; padding: 7px 14px; border: none; background: none; text-align: left; font-family: var(--font); font-size: 13px; color: var(--text); cursor: pointer; transition: background 0.1s; }
.a-ctx-item:hover { background: var(--accent-light); color: var(--accent); }
.a-ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }
.a-ctx-reingest { color: var(--amber); }
.a-ctx-reingest:hover { background: var(--amber-light); color: var(--amber); }

.a-upload { padding: 32px; text-align: center; cursor: pointer; transition: all 0.15s; color: var(--text-dim); }
.a-upload:hover, .a-upload.dragover { background: var(--accent-light); color: var(--accent); }
.a-upload p { margin-top: 8px; font-size: 14px; }
.a-upload svg { opacity: 0.4; }
.a-upload:hover svg { opacity: 1; }

.a-kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; padding: 0 20px 16px; }
.a-kv { display: flex; flex-direction: column; }
.a-kv-label { font-size: 11px; color: var(--text-dim); }
.a-kv-value { font-size: 16px; font-weight: 600; color: var(--text); font-family: var(--font-mono); }

.a-rules-list { padding: 0 20px 16px; }
.a-rule { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); line-height: 1.5; }
.a-rule:last-child { border-bottom: none; }

.a-synonyms-grid { max-height: 400px; overflow-y: auto; padding: 0 20px 16px; }
.a-syn { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 13px; }
.a-syn-term { font-weight: 600; color: var(--text); min-width: 100px; }
.a-syn-arrow { color: var(--text-dim); }
.a-syn-value { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 600px) { .a-form-row { flex-direction: column; } }

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
