/* ============================================================
   BACKUP MONITOR — Redesign 2026
   Narrow icon sidebar + top header + modern dashboard
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-subtle: rgba(245,158,11,0.08);
  --accent-ring: rgba(245,158,11,0.25);

  --green: #10b981;
  --green-bg: rgba(16,185,129,0.08);
  --green-border: rgba(16,185,129,0.15);
  --green-dot: #10b981;
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.08);
  --red-border: rgba(239,68,68,0.15);
  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,0.08);
  --amber-border: rgba(245,158,11,0.15);
  --blue: #6366f1;
  --blue-bg: rgba(99,102,241,0.08);

  --bg-root: #f5f5f7;
  --bg-card: #ffffff;
  --bg-inset: #f8f9fb;
  --bg-hover: #f0f1f4;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f3f4f6;
  --bg-sidebar-active: var(--accent);
  --bg-topbar: #ffffff;

  --border: #e5e7eb;
  --border-light: #f0f1f4;
  --border-sidebar: #e5e7eb;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;
  --text-sidebar: #6b7280;
  --text-sidebar-active: #78350f;

  --sidebar-w: 72px;
  --topbar-h: 60px;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-2: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-3: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-4: 0 16px 48px rgba(0,0,0,0.12);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);

  /* Aliases for inline styles in app.js */
  --gray-50: var(--bg-inset);
  --gray-100: var(--border-light);
  --gray-200: var(--border);
  --gray-300: #d1d5db;
  --gray-400: var(--text-tertiary);
  --gray-500: var(--text-secondary);
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --primary: var(--accent);
  --primary-light: var(--accent-subtle);
  --success: var(--green);
  --success-light: var(--green-bg);
  --danger: var(--red);
  --danger-light: var(--red-bg);
  --warning: var(--amber);
  --warning-light: var(--amber-bg);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
::selection { background: var(--accent); color: white; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-root);
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(245,158,11,0.10), transparent),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(99,102,241,0.05), transparent);
}

.login-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  animation: fadeInScale 0.45s ease-out;
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { max-width: 240px; height: auto; margin-bottom: 20px; }
.login-icon { font-size: 42px; margin-bottom: 12px; display: block; }
.login-header h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.login-header p { color: var(--text-tertiary); font-size: 13px; margin-top: 4px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all 0.15s;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-tertiary); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.error-message {
  background: var(--red-bg); color: var(--red);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
  border: 1px solid var(--red-border);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px; border: none;
  border-radius: var(--radius-sm); font-size: 13px;
  font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent); color: #78350f;
  box-shadow: 0 1px 3px rgba(245,158,11,0.25); font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 3px 10px rgba(245,158,11,0.3); transform: translateY(-1px); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { filter: brightness(1.08); }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { filter: brightness(1.08); }

