/* ============================================================
   GROUPE MEDCIS ART - ERP Global Stylesheet
   ============================================================ */

:root {
  --primary:       #C0392B;
  --primary-dark:  #96281b;
  --primary-light: #e74c3c;
  --accent:        #1a1a2e;
  --sidebar-w:     260px;
  --sidebar-bg:    #0f0f1a;
  --sidebar-text:  #ccc;
  --sidebar-active:#C0392B;
  --topbar-h:      64px;
  --radius:        10px;
  --shadow:        0 2px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.15);
  --transition:    .22s cubic-bezier(.4,0,.2,1);
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Dark mode */
[data-bs-theme="dark"] {
  --bs-body-bg: #111827;
  --bs-body-color: #e5e7eb;
  --bs-card-bg: #1f2937;
  --bs-border-color: #374151;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); margin: 0; overflow-x: hidden; }

/* ===== AUTH PAGE ===== */
.auth-body { height: 100vh; overflow: hidden; background: #fff; }

.auth-split { display: flex; height: 100vh; }

/* ── Left: brand panel ──────────────────── */
.auth-brand {
  flex: 0 0 58%;
  background: #0f0f1a;
  position: relative; overflow: hidden;
  display: flex; align-items: stretch;
}
.auth-brand::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 80% 15%, rgba(192,57,43,.2) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 85%, rgba(192,57,43,.12) 0%, transparent 50%);
}
.auth-brand-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  width: 100%; padding: 2.5rem 3rem;
}
.auth-brand-grid {
  position: absolute; inset: 0; z-index: 1;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 44px 44px;
}
.auth-blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); pointer-events: none; z-index: 1;
  animation: blob-drift 12s ease-in-out infinite alternate;
}
.auth-blob-1 { width: 420px; height: 420px; background: rgba(192,57,43,.13); top: -100px; right: -80px; }
.auth-blob-2 { width: 280px; height: 280px; background: rgba(192,57,43,.09); bottom: -60px; left: 5%; animation-delay: -5s; }
.auth-blob-3 { width: 200px; height: 200px; background: rgba(255,255,255,.025); top: 42%; right: 6%; animation-delay: -9s; }
@keyframes blob-drift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(22px,-22px) scale(1.15); }
}

