/* ══════════════════════════════════════════════
   WERK ADMIN PANEL — style.css
   Warm Professional Theme + Dark Mode
══════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
  /* Light Mode Palette */
  --bg-base:        #FDFBF7;
  --bg-surface:     #FFFFFF;
  --bg-sidebar:     #1E1A16;
  --bg-hover:       #F5F0E8;
  --bg-muted:       #F0EAE0;
  --bg-input:       #FDFBF7;

  --text-primary:   #2C2410;
  --text-secondary: #7A6A55;
  --text-muted:     #A89880;
  --text-inverse:   #F5F0E8;
  --text-sidebar:   #C8B89A;

  --accent-primary: #C8893A;
  --accent-hover:   #B07730;
  --accent-soft:    #F5E8D3;
  --accent-green:   #5A9A78;
  --accent-red:     #C05050;
  --accent-blue:    #5A7DAA;
  --accent-purple:  #8B75C2;

  --border-color:   #E8DFD0;
  --border-muted:   #F0EAE0;

  --shadow-sm:      0 1px 4px rgba(44, 36, 16, 0.06);
  --shadow-md:      0 4px 16px rgba(44, 36, 16, 0.08);
  --shadow-lg:      0 8px 32px rgba(44, 36, 16, 0.12);

  --sidebar-width:  240px;
  --sidebar-collapsed: 68px;
  --topbar-height:  68px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;

  --transition:     all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-base:        #16140F;
  --bg-surface:     #1E1A14;
  --bg-sidebar:     #110F0A;
  --bg-hover:       #2A2418;
  --bg-muted:       #252018;
  --bg-input:       #1E1A14;

  --text-primary:   #EDE5D8;
  --text-secondary: #A89268;
  --text-muted:     #6A5A45;
  --text-inverse:   #1E1A14;
  --text-sidebar:   #8A7860;

  --accent-primary: #D4A060;
  --accent-hover:   #E0B070;
  --accent-soft:    #2C2215;

  --border-color:   #2E2820;
  --border-muted:   #252018;

  --shadow-sm:      0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  display: flex;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-text {
  color: #EDE5D8;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s;
}

