/* =============================================
   InfraGuid AI — Dark Glassmorphism Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core palette */
  --bg-primary: #060a13;
  --bg-secondary: #0c1220;
  --bg-tertiary: #111827;
  --bg-elevated: #1a2332;

  /* Glass surfaces */
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-bg-hover: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(148, 163, 184, 0.08);
  --glass-border-hover: rgba(148, 163, 184, 0.15);
  --glass-blur: 20px;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* Accent gradient */
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #06b6d4, #3b82f6, #8b5cf6);
  --accent-gradient-hover: linear-gradient(135deg, #22d3ee, #60a5fa, #a78bfa);
  --accent-glow: 0 0 30px rgba(6, 182, 212, 0.15), 0 0 60px rgba(139, 92, 246, 0.08);

  /* Status */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.25);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(6, 182, 212, 0.08);

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Sidebar */
  --sidebar-width: 280px;
}

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

html {
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Animated background orbs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  animation: float 20s ease-in-out infinite;
}

body::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12), transparent 70%);
  top: -10%;
  left: -5%;
}

body::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent 70%);
  bottom: -10%;
  right: -5%;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

a {
  color: inherit;
  text-decoration: none;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.3);
}

/* === App Shell === */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

/* === Sidebar === */
.sidebar {
  background: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideInLeft 0.4s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 20px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--accent-gradient);
  color: white;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--accent-gradient);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav a:hover {
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-primary);
}

.nav a.active {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-cyan);
}

.nav a.active::before {
  opacity: 1;
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

/* Sidebar user block */
.sidebar-user {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  min-width: 0;
  flex: 1;
}

.sidebar-user .user-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: grid;
  place-items: center;
}

.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* === Main === */
.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: relative;
}

/* === Top Bar === */
.topbar {
  padding: 20px 32px;
  background: rgba(10, 14, 23, 0.7);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.topbar-left h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.topbar-left p {
  margin-top: 4px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 400;
}

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.3s ease;
}

.status-pill.ok {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.status-pill.ok::before {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-pill.fail {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.status-pill.fail::before {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* === Workspace === */
.workspace {
  min-height: 0;
  padding: 24px 32px;
  overflow: hidden;
}

/* === Chat Layout === */
.chat-layout {
  height: calc(100vh - 110px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
}

/* === Glass Panels === */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 0;
  animation: fadeInUp 0.4s ease;
}

/* === Chat Panel === */
.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.messages {
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome state */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 40px;
  flex: 1;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--accent-gradient);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.2);
  font-size: 28px;
}

.welcome-state h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-state p {
  color: var(--text-tertiary);
  font-size: 14px;
  max-width: 440px;
  line-height: 1.6;
}

/* Messages */
.message {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeInUp 0.3s ease;
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message .bubble {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  font-size: 14px;
  word-break: break-word;
}

.message.user .bubble {
  background: var(--accent-gradient);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
}

.message.assistant .bubble {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

.message .meta {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 0 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: typing-dot 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* === Composer === */
.composer {
  border-top: 1px solid var(--glass-border);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  background: rgba(10, 14, 23, 0.5);
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  transition: all 0.25s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1), 0 0 20px rgba(6, 182, 212, 0.05);
  background: rgba(255, 255, 255, 0.06);
}

textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: none;
  min-height: 48px;
  max-height: 160px;
  line-height: 1.5;
}

/* === Buttons === */
button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: var(--accent-gradient);
  background-size: 200% 200%;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
  box-shadow: none;
}

button.btn-send {
  height: 48px;
  width: 48px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

button.btn-send svg {
  width: 20px;
  height: 20px;
}

/* === Side Panel === */
.side-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.side-panel h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

/* Quick Prompts */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-actions button {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12.5px;
  border: 1px solid var(--glass-border);
  padding: 12px 14px;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.quick-actions button:hover {
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  transform: none;
  box-shadow: none;
}

/* Sources */
.source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.source {
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.source:hover {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent-purple);
}

.source strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 2px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--accent-blue);
  text-decoration: none;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.source-link:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* === Alert === */
.alert {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  font-weight: 600;
  font-size: 13px;
  animation: fadeInUp 0.3s ease;
}

/* ================
   ADMIN PAGE
   ================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0.6;
}

.metric span {
  display: block;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin: 0 0 16px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: top;
  font-size: 13px;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-tertiary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

td {
  color: var(--text-secondary);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Chunks */
.chunk-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.chunk {
  padding: 16px;
}

.chunk strong {
  color: var(--text-primary);
  font-size: 13px;
}

.chunk div {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.chunk pre,
pre {
  margin: 10px 0 0;
  padding: 14px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-secondary);
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  border: 1px solid var(--glass-border);
}

/* =====================
   AUTH PAGES
   ===================== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeInUp 0.5s ease;
  position: relative;
  z-index: 1;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--accent-gradient);
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  font-weight: 900;
  font-size: 20px;
  color: white;
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.25);
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.auth-header p {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: 6px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  padding: 13px 16px;
}

.form-group select {
  padding: 13px 16px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.form-group .hint {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-key-group {
  display: none;
}

.admin-key-group.visible {
  display: flex;
}

.auth-form button[type="submit"] {
  margin-top: 8px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.auth-footer a {
  color: var(--accent-cyan);
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-footer a:hover {
  color: var(--accent-blue);
}

.auth-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  display: none;
}

.auth-error.visible {
  display: block;
  animation: fadeInUp 0.3s ease;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    padding: 14px 20px;
    gap: 16px;
    overflow-x: auto;
  }

  .brand {
    padding: 0;
  }

  .nav {
    flex-direction: row;
    gap: 4px;
  }

  .nav a::before {
    display: none;
  }

  .sidebar-user {
    margin-top: 0;
    margin-left: auto;
  }

  .chat-layout {
    height: auto;
    grid-template-columns: 1fr;
    min-height: calc(100vh - 160px);
  }

  .chat-panel {
    min-height: 65vh;
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 660px) {
  .sidebar {
    flex-wrap: wrap;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
  }

  .workspace {
    padding: 16px;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 28px 24px;
  }
}

/* Upload Panel & Drag and Drop Zone */
.upload-area {
  border: 2px dashed rgba(6, 182, 212, 0.3);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
  box-shadow: var(--accent-glow);
}

.upload-icon {
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon, .upload-area.dragover .upload-icon {
  transform: translateY(-4px);
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 13.5px;
}

.upload-label {
  color: var(--accent-cyan);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}

.upload-label:hover {
  color: var(--accent-purple);
}

.file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--success);
  margin-top: 4px;
  word-break: break-all;
}

.upload-status {
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.upload-status.success {
  color: var(--success);
}

.upload-status.error {
  color: var(--danger);
}

.upload-status.info {
  color: var(--accent-cyan);
}

/* Utility: hidden */
[hidden] {
  display: none !important;
}
