* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8fafc; color: #1e293b; }

/* ─── App Shell ──────────────────────────────────────────── */
.app { display: flex; height: 100vh; height: 100dvh; }
.hidden { display: none !important; }

/* ─── Left Sidebar ───────────────────────────────────────── */
.sidebar { width: 300px; background: white; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; }
.sidebar-logo { height: 26px; }
.sidebar-title { font-size: 14px; font-weight: 600; color: #1e293b; flex: 1; }
.sidebar-close { display: none; background: none; border: none; font-size: 22px; color: #94a3b8; cursor: pointer; }
.sidebar-tabs { display: flex; border-bottom: 1px solid #e2e8f0; }
.sidebar-tab { flex: 1; padding: 10px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; }
.sidebar-tab.active { color: #4F46E5; border-bottom-color: #4F46E5; }
.sidebar-tab:hover:not(.active) { color: #334155; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
.sidebar-footer { padding: 10px 16px; border-top: 1px solid #e2e8f0; font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 8px; }
.sidebar-footer a { color: #4F46E5; text-decoration: none; font-size: 11px; }
.sidebar-dot { color: #cbd5e1; }
.badge { font-size: 10px; background: #4F46E5; color: white; padding: 1px 7px; border-radius: 8px; }
.muted { color: #94a3b8; font-size: 13px; text-align: center; padding: 30px 10px; }

/* Doc list in sidebar */
.doc-list { display: flex; flex-direction: column; gap: 2px; }
.doc-group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 10px 4px; }
.doc-group-label.League { color: #059669; }
.doc-group-label.Tournament { color: #6d28d9; }
.doc-group-label.Club { color: #2563eb; }
.doc-group-label.System { color: #92400e; }
.doc-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: #1e293b; transition: background 0.15s; }
.doc-item:hover { background: #f1f5f9; }
.doc-icon { color: #94a3b8; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; display: block; line-height: 1.3; }
.doc-meta { font-size: 11px; color: #94a3b8; }
.doc-view-link { font-size: 11px; color: #4F46E5; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.doc-item:hover .doc-view-link { opacity: 1; }

/* Recent list in sidebar */
.recent-item { padding: 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s; margin-bottom: 2px; }
.recent-item:hover { background: #f1f5f9; }
.recent-item.recent-active { background: #f5f3ff; border-left: 3px solid #4F46E5; }
.recent-q { font-size: 13px; font-weight: 500; color: #1e293b; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-time { font-size: 11px; color: #94a3b8; }

/* ─── Main Chat ──────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #f8fafc; }
.main-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: white; border-bottom: 1px solid #e2e8f0; }
.menu-btn { display: none; background: none; border: none; color: #475569; cursor: pointer; padding: 4px; }
.tcl-logo { height: 28px; margin-right: 4px; }
.main-title { font-size: 16px; font-weight: 600; }
.main-subtitle { font-size: 12px; color: #94a3b8; margin-left: 4px; }
.new-chat-btn { background: white; border: 1px solid #e2e8f0; color: #475569; padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.new-chat-btn:hover { border-color: #4F46E5; color: #4F46E5; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }

/* Welcome state */
.welcome { margin: auto; text-align: center; max-width: 520px; padding: 40px 20px; }
.welcome-icon { width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 20px; background: linear-gradient(135deg, #4F46E5 0%, #7c3aed 50%, #ec4899 100%); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2); }
.welcome h2 { font-size: 20px; color: #1e293b; margin-bottom: 6px; }
.welcome p { color: #64748b; font-size: 14px; margin-bottom: 20px; }
.beta-notice { background: #fef3c7; color: #92400e; padding: 8px 14px; border-radius: 8px; font-size: 12px; display: inline-block; margin-bottom: 16px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: white; border: 1px solid #e2e8f0; color: #475569; padding: 8px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: all 0.15s; }
.chip:hover { border-color: #4F46E5; color: #4F46E5; background: #f5f3ff; }

/* Messages */
.msg { max-width: 75%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg.user { align-self: flex-end; background: #4F46E5; color: white; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: white; color: #1e293b; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3 { margin: 8px 0 4px; font-size: 15px; color: #4F46E5; }
.msg.assistant ul, .msg.assistant ol { padding-left: 20px; margin: 4px 0; }
.msg.assistant strong { font-weight: 600; }
.msg.assistant code { background: #f1f5f9; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.msg.system { align-self: center; background: none; color: #94a3b8; font-size: 12px; font-style: italic; }
.msg .usage { margin-top: 8px; padding-top: 8px; border-top: 1px solid #f1f5f9; font-size: 11px; color: #94a3b8; }
.typing { align-self: flex-start; color: #94a3b8; font-size: 13px; display: flex; align-items: center; gap: 4px; padding: 12px 16px; background: white; border: 1px solid #e2e8f0; border-radius: 16px; border-bottom-left-radius: 4px; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: bounce 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Feedback */
.feedback-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid #f1f5f9; display: flex; align-items: center; gap: 8px; }
.feedback-label { font-size: 12px; color: #94a3b8; }
.fb-btn { background: none; border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 14px; transition: all 0.15s; }
.fb-btn:hover { border-color: #4F46E5; background: #f5f3ff; }
.feedback-thanks { font-size: 12px; color: #059669; }
.fb-comment-box { display: flex; gap: 6px; align-items: center; width: 100%; }
.fb-input { flex: 1; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 12px; outline: none; }
.fb-input:focus { border-color: #4F46E5; }
.fb-submit { background: #4F46E5; color: white; border: none; padding: 5px 10px; border-radius: 5px; font-size: 11px; cursor: pointer; }
.fb-cancel { background: none; border: none; color: #94a3b8; font-size: 11px; cursor: pointer; }

/* ─── Input Area ─────────────────────────────────────────── */
.input-area { padding: 12px 20px 16px; background: #f8fafc; }
.input-row { display: flex; gap: 8px; max-width: 800px; margin: 0 auto; }
.input-row input { flex: 1; background: white; border: 1px solid #e2e8f0; color: #1e293b; padding: 12px 16px; border-radius: 24px; font-size: 15px; outline: none; }
.input-row input:focus { border-color: #4F46E5; box-shadow: 0 0 0 3px #4F46E520; }
.input-row input::placeholder { color: #94a3b8; }
.input-footer { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 6px 0 0; }
.powered-by { font-size: 11px; color: #cbd5e1; display: flex; align-items: center; gap: 4px; }
.claude-icon { flex-shrink: 0; }
.built-by { font-size: 11px; color: #cbd5e1; display: flex; align-items: center; gap: 4px; }
.built-by a { color: #94a3b8; text-decoration: none; display: flex; align-items: center; gap: 3px; }
.built-by a:hover { color: #4F46E5; }
.nextgen-logo { height: 14px; }
.send-btn { width: 44px; height: 44px; background: #4F46E5; color: white; border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.send-btn:hover { background: #3e35b9; }
.send-btn:disabled { background: #cbd5e1; }

/* ─── Overlay ────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 19; }

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -320px; top: 0; bottom: 0; width: 300px; z-index: 20; box-shadow: 4px 0 16px rgba(0,0,0,0.08); transition: left 0.25s ease; }
  .sidebar.open { left: 0; }
  .sidebar-close { display: block; }
  .menu-btn { display: flex; }
  .main-title { font-size: 15px; }
  .chat-messages { padding: 12px; }
  .msg { max-width: 90%; }
  .input-area { padding: 8px 12px 12px; }
  .input-row input { font-size: 16px; }
  .welcome { padding: 20px 16px; }
  .chip { font-size: 12px; padding: 6px 12px; }
}
