/* ── Variables ─────────────────────────────────────── */
:root {
  color-scheme: light;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #4f46e5;
  --radius: 10px;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; background: #f8fafc; color: #1e293b; }

/* ── Layout ─────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-width);
  height: 100vh; background: var(--sidebar-bg); display: flex;
  flex-direction: column; z-index: 1000; transition: transform .3s ease;
  overflow-y: auto;
}
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-height); background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
.content-wrapper { flex: 1; padding: 24px; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 12px; color: #fff; font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08); min-height: var(--topbar-height);
}
.sidebar-nav { flex: 1; padding: 12px 12px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  color: var(--sidebar-text); text-decoration: none; border-radius: 8px;
  font-size: .9rem; transition: all .15s ease; margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-section {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; color: #6366f1;
  padding: 16px 14px 4px; text-transform: uppercase;
}
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar-sm { width: 32px; height: 32px; font-size: .85rem; flex-shrink: 0; }
.tiny { font-size: .7rem; }

/* ── Mobile sidebar ─────────────────────────────────── */
.sidebar-toggle {
  position: fixed; top: 12px; left: 12px; z-index: 1100;
  background: var(--sidebar-bg); color: #fff; border: none;
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ── Stat cards ─────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius); padding: 20px; color: #fff; height: 100%;
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.stat-card--primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-card--success { background: linear-gradient(135deg, #059669, #10b981); }
.stat-card--warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-card--info    { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.stat-card--danger  { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-icon { font-size: 2rem; opacity: .7; }
.stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; opacity: .85; }

/* ── Cards ──────────────────────────────────────────── */
.card { border: 1px solid #e2e8f0; border-radius: var(--radius); }
.card-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 12px 16px; font-size: .9rem; }

/* ── Tables ─────────────────────────────────────────── */
.table { font-size: .875rem; }
.table th { font-weight: 600; color: #64748b; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* ── Task cards ─────────────────────────────────────── */
.task-card { transition: box-shadow .15s; }
.task-card:hover { box-shadow: 0 4px 16px rgba(79,70,229,.12) !important; }

/* ── Color dots / swatches ──────────────────────────── */
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.color-swatch { width: 20px; height: 20px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.color-preview { width: 44px; height: 44px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); margin: 0 auto 4px; }

/* ── Client logo ────────────────────────────────────── */
.client-logo-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; border: 1px solid #e2e8f0; background: #f8fafc; }
.client-logo-placeholder { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.client-logo-main { max-width: 120px; max-height: 80px; object-fit: contain; }
.client-logo-placeholder-lg { width: 90px; height: 90px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 2rem; }

/* ── Reference image thumbnail ──────────────────────── */
.ref-image-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }

/* ── Alerts floating ────────────────────────────────── */
.alert-floating { position: fixed; top: 16px; right: 16px; z-index: 9999; min-width: 280px; max-width: 400px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }

/* ── Login page ─────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-container { width: 100%; max-width: 420px; }
.login-card { border: none; border-radius: 16px; background-color: #ffffff !important; color: #1e293b; }

/* ── Client portal ──────────────────────────────────── */
.client-portal { min-height: 100vh; }

/* ── Buttons extra small ────────────────────────────── */
.btn-xs { padding: 2px 6px; font-size: .75rem; line-height: 1.4; border-radius: 4px; }

/* ── Badge subtle colors (BS5.3 fallback) ───────────── */
.bg-primary-subtle { background-color: #ede9fe !important; }
.bg-success-subtle { background-color: #dcfce7 !important; }
.bg-danger-subtle  { background-color: #fee2e2 !important; }
.bg-warning-subtle { background-color: #fef3c7 !important; }
.bg-info-subtle    { background-color: #dbeafe !important; }
.bg-secondary-subtle { background-color: #f1f5f9 !important; }
.text-primary  { color: var(--primary) !important; }
.text-success  { color: #16a34a !important; }
.text-danger   { color: #dc2626 !important; }
.text-warning  { color: #d97706 !important; }
.text-info     { color: #0284c7 !important; }
.text-secondary { color: #64748b !important; }

/* ── Responsive tweaks ──────────────────────────────── */
@media (max-width: 576px) {
  .content-wrapper { padding: 16px; }
  .stat-value { font-size: 1.8rem; }
  .alert-floating { left: 16px; right: 16px; max-width: none; }
}
