:root {
  --ink: #172334;
  --ink-2: #334155;
  --muted: #758195;
  --line: #dbe4ef;
  --soft-line: #edf2f7;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --navy: #0a2540;
  --blue: #2563eb;
  --blue-soft: #e8f1ff;
  --green: #0f9f6e;
  --green-soft: #e9fbf3;
  --yellow: #c77b13;
  --yellow-soft: #fff6df;
  --red: #dc2626;
  --red-soft: #fff0f0;
  --purple: #7c3aed;
  --shadow: 0 2px 4px rgba(10, 37, 64, 0.06);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.18);
  --radius: 8px;
  --radius-sm: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface-2);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 1.05fr) minmax(360px, 0.95fr);
  background: var(--surface);
}

.auth-visual {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(10, 37, 64, 0.96), rgba(27, 62, 88, 0.96)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0, rgba(255,255,255,.04) 1px, transparent 1px, transparent 68px);
  color: white;
  padding: 38px;
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(16, 185, 129, .10), transparent 45%),
    linear-gradient(90deg, transparent, rgba(59, 130, 246, .16));
  pointer-events: none;
}

.brand-lockup,
.mobile-brand,
.sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.brand-name,
.brand-subtitle,
.user-chip p,
.user-chip span {
  margin: 0;
}

.brand-name {
  color: inherit;
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  color: inherit;
  font-size: 12px;
  opacity: 0.72;
  text-transform: uppercase;
}

.shelf-scene {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 430px;
}

.mini-dashboard {
  width: min(620px, 92%);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,.10);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
  padding: 18px;
  backdrop-filter: blur(18px);
}

.mini-topline {
  height: 12px;
  width: 210px;
  border-radius: 4px;
  background: rgba(255,255,255,.62);
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.mini-kpis span,
.mini-alerts span {
  display: block;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.16);
}

.mini-kpis span {
  height: 78px;
}

.mini-chart {
  height: 210px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.88);
  padding: 16px;
}

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

.mini-alerts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.mini-alerts span {
  height: 46px;
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.auth-copy h1 {
  margin: 0 0 16px;
  font-size: 44px;
  line-height: 1.08;
}

.auth-copy p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: 17px;
  line-height: 1.65;
}

.auth-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px;
}

.mobile-brand {
  display: none;
  margin-bottom: 28px;
  color: var(--navy);
}

.auth-card {
  width: min(430px, 100%);
}

.auth-heading h2,
.topbar h2,
.modal h3 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
  line-height: 1.2;
}

