:root,
:root[data-theme="light"] {
  --sge-bg: #ffffff;
  --sge-text: #1d1d1f;
  --sge-text-soft: rgba(0, 0, 0, 0.68);
  --sge-text-muted: rgba(0, 0, 0, 0.48);
  --sge-surface: #f5f5f7;
  --sge-surface-2: #fafafc;
  --sge-card: #ffffff;
  --sge-border: #d2d2d7;
  --sge-blue: #0071e3;
  --sge-blue-hover: #0066cc;
  --sge-green: #2f9e44;
  --sge-yellow: #b7791f;
  --sge-red: #d92d20;
  --sge-purple: #6f42c1;
  --sge-nav: rgba(0, 0, 0, 0.8);
  --sge-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
  --sge-focus: 0 0 0 3px rgba(0, 113, 227, 0.2);

  --sge-chart-1: #6C8EEF;
  --sge-chart-2: #5EC49A;
  --sge-chart-3: #F2A94B;
  --sge-chart-4: #EF7B7B;
  --sge-chart-5: #A97FD4;
  --sge-chart-6: #E891BA;
  --sge-chart-7: #4CBFC9;
  --sge-chart-8: #8B9DC3;
}

:root[data-theme="dark"] {
  --sge-bg: #000000;
  --sge-text: #f5f5f7;
  --sge-text-soft: rgba(255, 255, 255, 0.74);
  --sge-text-muted: rgba(255, 255, 255, 0.5);
  --sge-surface: #1d1d1f;
  --sge-surface-2: #1c1c1e;
  --sge-card: #272729;
  --sge-border: #333336;
  --sge-blue: #2997ff;
  --sge-blue-hover: #64b5ff;
  --sge-green: #32d74b;
  --sge-yellow: #ffd60a;
  --sge-red: #ff453a;
  --sge-purple: #bf5af2;
  --sge-nav: rgba(0, 0, 0, 0.88);
  --sge-shadow: 0 20px 52px rgba(0, 0, 0, 0.44);
  --sge-focus: 0 0 0 3px rgba(41, 151, 255, 0.25);

  --sge-chart-1: #7BAAFF;
  --sge-chart-2: #6EE0AD;
  --sge-chart-3: #FFD06B;
  --sge-chart-4: #FF8A8A;
  --sge-chart-5: #C494F0;
  --sge-chart-6: #FFA3CC;
  --sge-chart-7: #5ED4DE;
  --sge-chart-8: #9DB2D8;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sge-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--sge-bg);
  color: var(--sge-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--sge-blue);
}

a:hover {
  color: var(--sge-blue-hover);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 8px;
  z-index: 2000;
  transform: translateY(-140%);
  background: var(--sge-blue);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 980px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.sge-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--sge-nav);
  color: #ffffff;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.sge-navbar .navbar-brand,
.sge-navbar .nav-link,
.sge-navbar .btn-link {
  color: rgba(255, 255, 255, 0.84);
}

.sge-navbar .navbar-brand {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.sge-navbar .nav-link {
  font-size: 13px;
}

.sge-navbar .nav-link:hover,
.sge-navbar .btn-link:hover {
  color: #ffffff;
}

.brand-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #000000;
  font-size: 13px;
  font-weight: 800;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 52px);
  background: var(--sge-surface);
}

.app-sidebar {
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  padding: 22px 14px;
  overflow-y: auto;
  background: var(--sge-bg);
  border-right: 1px solid var(--sge-border);
}

