/* ============================================================
   Damerax AI Product Autofiller — style.css
   Color System:
     --charcoal   : #0d1117  (sidebar, header, dark surfaces)
     --lime       : #39ff14  (neon lime — primary CTA & highlights)
     --lime-soft  : #a8ff3e  (softer lime for hover states)
     --lime-dim   : rgba(57,255,20,0.12) (subtle lime tint)
     --white      : #ffffff
     --surface    : #f8fafb  (light page background)
     --surface-2  : #eef2f5  (card borders, table stripes)
     --text-main  : #0d1117
     --text-muted : #5a6475
     --danger     : #ff3b30
     --warning    : #ff9500
   ============================================================ */

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

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

:root {
  --charcoal:    #0d1117;
  --charcoal-2:  #161b22;
  --charcoal-3:  #21262d;
  --lime:        #39ff14;
  --lime-soft:   #a8ff3e;
  --lime-dim:    rgba(57, 255, 20, 0.10);
  --lime-border: rgba(57, 255, 20, 0.30);
  --white:       #ffffff;
  --surface:     #f5f7fa;
  --surface-2:   #eaecf0;
  --text-main:   #0d1117;
  --text-muted:  #5a6475;
  --text-light:  #8a93a2;
  --danger:      #ff3b30;
  --danger-dim:  rgba(255,59,48,0.10);
  --success:     #28d45c;
  --success-dim: rgba(40,212,92,0.12);
  --warning:     #ff9500;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 4px rgba(13,17,23,0.08);
  --shadow:      0 4px 16px rgba(13,17,23,0.12);
  --shadow-lg:   0 8px 32px rgba(13,17,23,0.16);
  --sidebar-w:   260px;
  --header-h:    64px;
  --transition:  0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ─── App Layout ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--charcoal);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  border-right: 1px solid var(--charcoal-3);
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--charcoal-3);
}

.sidebar-logo .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--lime);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(57,255,20,0.4);
}

.sidebar-logo .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo .brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.sidebar-logo .brand-sub {
  font-size: 10px;
  color: var(--lime);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #8b949e;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: var(--lime);
  background: var(--lime-dim);
  border-left-color: var(--lime);
}

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

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--charcoal-3);
}

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

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--charcoal);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; color: var(--white); }
.user-role  { font-size: 11px; color: var(--text-muted); }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  display: flex;
}
.logout-btn:hover { color: var(--danger); }

/* ─── Main Content Area ──────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Top Header Bar ─────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

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

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

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

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

/* Hamburger (mobile) */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-main);
}

/* ─── Page Body ──────────────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 28px;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--lime);
  color: var(--charcoal);
  box-shadow: 0 0 0 0 rgba(57,255,20,0);
}
.btn-primary:hover {
  background: var(--lime-soft);
  box-shadow: 0 0 20px rgba(57,255,20,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-dark {
  background: var(--charcoal);
  color: var(--white);
}
.btn-dark:hover {
  background: var(--charcoal-2);
  box-shadow: 0 0 16px rgba(57,255,20,0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1.5px solid var(--surface-2);
}
.btn-outline:hover {
  border-color: var(--lime);
  color: var(--charcoal);
  background: var(--lime-dim);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #d4302a; box-shadow: 0 0 14px rgba(255,59,48,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 7px 12px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-main); }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 13px 26px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-2);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body { padding: 24px; }

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

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--lime);
  opacity: 0;
  transition: opacity var(--transition);
}

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

.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-main); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-light); }

.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--lime-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lime);
}

/* ─── Table ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--surface-2);
  white-space: nowrap;
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid var(--surface-2);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }

tbody td {
  padding: 12px 16px;
  color: var(--text-main);
  vertical-align: middle;
}

/* Product thumbnail in table */
.tbl-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  flex-shrink: 0;
}

.tbl-thumb-placeholder {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 18px;
}

