/* ============================================================
   CNT AI - White-Label AI Workspace Panel
   cnt.chat
   ============================================================ */

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

:root {
  /* Backgrounds */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --bg-elevated: #1e1e1e;
  --bg-hover: #222222;
  --bg-active: #2a2a2a;

  /* Accent */
  --accent-primary: #00d4ff;
  --accent-primary-hover: #00b8e0;
  --accent-primary-muted: rgba(0, 212, 255, 0.12);
  --accent-secondary: #00ff41;
  --accent-secondary-muted: rgba(0, 255, 65, 0.1);

  /* Text */
  --text-primary: #e0e0e0;
  --text-secondary: #888888;
  --text-muted: #555555;
  --text-inverse: #0a0a0a;

  /* Status */
  --color-error: #ff5f57;
  --color-warning: #ffbd2e;
  --color-success: #28c840;
  --color-info: #00d4ff;

  /* Borders */
  --border-color: #2a2a2a;
  --border-color-subtle: #1f1f1f;
  --border-color-focus: #00d4ff;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 56px;

  /* Fonts */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary-hover);
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(0, 212, 255, 0.25);
  color: #fff;
}

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

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

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-mono { font-family: var(--font-mono); }

/* ============================================================
   1. LOGIN PAGE
   ============================================================ */
/* --- MATRIX LOGIN --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #020410;
  position: relative;
  overflow: hidden;
}

#matrixCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Floating glow orbs */
.login-glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 1;
}
.login-glow-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,100,255,0.15), transparent 70%);
  top: -10%; left: -10%;
  animation: orbFloat1 12s ease-in-out infinite;
}
.login-glow-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,60,200,0.12), transparent 70%);
  bottom: -10%; right: -5%;
  animation: orbFloat2 15s ease-in-out infinite;
}
.login-glow-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0,180,255,0.08), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 10s ease-in-out infinite;
}
@keyframes orbFloat1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(60px,40px)} }
@keyframes orbFloat2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-50px,-30px)} }
@keyframes orbFloat3 { 0%,100%{transform:translate(-50%,-50%) scale(1)} 50%{transform:translate(-50%,-50%) scale(1.3)} }

/* Floating particles */
.login-particles { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.login-particle {
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(0, 130, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,130,255,0.4);
  animation: particleFloat 8s ease-in-out infinite;
}
@keyframes particleFloat {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-100vh) scale(0); opacity: 0; }
}

/* Login card */
.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px 40px;
  background: rgba(4, 8, 24, 0.85);
  border: 1px solid rgba(0, 100, 255, 0.15);
  border-radius: 16px;
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  box-shadow:
    0 0 60px rgba(0, 80, 255, 0.08),
    0 0 120px rgba(0, 80, 255, 0.04),
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(0, 130, 255, 0.1);
  animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(30px);
}
@keyframes cardAppear {
  to { opacity: 1; transform: translateY(0); }
}

/* Animated border glow */
.login-card-border {
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: conic-gradient(from var(--angle, 0deg), transparent 60%, rgba(0,120,255,0.4), rgba(0,200,255,0.2), transparent 100%);
  z-index: -1;
  animation: borderRotate 4s linear infinite;
  opacity: 0.5;
}
@keyframes borderRotate {
  to { --angle: 360deg; }
}
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Logo section */
.login-logo {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
}

.login-hex-grid {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeIn 0.6s 0.3s forwards;
}
.login-hex {
  width: 8px; height: 8px;
  background: rgba(0, 130, 255, 0.3);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: hexPulse 2s ease-in-out infinite;
}
.login-hex:nth-child(2) { animation-delay: 0.3s; background: rgba(0, 130, 255, 0.6); }
.login-hex:nth-child(3) { animation-delay: 0.6s; }
@keyframes hexPulse { 0%,100%{opacity:0.4;transform:scale(1)} 50%{opacity:1;transform:scale(1.3)} }

.login-logo-icon {
  margin-bottom: 16px;
  opacity: 0;
  animation: logoReveal 0.8s 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  filter: drop-shadow(0 0 20px rgba(0,120,255,0.3));
}
@keyframes logoReveal {
  from { opacity: 0; transform: scale(0.5) rotateY(90deg); }
  to { opacity: 1; transform: scale(1) rotateY(0deg); }
}