.auth-heading p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.demo-credentials {
  display: grid;
  gap: 4px 8px;
  grid-template-columns: auto 1fr;
  margin: 24px 0;
  border: 1px solid #b7d1ff;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #173a70;
  padding: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.register-fields {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check-line input {
  width: 17px;
  min-height: 17px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.primary-button {
  background: var(--navy);
  color: white;
}

.primary-button:hover {
  background: #123a5f;
}

.secondary-button {
  border-color: #aac7ff;
  background: var(--blue-soft);
  color: #144385;
}

.secondary-button:hover {
  border-color: var(--blue);
}

.ghost-button {
  border-color: var(--line);
  background: white;
  color: var(--ink-2);
}

.ghost-button:hover {
  background: var(--surface-2);
}

.danger-button {
  background: var(--red);
  color: white;
}

.danger-button:hover {
  background: #b91c1c;
}

.text-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.full {
  width: 100%;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-color: var(--line);
  background: white;
  color: var(--ink-2);
  padding: 0;
}

.icon-button:hover {
  border-color: #c1d0e0;
  background: var(--surface-2);
}

[data-icon] svg,
.icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar-brand {
  padding: 22px;
  color: var(--navy);
}

.nav-list {
  display: grid;
  gap: 4px;
  padding: 4px 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
}

.nav-item:hover {
  background: var(--surface-2);
}

.nav-item.active {
  background: var(--navy);
  color: white;
}

.nav-badge {
  margin-left: auto;
  border-radius: 999px;
  background: var(--red);
  color: white;
  padding: 2px 7px;
  font-size: 11px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.user-chip {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #19477b;
  font-size: 13px;
  font-weight: 900;
}

.user-chip p {
  font-size: 14px;
  font-weight: 850;
}

.user-chip span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  padding: 16px 28px;
  backdrop-filter: blur(12px);
}

.topbar h2 {
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.mobile-nav {
  display: none;
}

.content {
  display: grid;
  gap: 22px;
  max-width: 1380px;
  margin: 0 auto;
  padding: 26px 28px 48px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-header h3,
.panel-title,
.page-title {
  margin: 0;
  color: var(--navy);
  font-size: 19px;
  line-height: 1.28;
}

.section-header p,
.panel-subtitle,
.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-left,
.toolbar-right,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  min-width: min(340px, 100%);
}

.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 38px;
}

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

.kpi-card,
.panel,
.alert-card,
.product-card,
.report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 126px;
  padding: 18px;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.kpi-value {
  margin: 12px 0 6px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.kpi-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-card.good {
  border-color: rgba(15, 159, 110, .30);
}

.kpi-card.warn {
  border-color: rgba(199, 123, 19, .34);
}

.kpi-card.danger {
  border-color: rgba(220, 38, 38, .28);
}

.view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, .9fr);
  gap: 18px;
}

.view-grid.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  padding: 16px 18px;
}

.panel-body {
  padding: 18px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th {
  background: var(--navy);
  color: white;
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  border-bottom: 1px solid var(--soft-line);
  padding: 12px 14px;
  color: var(--ink-2);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--surface-2);
}

.num,
.currency {
  font-variant-numeric: tabular-nums;
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.good,
.soft.good {
  border-color: rgba(15, 159, 110, .22);
  background: var(--green-soft);
  color: #08724d;
}

.pill.warn,
.soft.warn {
  border-color: rgba(199, 123, 19, .28);
  background: var(--yellow-soft);
  color: #8a5008;
}

.pill.danger,
.soft.danger {
  border-color: rgba(220, 38, 38, .25);
  background: var(--red-soft);
  color: #a21616;
}

.pill.info,
.soft.info {
  border-color: rgba(37, 99, 235, .25);
  background: var(--blue-soft);
  color: #164485;
}

.pill.neutral,
.soft.neutral {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}

.soft {
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px;
}

.action-cell {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.mini-action {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink-2);
}

.mini-action:hover {
  background: var(--surface-2);
}

.chart-box {
  min-height: 300px;
}

.chart-box svg {
  width: 100%;
  min-height: 270px;
}

.chart-axis {
  stroke: #cfd8e3;
  stroke-width: 1;
}

.chart-grid {
  stroke: #edf2f7;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-projection {
  fill: none;
  stroke: var(--green);
  stroke-width: 4;
  stroke-dasharray: 9 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.alert-list {
  display: grid;
  gap: 12px;
}

.alert-card {
  display: grid;
  gap: 12px;
  border-left-width: 4px;
  padding: 16px;
}

.alert-card.danger {
  border-left-color: var(--red);
}

.alert-card.warn {
  border-left-color: var(--yellow);
}

.alert-card.info {
  border-left-color: var(--blue);
}

.alert-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.alert-card h4,
.product-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.alert-card p,
.product-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.alert-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-weight: 850;
}

.product-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef3f8;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.progress.warn span {
  background: var(--yellow);
}

.progress.danger span {
  background: var(--red);
}

.progress.good span {
  background: var(--green);
}

.order-row {
  display: grid;
  grid-template-columns: 32px minmax(240px, 1.2fr) 130px 140px minmax(180px, .8fr) 120px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  padding: 12px 14px;
}

.order-head {
  background: var(--navy);
  color: white;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.order-row input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 34px 58px 34px;
  align-items: center;
  gap: 4px;
}

.qty-control button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
}

.qty-control input {
  min-height: 34px;
  padding: 4px 6px;
  text-align: center;
}

.summary-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.summary-value {
  display: block;
  margin-top: 3px;
  color: var(--navy);
  font-size: 24px;
  font-weight: 900;
}

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

.report-card {
  padding: 18px;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-item {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 800;
}

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

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(820px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 0;
}

.modal::backdrop {
  background: rgba(15, 23, 42, .46);
}

.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.modal-card > .form-grid {
  padding: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(15, 159, 110, .28);
  border-radius: var(--radius);
  background: #f0fff8;
  color: #0b5e43;
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.print-only {
  display: none;
}

@media (max-width: 1160px) {
  .kpi-grid,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .order-row {
    grid-template-columns: 28px minmax(220px, 1fr) 124px 130px;
  }

  .order-row > :nth-child(5),
  .order-row > :nth-child(6) {
    display: none;
  }
}

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

  .auth-visual {
    display: none;
  }

  .auth-panel {
    display: block;
    min-height: auto;
    padding: 24px;
  }

  .mobile-brand {
    display: flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    min-height: 72px;
    padding: 14px 16px;
  }

  .mobile-nav {
    position: sticky;
    top: 72px;
    z-index: 18;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: white;
    padding: 8px 12px;
  }

  .mobile-nav .nav-item {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 10px;
  }

  .mobile-nav .nav-item span:not(.icon):not(.nav-badge) {
    display: none;
  }

  .content {
    padding: 18px 14px 40px;
  }

  .section-header,
  .summary-band,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-left,
  .toolbar-right,
  .button-row {
    width: 100%;
  }

  .toolbar-left > *,
  .toolbar-right > *,
  .button-row > * {
    flex: 1 1 160px;
  }

  .search-box {
    width: 100%;
  }

  .form-grid.two,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .order-row {
    grid-template-columns: 28px minmax(190px, 1fr) 120px;
  }

  .order-row > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 560px) {
  .kpi-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 18px;
  }

  .demo-credentials {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .alert-metrics {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .toolbar,
  .button-row,
  .icon-button,
  .ghost-button,
  .primary-button,
  .secondary-button,
  .danger-button,
  .toast {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    max-width: none;
    padding: 0;
  }

  .panel,
  .kpi-card,
  .report-card {
    box-shadow: none;
  }

  body {
    background: white;
  }
}