.logo-badge {
  background: rgba(200, 137, 58, 0.25);
  color: var(--accent-primary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-toggle {
  color: #6A5A45;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: rgba(255,255,255,0.08); color: #EDE5D8; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #EDE5D8;
}

.nav-item.active {
  background: rgba(200, 137, 58, 0.18);
  color: var(--accent-primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-label {
  font-size: 13.5px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.nav-badge {
  margin-left: auto;
  background: rgba(200, 137, 58, 0.2);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  transition: opacity 0.2s;
}

.nav-badge.new {
  background: rgba(90, 154, 120, 0.2);
  color: var(--accent-green);
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 8px 0;
}

/* Collapsed Sidebar */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-item { justify-content: center; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.admin-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s;
}

.sidebar.collapsed .admin-info { opacity: 0; width: 0; overflow: hidden; }

.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: #EDE5D8;
  white-space: nowrap;
}

.admin-role {
  font-size: 11px;
  color: #6A5A45;
}

/* ══════════════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-collapsed);
}

/* ══════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.topbar-left { display: flex; flex-direction: column; gap: 1px; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--accent-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  border: none;
  background: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 220px;
}

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

.search-bar.inline {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.search-bar.inline input { width: 160px; font-size: 12.5px; }

/* Icon Button */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
}

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

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

/* Theme Toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: var(--transition);
}

.theme-toggle:hover { background: var(--bg-hover); }

.theme-icon { display: none; }
[data-theme="light"] .theme-icon.moon { display: block; }
[data-theme="dark"] .theme-icon.sun { display: block; }

/* ══════════════════════════════════════════════
   CONTENT AREA
══════════════════════════════════════════════ */
.content-area {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Views */
.view { display: none; flex-direction: column; gap: 24px; animation: fadeIn 0.2s ease; }
.view.active { display: flex; }

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

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-link {
  font-size: 12.5px;
  color: var(--accent-primary);
  font-weight: 500;
  transition: var(--transition);
}

.card-link:hover { color: var(--accent-hover); }

/* ══════════════════════════════════════════════
   STATS GRID
══════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stats-grid.mini { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.mini-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.users-icon  { background: rgba(90, 125, 170, 0.12); color: var(--accent-blue); }
.resume-icon { background: rgba(200, 137, 58, 0.12); color: var(--accent-primary); }
.ai-icon     { background: rgba(139, 117, 194, 0.12); color: var(--accent-purple); }
.active-icon { background: rgba(90, 154, 120, 0.12); color: var(--accent-green); }

.stat-info { display: flex; flex-direction: column; gap: 2px; }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-value.small { font-size: 22px; }

.stat-change {
  font-size: 11.5px;
  font-weight: 500;
}

.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-red); }
.stat-change.neutral  { color: var(--text-muted); }

/* ══════════════════════════════════════════════
   CHARTS
══════════════════════════════════════════════ */
.charts-row {
  display: grid;
  gap: 18px;
}

.charts-row:has(.large):has(.small) {
  grid-template-columns: 1.6fr 1fr;
}

.charts-row:has(.medium) {
  grid-template-columns: 1fr 1fr;
}

.chart-card { }

.chart-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.chart-tab {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.chart-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════
   ACTIVITY FEED
══════════════════════════════════════════════ */
.bottom-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

.activity-list { display: flex; flex-direction: column; gap: 12px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.activity-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }

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

.activity-time { font-size: 11.5px; color: var(--text-muted); }

.activity-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tag-create { background: rgba(90, 154, 120, 0.15); color: var(--accent-green); }
.tag-ai     { background: rgba(139, 117, 194, 0.15); color: var(--accent-purple); }
.tag-pro    { background: rgba(200, 137, 58, 0.15); color: var(--accent-primary); }
.tag-export { background: rgba(90, 125, 170, 0.15); color: var(--accent-blue); }

/* Top Users */
.top-users-list { display: flex; flex-direction: column; gap: 10px; }

.top-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  width: 18px;
  text-align: center;
}

.top-user-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.top-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.top-user-meta { font-size: 11.5px; color: var(--text-muted); }
.top-user-stat { font-size: 13px; font-weight: 700; color: var(--accent-primary); }

/* ══════════════════════════════════════════════
   TOOLBAR
══════════════════════════════════════════════ */
.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }

.filter-group { display: flex; gap: 8px; }

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: rgba(192, 80, 80, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(192, 80, 80, 0.2);
}

.btn-danger:hover { background: rgba(192, 80, 80, 0.2); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* Action buttons in table */
.action-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}

.action-edit   { background: rgba(90, 125, 170, 0.1); color: var(--accent-blue); }
.action-delete { background: rgba(192, 80, 80, 0.1); color: var(--accent-red); }
.action-view   { background: rgba(200, 137, 58, 0.1); color: var(--accent-primary); }

.action-edit:hover   { background: rgba(90, 125, 170, 0.2); }
.action-delete:hover { background: rgba(192, 80, 80, 0.2); }
.action-view:hover   { background: rgba(200, 137, 58, 0.2); }

/* ══════════════════════════════════════════════
   DATA TABLE
══════════════════════════════════════════════ */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-header { padding: 18px 22px 0; }

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

.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-muted);
  white-space: nowrap;
}

.data-table th:first-child { padding-left: 22px; }
.data-table th:last-child  { padding-right: 22px; }

.data-table td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.data-table td:first-child { padding-left: 22px; }
.data-table td:last-child  { padding-right: 22px; }

.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text-primary); }
.sort-icon { opacity: 0.5; }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active   { background: rgba(90,154,120,0.12); color: var(--accent-green); }
.status-active::before { background: var(--accent-green); }
.status-inactive { background: rgba(122,106,85,0.12); color: var(--text-secondary); }
.status-inactive::before { background: var(--text-secondary); }
.status-suspended { background: rgba(192,80,80,0.12); color: var(--accent-red); }
.status-suspended::before { background: var(--accent-red); }