.login-logo-text {
  font-family: 'Inter', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 6px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #0080ff 0%, #00c8ff 50%, #0080ff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShine 3s linear infinite;
  opacity: 0;
  animation: textShine 3s linear infinite, fadeIn 0.5s 0.5s forwards;
}
.login-logo-text span {
  font-weight: 300;
  font-size: 1.2rem;
  letter-spacing: 3px;
  margin-left: 2px;
  opacity: 0.7;
}
@keyframes textShine {
  to { background-position: 200% center; }
}

.login-logo-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: rgba(0, 160, 255, 0.5);
  letter-spacing: 5px;
  margin-top: 8px;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 0.5s 0.7s forwards;
}

.login-logo-domain {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: rgba(0, 130, 255, 0.3);
  letter-spacing: 3px;
  margin-top: 4px;
  opacity: 0;
  animation: fadeIn 0.5s 0.9s forwards;
}

/* Form fields */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  opacity: 0;
  animation: fadeIn 0.6s 0.8s forwards;
}

.login-form .form-group { margin-bottom: 0; }

.login-field .form-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: rgba(0, 160, 255, 0.5);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.login-field-icon {
  color: #0080ff;
  font-weight: 700;
  font-size: 0.8rem;
  animation: fieldIconPulse 2s ease-in-out infinite;
}
@keyframes fieldIconPulse { 0%,100%{opacity:0.5} 50%{opacity:1} }

.login-field .form-input {
  background: rgba(0, 40, 120, 0.08);
  border: 1px solid rgba(0, 100, 255, 0.12);
  color: #c8deff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  padding: 14px 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}
.login-field .form-input::placeholder { color: rgba(0, 130, 255, 0.2); }
.login-field .form-input:focus {
  border-color: rgba(0, 130, 255, 0.5);
  background: rgba(0, 50, 150, 0.12);
  box-shadow: 0 0 25px rgba(0, 100, 255, 0.1), inset 0 0 20px rgba(0, 80, 255, 0.03);
  outline: none;
}

/* Submit button */
.login-submit {
  margin-top: 8px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(0,80,255,0.3), rgba(0,120,255,0.15));
  border: 1px solid rgba(0, 120, 255, 0.3);
  color: #80c8ff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.login-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,130,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.login-submit:hover::before { transform: translateX(100%); }
.login-submit:hover {
  background: linear-gradient(135deg, rgba(0,100,255,0.5), rgba(0,140,255,0.25));
  border-color: rgba(0, 160, 255, 0.5);
  color: #b8e0ff;
  box-shadow: 0 0 40px rgba(0, 100, 255, 0.2), 0 0 80px rgba(0, 100, 255, 0.05);
  transform: translateY(-1px);
}
.login-submit:active { transform: translateY(0); }
.login-btn-arrow {
  transition: transform 0.3s;
  font-size: 1.1rem;
}
.login-submit:hover .login-btn-arrow { transform: translateX(4px); }

/* Error */
.login-error {
  background: rgba(255, 50, 50, 0.08);
  border: 1px solid rgba(255, 50, 50, 0.2);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  animation: fadeIn 0.2s ease;
}

/* Footer */
.login-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: rgba(0, 130, 255, 0.25);
  text-transform: uppercase;
}
.login-footer-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,100,255,0.15), transparent);
}