.product-name-cell { font-weight: 600; color: var(--text-main); }
.product-sku-cell  { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); }

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active  { background: var(--success-dim); color: #1a9040; }
.badge-draft   { background: rgba(90,100,117,0.12); color: var(--text-muted); }
.badge-cat {
  background: var(--lime-dim);
  color: #1a8000;
  border: 1px solid var(--lime-border);
}

/* ─── Form Elements ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-full { grid-column: 1 / -1; }

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

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

label .required {
  color: var(--danger);
  margin-left: 2px;
}

label .hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-main);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

.form-control:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(57,255,20,0.14);
}

.form-control.ai-filled {
  border-color: var(--lime);
  background: linear-gradient(to right, rgba(57,255,20,0.04), var(--white));
}

.form-control[readonly] {
  background: var(--surface);
  color: var(--text-muted);
  cursor: default;
}

textarea.form-control { min-height: 90px; }

select.form-control { cursor: pointer; }

.char-counter {
  font-size: 11px;
  color: var(--text-light);
  text-align: right;
}

.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--danger); font-weight: 600; }

/* Price field special treatment */
.price-field-wrap {
  position: relative;
}
.price-currency {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}
.price-field-wrap .form-control { padding-left: 26px; }

.ai-never-fills {
  font-size: 11px;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Dropzone ───────────────────────────────────────────── */
.dropzone-wrapper {
  border: 2px dashed var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: all 0.2s ease;
  position: relative;
}

.dropzone-wrapper:hover,
.dropzone-wrapper.dragover {
  border-color: var(--lime);
  background: var(--lime-dim);
  box-shadow: 0 0 0 4px rgba(57,255,20,0.10);
}

.dropzone-wrapper.has-image {
  border-style: solid;
  border-color: var(--lime);
  padding: 0;
  overflow: hidden;
  cursor: default;
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  background: var(--lime-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--lime);
  border: 2px solid var(--lime-border);
}

.dropzone-icon svg { width: 26px; height: 26px; }

.dropzone-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.dropzone-hint span {
  color: var(--lime);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.dropzone-formats {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-light);
}

#file-input-hidden { display: none !important; }

/* Preview image inside dropzone */
.dropzone-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.dropzone-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--charcoal);
  color: var(--white);
  font-size: 12px;
  gap: 10px;
}

.dropzone-preview-bar .filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ─── AI Analysis Button ─────────────────────────────────── */
.analyze-btn-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--lime-dim);
  border: 1px solid var(--lime-border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #1a8000;
  letter-spacing: 0.04em;
}

.ai-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 6px var(--lime);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── Spinner Overlay ────────────────────────────────────── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.spinner-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.spinner-ring {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(57,255,20,0.2);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 20px rgba(57,255,20,0.3);
}

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

.spinner-text {
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.spinner-sub {
  color: var(--lime);
  font-size: 12px;
  margin-top: -14px;
}

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  background: var(--charcoal);
  color: var(--white);
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--lime);
  animation: slideInToast 0.3s ease;
  overflow: hidden;
  position: relative;
}

.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-msg { color: #8b949e; font-size: 12px; line-height: 1.4; }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: var(--lime);
  animation: toastProgress 4s linear forwards;
}
.toast-error .toast-progress   { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0; }
}

/* ─── Image Gallery (edit page) ──────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--surface-2);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  aspect-ratio: 1;
}

.gallery-item:hover { border-color: var(--lime); }

.gallery-item.primary {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(57,255,20,0.20);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,17,23,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }

.gallery-item .primary-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--lime);
  color: var(--charcoal);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Neon Glow Accents ──────────────────────────────────── */
.neon-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  opacity: 0.5;
  border: none;
}

.highlight-box {
  background: var(--lime-dim);
  border: 1px solid var(--lime-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ─── Login Page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -100px;
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(57,255,20,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -200px;
  left: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(57,255,20,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--charcoal-2);
  border: 1px solid var(--charcoal-3);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

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

.login-icon {
  width: 64px;
  height: 64px;
  background: var(--lime);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  font-weight: 900;
  color: var(--charcoal);
  box-shadow: 0 0 30px rgba(57,255,20,0.35);
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

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

.login-subtitle .company {
  color: var(--lime);
  font-weight: 600;
}

.login-card label { color: #8b949e; }

.login-card .form-control {
  background: var(--charcoal-3);
  border-color: rgba(255,255,255,0.1);
  color: var(--white);
}

.login-card .form-control:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(57,255,20,0.18);
  background: rgba(57,255,20,0.05);
}

.login-card .form-control::placeholder { color: #4a5568; }

.login-error {
  background: var(--danger-dim);
  border: 1px solid rgba(255,59,48,0.3);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: #ff6b6b;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto 24px;
}

/* ─── Pagination / Search bar ────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--lime); }

/* ─── Confirm Modal ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,0.75);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.94);
  transition: transform 0.2s ease;
}

.modal-backdrop.show .modal-box { transform: scale(1); }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Section Divider ────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
}

.section-divider-line {
  flex: 1;
  height: 1px;
  background: var(--surface-2);
}

.section-divider-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── AI Fields Highlight Pulse ──────────────────────────── */
@keyframes aiPulse {
  0%  { box-shadow: 0 0 0 0 rgba(57,255,20,0.4); }
  70% { box-shadow: 0 0 0 8px rgba(57,255,20,0); }
  100%{ box-shadow: 0 0 0 0 rgba(57,255,20,0); }
}

.ai-filled { animation: aiPulse 0.7s ease; }

/* ─── Footer ─────────────────────────────────────────────── */
.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--surface-2);
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-brand { font-weight: 600; color: var(--text-muted); }
.footer-brand span { color: var(--lime); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .card-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal-box { padding: 20px; }
  .login-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  #toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: 100%; }
}

/* ─── Utility ────────────────────────────────────────────── */
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 12px; }
.font-mono   { font-family: 'JetBrains Mono', monospace; }
.fw-bold     { font-weight: 700; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.w-100       { width: 100%; }
.text-right  { text-align: right; }
.hidden      { display: none !important; }