/* Plan Badges */
.plan-badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.plan-pro   { background: rgba(200,137,58,0.15); color: var(--accent-primary); }
.plan-free  { background: rgba(122,106,85,0.12); color: var(--text-secondary); }
.plan-admin { background: rgba(139,117,194,0.15); color: var(--accent-purple); }

/* Checkbox */
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
}

.pagination-info { font-size: 12.5px; color: var(--text-muted); }

.pagination-controls { display: flex; align-items: center; gap: 6px; }

.page-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) { background: var(--bg-hover); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-nums { display: flex; gap: 4px; }

.page-num {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: none;
  border: 1px solid transparent;
  transition: var(--transition);
}

.page-num:hover { background: var(--bg-muted); }
.page-num.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

/* ══════════════════════════════════════════════
   REPORTS
══════════════════════════════════════════════ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.report-card { position: relative; display: flex; flex-direction: column; gap: 12px; }
.report-card.unread { border-left: 3px solid var(--accent-primary); }

.report-header { display: flex; align-items: flex-start; justify-content: space-between; }

.report-icon { font-size: 24px; }

.report-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  margin-top: 4px;
}

.report-card h4 { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.report-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.report-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.report-severity {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-severity.high   { background: rgba(192,80,80,0.12); color: var(--accent-red); }
.report-severity.medium { background: rgba(200,137,58,0.12); color: var(--accent-primary); }
.report-severity.low    { background: rgba(90,154,120,0.12); color: var(--accent-green); }

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

/* ══════════════════════════════════════════════
   SETTINGS
══════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-nav {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.settings-tab {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  transition: var(--transition);
}

.settings-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-tab.active { background: var(--accent-soft); color: var(--accent-primary); font-weight: 600; }

.settings-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.settings-panel { display: none; flex-direction: column; gap: 20px; }
.settings-panel.active { display: flex; }
.settings-panel h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }

/* Form Elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

.form-input {
  padding: 9px 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

textarea.form-input { resize: vertical; min-height: 80px; }

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.toggle { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color);
  border-radius: 21px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider { background: var(--accent-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(17px); }

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

/* ══════════════════════════════════════════════
   AI LOG — LIVE BADGE
══════════════════════════════════════════════ */
.live-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

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

/* ══════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 18, 12, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 460px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: var(--transition);
}

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

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color);
}

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-sidebar);
  color: #EDE5D8;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid.mini { grid-template-columns: repeat(2, 1fr); }
  .bottom-row { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .charts-row { grid-template-columns: 1fr !important; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; }
  .view-toolbar { flex-direction: column; align-items: flex-start; }
  .search-bar input { width: 140px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .search-bar { display: none; }
}


/* ══════════════════════════════════════════════
   ADMIN APP ADDITIONS — real data + full responsive
══════════════════════════════════════════════ */

/* Scrollable tables (mobile safety) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .data-table { min-width: 640px; }

/* Sidebar logout */
.logout-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sidebar);
  flex-shrink: 0;
  transition: var(--transition);
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: var(--accent-red); }
.sidebar.collapsed .logout-btn { display: none; }

/* Collapsed sidebar: 68px can't fit the logo and the arrow side by side —
   stack them vertically and center everything */
.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 16px 8px;
}
.sidebar.collapsed .logo { justify-content: center; gap: 0; }
.sidebar.collapsed .admin-profile { justify-content: center; gap: 0; }

/* Take labels/badges out of the layout entirely when collapsed — a zero-width
   badge still keeps its margin-left:auto and pushes the icon off-center */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .admin-info { display: none; }

/* Mobile hamburger (hidden on desktop) */
.menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Backdrop behind the off-canvas sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 18, 12, 0.45);
  z-index: 90;
}

/* Empty/loading table states */
.empty-cell { text-align: center; padding: 32px !important; color: var(--text-muted); }