/* Bottom status text */
.login-bottom-text {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(0, 130, 255, 0.25);
  letter-spacing: 4px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-status-dot {
  width: 6px; height: 6px;
  background: #0080ff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,128,255,0.6);
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,100% { box-shadow: 0 0 5px rgba(0,128,255,0.4); }
  50% { box-shadow: 0 0 15px rgba(0,128,255,0.8), 0 0 30px rgba(0,128,255,0.3); }
}

/* ============================================================
   2. APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.app-content {
  flex: 1;
  padding: 24px 28px;
  margin-top: var(--header-height);
  overflow-y: auto;
}

/* ============================================================
   3. HEADER
   ============================================================ */
.header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: left var(--transition-slow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.header-user-name {
  color: var(--text-primary);
  font-weight: 500;
}

.header-user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-logo-version {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  border-left-color: var(--accent-primary);
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.nav-item-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 190;
}

/* ============================================================
   5. DASHBOARD PAGE
   ============================================================ */
.page-dashboard {
  animation: fadeIn 0.3s ease;
}

.welcome-header {
  margin-bottom: 28px;
}

.welcome-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.welcome-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.stat-card:hover {
  border-color: #333;
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.quick-action-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.quick-action-card:hover {
  border-color: var(--accent-primary);
  background: var(--accent-primary-muted);
  box-shadow: var(--shadow-glow);
}

.quick-action-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.quick-action-label {
  font-weight: 500;
  color: var(--text-primary);
}

.quick-action-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Recent Activity */
.dashboard-section {
  margin-bottom: 28px;
}

.dashboard-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.activity-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  font-size: 0.875rem;
  transition: background var(--transition-fast);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: var(--bg-hover);
}

.activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  color: var(--text-secondary);
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Server Info */
.server-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.server-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color-subtle);
  font-size: 0.875rem;
}

.server-info-row:last-child {
  border-bottom: none;
}

.server-info-key {
  color: var(--text-secondary);
}

.server-info-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ============================================================
   6. TERMINAL PAGE
   ============================================================ */
.page-terminal {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  margin: calc(-1 * 24px) calc(-1 * 28px);
  animation: fadeIn 0.3s ease;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.terminal-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.terminal-status .status-dot {
  width: 8px;
  height: 8px;
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.terminal-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.terminal-container {
  flex: 1;
  background: #000;
  position: relative;
  overflow: hidden;
}

.terminal-container .xterm {
  padding: 8px;
  height: 100%;
}

.terminal-reconnecting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  z-index: 10;
}

/* ============================================================
   7. FILES PAGE
   ============================================================ */
.page-files {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  margin: calc(-1 * 24px) calc(-1 * 28px);
  animation: fadeIn 0.3s ease;
}

/* Toolbar */
.files-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.files-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.files-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Split Pane */
.split-pane {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.split-pane-left {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  flex-shrink: 0;
}

.split-pane-right {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.split-pane-divider {
  width: 3px;
  cursor: col-resize;
  background: var(--border-color);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.split-pane-divider:hover {
  background: var(--accent-primary);
}

/* File Tree */
.file-tree {
  padding: 8px 0;
}

.file-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-tree-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.file-tree-item.active {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.file-tree-item-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.file-tree-indent {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
}

/* File List */
.file-list-container {
  flex: 1;
  overflow-y: auto;
}

/* List view */
.file-list {
  width: 100%;
}

.file-list-header {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 100px 160px 100px;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 5;
}

.file-list-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 100px 160px 100px;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color-subtle);
  align-items: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.file-list-row:hover {
  background: var(--bg-hover);
}

.file-list-row.selected {
  background: var(--accent-primary-muted);
}

.file-list-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-list-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.file-icon.folder { color: var(--color-warning); }
.file-icon.document { color: var(--text-secondary); }
.file-icon.image { color: #c678dd; }
.file-icon.code { color: var(--accent-primary); }
.file-icon.archive { color: #e06c75; }

.file-list-size {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.file-list-modified {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.file-list-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-list-row:hover .file-list-actions {
  opacity: 1;
}

.file-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.file-action-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

.file-action-btn.danger:hover {
  color: var(--color-error);
}

/* Grid view */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px;
}

.file-grid-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.file-grid-item:hover {
  border-color: #333;
  background: var(--bg-hover);
}

.file-grid-item.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.file-grid-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.file-grid-name {
  font-size: 0.8rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-grid-size {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Drag & Drop Overlay */
.drag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 212, 255, 0.05);
  border: 2px dashed var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.drag-overlay.active {
  opacity: 1;
}

.drag-overlay-content {
  text-align: center;
  color: var(--accent-primary);
}

.drag-overlay-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.drag-overlay-text {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Upload Progress */
.upload-progress {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.85rem;
}

.upload-progress-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.upload-progress-bar-track {
  width: 120px;
  flex-shrink: 0;
}

.upload-progress-percent {
  width: 40px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Image Preview Modal */
.image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-preview img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
}

/* Code Editor */
.editor-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.editor-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.editor-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.editor-tab:hover {
  background: var(--bg-hover);
}

.editor-tab.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-primary);
}

.editor-tab-close {
  font-size: 0.75rem;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.editor-tab-close:hover {
  opacity: 1;
}

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-primary);
}

.editor-line-numbers {
  width: 48px;
  padding: 12px 8px 12px 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.editor-textarea {
  flex: 1;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.editor-footer-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* ============================================================
   8. USERS PAGE
   ============================================================ */
.page-users {
  animation: fadeIn 0.3s ease;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.users-table-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-info-email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   9. SETTINGS PAGE
   ============================================================ */
.page-settings {
  max-width: 800px;
  animation: fadeIn 0.3s ease;
}

.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.settings-section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-subtle);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-active);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-base);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--text-inverse);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Password toggle */
.password-wrapper {
  position: relative;
}

.password-wrapper .form-input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px;
  transition: color var(--transition-fast);
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* ============================================================
   COMMON COMPONENTS
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-ui);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: #444;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: #e04840;
  border-color: #e04840;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-admin {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.badge-worker {
  background: rgba(136, 136, 136, 0.15);
  color: var(--text-secondary);
}

.badge-active {
  background: rgba(40, 200, 64, 0.12);
  color: var(--color-success);
}

.badge-disabled {
  background: rgba(255, 95, 87, 0.12);
  color: var(--color-error);
}

.badge-warning {
  background: rgba(255, 189, 46, 0.12);
  color: var(--color-warning);
}

.badge-info {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.form-input.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--color-error);
  margin-top: 4px;
}

.form-input.error,
.form-select.error {
  border-color: var(--color-error);
}

.form-input.error:focus,
.form-select.error:focus {
  box-shadow: 0 0 0 3px rgba(255, 95, 87, 0.1);
}

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
}

.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  animation: modalIn 0.25s ease;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.modal-lg .modal-content {
  max-width: 700px;
}

.modal-sm .modal-content {
  max-width: 380px;
}

/* ---------- Toast / Notification ---------- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight 0.3s ease;
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast.toast-success { border-left: 3px solid var(--color-success); }
.toast.toast-error { border-left: 3px solid var(--color-error); }
.toast.toast-warning { border-left: 3px solid var(--color-warning); }
.toast.toast-info { border-left: 3px solid var(--accent-primary); }

.toast.removing {
  animation: slideOutRight 0.25s ease forwards;
}

/* ---------- Loading Spinner ---------- */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner.sm {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
}

.loading-spinner.lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

.loading-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- Dropdown ---------- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px 0;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--color-error);
}

