html {
  font-size: 15px;
  min-height: 100%;
  position: relative;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

:root {
  --app-bg: #f3f6fb;
  --app-surface: #ffffff;
  --app-surface-2: #f8faff;
  --app-border: #e4e9f3;
  --app-text: #111a36;
  --app-muted: #6f7890;
  --app-primary: #4157ff;
  --app-primary-dark: #1727b6;
  --app-accent: #16b981;
  --app-warning: #f98a28;
  --app-purple: #7a3cff;
  --app-shadow: 0 20px 55px rgba(21, 30, 71, 0.1);
  /* Sidebar */
  --sb-w: 262px;
  --sb-cw: 72px;
  --sb-bg: #F1F5F9;
  --sb-hover: #EEF6FF;
  --sb-active-bg: #DBEAFE;
  --sb-text: #334155;
  --sb-text-hover: #1e40af;
  --sb-text-active: #1d4ed8;
  --sb-heading: #64748B;
  --sb-border: #E2E8F0;
  --sb-transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

body {
  background:
    radial-gradient(circle at top left, rgba(65, 87, 255, 0.1), transparent 26rem),
    linear-gradient(180deg, #f9fbff 0%, var(--app-bg) 55%, #edf2fb 100%);
  color: var(--app-text);
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

a {
  text-decoration: none;
}

.icon-sprite {
  height: 0;
  position: absolute;
  width: 0;
}

.icon-sprite symbol,
.sb-icon,
.sb-toggle svg,
.topbar-hamburger svg,
.nav-icon,
.search-icon,
.icon-btn svg,
.profile-caret {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.btn,
.form-control,
.form-select,
.card,
.modal-content {
  border-radius: 8px;
}

.btn {
  font-weight: 700;
}

.btn-primary,
.btn-success {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-success:hover {
  background: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(65, 87, 255, 0.14);
}

.app-shell {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(226, 232, 245, 0.9);
  border-radius: 8px;
  box-shadow: var(--app-shadow);
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  margin: 16px;
  min-height: calc(100vh - 32px);
  overflow: clip;
  transition: grid-template-columns var(--sb-transition);
}

.app-shell.sb-collapsed {
  grid-template-columns: var(--sb-cw) minmax(0, 1fr);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.app-sidebar {
  align-self: start;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: calc(100vh - 32px);
  overflow: hidden;
  position: sticky;
  top: 16px;
  transition: width var(--sb-transition);
  width: var(--sb-w);
}

.sb-collapsed .app-sidebar {
  width: var(--sb-cw);
}

/* Brand row */
.sb-brand {
  align-items: center;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 13px 0 17px;
}

.sb-brand-link {
  align-items: center;
  color: #0f172a;
  display: flex;
  flex: 1;
  font-size: 15px;
  font-weight: 800;
  gap: 12px;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
}

.sb-logo {
  align-items: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  color: #fff;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.sb-brand-name {
  max-width: 160px;
  overflow: hidden;
  transition: opacity var(--sb-transition), max-width var(--sb-transition);
}

.sb-collapsed .sb-brand-name {
  max-width: 0;
  opacity: 0;
}

.sb-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid var(--sb-border);
  border-radius: 7px;
  color: var(--sb-heading);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 30px;
  justify-content: center;
  padding: 0;
  transition: background var(--sb-transition), color var(--sb-transition);
  width: 30px;
}

.sb-toggle:hover {
  background: var(--sb-hover);
  color: var(--app-primary);
}

.sb-toggle svg {
  height: 16px;
  stroke-width: 2.5;
  transition: transform var(--sb-transition);
  width: 16px;
}

.sb-collapsed .sb-toggle svg {
  transform: rotate(180deg);
}

/* Scrollable nav area */
.sb-nav {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 10px 16px;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* Groups */
.sb-group { padding-bottom: 4px; }

.sb-group + .sb-group {
  border-top: 1px solid var(--sb-border);
  margin-top: 6px;
  padding-top: 6px;
}

.sb-group-label {
  color: var(--sb-heading);
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  max-height: 32px;
  overflow: hidden;
  padding: 6px 0 4px 10px;
  text-transform: uppercase;
  transition: max-height var(--sb-transition), opacity var(--sb-transition), padding var(--sb-transition);
  white-space: nowrap;
}

.sb-collapsed .sb-group-label {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  padding-top: 0;
}

/* Nav items */
.sb-item {
  align-items: center;
  border-radius: 8px;
  color: var(--sb-text);
  display: flex;
  gap: 11px;
  margin-bottom: 2px;
  min-height: 40px;
  overflow: hidden;
  padding: 9px 10px;
  position: relative;
  text-decoration: none;
  transition: background var(--sb-transition), color var(--sb-transition);
  white-space: nowrap;
}

.sb-item:hover {
  background: var(--sb-hover);
  color: var(--sb-text-hover);
}

.sb-item.active {
  background: var(--sb-active-bg);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
  color: var(--sb-text-active);
  font-weight: 700;
}

.sb-icon {
  flex-shrink: 0;
  height: 19px;
  width: 19px;
}

.sb-label {
  font-size: 13px;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  transition: opacity var(--sb-transition), max-width var(--sb-transition);
}

.sb-collapsed .sb-label {
  max-width: 0;
  opacity: 0;
}


/* Sidebar footer */
.sb-footer {
  align-items: center;
  border-top: 1px solid var(--sb-border);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  overflow: hidden;
  padding: 14px 14px 14px 15px;
}

.sb-footer-avatar {
  align-items: center;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.sb-footer-info {
  max-width: 160px;
  min-width: 0;
  overflow: hidden;
  transition: opacity var(--sb-transition), max-width var(--sb-transition);
}

.sb-footer-info strong,
.sb-footer-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-footer-info strong {
  color: #1e293b;
  font-size: 13px;
  font-weight: 700;
}

.sb-footer-info small {
  color: var(--sb-heading);
  font-size: 11px;
  margin-top: 1px;
}

.sb-collapsed .sb-footer-info {
  max-width: 0;
  opacity: 0;
}

/* Mobile overlay */
.sb-overlay {
  background: rgba(0,0,0,0.55);
  display: none;
  inset: 0;
  opacity: 0;
  position: fixed;
  transition: opacity var(--sb-transition);
  z-index: 998;
}

.sb-overlay.show {
  display: block;
  opacity: 1;
}

/* Mobile hamburger */
.topbar-hamburger {
  align-items: center;
  background: transparent;
  border: 0;
  color: #1d2846;
  cursor: pointer;
  display: none;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.topbar-hamburger svg {
  height: 22px;
  width: 22px;
}

.app-content {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.app-topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 78px;
  padding: 18px 32px;
}

.search-box {
  align-items: center;
  background: #fbfcff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(21, 30, 71, 0.04);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  max-width: 510px;
  min-height: 44px;
  padding: 0 12px;
  position: relative;
  width: 45%;
}

.global-search-results {
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(21, 30, 71, 0.14);
  display: none;
  left: 0;
  max-height: 420px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
}

.global-search-results.show {
  display: block;
}

.global-search-results .gsr-group-label {
  color: #8992a8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 10px 14px 4px;
  text-transform: uppercase;
}

.global-search-results .gsr-item {
  border-top: 1px solid #f0f2f8;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
}

.global-search-results .gsr-item:hover,
.global-search-results .gsr-item.active {
  background: #f6f8fd;
}

.global-search-results .gsr-title {
  color: var(--app-text);
  font-size: 13.5px;
  font-weight: 700;
}

.global-search-results .gsr-subtitle {
  color: #7c869e;
  font-size: 12px;
}

.global-search-results .gsr-empty {
  color: #8992a8;
  font-size: 13px;
  padding: 14px;
}

.search-icon {
  color: #2d3858;
  height: 19px;
  width: 19px;
}

.search-box input {
  background: transparent;
  border: 0;
  color: var(--app-text);
  min-width: 0;
  outline: 0;
}

.search-box input::placeholder {
  color: #8992a8;
}

.search-box kbd {
  background: #fff;
  border: 1px solid #e0e6f1;
  border-radius: 6px;
  color: #69738b;
  font-size: 12px;
  font-weight: 700;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.icon-btn {
  align-items: center;
  background: transparent;
  border: 0;
  color: #1d2846;
  display: inline-flex;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  position: relative;
  width: 36px;
}

.icon-btn svg,
.profile-caret {
  height: 20px;
  width: 20px;
}

.profile-chip {
  align-items: center;
  color: #16203b;
  display: flex;
  gap: 10px;
}

.profile-avatar {
  align-items: center;
  background: linear-gradient(135deg, #253456, #6c7aa0);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.profile-chip strong,
.profile-chip small {
  display: block;
}

.profile-chip small {
  color: var(--app-muted);
  font-size: 12px;
}

.profile-caret {
  color: var(--app-muted);
  font-weight: 900;
}

.app-main {
  min-width: 0;
  padding: 26px 34px 28px;
}

.card,
.section-panel,
.glass-card {
  border-color: var(--app-border) !important;
  box-shadow: 0 12px 28px rgba(20, 32, 51, 0.08);
}

.nav-tabs {
  border-bottom-color: var(--app-border);
}

.nav-tabs .nav-link {
  color: var(--app-muted);
  font-weight: 700;
}

.nav-tabs .nav-link.active {
  color: var(--app-primary);
}

.table {
  --bs-table-striped-bg: #f8fafc;
  --bs-table-hover-bg: #eef6f5;
}

.table thead th,
.table th {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.home-dashboard {
  display: grid;
  gap: 24px;
}

.home-hero {
  align-items: center;
  background:
    radial-gradient(circle at 78% 20%, rgba(255, 255, 255, 0.14), transparent 14rem),
    linear-gradient(135deg, rgba(5, 28, 139, 0.98), rgba(49, 32, 220, 0.96)),
    linear-gradient(45deg, #042b88, #3a2fff);
  border-radius: 8px;
  box-shadow: var(--app-shadow);
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 238px;
  overflow: hidden;
  padding: 44px 48px;
  position: relative;
}

.home-hero::after {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.13), transparent 35%),
    repeating-linear-gradient(35deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 58px);
  content: "";
  inset: 0 0 0 42%;
  opacity: 0.55;
  position: absolute;
}

.hero-copy,
.hero-actions {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  color: rgba(255, 255, 255, 0.78);
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.home-hero h1 {
  font-size: clamp(2rem, 3vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 14px;
  max-width: 760px;
}

.home-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
  max-width: 620px;
}

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

.hero-actions .btn {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  gap: 10px;
  min-height: 50px;
  min-width: 170px;
  justify-content: center;
}

.btn-icon {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 6px;
  display: inline-flex;
  font-size: 11px;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.btn-svg,
.metric-icon svg,
.empty-dashboard-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.btn-svg {
  height: 18px;
  width: 18px;
}

.dashboard-mode-note {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  color: #4e5a75;
  display: flex;
  font-size: 14px;
  font-weight: 800;
  gap: 10px;
  padding: 14px 18px;
}

.dashboard-mode-note span {
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.live-note span {
  background: var(--app-accent);
}

.demo-note {
  background: #fff8ee;
  border-color: #f7d9ad;
  color: #8a5a0d;
}

.demo-note span {
  background: var(--app-warning);
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  align-items: center;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 30, 71, 0.06);
  color: var(--app-text);
  display: flex;
  gap: 18px;
  min-height: 146px;
  padding: 22px;
  position: relative;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.metric-card:hover {
  border-color: rgba(65, 87, 255, 0.28);
  box-shadow: 0 18px 34px rgba(21, 30, 71, 0.11);
  color: var(--app-text);
  transform: translateY(-2px);
}

.metric-icon {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 800;
  height: 74px;
  justify-content: center;
  width: 74px;
}

.metric-icon svg {
  height: 30px;
  width: 30px;
}

.metric-icon.customers {
  background: #e9edff;
  color: var(--app-primary);
}

.metric-icon.orders {
  background: #daf6e9;
  color: #15a673;
}

.metric-icon.products {
  background: #efe4ff;
  color: var(--app-purple);
}

.metric-icon.revenue {
  background: #fff0e5;
  color: var(--app-warning);
  font-size: 28px;
}

.metric-body {
  display: grid;
  gap: 4px;
}

.metric-body small,
.overview-stats small,
.status-strip small {
  color: var(--app-muted);
  font-weight: 700;
}

.metric-body strong {
  font-size: 26px;
  line-height: 1.1;
}

.metric-body em,
.overview-stats em {
  color: var(--app-accent);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.metric-menu {
  color: #5b6680;
  font-weight: 900;
  letter-spacing: 0.08em;
  position: absolute;
  right: 18px;
  top: 18px;
}

.dashboard-main-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
}

.overview-panel,
.activity-panel,
.status-strip {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 30, 71, 0.06);
}

.overview-panel,
.activity-panel {
  padding: 24px;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  font-size: 18px;
  font-weight: 900;
  margin: 0;
}

.panel-tools {
  display: flex;
  gap: 12px;
}

.panel-tools button,
.panel-tools a,
.activity-panel .panel-heading a {
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  color: #202a45;
  font-size: 13px;
  font-weight: 800;
  min-height: 38px;
  padding: 0 16px;
}

.panel-tools a {
  align-items: center;
  display: inline-flex;
}

.live-summary-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.live-summary-grid div {
  background: #f8faff;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 134px;
  padding: 20px;
}

.live-summary-grid small {
  color: var(--app-muted);
  font-weight: 800;
}

.live-summary-grid strong {
  color: var(--app-text);
  font-size: 28px;
  line-height: 1.1;
}

.live-summary-grid span {
  color: #64708b;
  font-size: 13px;
  font-weight: 700;
}

.home-insight-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
}

.live-chart-panel,
.live-ring-panel {
  overflow: hidden;
}

.live-chart-panel .panel-heading {
  margin-bottom: 12px;
}

.live-line-chart {
  background:
    repeating-linear-gradient(to bottom, #e8eef8 0 1px, transparent 1px 42px),
    linear-gradient(180deg, #fbfdff, #f5f8ff);
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  height: 230px;
  overflow: hidden;
  padding: 18px;
}

.live-line-chart svg {
  height: 100%;
  width: 100%;
}

.live-kpi-line {
  fill: none;
  stroke: #4157ff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.live-area-fill {
  fill: rgba(65, 87, 255, .13);
  stroke: none;
}

.live-chart-labels {
  color: #63708a;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 12px;
}

.live-chart-labels span:last-child {
  text-align: right;
}

.live-ring-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-ring-item {
  align-items: center;
  background: #f8faff;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 190px;
  padding: 18px 12px;
  text-align: center;
}

.live-ring-item strong {
  color: #263452;
  font-size: 13px;
  font-weight: 900;
}

.live-ring {
  --ring-color: #4157ff;
  align-items: center;
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--ring-color) var(--percent, 0%), #e6ecf7 0);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(215, 224, 239, .9), 0 10px 22px rgba(21, 30, 71, .08);
  display: inline-flex;
  height: 112px;
  justify-content: center;
  width: 112px;
}

.live-ring.accent {
  --ring-color: #16b981;
}

.live-ring.purple {
  --ring-color: #7a3cff;
}

.live-ring span {
  color: #111a36;
  font-size: 22px;
  font-weight: 900;
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-empty {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 255, 0.98));
  border: 1px dashed #c8d3e6;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 30, 71, 0.05);
  color: var(--app-text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  padding: 44px 28px;
  text-align: center;
}

.dashboard-empty.compact {
  box-shadow: none;
  min-height: 280px;
  padding: 28px;
}

.empty-dashboard-icon {
  align-items: center;
  background: #eef1ff;
  border-radius: 999px;
  color: var(--app-primary);
  display: inline-flex;
  height: 76px;
  justify-content: center;
  margin-bottom: 18px;
  width: 76px;
}

.empty-dashboard-icon svg {
  height: 34px;
  width: 34px;
}

.dashboard-empty h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 0 0 10px;
}

.dashboard-empty strong {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 6px;
}

.dashboard-empty p {
  color: var(--app-muted);
  line-height: 1.65;
  margin: 0;
  max-width: 620px;
}

.empty-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.activity-panel .panel-heading a {
  align-items: center;
  display: inline-flex;
}

.chart-legend {
  display: flex;
  gap: 34px;
  margin-bottom: 18px;
}

.chart-legend span,
.chart-tooltip span {
  align-items: center;
  color: #59647d;
  display: inline-flex;
  gap: 10px;
  font-size: 13px;
}

.chart-legend i,
.chart-tooltip i {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.legend-orders {
  background: #2f59ff;
}

.legend-revenue {
  background: #13a873;
}

.chart-wrap {
  display: grid;
  gap: 14px;
  grid-template-columns: 28px minmax(0, 1fr);
}

.axis-labels {
  color: #63708a;
  display: grid;
  font-size: 13px;
  grid-template-rows: repeat(5, 1fr);
  padding: 2px 0 8px;
}

.chart-area {
  height: 240px;
  overflow: hidden;
  position: relative;
}

.grid-line {
  border-top: 1px dashed #dfe5ef;
  left: 0;
  position: absolute;
  right: 0;
}

.line-1 {
  top: 6px;
}

.line-2 {
  top: 64px;
}

.line-3 {
  top: 122px;
}

.line-4 {
  top: 180px;
}

.line-chart {
  inset: 0;
  position: absolute;
  width: 100%;
  height: 100%;
}

.line-chart path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.orders-line {
  stroke: #2f59ff;
}

.revenue-line {
  stroke: #13a873;
}

.chart-point {
  fill: #fff;
  stroke: #2f59ff;
  stroke-width: 5;
}

.chart-fill {
  bottom: 0;
  height: 62%;
  left: 0;
  opacity: 0.2;
  position: absolute;
  right: 0;
}

.orders-fill {
  background: linear-gradient(180deg, rgba(47, 89, 255, 0.32), rgba(47, 89, 255, 0));
  clip-path: polygon(0 60%, 12% 42%, 26% 18%, 38% 26%, 52% 50%, 66% 74%, 82% 44%, 100% 30%, 100% 100%, 0 100%);
}

.revenue-fill {
  background: linear-gradient(180deg, rgba(19, 168, 115, 0.32), rgba(19, 168, 115, 0));
  clip-path: polygon(0 82%, 16% 62%, 30% 42%, 46% 68%, 62% 50%, 78% 78%, 92% 54%, 100% 58%, 100% 100%, 0 100%);
}

.chart-tooltip {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #edf1f7;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(21, 30, 71, 0.12);
  display: grid;
  gap: 10px;
  left: 48%;
  padding: 14px 16px;
  position: absolute;
  top: 26px;
  width: 180px;
}

.chart-tooltip strong {
  color: #38435d;
  font-size: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--app-border);
}

.chart-tooltip b {
  color: #56617b;
  margin-left: auto;
}

.chart-months {
  color: #63708a;
  display: grid;
  font-size: 13px;
  grid-template-columns: repeat(5, 1fr);
  margin: 8px 0 22px 42px;
}

.overview-stats {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.overview-stats div {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px 16px;
}

.overview-stats strong {
  font-size: 18px;
}

.overview-stats em {
  justify-self: end;
  margin-top: -26px;
}

.overview-stats .danger {
  color: #f05252;
}

.activity-list {
  display: grid;
  gap: 22px;
}

.activity-list a {
  align-items: center;
  color: var(--app-text);
  display: grid;
  gap: 14px;
  grid-template-columns: 46px minmax(0, 1fr);
}

.activity-icon {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.activity-icon.green {
  background: #dcf7e8;
  color: #12a16b;
}

.activity-icon.blue {
  background: #e8edff;
  color: var(--app-primary);
}

.activity-icon.purple {
  background: #f0e6ff;
  color: var(--app-purple);
}

.activity-icon.orange {
  background: #fff0e6;
  color: var(--app-warning);
}

.activity-list strong,
.activity-list small {
  display: block;
}

.activity-list strong {
  font-size: 14px;
  line-height: 1.4;
}

.activity-list small {
  color: var(--app-muted);
  margin-top: 4px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 22px 28px;
}

.status-strip > div {
  align-items: center;
  border-right: 1px solid var(--app-border);
  display: flex;
  gap: 14px;
  min-width: 0;
  padding: 0 24px;
}

.status-strip > div:first-child {
  padding-left: 0;
}

.status-strip > div:last-child {
  border-right: 0;
  padding-right: 0;
}

.status-icon {
  align-items: center;
  background: #f0e9ff;
  border-radius: 8px;
  color: var(--app-purple);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  display: inline-flex;
  width: 48px;
}

.status-strip strong,
.status-strip small {
  display: block;
}

.status-strip strong {
  font-size: 14px;
  margin-top: 4px;
}

.status-strip i {
  background: var(--app-accent);
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  margin-right: 8px;
  width: 8px;
}

.status-strip em {
  background: #dff8ea;
  border-radius: 999px;
  color: #11a36e;
  display: inline-block;
  font-size: 12px;
  font-style: normal;
  margin-left: 8px;
  padding: 4px 10px;
}

.settings-workspace {
  display: grid;
  gap: 22px;
}

.settings-heading {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.settings-eyebrow {
  color: #56627d;
  display: inline-block;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-title-line {
  align-items: center;
  display: flex;
  gap: 12px;
}

.settings-heading h1 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}

.settings-title-icon,
.settings-card-icon {
  align-items: center;
  background: #eef1ff;
  border-radius: 8px;
  color: var(--app-primary);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.settings-heading p {
  color: var(--app-muted);
  line-height: 1.5;
  margin: 10px 0 0;
}

.settings-help {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe3f1;
  border-radius: 8px;
  color: #4d5974;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
}

.settings-help span,
.save-icon {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-panel {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 30, 71, 0.06);
  min-height: 250px;
  padding: 24px;
}

.settings-panel:first-child {
  min-height: 480px;
}

.settings-card-head {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-title {
  align-items: center;
  color: var(--app-text);
  display: flex;
  font-size: 18px;
  font-weight: 900;
  justify-content: space-between;
  margin-bottom: 4px;
}

.settings-card-head p {
  color: var(--app-muted);
  font-size: 14px;
  margin: 0;
}

.panel-title.editing::after {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  color: #92400e;
  content: "Editing";
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.settings-panel .form-label {
  color: #263452;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.settings-panel .form-control,
.settings-panel .form-select {
  border: 1px solid #dce4f1;
  border-radius: 8px;
  color: #1a2542;
  font-weight: 600;
  min-height: 42px;
}

.settings-panel .form-control::placeholder {
  color: #1a2542;
  opacity: 0.92;
}

.settings-panel .form-select {
  background-color: #fff;
}

.settings-panel .form-select[name="status"] {
  color: #1a2542;
}

.panel-actions {
  border-top: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 0;
}

.panel-actions .btn {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding-inline: 18px;
}

.panel-actions .btn-primary {
  background: linear-gradient(135deg, #4e63ff, #362dff);
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(65, 87, 255, 0.22);
}

.panel-actions .btn-outline-secondary {
  background: #fff;
  border-color: #d7dfec;
  color: #53607a;
}

.settings-review {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 30, 71, 0.06);
  padding: 24px;
}

.settings-review h2 {
  color: var(--app-text);
  font-weight: 900;
}

.settings-review .nav-tabs {
  border-bottom-color: #dfe6f2;
  gap: 6px;
  overflow-x: auto;
  padding: 0 12px;
}

.settings-review .nav-tabs .nav-link {
  align-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #56627d;
  display: inline-flex;
  gap: 10px;
  font-weight: 900;
  min-height: 58px;
  padding: 0 16px;
  white-space: nowrap;
}

.settings-review .nav-tabs .nav-link.active {
  background: transparent;
  border-bottom-color: var(--app-primary);
  color: var(--app-primary);
}

.settings-review .table {
  margin-bottom: 0;
}

.review-icon,
.review-action svg,
.review-search svg,
.review-tools svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.review-icon {
  height: 22px;
  width: 22px;
}

.review-table-shell {
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  overflow: hidden;
}

.review-toolbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dfe6f2;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 20px 14px;
}

.review-search {
  align-items: center;
  border: 1px solid #dce4f1;
  border-radius: 8px;
  color: #61708b;
  display: flex;
  gap: 12px;
  min-height: 46px;
  max-width: 470px;
  padding: 0 14px;
  width: 38%;
}

.review-search svg {
  height: 19px;
  width: 19px;
}

.review-search input {
  border: 0;
  color: #1a2542;
  min-width: 0;
  outline: 0;
  width: 100%;
}

.review-search input::placeholder {
  color: #8b96ad;
}

.review-tools {
  align-items: center;
  display: flex;
  gap: 12px;
}

.review-tools button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce4f1;
  border-radius: 8px;
  color: #263452;
  display: inline-flex;
  font-weight: 800;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
}

.review-tools svg {
  height: 18px;
  width: 18px;
}

.review-tools .review-add {
  background: linear-gradient(135deg, #4e63ff, #362dff);
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(65, 87, 255, 0.22);
  color: #ffffff;
}

.review-table th {
  background: #f8faff;
  color: #62708c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  padding: 16px 18px;
  text-transform: none;
}

.review-table td {
  border-color: #eef2f8;
  color: #14203a;
  font-weight: 600;
  padding: 20px 18px;
  vertical-align: middle;
}

.review-entity {
  align-items: center;
  display: inline-flex;
  gap: 14px;
}

.review-entity .review-icon {
  background: #f0eaff;
  border-radius: 999px;
  color: var(--app-primary);
  height: 42px;
  padding: 10px;
  width: 42px;
}

.review-status {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  gap: 8px;
  padding: 8px 12px;
}

.review-status::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  height: 7px;
  width: 7px;
}

.review-status.active {
  background: #ddf8e9;
  color: #0c9b67;
}

.review-status.draft {
  background: #fff1f2;
  color: #be123c;
}

.review-action {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce4f1;
  border-radius: 8px;
  color: #40506e;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  margin-left: 8px;
  width: 42px;
}

.review-action svg {
  height: 18px;
  width: 18px;
}

.sort-mark {
  color: #95a0b4;
  font-size: 13px;
  margin-left: 6px;
}

.review-footer {
  align-items: center;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 14px;
}

.review-footer span {
  color: #56627d;
  font-weight: 700;
}

.review-pages {
  align-items: center;
  display: flex;
  gap: 10px;
}

.review-pages button,
.review-pages strong,
.review-pages select {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce4f1;
  border-radius: 8px;
  color: #68748c;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  min-width: 42px;
  padding: 0 12px;
}

.review-pages strong {
  background: linear-gradient(135deg, #4e63ff, #362dff);
  border-color: transparent;
  color: #ffffff;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

@media (max-width: 1100px) {
  .metric-grid,
  .overview-stats,
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }

  .home-insight-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .app-shell {
    border-radius: 0;
    grid-template-columns: 1fr !important;
    margin: 0;
    min-height: 100vh;
  }

  /* Sidebar becomes a fixed off-canvas drawer */
  .app-sidebar {
    height: 100vh;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--sb-transition);
    width: var(--sb-w) !important;
    z-index: 999;
  }

  .app-sidebar.sb-mobile-open {
    transform: translateX(0);
  }

  /* Hide the desktop collapse toggle on mobile */
  .sb-toggle {
    display: none;
  }

  /* Show hamburger */
  .topbar-hamburger {
    display: inline-flex;
  }

  .app-topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .search-box {
    max-width: none;
    width: 100%;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .app-main {
    padding: 14px;
  }

  .status-strip > div {
    border-right: 0;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .home-hero {
    min-height: 0;
    padding: 24px;
  }

  .metric-grid,
  .live-ring-grid,
  .overview-stats,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .live-line-chart {
    height: 190px;
  }

  .metric-card {
    min-height: 120px;
  }

  .panel-heading,
  .hero-actions,
  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-tooltip {
    display: none;
  }

  .chart-months {
    margin-left: 42px;
  }

  .profile-chip span:not(.profile-avatar):not(.profile-caret) {
    display: none;
  }
}

.erp-toast-container {
  display: grid;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  position: fixed;
  right: 24px;
  top: 24px;
  width: 420px;
  z-index: 2147483000;
}

.erp-toast {
  align-items: flex-start;
  animation: erpToastIn 180ms ease-out;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-left: 5px solid var(--toast-accent);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(21, 30, 71, 0.18);
  color: var(--app-text);
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 76px;
  overflow: hidden;
  padding: 14px 14px 14px 16px;
  pointer-events: auto;
}

.erp-toast.is-hiding {
  animation: erpToastOut 180ms ease-in forwards;
}

.erp-toast-success {
  --toast-accent: #16a34a;
  --toast-soft: #dcfce7;
}

.erp-toast-error {
  --toast-accent: #dc2626;
  --toast-soft: #fee2e2;
}

.erp-toast-warning {
  --toast-accent: #f59e0b;
  --toast-soft: #fef3c7;
}

.erp-toast-info {
  --toast-accent: #2563eb;
  --toast-soft: #dbeafe;
}

.erp-toast-icon {
  align-items: center;
  background: var(--toast-soft);
  border-radius: 8px;
  color: var(--toast-accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  margin-top: 1px;
  width: 32px;
}

.erp-toast-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.erp-toast-title {
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.erp-toast-message {
  color: #526079;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.erp-toast-close {
  align-items: center;
  background: #f4f7fb;
  border: 1px solid #e4e9f3;
  border-radius: 8px;
  color: #647089;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
}

.erp-toast-close:hover {
  background: #eaf0fb;
  color: #1f2a44;
}

.erp-confirm-backdrop {
  align-items: center;
  background: rgba(17, 26, 54, 0.46);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 2147482999;
}

.erp-confirm-backdrop.show {
  display: flex;
}

.erp-confirm-modal {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(21, 30, 71, 0.28);
  display: grid;
  gap: 16px;
  grid-template-columns: auto minmax(0, 1fr);
  max-width: 460px;
  padding: 22px;
  width: min(460px, 100%);
}

.erp-confirm-icon {
  align-items: center;
  background: #fef3c7;
  border-radius: 8px;
  color: #b45309;
  display: inline-flex;
  font-size: 16px;
  font-weight: 900;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.erp-confirm-copy {
  min-width: 0;
}

.erp-confirm-copy h2 {
  color: var(--app-text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 6px;
}

.erp-confirm-copy p {
  color: var(--app-muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  margin: 0;
}

.erp-confirm-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.erp-error-panel {
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(127, 29, 29, 0.08);
  color: #7f1d1d;
  margin-bottom: 18px;
  padding: 18px 20px;
}

.erp-error-panel h1 {
  color: #991b1b;
  font-weight: 900;
  margin-bottom: 8px;
}

@keyframes erpToastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes erpToastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 640px) {
  .erp-toast-container {
    left: 16px;
    max-width: none;
    right: 16px;
    top: 16px;
    width: auto;
  }

  .erp-toast {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 70px;
  }

  .erp-confirm-modal {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .erp-confirm-actions {
    flex-direction: column-reverse;
  }

  .erp-confirm-actions .btn {
    width: 100%;
  }
}