.btn-outline {
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--text-secondary); box-shadow: var(--shadow-1);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-outline.active { background: var(--accent); color: #78350f; border-color: var(--accent); font-weight: 600; }
.btn-outline.active:hover { background: var(--accent-hover); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px 16px; font-size: 14px; }
.btn-icon { padding: 6px; min-width: 30px; }

/* ============================================================
   LAYOUT — Narrow sidebar + Top bar
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR — Narrow icon-based with SVG icons
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.2s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 0 14px;
  text-align: center;
  width: 100%;
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo {
  width: 38px; height: 38px;
  background: rgba(16,185,129,0.1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}

.sidebar-header h1 { display: none; }
.sidebar-header .subtitle { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow-y: auto;
}

.nav-section { display: none; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 2px 8px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 60px;
  text-align: center;
  font-family: inherit;
  border-radius: var(--radius-sm);
  position: relative;
}

.nav-item svg {
  opacity: 0.45;
  transition: opacity 0.15s;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.nav-label {
  font-size: 9px;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62px;
}

/* Hide old span emoji icons */
.nav-item > span:first-child:not(.nav-label):not(.nav-notif-dot) {
  display: none;
}

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

.nav-item.active {
  color: var(--text-sidebar-active);
  background: var(--bg-sidebar-active);
}
.nav-item.active svg { opacity: 1; color: #78350f; }
.nav-item.active::before { display: none; }

.nav-notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid white;
}

.sidebar-footer {
  padding: 8px 0 12px;
  border-top: 1px solid var(--border);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.sidebar-footer .nav-item {
  padding: 8px 4px;
}

/* Hide old user elements */
.user-info { display: none; }
.user-avatar { display: none; }
.user-details { display: none; }
.btn-logout { display: none; }

/* Mobile toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px; z-index: 200;
  background: var(--bg-sidebar); color: white;
  border: none; border-radius: var(--radius-sm);
  width: 38px; height: 38px; font-size: 16px;
  cursor: pointer; box-shadow: var(--shadow-3);
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  z-index: 99;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 90;
  gap: 20px;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-bar-brand span { font-size: 16px; }

.top-bar-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}

.top-bar-search input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-inset);
  transition: all 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.868-3.834zm-5.44.156a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

.top-bar-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background-color: white;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar-notif {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-inset);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  position: relative;
}
.top-bar-notif:hover { background: var(--bg-hover); color: var(--text-primary); }

.top-bar-notif .notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid white;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  position: relative;
}
.top-bar-user:hover { background: var(--bg-hover); }

.top-bar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #78350f;
}

.top-bar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.top-bar-user-arrow {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* User dropdown menu */
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-width: 220px; z-index: 1000; overflow: hidden;
  animation: fadeInScale 0.15s ease;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-inset);
}
.user-dropdown-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.user-dropdown-role { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.user-dropdown-divider { height: 1px; background: var(--border-light); }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); background: none; border: none;
  cursor: pointer; transition: background 0.12s;
}
.user-dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-dropdown-item svg { flex-shrink: 0; }
.user-dropdown-logout { color: var(--red); }
.user-dropdown-logout:hover { background: var(--red-bg); color: var(--red); }

.top-bar-actions { position: relative; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 24px 28px;
  min-height: calc(100vh - var(--topbar-h));
  max-width: 100%;
  animation: fadeIn 0.25s ease;
}

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

.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.page-header .actions { display: flex; gap: 8px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.15s;
  animation: fadeIn 0.3s ease both;
}
.card:hover { box-shadow: var(--shadow-card-hover); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.1px;
}

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS — with mini sparkline
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s;
  animation: fadeIn 0.35s ease both;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card:nth-child(1) { animation-delay: 0.03s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.09s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }

.stat-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }

/* Horizontal layout for client detail stat cards */
.stat-card.stat-card-row {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-card-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-card-sparkline {
  height: 32px;
  margin-top: 4px;
}

.stat-card-sparkline svg {
  width: 100%;
  height: 100%;
}

/* Legacy stat-card layout support (for non-dashboard pages) */
.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(99,102,241,0.1); color: #6366f1; }
.stat-icon.green { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.red { background: rgba(239,68,68,0.1); color: #ef4444; }
.stat-icon.yellow { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-icon svg { stroke: currentColor; }

.stat-info h4 {
  font-size: 28px; font-weight: 800;
  color: var(--text-primary); line-height: 1; letter-spacing: -0.5px;
}
.stat-info p { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; font-weight: 500; }

/* ============================================================
   DASHBOARD TWO-COLUMN LAYOUT
   ============================================================ */
.dashboard-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ============================================================
   ACTIVITY STREAM
   ============================================================ */
.activity-stream {
  max-height: 380px;
  overflow-y: auto;
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
  line-height: 1.5;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-hover); }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-dot.success { background: var(--green); }
.activity-dot.failed { background: var(--red); }
.activity-dot.warning { background: var(--amber); }
.activity-dot.info { background: var(--blue); }

.activity-time {
  color: var(--text-tertiary);
  font-size: 11.5px;
  white-space: nowrap;
  min-width: 50px;
  font-weight: 500;
  flex-shrink: 0;
}

.activity-client {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  min-width: 80px;
  flex-shrink: 0;
}

.activity-detail {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.activity-status {
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.activity-status.ok { color: var(--green); }
.activity-status.error { color: var(--red); }
.activity-status.warn { color: var(--amber); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container { overflow-x: auto; }

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

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border-light);
}

tbody td {
  padding: 11px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
}

tbody td strong, tbody td a { color: var(--text-primary); }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.badge-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-danger { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-info { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(99,102,241,0.15); }
.badge-gray { background: var(--bg-inset); color: var(--text-tertiary); border: 1px solid var(--border); }

/* ============================================================
   HEALTH SCORE
   ============================================================ */
.health-score {
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  background: var(--bg-card);
  position: relative;
}
.health-score::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; border: 3px solid var(--border-light);
}
.health-score::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; border: 3px solid transparent;
}
.health-score.good { color: var(--green); }
.health-score.good::after { border-color: var(--green); }
.health-score.fair { color: var(--amber); }
.health-score.fair::after { border-color: var(--amber); }
.health-score.poor { color: var(--red); }
.health-score.poor::after { border-color: var(--red); }

/* ============================================================
   CLIENT CARDS (dashboard)
   ============================================================ */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.client-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 4px solid transparent;
  animation: fadeIn 0.3s ease both;
}
.client-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.client-card.status-good { border-left-color: var(--green); }
.client-card.status-warning { border-left-color: var(--amber); }
.client-card.status-critical { border-left-color: var(--red); }

.client-card-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.client-card-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.client-card-stats {
  display: flex; gap: 6px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.client-card-stat { text-align: center; flex: 1; padding: 6px 4px; border-radius: var(--radius-xs); background: var(--bg-inset); }
.client-card-stat .value { font-size: 18px; font-weight: 800; }
.client-card-stat .label {
  font-size: 9.5px; color: var(--text-tertiary);
  text-transform: uppercase; font-weight: 700; letter-spacing: 0.4px; margin-top: 1px;
}

/* ============================================================
   AI ASSISTANT - FULL SCREEN
   ============================================================ */
.ai-fullscreen {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 80px);
}
.ai-header {
  display: flex; align-items: center; gap: 14px;
  padding: 0 0 20px 0;
}
.ai-header-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--accent-subtle); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.ai-header h2 { color: var(--text-primary); font-weight: 800; }

/* Chat container: flex column, messages grow, input at bottom */
.ai-chat-container-new {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
  display: flex; flex-direction: column;
  height: calc(100vh - 180px); min-height: 400px;
  overflow: hidden;
}

/* Messages area - grows to fill, scrolls */
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  background: var(--bg-inset);
}

/* Bottom bar: quick actions + search input */
.ai-bottom-bar {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  flex-shrink: 0;
}
.ai-search-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-inset); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px 6px 16px;
  transition: all 0.2s;
}
.ai-search-box:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring);
  background: white;
}
.ai-search-icon { color: var(--text-tertiary); flex-shrink: 0; }
.ai-search-box input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 15px; font-family: inherit; color: var(--text-primary);
  padding: 10px 0;
}
.ai-search-box input::placeholder { color: var(--gray-400); }
.ai-search-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--accent); color: #78350f; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.ai-search-btn:hover { background: var(--accent-hover); transform: scale(1.05); }