/* Provider badges */
.type-badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.type-openai { background: rgba(90,125,170,0.12);  color: var(--accent-blue); }
.type-ollama { background: rgba(139,117,194,0.15); color: var(--accent-purple); }
.default-star { color: var(--accent-primary); font-weight: 700; }
.key-set   { color: var(--accent-green); font-weight: 600; }
.key-unset { color: var(--text-muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.cell-clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Form hint + inline error */
.form-hint { font-size: 11.5px; color: var(--text-muted); }
.form-error { font-size: 12.5px; color: var(--accent-red); min-height: 18px; }

/* Chart canvas: keep charts from growing unbounded on tall screens */
.chart-card canvas { max-height: 320px; width: 100% !important; }

/* Country select in analytics */
.card-header .filter-select { padding: 5px 10px; font-size: 12.5px; }

/* ── AI Chat ── */
.chat-card { display: flex; flex-direction: column; padding: 0; }
.chat-card .card-header {
  padding: 18px 22px 14px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
}
.chat-controls { display: flex; gap: 8px; align-items: center; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 320px;
  max-height: calc(100vh - 330px);
}

.chat-empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--text-muted);
  max-width: 380px;
  font-size: 13px;
}
.chat-empty-icon { font-size: 30px; }

.chat-msg { display: flex; gap: 10px; align-items: flex-end; max-width: 82%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .activity-avatar { width: 30px; height: 30px; font-size: 12px; }

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--accent-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai .chat-bubble {
  background: var(--bg-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-muted);
  border-bottom-left-radius: 4px;
}
.chat-meta { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border-color);
}
.chat-input-row textarea { resize: none; min-height: 40px; max-height: 140px; }
.chat-input-row .btn { flex-shrink: 0; }

.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ── Login page ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 380px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-logo { display: flex; align-items: center; gap: 12px; justify-content: center; }
.login-logo .logo-icon { width: 42px; height: 42px; font-size: 20px; border-radius: 11px; }
.login-title { font-size: 19px; font-weight: 700; color: var(--text-primary); }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: -10px; }
.login-card .btn { justify-content: center; padding: 11px; font-size: 14px; }

/* ── Responsive: tablets & phones ── */
@media (max-width: 820px) {
  /* Sidebar becomes off-canvas */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open ~ .sidebar-overlay { display: block; }
  .sidebar-toggle { display: none; }        /* collapse control is desktop-only */
  .main-wrapper { margin-left: 0 !important; }
  .menu-btn { display: flex; }

  /* Collapsed-state rules must not apply while off-canvas */
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .nav-label { display: inline; opacity: 1; pointer-events: auto; width: auto; }
  .sidebar.collapsed .nav-badge { display: inline-block; opacity: 1; pointer-events: auto; width: auto; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; }
  .sidebar.collapsed .admin-info { display: flex; opacity: 1; width: auto; }
  .sidebar.collapsed .logout-btn { display: flex; }
  .sidebar.collapsed .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
    gap: 0;
    padding: 20px 16px;
  }
  .sidebar.collapsed .logo { justify-content: flex-start; gap: 10px; }
  .sidebar.collapsed .admin-profile { justify-content: flex-start; gap: 10px; }

  .topbar-left { min-width: 0; }
  .page-title, .page-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 600px) {
  .stats-grid, .stats-grid.mini { grid-template-columns: 1fr 1fr; }
  .toolbar-left, .toolbar-right { width: 100%; flex-wrap: wrap; }
  .toolbar-right .btn { flex: 1; justify-content: center; }
  .filter-group { width: 100%; }
  .filter-select { flex: 1; }
  .table-pagination { flex-direction: column; gap: 10px; align-items: flex-start; }
  .modal { width: 100%; }
  .chat-msg { max-width: 95%; }
  .chat-messages { max-height: calc(100vh - 290px); }
  .page-subtitle { display: none; }
  .content-area { gap: 16px; }
}

@media (max-width: 420px) {
  .stats-grid, .stats-grid.mini { grid-template-columns: 1fr; }
  .topbar-right { gap: 8px; }
}
