:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --topbar-height: 56px;
  --body-bg: #f8fafc;
  --card-border: #e2e8f0;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

body {
  background: var(--body-bg);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#wrapper {
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.25rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 0.5rem;
}

.sidebar .nav-link {
  color: var(--sidebar-text);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.sidebar .nav-link.active {
  color: #fff;
  background: var(--sidebar-active);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ── Main content ─────────────────────────────────────────────────────────── */

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--body-bg);
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 90;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  border-radius: 12px 12px 0 0 !important;
  padding: 0.85rem 1.25rem;
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */

.stat-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}

.bg-primary-soft   { background: #eff6ff; }
.bg-secondary-soft { background: #f1f5f9; }
.bg-warning-soft   { background: #fffbeb; }
.bg-danger-soft    { background: #fef2f2; }
.bg-success-soft   { background: #f0fdf4; }

/* ── Notification items ───────────────────────────────────────────────────── */

.notification-item {
  display: flex;
  align-items: flex-start;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.875rem;
}
.notification-item.critical { background: #fef2f2; }
.notification-item.warning  { background: #fffbeb; }
.notification-item:last-child { border-bottom: none; }

/* ── Stock alert rows ─────────────────────────────────────────────────────── */

.stock-alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
  transition: background 0.1s;
}
.stock-alert-row:hover { background: #f8fafc; }
.stock-alert-row.critical { border-left: 3px solid #ef4444; }
.stock-alert-row.warning  { border-left: 3px solid #f59e0b; }
.stock-alert-row:last-child { border-bottom: none; }

/* ── Movement rows ────────────────────────────────────────────────────────── */

.movement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.875rem;
}
.movement-row:last-child { border-bottom: none; }

/* ── Product cards ────────────────────────────────────────────────────────── */

.product-card {
  transition: box-shadow 0.2s;
}
.product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.product-thumb-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stock-display {
  font-size: 1.15rem;
  font-weight: 600;
}

.stock-bar {
  height: 5px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Stock bar (large, for detail page) ───────────────────────────────────── */

.stock-bar-lg {
  height: 12px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: visible;
  position: relative;
}

.stock-bar-fill-lg {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.stock-bar-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 20px;
  background: #ef4444;
  border-radius: 2px;
  transform: translateX(-50%);
}

.stock-bar-marker.warning {
  background: #f59e0b;
}

/* ── Category icon ────────────────────────────────────────────────────────── */

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Auth pages ───────────────────────────────────────────────────────────── */

.auth-body {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */

pre {
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.border-transparent {
  border-color: transparent !important;
}

.min-w-0 {
  min-width: 0;
}

.table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