.ai-quick-actions {
  display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.ai-quick-btn {
  padding: 6px 14px; border-radius: 99px;
  background: var(--bg-inset); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.ai-quick-btn:hover {
  background: var(--accent-subtle); color: var(--accent);
  border-color: var(--accent);
}

/* Welcome grid */
.ai-welcome { padding: 10px 0; }
.ai-welcome-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.ai-welcome-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border-light);
  cursor: pointer; transition: all 0.15s;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  box-shadow: var(--shadow-1);
}
.ai-welcome-card:hover {
  border-color: var(--accent); background: var(--accent-subtle);
  color: var(--accent); transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.ai-welcome-card svg { flex-shrink: 0; color: var(--text-tertiary); }
.ai-welcome-card:hover svg { color: var(--accent); }

/* Messages */
.ai-message {
  margin-bottom: 20px; display: flex; gap: 12px;
  max-width: 100%;
}
.ai-message-user { justify-content: flex-end; }
.ai-message-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-message-avatar.ai { background: var(--accent-subtle); color: var(--accent); }
.ai-message-avatar.user { background: var(--bg-inset); color: var(--text-secondary); border: 1px solid var(--border); }

.ai-message-content {
  flex: 1; font-size: 13px; line-height: 1.65;
  background: var(--bg-card); padding: 14px 18px;
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  box-shadow: var(--shadow-1); border: 1px solid var(--border-light);
  max-width: 85%;
}
.ai-msg-user {
  background: var(--accent); color: #78350f;
  border-color: var(--accent-hover);
  border-radius: var(--radius) 4px var(--radius) var(--radius);
  max-width: 60%; font-weight: 500;
}
.ai-message-content strong { color: var(--text-primary); }

.ai-answer-text {
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  margin-bottom: 12px; line-height: 1.6;
}

/* Results grid */
.ai-results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.ai-result-card {
  background: var(--bg-inset); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 12px 14px;
  transition: all 0.15s;
}
.ai-result-card:hover {
  border-color: var(--accent); box-shadow: var(--shadow-2);
  background: white;
}
.ai-result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.ai-result-date { font-size: 11px; color: var(--text-tertiary); }
.ai-result-main { margin-bottom: 6px; }
.ai-result-job { font-size: 13px; color: var(--text-primary); }
.ai-result-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-result-link {
  font-size: 11px; font-weight: 600; color: var(--accent);
  cursor: pointer; text-decoration: underline;
  text-decoration-style: dotted;
}
.ai-result-link:hover { text-decoration-style: solid; }
.ai-result-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-tertiary); font-family: monospace;
}

.ai-more-results {
  color: var(--text-tertiary); font-size: 12px;
  margin-top: 10px; font-weight: 500;
}

/* ============================================================
   GLOBAL SEARCH DROPDOWN
   ============================================================ */
