:root {
  --bg: #0f172a;
  --bg-soft: #16213e;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-solid: #121b33;
  --text: #e5eefb;
  --muted: #96a4c4;
  --border: rgba(148, 163, 184, 0.15);
  --primary: #7c3aed;
  --primary-2: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.25);
}

html[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.25), transparent 25%),
              radial-gradient(circle at top right, rgba(37, 99, 235, 0.22), transparent 20%),
              var(--bg);
  color: var(--text);
}

a { text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
  gap: 24px;
  padding: 24px;
}

.content-shell { min-width: 0; }

.glass-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
}

.brand strong { display: block; font-size: 1.2rem; }
.brand small { color: var(--muted); }

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
}

.brand-mark.xl { width: 72px; height: 72px; border-radius: 22px; }

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-nav .nav-link {
  color: var(--text);
  padding: 14px 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: rgba(124, 58, 237, 0.14);
}

.sidebar-title {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 18px 14px 8px;
  text-transform: uppercase;
}

.topbar {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-title { font-size: 1.6rem; font-weight: 800; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.small-label, .eyebrow, .muted-text { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 700; }
.user-pill {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.06);
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; font-weight: 700;
}
.page-content { padding-bottom: 24px; }
.hero-card {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 30px; border-radius: 30px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(37, 99, 235, 0.18));
  border: 1px solid var(--border);
}
.hero-card h2 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { padding: 22px; display: flex; gap: 14px; align-items: center; }
.stat-icon {
  width: 56px; height: 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--text);
}
.stat-label { margin: 0; color: var(--muted); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-header h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.list-stack { display: flex; flex-direction: column; gap: 12px; }
.list-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255,255,255,0.04); padding: 16px 18px; border-radius: 20px; border: 1px solid var(--border);
}
.empty-state { padding: 22px; text-align: center; border-radius: 20px; background: rgba(255,255,255,0.04); color: var(--muted); }
.table-modern { color: var(--text); }
.table-modern thead th { color: var(--muted); border-bottom-color: var(--border); font-weight: 600; }
.table-modern > :not(caption) > * > * { background: transparent; border-bottom-color: var(--border); }
.form-control, .form-select, .branch-switch-input {
  border-radius: 18px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); padding: 0.9rem 1rem;
}
.branch-switch-input { width: 78px; }
.form-control:focus, .form-select:focus, .form-check-input:focus, .branch-switch-input:focus {
  background: rgba(255,255,255,0.06); color: var(--text); border-color: rgba(124, 58, 237, 0.6); box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.18);
}
.form-check-input { cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: none; }
.btn-soft-primary, .btn-soft-secondary {
  border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--text);
}
.btn-soft-primary:hover, .btn-soft-secondary:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.btn-xl { padding: 1rem 1.4rem; font-size: 1.1rem; }
.soft-alert { border-radius: 18px; border: none; }
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(100%, 520px); padding: 36px; }
.login-brand { display: flex; align-items: center; gap: 18px; }
.login-hint { padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.04); color: var(--muted); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.product-card {
  text-align: left; padding: 18px; border-radius: 24px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); display: flex; flex-direction: column; gap: 6px;
}
.product-card:hover { transform: translateY(-2px); background: rgba(124, 58, 237, 0.12); }
.total-box {
  display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-radius: 24px; background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(37, 99, 235, 0.16));
}
.total-box strong { font-size: 2rem; }
.sticky-panel { position: sticky; top: 24px; }
.search-results { display: flex; flex-direction: column; gap: 10px; }
.search-result-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 14px; border-radius: 18px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); }

@media (max-width: 1199px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sticky-panel { position: static; }
}

@media (max-width: 767px) {
  .topbar, .hero-card { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: 1fr; }
}