.dropdown-item.danger:hover {
  background: rgba(255, 95, 87, 0.08);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: nowrap;
}

.breadcrumb-item {
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.breadcrumb-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  cursor: default;
}

.breadcrumb-item.active:hover {
  background: none;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 20px;
}

/* ---------- Status Dot ---------- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.online,
.status-dot.active,
.status-dot.connected {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(40, 200, 64, 0.5);
}

.status-dot.offline,
.status-dot.disconnected {
  background: var(--color-error);
  box-shadow: 0 0 6px rgba(255, 95, 87, 0.4);
}

.status-dot.warning,
.status-dot.idle {
  background: var(--color-warning);
  box-shadow: 0 0 6px rgba(255, 189, 46, 0.4);
}

.status-dot.pulse {
  animation: pulse 2s ease infinite;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: width var(--transition-base);
}

.progress-bar-fill.success {
  background: var(--color-success);
}

.progress-bar-fill.error {
  background: var(--color-error);
}

.progress-bar.lg {
  height: 8px;
  border-radius: 4px;
}

.progress-bar.lg .progress-bar-fill {
  border-radius: 4px;
}

/* ---------- Context Menu ---------- */
.context-menu {
  position: fixed;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px 0;
  z-index: 1100;
  animation: fadeIn 0.1s ease;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.context-menu-item.danger {
  color: var(--color-error);
}

.context-menu-item.danger:hover {
  background: rgba(255, 95, 87, 0.08);
}

.context-menu-item-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.context-menu-item-shortcut {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ---------- Confirm Dialog ---------- */
.confirm-dialog .modal-content {
  max-width: 400px;
  text-align: center;
  padding: 32px;
}

.confirm-dialog-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.confirm-dialog-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-dialog-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.confirm-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ---------- View Toggle ---------- */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.view-toggle-btn.active {
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border-color);
}

/* ---------- Search ---------- */
.search-input-wrap {
  position: relative;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 32px;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  font-size: 0.7rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: 500;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

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

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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

/* Page transition */
.page-enter {
  animation: fadeIn 0.25s ease;
}

.page-leave {
  animation: fadeOut 0.15s ease;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-hover) 50%, var(--bg-tertiary) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-lg);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }

  .header {
    left: 0;
  }

  .hamburger-btn {
    display: block;
  }

  .app-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  /* File manager full width */
  .split-pane {
    flex-direction: column;
  }

  .split-pane-left {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .split-pane-divider {
    display: none;
  }

  .file-list-header,
  .file-list-row {
    grid-template-columns: 1fr 80px 60px;
  }

  .file-list-modified {
    display: none;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  /* Terminal full screen */
  .page-terminal {
    height: calc(100vh - var(--header-height));
  }

  /* Modal responsive */
  .modal-content {
    margin: 12px;
    max-height: calc(100vh - 24px);
    padding: 20px;
  }

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

  .table {
    min-width: 600px;
  }

  /* Toast */
  .toast-container {
    left: 16px;
    right: 16px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Settings */
  .page-settings {
    max-width: 100%;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Login */
  .login-card {
    margin: 16px;
    padding: 28px 24px;
  }

  /* Breadcrumb */
  .files-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .files-toolbar-left,
  .files-toolbar-right {
    width: 100%;
  }

  .files-toolbar-right {
    justify-content: flex-end;
  }

  /* Editor */
  .editor-line-numbers {
    width: 36px;
    font-size: 0.7rem;
  }

  .editor-textarea {
    font-size: 0.8rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card-value {
    font-size: 1.25rem;
  }

  .welcome-header h1 {
    font-size: 1.2rem;
  }

  .confirm-dialog-actions {
    flex-direction: column;
  }

  .confirm-dialog-actions .btn {
    width: 100%;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-select { user-select: none; }
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }

.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-top { border-top: 1px solid var(--border-color); }

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

/* Focus visible ring for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Print */
@media print {
  .sidebar,
  .header,
  .toast-container {
    display: none !important;
  }

  .app-main {
    margin-left: 0;
  }

  .app-content {
    margin-top: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* ============================================================
   AI CHAT
   ============================================================ */

.page-chat {
    display: flex;
    height: calc(100vh - var(--header-height, 56px));
    overflow: hidden;
}

/* Chat sidebar */
.chat-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary, #111);
    border-right: 1px solid var(--border-color, #1e1e1e);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color, #1e1e1e);
}

.chat-conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-conv-item {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
    position: relative;
}

.chat-conv-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-conv-item.active {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.chat-conv-title {
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.chat-conv-meta {
    font-size: 11px;
    color: var(--text-muted, #555);
    margin-top: 4px;
}

.chat-conv-delete {
    position: absolute;
    top: 10px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted, #555);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    padding: 0 4px;
    line-height: 1;
}

.chat-conv-item:hover .chat-conv-delete {
    opacity: 1;
}

.chat-conv-delete:hover {
    color: var(--color-error, #ff5f57);
}

.chat-empty-convs {
    text-align: center;
    color: var(--text-muted, #555);
    padding: 40px 16px;
    font-size: 13px;
    line-height: 1.6;
}

/* Chat main area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary, #0a0a0a);
}

.chat-header {
    height: 56px;
    min-height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color, #1e1e1e);
    background: var(--bg-secondary, #111);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.chat-header-icon {
    font-size: 20px;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #888);
}

/* Chat messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-assistant {
    align-self: flex-start;
}

.chat-msg-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-tertiary, #1a1a1a);
}

.chat-msg-user .chat-msg-avatar {
    background: rgba(0, 212, 255, 0.15);
}

.chat-msg-assistant .chat-msg-avatar {
    background: rgba(0, 255, 65, 0.1);
}

.chat-msg-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-msg-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #888);
}

.chat-msg-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-secondary, #111);
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-msg-user .chat-msg-content {
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px 12px 2px 12px;
}

.chat-msg-assistant .chat-msg-content {
    background: var(--bg-secondary, #111);
    border: 1px solid var(--border-color, #1e1e1e);
    border-radius: 12px 12px 12px 2px;
}

.chat-msg-content pre {
    background: #0a0a0a;
    border: 1px solid var(--border-color, #1e1e1e);
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.chat-msg-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
}

.chat-msg-content pre code {
    background: none;
    padding: 0;
}

.chat-msg-content strong {
    font-weight: 600;
    color: #fff;
}

.chat-msg-time {
    font-size: 11px;
    color: var(--text-muted, #555);
}

/* Welcome state */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary, #888);
}

.chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-welcome h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--text-secondary, #888);
    margin-bottom: 24px;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 500px;
}

.chat-suggestion {
    background: var(--bg-secondary, #111);
    border: 1px solid var(--border-color, #1e1e1e);
    color: var(--text-secondary, #888);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.chat-suggestion:hover {
    border-color: var(--accent-primary, #00d4ff);
    color: var(--accent-primary, #00d4ff);
    background: rgba(0, 212, 255, 0.05);
}

/* Chat input */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color, #1e1e1e);
    background: var(--bg-secondary, #111);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-primary, #0a0a0a);
    border: 1px solid var(--border-color, #1e1e1e);
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary, #00d4ff);
}

.chat-input-text {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary, #e0e0e0);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 200px;
    line-height: 1.5;
    padding: 4px 0;
}

.chat-input-text::placeholder {
    color: var(--text-muted, #555);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: var(--accent-primary, #00d4ff);
    color: #0a0a0a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chat-send-btn:hover:not(:disabled) {
    background: #33ddff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-input-hint {
    font-size: 11px;
    color: var(--text-muted, #555);
    margin-top: 6px;
    text-align: center;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: var(--text-muted, #555);
    border-radius: 50%;
    animation: chatTyping 1.4s infinite;
}

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

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

/* Chat error */
.chat-error {
    color: var(--color-error, #ff5f57);
    font-size: 13px;
    padding: 8px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .page-chat {
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color, #1e1e1e);
    }

    .chat-msg {
        max-width: 95%;
    }
}

/* Chat image upload */
.chat-attach-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-secondary, #888);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chat-attach-btn:hover {
    color: var(--color-primary, #00d4ff);
    background: rgba(0, 212, 255, 0.1);
}

.chat-image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-bg-tertiary, #1a1a1a);
    border: 1px solid var(--color-border, #1e1e1e);
    border-radius: 8px;
    margin-top: 8px;
}

.chat-preview-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--color-border, #1e1e1e);
}

.chat-preview-name {
    flex: 1;
    font-size: 12px;
    color: var(--color-text-secondary, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 95, 87, 0.15);
    color: var(--color-error, #ff5f57);
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chat-preview-remove:hover {
    background: rgba(255, 95, 87, 0.3);
}

.chat-msg-image img {
    max-width: 300px;
    max-height: 250px;
    border-radius: 8px;
    border: 1px solid var(--color-border, #1e1e1e);
    margin-bottom: 8px;
    cursor: pointer;
}

.chat-msg-image img:hover {
    opacity: 0.9;
}

.chat-msg-image-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 6px;
    font-size: 12px;
    color: var(--color-primary, #00d4ff);
    margin-bottom: 8px;
}

.chat-main.drag-over {
    outline: 2px dashed var(--color-primary, #00d4ff);
    outline-offset: -4px;
    background: rgba(0, 212, 255, 0.03);
}

/* Generated images in chat */
.chat-generated-image {
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border, #1e1e1e);
    background: #0a0a0a;
    display: inline-block;
    max-width: 100%;
}
.chat-generated-image img {
    display: block;
    max-width: 512px;
    width: 100%;
    height: auto;
    cursor: pointer;
    transition: opacity 0.2s;
}
.chat-generated-image img:hover { opacity: 0.9; }
.chat-img-caption {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--color-text-muted, #555);
    font-style: italic;
    border-top: 1px solid var(--color-border, #1e1e1e);
}