.sidebar-heading {
  display: block;
  margin: 0 10px 12px;
  color: var(--sge-text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.sidebar-nav .nav-link,
.sidebar-nav button.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--sge-text-soft);
  background: transparent;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav button.nav-link:hover {
  background: var(--sge-surface);
  color: var(--sge-text);
}

.sidebar-nav i {
  width: 20px;
  color: var(--sge-blue);
  font-size: 17px;
}

.mobile-menu-button {
  display: none;
}

.app-main {
  min-width: 0;
  padding: 32px;
}

.app-container {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.public-main {
  background: var(--sge-bg);
}

.page-shell,
.container.mt-4,
div[container="container mt-4"] {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.page-header,
.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.eyebrow,
.section-label {
  margin-bottom: 6px;
  color: var(--sge-text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.page-title,
.dashboard-title,
.section-title,
.display-4,
.display-6 {
  margin: 0;
  color: var(--sge-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.page-title,
.dashboard-title {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
}

.display-4,
.display-6 {
  margin-bottom: 18px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

.page-description,
.dashboard-description,
.section-copy {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--sge-text-soft);
  font-size: 17px;
}

.btn {
  min-height: 38px;
  border-radius: 980px;
  font-weight: 600;
}

.btn-primary,
.btn-success,
.btn-info {
  border-color: var(--sge-blue);
  background: var(--sge-blue);
  color: #ffffff;
}

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover {
  border-color: var(--sge-blue-hover);
  background: var(--sge-blue-hover);
  color: #ffffff;
}

.btn-secondary {
  border-color: var(--sge-border);
  background: var(--sge-card);
  color: var(--sge-text);
}

.btn-secondary:hover {
  border-color: var(--sge-text-muted);
  background: var(--sge-surface);
  color: var(--sge-text);
}

.btn-warning {
  border-color: rgba(183, 121, 31, 0.24);
  background: rgba(183, 121, 31, 0.12);
  color: var(--sge-yellow);
}

.btn-danger {
  border-color: rgba(217, 45, 32, 0.26);
  background: rgba(217, 45, 32, 0.12);
  color: var(--sge-red);
}

.btn-sm {
  min-height: 32px;
  padding-inline: 11px;
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus {
  border-color: var(--sge-blue);
  box-shadow: var(--sge-focus);
}

.card,
.table-card,
.chart-panel,
.metric-tile,
.action-panel,
.login-panel,
.landing-panel {
  border: 1px solid var(--sge-border);
  border-radius: 8px;
  background: var(--sge-card);
  color: var(--sge-text);
  box-shadow: none;
}

.card:hover,
.table-card:hover,
.chart-panel:hover,
.metric-tile:hover {
  box-shadow: var(--sge-shadow);
}

.card-body {
  padding: 24px;
}

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

.metric-tile {
  min-height: 132px;
  padding: 20px;
}

.metric-label {
  color: var(--sge-text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 10px;
  color: var(--sge-text);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 750;
  line-height: 1;
}

.metric-note {
  margin-top: 10px;
  color: var(--sge-text-soft);
  font-size: 13px;
}

.metric-accent-blue {
  border-top: 4px solid var(--sge-chart-1);
}

.metric-accent-green {
  border-top: 4px solid var(--sge-chart-2);
}

.metric-accent-yellow {
  border-top: 4px solid var(--sge-chart-3);
}

.metric-accent-red {
  border-top: 4px solid var(--sge-chart-4);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
  align-items: start;
}

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

.chart-panel {
  padding: 20px;
}

.chart-panel-wide {
  grid-column: 1 / -1;
}

.chart-panel h2,
.chart-panel h5,
.action-panel h2,
.table-card h2 {
  margin: 0 0 14px;
  color: var(--sge-text);
  font-size: 18px;
  font-weight: 750;
}

.chart-panel canvas {
  width: 100% !important;
  height: 260px !important;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.action-panel {
  padding: 20px;
}

.movement-list,
.stock-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.movement-item,
.stock-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--sge-border);
}

.movement-item:first-child,
.stock-item:first-child {
  border-top: 0;
}

.movement-title,
.stock-title {
  margin: 0;
  color: var(--sge-text);
  font-size: 14px;
  font-weight: 700;
}

.movement-meta,
.stock-meta {
  margin: 3px 0 0;
  color: var(--sge-text-muted);
  font-size: 13px;
}

.badge,
.status-badge {
  border-radius: 980px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--sge-border);
  background: var(--sge-surface);
  color: var(--sge-text-soft);
  white-space: nowrap;
}

.status-danger {
  border-color: rgba(217, 45, 32, 0.3);
  color: var(--sge-red);
}

.status-warning {
  border-color: rgba(183, 121, 31, 0.3);
  color: var(--sge-yellow);
}

.table-responsive {
  overflow: auto;
  border: 1px solid var(--sge-border);
  border-radius: 8px;
  background: var(--sge-card);
}

.table {
  margin-bottom: 0;
  color: var(--sge-text);
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: 14px 16px;
  border-bottom-color: var(--sge-border);
  background: transparent;
  color: var(--sge-text);
}

.table thead th {
  border-bottom: 1px solid var(--sge-border);
  color: var(--sge-text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: color-mix(in srgb, var(--sge-surface) 50%, transparent);
}

.form-control,
.form-select {
  min-height: 42px;
  border-color: var(--sge-border);
  border-radius: 8px;
  background-color: var(--sge-card);
  color: var(--sge-text);
}

textarea.form-control {
  min-height: 104px;
}

.form-label,
form p label {
  color: var(--sge-text);
  font-size: 14px;
  font-weight: 700;
}

form p {
  margin-bottom: 16px;
}

.input-group {
  gap: 8px;
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .btn {
  border-radius: 980px !important;
}

.pagination {
  gap: 6px;
  margin-top: 22px;
}

.page-link {
  border-color: var(--sge-border);
  border-radius: 980px !important;
  background: var(--sge-card);
  color: var(--sge-text);
}

.page-item.active .page-link {
  border-color: var(--sge-blue);
  background: var(--sge-blue);
}

.empty-state {
  padding: 30px;
  border: 1px dashed var(--sge-border);
  border-radius: 8px;
  color: var(--sge-text-muted);
  text-align: center;
}

.landing-hero {
  position: relative;
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 92px 24px 70px;
  background: #050506;
  color: #ffffff;
}

.landing-hero-scene {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  opacity: 0.54;
}

.warehouse-cell {
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
}

.warehouse-cell:nth-child(3n) {
  background: rgba(41, 151, 255, 0.16);
}

.warehouse-cell:nth-child(5n) {
  background: rgba(50, 215, 75, 0.12);
}

.landing-hero-content {
  position: relative;
  z-index: 1;
  width: min(940px, 100%);
  text-align: center;
}

.landing-hero h1 {
  margin: 0 auto 18px;
  max-width: 860px;
  font-size: clamp(44px, 8vw, 86px);
  font-weight: 760;
  line-height: 1.02;
}

.landing-hero p {
  max-width: 680px;
  margin: 0 auto 28px;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(18px, 2vw, 23px);
}

.landing-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-section {
  padding: 72px 24px;
  background: var(--sge-bg);
}

.landing-section-muted {
  background: var(--sge-surface);
}

.landing-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.feature-grid,
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.feature-item,
.module-item {
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--sge-border);
  border-radius: 8px;
  background: var(--sge-card);
}

.feature-item i,
.module-item i {
  color: var(--sge-blue);
  font-size: 24px;
}

.feature-item h3,
.module-item h3 {
  margin: 18px 0 8px;
  font-size: 21px;
}

.feature-item p,
.module-item p {
  margin: 0;
  color: var(--sge-text-soft);
}

.dashboard-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 30px;
}

.preview-pane {
  min-height: 320px;
  padding: 22px;
  border: 1px solid var(--sge-border);
  border-radius: 8px;
  background: var(--sge-card);
}

.preview-bars {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  height: 190px;
  margin-top: 28px;
}

.preview-bar {
  border-radius: 8px 8px 0 0;
  background: var(--sge-blue);
}

.preview-bar:nth-child(even) {
  background: var(--sge-green);
}

.preview-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--sge-border);
  color: var(--sge-text-soft);
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.55fr);
  gap: 28px;
  align-items: stretch;
  min-height: calc(100vh - 170px);
}

.login-showcase,
.login-panel {
  padding: clamp(28px, 5vw, 48px);
}

.login-showcase {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  background: var(--sge-surface);
}

.login-showcase h1,
.login-panel h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.06;
}

.login-showcase p,
.login-panel p {
  margin: 14px 0 0;
  color: var(--sge-text-soft);
}

.login-panel {
  align-self: center;
}

.footer {
  border-top: 1px solid var(--sge-border);
  background: var(--sge-bg);
  color: var(--sge-text-muted);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--sge-border);
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .app-main {
    padding: 24px 18px;
  }

  .metric-grid,
  .chart-grid,
  .dashboard-grid,
  .feature-grid,
  .module-grid,
  .dashboard-preview,
  .login-page {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  .page-header,
  .dashboard-header {
    display: block;
  }

  .sge-navbar .navbar-nav {
    align-items: flex-start !important;
    gap: 6px !important;
    padding-top: 10px;
  }

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

  .landing-hero {
    min-height: 680px;
    padding-top: 72px;
  }

  .landing-hero-scene {
    grid-template-columns: repeat(4, 1fr);
  }

  .input-group {
    display: grid;
  }
}