.global-search-dropdown {
  display: none; position: absolute; top: 100%;
  left: 0; right: 0; margin-top: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-4);
  z-index: 999; max-height: 400px; overflow-y: auto;
}
.gsd-section { padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.gsd-section:last-child { border-bottom: none; }
.gsd-section-ai { background: var(--bg-inset); }
.gsd-label {
  font-size: 10px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 14px 4px;
}
.gsd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; transition: all 0.1s;
  font-size: 13px; color: var(--text-primary);
}
.gsd-item:hover { background: var(--accent-subtle); color: var(--accent); }
.gsd-item svg { flex-shrink: 0; color: var(--text-tertiary); }
.gsd-item:hover svg { color: var(--accent); }
.gsd-badge {
  margin-left: auto; font-size: 11px; padding: 1px 8px;
  border-radius: 99px; background: var(--bg-inset); color: var(--text-tertiary);
  border: 1px solid var(--border); font-weight: 500;
}
.gsd-meta {
  margin-left: auto; font-size: 11px; color: var(--text-tertiary);
}
.gsd-ai { color: var(--accent); font-weight: 500; }
.gsd-ai svg { color: var(--accent); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: all 0.2s; padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05), var(--shadow-4);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-tertiary);
  padding: 4px; border-radius: var(--radius-xs);
  transition: all 0.12s; line-height: 1;
}
.modal-close:hover { background: var(--bg-inset); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-inset);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; line-height: 1.5;
}
.alert-item.critical { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.alert-item.warning { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.alert-item.info { background: var(--accent-subtle); color: var(--accent); }

/* ============================================================
   FILTER BAR (Server page)
   ============================================================ */
.filter-bar { padding: 16px 20px 12px; overflow: visible !important; }
.filter-bar-inner {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  overflow: visible;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 130px; overflow: visible; position: relative; }
.filter-group label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.filter-group input, .filter-group select {
  padding: 7px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  font-family: inherit; background: var(--bg-card); color: var(--text-primary);
  transition: all 0.15s;
}
.filter-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.filter-group input:focus, .filter-group select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.filter-actions { align-self: flex-end; }
.filter-count {
  display: none; font-size: 12px; color: var(--text-tertiary);
  margin-top: 8px; font-weight: 500; padding-left: 2px;
}

/* Multi-select dropdown */
.multi-select { position: relative; min-width: 150px; flex: 1; }
.multi-select-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px 7px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; height: 36px;
  font-family: inherit; background: var(--bg-card); color: var(--text-primary);
  cursor: pointer; transition: all 0.15s; width: 100%; box-sizing: border-box;
}
.multi-select-btn:hover { border-color: var(--accent); }
.multi-select-btn.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.multi-select-btn .ms-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; line-height: 1.3;
}
.multi-select-btn .ms-arrow {
  font-size: 9px; color: var(--text-tertiary); flex-shrink: 0;
  transition: transform 0.15s;
}
.multi-select-btn.active .ms-arrow { transform: rotate(180deg); }
.multi-select-btn .ms-count {
  background: var(--accent); color: #78350f; font-size: 10px; font-weight: 700;
  padding: 0 6px; border-radius: 99px; flex-shrink: 0; line-height: 18px;
}
.multi-select-dropdown {
  display: none; position: fixed;
  min-width: 280px; max-width: 420px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  z-index: 9999;
  flex-direction: column; max-height: 320px;
}
.multi-select-dropdown.open { display: flex; }
.multi-select-search {
  padding: 8px 10px; border: none; border-bottom: 1px solid var(--border-light);
  width: 100%; font-size: 12px; font-family: inherit; outline: none;
  background: var(--bg-inset); flex-shrink: 0; box-sizing: border-box;
}
.multi-select-search:focus { background: white; }
.ms-options {
  overflow-y: auto; max-height: 200px; flex: 1;
}
.multi-select-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 12px;
  transition: background 0.1s; line-height: 1.4;
}
.multi-select-option:hover { background: var(--accent-subtle); }
.multi-select-option input[type="checkbox"] {
  accent-color: var(--accent); margin: 0; cursor: pointer;
  width: 15px; height: 15px; flex-shrink: 0;
}
.multi-select-option label {
  cursor: pointer; flex: 1;
  word-break: break-word; line-height: 1.3;
}
.multi-select-actions {
  display: flex; gap: 6px; padding: 6px 10px;
  border-bottom: 1px solid var(--border-light); background: var(--bg-inset);
  flex-shrink: 0;
}
.multi-select-actions button {
  font-size: 11px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-card);
  cursor: pointer; font-family: inherit; color: var(--text-secondary);
  transition: all 0.1s;
}
.multi-select-actions button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }

.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th:hover { color: var(--accent); }
.sort-icon { font-size: 10px; color: var(--accent); }

.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
.status-dot.offline { background: var(--gray-300); }

/* ============================================================
   MISC UI
   ============================================================ */
.notif-badge {
  background: var(--red); color: white;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 99px;
  min-width: 16px; text-align: center;
}

.filters-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters-bar select, .filters-bar input {
  padding: 7px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  font-family: inherit; background: var(--bg-card); color: var(--text-primary);
}
.filters-bar select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.filters-bar select:focus, .filters-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.api-key-display {
  background: #0a0e18; color: #7dd3fc;
  padding: 14px 16px; border-radius: var(--radius-sm);
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 12.5px; word-break: break-all; margin: 12px 0; line-height: 1.6;
  border: 1px solid rgba(125,211,252,0.1);
}

.empty-state { text-align: center; padding: 56px 20px; }
.empty-state-icon { font-size: 44px; margin-bottom: 14px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-tertiary); }