.auth-brand-header { display: flex; align-items: center; gap: .9rem; }
.auth-brand-logo {
  height: 50px; width: 50px; object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(192,57,43,.55));
  flex-shrink: 0;
}
.auth-brand-logo-fallback {
  height: 50px; width: 50px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #C0392B, #1a1a2e);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
}
.auth-brand-name { font-size: 1.05rem; font-weight: 900; color: #fff; letter-spacing: .02em; line-height: 1.2; }
.auth-brand-tagline { font-size: .68rem; color: rgba(255,255,255,.38); letter-spacing: .12em; text-transform: uppercase; margin-top: .2rem; }

.auth-brand-center { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 2rem 0; }
.auth-headline { font-size: 2.5rem; font-weight: 900; color: #fff; line-height: 1.15; margin-bottom: 1.1rem; }
.auth-headline span { color: #C0392B; }
.auth-lead { font-size: .9rem; color: rgba(255,255,255,.48); line-height: 1.78; max-width: 400px; margin-bottom: 1.75rem; }
.auth-features { display: flex; flex-wrap: wrap; gap: .45rem; }
.auth-feat {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .8rem;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  border-radius: 100px; font-size: .7rem; color: rgba(255,255,255,.58); font-weight: 600;
}
.auth-feat i { color: #C0392B; font-size: .62rem; }

.auth-entities {
  border-top: 1px solid rgba(255,255,255,.07);
  padding-top: 1.5rem;
  display: grid; grid-template-columns: repeat(3,1fr); gap: .7rem;
}
.auth-entity {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: .8rem .5rem;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  transition: .2s;
}
.auth-entity:hover { background: rgba(192,57,43,.1); border-color: rgba(192,57,43,.3); }
.auth-entity img { height: 32px; object-fit: contain; }
.auth-entity-ico {
  height: 32px; width: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #C0392B, #333);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: #fff;
}
.auth-entity span { font-size: .58rem; color: rgba(255,255,255,.42); text-align: center; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 1.3; }
.auth-brand-ver { font-size: .63rem; color: rgba(255,255,255,.18); text-align: right; margin-top: 1rem; letter-spacing: .06em; }

/* ── Right: form panel ──────────────────── */
.auth-form-panel {
  flex: 0 0 42%;
  background: #fff;
  display: flex; flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid #f0f0f0;
}
.auth-form-topbar { padding: 1.75rem 2.5rem 0; display: flex; justify-content: flex-end; }
.auth-form-toplogo { height: 36px; object-fit: contain; opacity: .5; }
.auth-form-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 1rem 2.75rem 2rem; max-width: 420px; width: 100%; margin: 0 auto;
}
.auth-form-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .32rem .85rem;
  background: rgba(192,57,43,.07); border: 1px solid rgba(192,57,43,.18);
  border-radius: 100px; font-size: .7rem; color: #C0392B; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; margin-bottom: 1.1rem;
  width: fit-content;
}
.auth-form-title { font-size: 1.85rem; font-weight: 900; color: #111827; margin-bottom: .4rem; }
.auth-form-sub { font-size: .85rem; color: #6b7280; margin-bottom: 1.75rem; }

.auth-form .form-label { font-size: .8rem; font-weight: 700; color: #374151; margin-bottom: .38rem; }
.auth-form .form-control {
  border: 1.5px solid #e5e7eb; border-radius: 10px;
  padding: .72rem 1rem; font-size: .9rem; color: #111827;
  background: #fff; transition: .2s;
}
.auth-form .form-control:focus {
  border-color: #C0392B; box-shadow: 0 0 0 .18rem rgba(192,57,43,.13);
  color: #111827; background: #fff;
}
.auth-form .form-control::placeholder { color: #9ca3af; }
.auth-form .input-group-text {
  background: #f9fafb; border: 1.5px solid #e5e7eb; border-right: none;
  color: #9ca3af; border-radius: 10px 0 0 10px; font-size: .88rem;
  transition: .2s;
}
.auth-form .input-group .form-control { border-left: none; border-radius: 0 10px 10px 0; }
.auth-form .input-group:focus-within .input-group-text { border-color: #C0392B; color: #C0392B; }
.auth-form .pwd-toggle {
  background: #f9fafb; border: 1.5px solid #e5e7eb; border-left: none;
  border-radius: 0 10px 10px 0; color: #9ca3af; padding: 0 .9rem;
  cursor: pointer; transition: .2s; font-size: .85rem;
}
.auth-form .pwd-toggle:hover { color: #C0392B; background: #fff; }
.auth-form .input-group:focus-within .pwd-toggle { border-color: #C0392B; }

.btn-auth {
  background: linear-gradient(135deg, #C0392B 0%, #96281b 100%);
  border: none; color: #fff;
  font-weight: 700; letter-spacing: .04em;
  padding: .85rem 2rem; border-radius: 10px;
  width: 100%; font-size: .95rem;
  transition: .22s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 4px 16px rgba(192,57,43,.3);
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-auth:hover {
  background: linear-gradient(135deg, #e74c3c 0%, #C0392B 100%);
  transform: translateY(-1px); box-shadow: 0 8px 24px rgba(192,57,43,.42);
  color: #fff;
}
.btn-auth:active { transform: translateY(0); }

.auth-separator { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; }
.auth-separator::before, .auth-separator::after { content: ''; flex: 1; height: 1px; background: #f3f4f6; }
.auth-separator span { font-size: .7rem; color: #9ca3af; font-weight: 600; white-space: nowrap; }

.auth-demo {
  background: #f9fafb; border: 1px solid #f0f0f0; border-radius: 10px;
  padding: .8rem 1rem;
}
.auth-demo-title { font-size: .68rem; color: #9ca3af; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .45rem; }
.auth-demo-row { font-size: .75rem; color: #6b7280; margin-bottom: .2rem; }
.auth-demo-row:last-child { margin-bottom: 0; }
.auth-demo-row code { background: #f1f3f5; color: #C0392B; padding: .08rem .3rem; border-radius: 4px; font-size: .72rem; }

.auth-form-footer {
  padding: 1.1rem 2.5rem;
  font-size: .72rem; color: #9ca3af;
  text-align: center; border-top: 1px solid #f3f4f6;
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .auth-brand { flex: 0 0 50%; }
  .auth-form-panel { flex: 0 0 50%; }
  .auth-headline { font-size: 1.85rem; }
  .auth-brand-inner { padding: 2rem; }
  .auth-form-body { padding: 1rem 2rem 2rem; }
}
@media (max-width: 640px) {
  .auth-body { height: auto; overflow: auto; }
  .auth-split { flex-direction: column; height: auto; }
  .auth-brand { flex: none; min-height: 180px; }
  .auth-brand-inner { padding: 1.5rem 1.5rem 1.25rem; }
  .auth-brand-center, .auth-entities { display: none; }
  .auth-brand-header { justify-content: center; }
  .auth-form-panel { flex: none; border-left: none; }
  .auth-form-body { padding: 1.25rem 1.5rem 2rem; }
  .auth-form-topbar { display: none; }
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: var(--topbar-h);
}

.brand-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; flex-shrink: 0;
}

.brand-name { font-weight: 800; font-size: .85rem; color: #fff; line-height: 1; letter-spacing: .03em; }
.brand-sub  { font-size: .65rem; color: rgba(255,255,255,.4); margin-top: .15rem; }

.btn-sidebar-toggle {
  margin-left: auto; background: none; border: none; color: rgba(255,255,255,.5);
  padding: .3rem; cursor: pointer; border-radius: 6px;
}

.sidebar-user {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
}

.sidebar-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.sidebar-user-name { font-size: .8rem; font-weight: 700; color: #fff; line-height: 1.2; }
.badge-sm { font-size: .6rem; padding: .15rem .4rem; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: .75rem 0;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section-title {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: .75rem 1rem .3rem;
}

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  margin: 1px .5rem;
  transition: var(--transition);
  font-size: .85rem; font-weight: 500;
  cursor: pointer;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(192,57,43,.35); }
.nav-item.active .nav-icon { color: #fff; }

.nav-icon { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; color: rgba(255,255,255,.5); transition: var(--transition); }
.nav-item:hover .nav-icon { color: #fff; }

.nav-arrow { margin-left: auto; font-size: .7rem; color: rgba(255,255,255,.3); transition: var(--transition); }
.nav-item-parent[aria-expanded="true"] .nav-arrow,
.nav-item-group.open .nav-arrow { transform: rotate(180deg); }

.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px;
  background: var(--primary); color: #fff;
  border-radius: 10px; font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 .35rem;
}

.nav-sub { padding: .25rem 0 .25rem 1rem; }
.nav-sub-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem 1rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px .5rem;
  font-size: .8rem;
  transition: var(--transition);
}
.nav-sub-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-sub-item.active { color: var(--primary-light); font-weight: 700; }
.nav-sub-item i { width: 16px; text-align: center; font-size: .8rem; color: rgba(255,255,255,.35); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: .5rem 0;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin var(--transition);
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.08);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

[data-bs-theme="dark"] .topbar {
  background: rgba(17,24,39,.95);
  border-bottom-color: rgba(255,255,255,.08);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }

.btn-menu-toggle {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #666; font-size: 1.1rem;
  transition: var(--transition);
}
.btn-menu-toggle:hover { background: rgba(0,0,0,.07); color: #333; }
[data-bs-theme="dark"] .btn-menu-toggle:hover { background: rgba(255,255,255,.07); color: #fff; }

.breadcrumb { font-size: .8rem; margin: 0; }
.breadcrumb-item a { color: #888; text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--primary); font-weight: 600; }

.topbar-search {
  position: relative; flex: 1; max-width: 320px;
}
.topbar-search > i {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: #999; font-size: .85rem; pointer-events: none;
}
.topbar-search input {
  width: 100%; padding: .45rem .9rem .45rem 2.3rem;
  border: 1px solid rgba(0,0,0,.12); border-radius: 20px;
  background: rgba(0,0,0,.04); font-size: .85rem; outline: none;
  transition: var(--transition);
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 .2rem rgba(192,57,43,.15); }
[data-bs-theme="dark"] .topbar-search input { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); color: #fff; }

.search-results {
  position: absolute; top: calc(100% + .5rem); left: 0; right: 0;
  background: #fff; border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  display: none; z-index: 9999; overflow: hidden; max-height: 300px; overflow-y: auto;
}
[data-bs-theme="dark"] .search-results { background: #1f2937; border-color: rgba(255,255,255,.1); }
.search-results.show { display: block; }
.search-result-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; cursor: pointer; transition: var(--transition); }
.search-result-item:hover { background: rgba(192,57,43,.08); }
.search-result-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.search-result-name { font-size: .85rem; font-weight: 600; }
.search-result-sub  { font-size: .75rem; color: #999; }

.topbar-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(0,0,0,.04); border: 1px solid rgba(0,0,0,.08);
  color: #555; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: .95rem; transition: var(--transition); position: relative;
}
.topbar-btn:hover { background: rgba(192,57,43,.1); border-color: rgba(192,57,43,.3); color: var(--primary); }

.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--primary); color: #fff;
  font-size: .65rem; font-weight: 700; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

.notif-dropdown {
  width: 340px; border: 1px solid rgba(0,0,0,.1);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 0; overflow: hidden;
}
[data-bs-theme="dark"] .notif-dropdown { border-color: rgba(255,255,255,.1); }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem;
  font-weight: 700; font-size: .9rem;
  border-bottom: 1px solid rgba(0,0,0,.07);
  background: rgba(0,0,0,.02);
}
[data-bs-theme="dark"] .notif-header { border-color: rgba(255,255,255,.07); background: rgba(255,255,255,.03); }

.notif-item {
  display: flex; gap: .75rem; padding: .85rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,.05);
  cursor: pointer; transition: var(--transition); text-decoration: none; color: inherit;
}
.notif-item:hover { background: rgba(192,57,43,.05); }
.notif-item.unread { background: rgba(192,57,43,.04); }

.notif-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; flex-shrink: 0;
}

.notif-text { flex: 1; min-width: 0; }
.notif-title { font-size: .82rem; font-weight: 600; line-height: 1.3; }
.notif-time  { font-size: .72rem; color: #999; margin-top: .2rem; }

.topbar-user {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px; padding: .35rem .75rem .35rem .35rem;
  cursor: pointer; transition: var(--transition);
  font-size: .85rem; font-weight: 600; color: #333;
}
.topbar-user:hover { background: rgba(192,57,43,.08); border-color: rgba(192,57,43,.3); }
[data-bs-theme="dark"] .topbar-user { color: #e5e7eb; border-color: rgba(255,255,255,.12); }
.user-avatar { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }

/* ===== PAGE CONTENT ===== */
.page-content {
  flex: 1; padding: 1.75rem;
  max-width: 1600px;
}

.page-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; color: #999;
}
[data-bs-theme="dark"] .page-footer { border-top-color: rgba(255,255,255,.07); }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-header-left {}
.page-title { font-size: 1.5rem; font-weight: 800; margin: 0; color: #1a1a2e; }
[data-bs-theme="dark"] .page-title { color: #fff; }
.page-subtitle { color: #888; font-size: .85rem; margin-top: .2rem; }
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.06);
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
[data-bs-theme="dark"] .stat-card { background: #1f2937; border-color: rgba(255,255,255,.07); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: #27ae60; }
.stat-card.warning::before { background: #f39c12; }
.stat-card.info::before    { background: #2980b9; }
.stat-card.dark::before    { background: #1a1a2e; }

.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.stat-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff;
}
.stat-card-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-card-icon.success { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-card-icon.warning { background: linear-gradient(135deg, #f39c12, #f1c40f); }
.stat-card-icon.info    { background: linear-gradient(135deg, #2980b9, #3498db); }
.stat-card-icon.dark    { background: linear-gradient(135deg, #1a1a2e, #2d2d44); }

.stat-card-trend { font-size: .75rem; font-weight: 700; display: flex; align-items: center; gap: .2rem; }
.trend-up   { color: #27ae60; }
.trend-down { color: #C0392B; }

.stat-card-value { font-size: 1.85rem; font-weight: 900; line-height: 1; margin-bottom: .3rem; }
.stat-card-label { font-size: .82rem; color: #888; font-weight: 500; }

/* ===== CARDS ===== */
.card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
[data-bs-theme="dark"] .card { border-color: rgba(255,255,255,.07); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid rgba(0,0,0,.07);
  font-weight: 700; font-size: .9rem;
}
[data-bs-theme="dark"] .card-header { border-color: rgba(255,255,255,.07); }

.card-header-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; margin-right: .75rem;
}

/* ===== TABLES ===== */
.table { font-size: .85rem; }
.table th { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #888; padding: .75rem 1rem; border-top: none; }
.table td { padding: .75rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(192,57,43,.04); }

/* DataTables custom */
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; font-size: .85rem; padding: .35rem .75rem; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; font-size: .85rem; }

/* ===== BADGES ===== */
.badge { font-size: .72rem; font-weight: 700; letter-spacing: .03em; padding: .28em .55em; border-radius: 6px; }

/* ===== FORMS ===== */
.form-control, .form-select {
  border-radius: 8px; font-size: .88rem;
  border-color: rgba(0,0,0,.15);
  padding: .55rem .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(192,57,43,.15);
}
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .4rem; color: #555; }
[data-bs-theme="dark"] .form-label { color: #aaa; }

.form-section {
  background: rgba(0,0,0,.02); border: 1px solid rgba(0,0,0,.07);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
}
.form-section-title {
  font-size: .8rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--primary); margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.form-section-title::after {
  content: ''; flex: 1; height: 1px; background: rgba(192,57,43,.2);
}

/* ===== BUTTONS ===== */
.btn { border-radius: 8px; font-weight: 600; font-size: .85rem; transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ===== AVATAR ===== */
.avatar-initials { user-select: none; }

/* ===== EMPLOYEE CARD ===== */
.employee-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,.08); overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
[data-bs-theme="dark"] .employee-card { background: #1f2937; border-color: rgba(255,255,255,.07); }
.employee-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.employee-card-header { background: linear-gradient(135deg, var(--primary), #1a1a2e); padding: 1.5rem; text-align: center; }
.employee-card-body { padding: 1.25rem; }
.employee-avatar { width: 80px; height: 80px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); object-fit: cover; margin-bottom: .5rem; }
.employee-name { font-weight: 800; font-size: 1rem; color: #fff; margin: 0; }
.employee-role { font-size: .78rem; color: rgba(255,255,255,.7); }

/* ===== BADGE CARD (physical badge) ===== */
.badge-card-preview {
  width: 340px; height: 210px; border-radius: 16px;
  background: linear-gradient(135deg, #1a1a2e 0%, var(--primary) 100%);
  position: relative; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.3);
  color: #fff; display: flex; flex-direction: column;
}

.badge-card-preview.immo {
  background: linear-gradient(135deg, #1B2A5E 0%, #C0392B 100%);
}

.badge-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

.badge-company-name { font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.badge-logo { width: 28px; height: 28px; border-radius: 6px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: .7rem; }

.badge-card-body { display: flex; gap: .85rem; padding: .85rem 1.1rem; flex: 1; align-items: center; }
.badge-photo { width: 56px; height: 56px; border-radius: 10px; border: 2px solid rgba(255,255,255,.4); object-fit: cover; flex-shrink: 0; }
.badge-photo-placeholder { width: 56px; height: 56px; border-radius: 10px; border: 2px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.badge-info { flex: 1; min-width: 0; }
.badge-emp-name { font-size: .9rem; font-weight: 800; line-height: 1.2; }
.badge-emp-post { font-size: .72rem; color: rgba(255,255,255,.7); margin-top: .2rem; }
.badge-emp-id   { font-size: .65rem; color: rgba(255,255,255,.5); margin-top: .5rem; font-family: monospace; }

.badge-qr { width: 52px; height: 52px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge-qr img { width: 46px; height: 46px; }

.badge-card-footer { padding: .5rem 1.1rem; border-top: 1px solid rgba(255,255,255,.15); display: flex; justify-content: space-between; align-items: center; }
.badge-validity { font-size: .62rem; color: rgba(255,255,255,.6); }
.badge-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }

/* ===== PROPERTY CARD ===== */
.property-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(0,0,0,.08); transition: transform var(--transition), box-shadow var(--transition); }
[data-bs-theme="dark"] .property-card { background: #1f2937; border-color: rgba(255,255,255,.07); }
.property-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.property-img { height: 180px; object-fit: cover; width: 100%; }
.property-img-placeholder { height: 180px; background: linear-gradient(135deg, #1B2A5E, #C0392B); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: rgba(255,255,255,.5); }
.property-price { font-size: 1.1rem; font-weight: 900; color: var(--primary); }
.property-meta { font-size: .78rem; color: #888; }

/* ===== BRICK CARDS ===== */
.brick-stock-card { background: #fff; border-radius: var(--radius); padding: 1.25rem; border: 1px solid rgba(0,0,0,.08); box-shadow: var(--shadow); }
[data-bs-theme="dark"] .brick-stock-card { background: #1f2937; border-color: rgba(255,255,255,.07); }
.brick-stock-value { font-size: 2rem; font-weight: 900; }
.brick-stock-label { font-size: .8rem; color: #888; }
.stock-alert { background: rgba(192,57,43,.08); border: 1px solid rgba(192,57,43,.2); }

/* ===== PROGRESS ===== */
.progress { height: 8px; border-radius: 4px; background: rgba(0,0,0,.07); }
[data-bs-theme="dark"] .progress { background: rgba(255,255,255,.1); }
.progress-bar { border-radius: 4px; }

/* ===== CHARTS ===== */
.chart-container { position: relative; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before { content: ''; position: absolute; left: .6rem; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.1); }
[data-bs-theme="dark"] .timeline::before { background: rgba(255,255,255,.1); }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot { position: absolute; left: -1.6rem; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); top: .3rem; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(192,57,43,.2); }
[data-bs-theme="dark"] .timeline-dot { border-color: #1f2937; }
.timeline-title { font-size: .85rem; font-weight: 700; }
.timeline-sub   { font-size: .78rem; color: #888; }

/* ===== QR SCANNER ===== */
.scanner-wrapper { position: relative; }
#qr-video { width: 100%; max-width: 500px; border-radius: var(--radius); }
.scanner-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scanner-frame {
  width: 200px; height: 200px; border: 3px solid var(--primary);
  border-radius: 12px; position: relative;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
}
.scanner-frame::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--primary);
  animation: scan-line 2s linear infinite;
}
@keyframes scan-line {
  0%   { top: 0; }
  100% { top: calc(100% - 3px); }
}

/* ===== AVATAR INITIALS ===== */
.avatar-initials { flex-shrink: 0; }

/* ===== SIDEBAR COLLAPSED ===== */
.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.sidebar-collapsed .main-wrapper { margin-left: 0; }

/* ===== OVERLAY ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 1rem; }
  .stat-card-value { font-size: 1.4rem; }
}

@media (max-width: 576px) {
  .topbar { padding: 0 .75rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .badge-card-preview { width: 100%; max-width: 340px; }
}

/* ===== UTILITIES ===== */
.text-primary { color: var(--primary) !important; }
.bg-primary   { background: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

.hover-lift { transition: transform var(--transition), box-shadow var(--transition); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.rounded-xl { border-radius: 16px; }
.rounded-2xl { border-radius: 20px; }

/* Company theme patches */
.company-gma { --primary: #C0392B; }
.company-bsi { --primary: #1B2A5E; }
.company-bmc { --primary: #C0392B; }

/* Loading spinner */
.spinner-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  display: none;
}
[data-bs-theme="dark"] .spinner-overlay { background: rgba(0,0,0,.7); }
.spinner-overlay.show { display: flex; }

/* Print */
@media print {
  .sidebar, .topbar, .page-footer, .btn, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