.detail-grid { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.detail-label { font-weight: 600; color: var(--text-tertiary); font-size: 12.5px; }
.detail-value { color: var(--text-primary); }

/* ===== Server Detail: System Info ===== */
.sysinfo-sections { display: flex; flex-direction: column; gap: 20px; }

.sysinfo-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .sysinfo-overview { grid-template-columns: 1fr; } }

.sysinfo-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 18px 20px;
}
.sysinfo-card h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-tertiary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.sysinfo-card h4 svg { flex-shrink: 0; }

.sysinfo-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.sysinfo-row:last-child { border-bottom: none; }
.sysinfo-row-label { color: var(--text-tertiary); font-weight: 500; }
.sysinfo-row-value { color: var(--text-primary); font-weight: 600; text-align: right; max-width: 60%; word-break: break-all; }

.progress-bar {
  background: var(--border-light); border-radius: 4px; height: 8px;
  overflow: hidden; margin-top: 4px; width: 100%;
}
.progress-fill {
  height: 100%; border-radius: 4px; transition: width 0.4s ease;
}
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }

.disk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.disk-card {
  background: var(--bg-inset); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.disk-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.disk-card-drive { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.disk-card-label { font-size: 11px; color: var(--text-tertiary); }
.disk-card-detail { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-tertiary); margin-top: 6px; }

.nic-card {
  background: var(--bg-inset); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px;
}
.nic-card:last-child { margin-bottom: 0; }
.nic-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.nic-detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: 12px; }
.nic-detail-label { color: var(--text-tertiary); font-weight: 500; }
.nic-detail-value { color: var(--text-primary); font-family: 'SF Mono', 'Consolas', monospace; font-size: 11.5px; }

.sysinfo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.sysinfo-badge.online { background: var(--green-bg); color: var(--green); }
.sysinfo-badge.offline { background: var(--red-bg); color: var(--red); }
.sysinfo-badge.fw-on { background: var(--green-bg); color: var(--green); }
.sysinfo-badge.fw-off { background: var(--amber-bg); color: var(--amber); }

/* Toast notifications */
.toast-success {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--green); color: white;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
  z-index: 9999; opacity: 0; transform: translateY(10px);
  transition: all 0.3s; pointer-events: none;
}
.toast-success.show { opacity: 1; transform: translateY(0); }

.sysinfo-upgrade-notice {
  text-align: center; padding: 40px 20px; color: var(--text-tertiary);
}
.sysinfo-upgrade-notice svg { margin-bottom: 10px; }
.sysinfo-upgrade-notice h3 { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.sysinfo-upgrade-notice p { font-size: 13px; }

.ai-analysis {
  background: var(--bg-inset); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 16px; margin-top: 14px;
}
.ai-analysis h4 { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ai-analysis ul { list-style: none; padding: 0; }
.ai-analysis li { padding: 3px 0; font-size: 13px; padding-left: 16px; position: relative; color: var(--text-secondary); }
.ai-analysis li::before { content: '\203A'; position: absolute; left: 3px; color: var(--accent); font-weight: bold; }
.suggestion-list li::before { content: '\2022'; color: var(--amber); }

.btn-icon-ghost {
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.btn-icon-ghost:hover { background: var(--bg-hover); }

.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.55s linear infinite; }

/* ============================================================
   TABLE ACTION BAR
   ============================================================ */
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
}

.table-actions .btn {
  font-size: 11.5px;
  padding: 5px 12px;
}

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

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar-overlay.active { display: block; }
  .top-bar { left: 0; }
  .main-content { margin-left: 0; padding: 16px; padding-top: calc(var(--topbar-h) + 16px); }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .clients-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .modal { max-width: calc(100% - 16px); }
  .login-card { padding: 32px 24px; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  thead th, tbody td { padding: 8px 10px; font-size: 12px; }
  .top-bar-search { display: none; }
  .top-bar-brand { font-size: 14px; }
}

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

@media print {
  .sidebar, .menu-toggle, .sidebar-overlay, .top-bar { display: none !important; }
  .main-content { margin-left: 0 !important; margin-top: 0 !important; padding: 0 !important; }
}
