:root {
  color-scheme: dark;
  --bg: #080909;
  --panel: #111212;
  --panel-2: #171818;
  --panel-3: #1d1e1e;
  --sidebar: #151616;
  --line: rgba(255, 255, 255, 0.105);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f2;
  --muted: #969a98;
  --muted-2: #6e7370;
  --green: #16c765;
  --green-soft: rgba(22, 199, 101, 0.13);
  --yellow: #e7b84b;
  --yellow-soft: rgba(231, 184, 75, 0.13);
  --red: #f05d67;
  --red-soft: rgba(240, 93, 103, 0.12);
  --white-soft: rgba(255, 255, 255, 0.055);
  --radius: 16px;
  --sidebar-width: 286px;
  --topbar-height: 74px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --panel-3: #eef0ed;
  --sidebar: #ffffff;
  --line: rgba(19, 24, 21, 0.10);
  --line-strong: rgba(19, 24, 21, 0.16);
  --text: #171a18;
  --muted: #68706b;
  --muted-2: #89908c;
  --green-soft: rgba(22, 199, 101, 0.10);
  --yellow-soft: rgba(184, 126, 18, 0.10);
  --red-soft: rgba(207, 63, 72, 0.08);
  --white-soft: rgba(20, 24, 22, 0.045);
  --shadow: 0 18px 45px rgba(28, 35, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

a,
button,
input,
textarea,
select,
[role="button"] {
  touch-action: manipulation;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] ::selection {
  background: rgba(20, 24, 22, 0.14);
}

html[data-theme="light"] .app-shell {
  background: #ffffff;
}

html[data-theme="light"] .topbar {
  background: #ffffff;
}

html[data-theme="light"] .nav-label {
  color: #747b77;
}

html[data-theme="light"] .nav-item {
  color: #434945;
}

html[data-theme="light"] .nav-item:hover {
  background: rgba(19, 24, 21, 0.045);
  color: #111411;
}

html[data-theme="light"] .nav-item.active {
  background: rgba(19, 24, 21, 0.075);
  border-color: rgba(19, 24, 21, 0.04);
  color: #111411;
}

html[data-theme="light"] .role-switch:hover,
html[data-theme="light"] .action-button:hover,
html[data-theme="light"] .icon-button:hover,
html[data-theme="light"] .segment-button:hover {
  background: rgba(19, 24, 21, 0.055);
  border-color: rgba(19, 24, 21, 0.18);
  color: #111411;
}

html[data-theme="light"] .language-switch button.active {
  background: #171a18;
  color: #ffffff;
}

html[data-theme="light"] .hero-label {
  color: var(--text);
}

html[data-theme="light"] .key-box {
  background: rgba(19, 24, 21, 0.045);
}

html[data-theme="light"] .key-value {
  color: #242925;
}

html[data-theme="light"] .mini-button,
html[data-theme="light"] .secondary-button {
  background: rgba(19, 24, 21, 0.025);
  color: #303632;
}

html[data-theme="light"] .mini-button:hover,
html[data-theme="light"] .secondary-button:hover {
  background: rgba(19, 24, 21, 0.065);
}

html[data-theme="light"] .primary-button {
  border-color: #171a18;
  background: #171a18;
  color: #ffffff;
}

html[data-theme="light"] .primary-button:hover {
  background: #050706;
}

html[data-theme="light"] .card::after {
  background-image: radial-gradient(rgba(19, 24, 21, 0.11) 0.7px, transparent 0.7px);
}

html[data-theme="light"] .stock-bar {
  background: #e2e5e1;
}

html[data-theme="light"] .stock-bar > div {
  background: #303632;
}

html[data-theme="light"] .stock-split strong {
  color: var(--text);
}

html[data-theme="light"] .activity-icon {
  background: rgba(19, 24, 21, 0.025);
  color: #555d58;
}

html[data-theme="light"] .table-head {
  background: rgba(19, 24, 21, 0.025);
}

html[data-theme="light"] .empty-state strong {
  color: var(--text);
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(28, 35, 31, 0.16);
}

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% -12%, rgba(255, 255, 255, 0.035), transparent 30rem),
    var(--bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.brand-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 10px;
}

.nav-section + .nav-section {
  margin-top: 24px;
}

.nav-label {
  margin: 0 10px 8px;
  color: #8d918f;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  text-decoration: none;
  font: inherit;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #d8dad8;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(255, 255, 255, 0.035);
  color: #fff;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.nav-item span {
  font-size: 14px;
  font-weight: 545;
}

.sidebar-user {
  margin: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #d8b96f, #815d1e);
  color: #0e0e0e;
  font-size: 12px;
  font-weight: 800;
}

.avatar > span {
  position: relative;
  z-index: 0;
}

.avatar > img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-meta strong,
.user-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta strong {
  font-size: 13px;
  font-weight: 650;
}

.user-meta span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.role-switch {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.role-switch:hover {
  background: var(--white-soft);
  color: #fff;
}

.role-switch svg {
  width: 16px;
  height: 16px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto var(--sidebar-width);
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 9, 0.92);
  backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.mobile-menu {
  display: none;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-button,
.icon-button,
.segment-button {
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.action-button:hover,
.icon-button:hover,
.segment-button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

.action-button:active,
.icon-button:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 650;
}

.action-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
}

.language-switch {
  height: 40px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.language-switch button {
  width: 41px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.language-switch button.active {
  background: #ededeb;
  color: #171818;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 34px) 30px 48px;
}

.content {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.page-head {
  min-height: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-title {
  margin: 0;
  font-size: clamp(27px, 3vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-actions .primary-button,
.page-actions .secondary-button {
  white-space: nowrap;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.26;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 0.7px, transparent 0.7px);
  background-size: 16px 16px;
  mask-image: linear-gradient(145deg, rgba(0,0,0,.42), transparent 58%);
}

.hero-card {
  min-height: 252px;
  padding: 26px;
}

.hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e8e9e7;
  font-size: 15px;
  font-weight: 650;
}

.hero-label svg {
  width: 20px;
  height: 20px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: .86;
}

.status-active,
.status-success {
  background: var(--green-soft);
  color: #63df95;
}

.status-pending {
  background: var(--yellow-soft);
  color: #efc866;
}

.status-danger,
.status-disabled {
  background: var(--red-soft);
  color: #ff838b;
}

.hero-product {
  position: relative;
  z-index: 1;
  margin: 30px 0 10px;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 690;
  letter-spacing: -0.025em;
}

.key-box {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.key-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: #e8ebe8;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.key-actions {
  display: flex;
  gap: 6px;
}

.mini-button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #dfe1df;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.mini-button:hover {
  background: rgba(255, 255, 255, 0.075);
}

.mini-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.hero-meta {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.hero-validity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 14px;
}

.hero-validity .key-expiry {
  margin-top: 0;
}

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

.metric-card {
  min-height: 150px;
  padding: 22px;
}

.metric-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.metric-label svg {
  width: 17px;
  height: 17px;
  color: #737876;
}

.metric-value {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  font-size: 28px;
  font-weight: 690;
  letter-spacing: -0.035em;
}

.metric-note {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  color: var(--muted);
  font-size: 11px;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 670;
  letter-spacing: -0.015em;
}

.activity-list,
.key-list,
.order-list,
.inventory-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.activity-item,
.key-list-item,
.order-row,
.inventory-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child,
.key-list-item:last-child,
.order-row:last-child,
.inventory-row:last-child {
  border-bottom: 0;
}

.activity-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: #c9ccca;
}

.activity-icon svg {
  width: 17px;
  height: 17px;
}

.activity-main,
.list-main {
  min-width: 0;
  flex: 1;
}

.activity-main strong,
.list-main strong {
  display: block;
  font-size: 13px;
  font-weight: 610;
}

.activity-main span,
.list-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.activity-time {
  color: var(--muted-2);
  font-size: 11px;
}

.primary-button,
.secondary-button,
.danger-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid #f0f1ef;
  background: #f0f1ef;
  color: #121313;
}

.primary-button:hover {
  background: #fff;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  color: #f1f2f0;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.075);
}

.danger-button {
  border: 1px solid rgba(240, 93, 103, 0.35);
  background: var(--red-soft);
  color: #ff9399;
}

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

.product-card {
  min-height: 270px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.product-card-sale {
  border-color: rgba(231, 184, 75, 0.32);
}

.product-promo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
  color: var(--yellow);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.product-promo strong {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--yellow-soft);
  font-size: 10px;
}

.product-eyebrow {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.product-name {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  font-size: 21px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.product-price {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  font-size: 30px;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.product-price small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.product-price-sale {
  color: var(--yellow);
}

.product-price-original {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: line-through;
}

.product-stock {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.product-stock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.product-stock.low::before {
  background: var(--yellow);
}

.product-stock.empty::before {
  background: var(--red);
}

.product-card .primary-button {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: auto;
}

.product-card .primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.table-head,
.order-row,
.inventory-row {
  display: grid;
  align-items: center;
  gap: 16px;
}

.order-grid {
  grid-template-columns: 1.1fr 1.35fr .8fr .85fr 1fr;
}

.inventory-grid {
  grid-template-columns: 1.35fr .8fr .8fr .8fr auto;
}

.table-head {
  min-height: 44px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.order-row,
.inventory-row {
  min-height: 70px;
}

.cell-title {
  font-size: 12px;
  font-weight: 620;
}

.cell-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 650;
}

.stat-positive {
  color: #5bd88d;
}

.stat-warning {
  color: #efc866;
}

.stat-danger {
  color: #ff7d85;
}

.admin-hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
}

.stock-summary {
  min-height: 250px;
  padding: 26px;
}

.stock-number {
  position: relative;
  z-index: 1;
  margin-top: 30px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 740;
  line-height: 1;
  letter-spacing: -0.045em;
}

.stock-number span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 540;
  letter-spacing: 0;
  white-space: nowrap;
}

.stock-bar {
  position: relative;
  z-index: 1;
  height: 10px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #292b2a;
}

.stock-bar > div {
  height: 100%;
  border-radius: inherit;
  background: #e9ebe7;
}

.stock-split {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 20px;
}

.stock-split div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.stock-split strong {
  color: #e8eae7;
  font-size: 12px;
}

.alert-card {
  min-height: 250px;
  padding: 26px;
}

.alert-list {
  position: relative;
  z-index: 1;
  margin-top: 19px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.alert-item:last-child {
  border-bottom: 0;
}

.alert-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
}

.alert-dot.warning {
  background: var(--yellow);
}

.alert-dot.danger {
  background: var(--red);
}

.alert-item strong {
  display: block;
  font-size: 12px;
}

.alert-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.empty-state {
  padding: 52px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
}

.empty-state strong {
  display: block;
  color: #dedfdd;
  font-size: 14px;
}

.empty-state span {
  display: block;
  margin-top: 7px;
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(640px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #121313;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.55);
}

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

.modal-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 17px 22px 22px;
}

.form-group + .form-group {
  margin-top: 17px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  color: #d8dad8;
  font-size: 11px;
  font-weight: 650;
}

.form-control {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: #0c0d0d;
  color: #f0f1ef;
  font-size: 12px;
}

textarea.form-control {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.55;
}

.form-control:focus {
  border-color: rgba(255,255,255,.32);
}

.preview-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preview-stat {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}

.preview-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.preview-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
}

.help-text {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.toast-root {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  width: min(360px, calc(100vw - 44px));
  display: grid;
  gap: 9px;
}

.toast {
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(25, 26, 26, 0.97);
  box-shadow: 0 18px 44px rgba(0,0,0,.35);
  animation: toast-in 180ms ease-out;
}

.toast strong {
  display: block;
  font-size: 12px;
}

.toast span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


.payment-grid {
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
}

.payment-history-grid {
  grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1.2fr) minmax(110px, .8fr) minmax(100px, .8fr) minmax(110px, .8fr) minmax(140px, 1fr) minmax(110px, .8fr);
}

.payment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.payment-row {
  min-height: 70px;
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.payment-row:last-child {
  border-bottom: 0;
}

.test-active-card {
  padding: 24px;
}

.test-active-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.test-active-title {
  margin: 10px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.test-active-notes {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.test-active-notes > div {
  min-height: 102px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.024);
}

.test-active-notes span,
.test-active-notes strong {
  display: block;
}

.test-active-notes span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.test-active-notes strong {
  margin-top: 8px;
  color: #e5e7e4;
  font-size: 11px;
  line-height: 1.55;
  font-weight: 570;
}

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

.test-scenario-card {
  min-height: 230px;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.test-scenario-card.active {
  border-color: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), var(--shadow);
}

.scenario-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scenario-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.scenario-dot.warning {
  background: var(--yellow);
}

.scenario-dot.danger {
  background: var(--red);
}

.test-scenario-card h3 {
  position: relative;
  z-index: 1;
  margin: 15px 0 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.test-scenario-card p {
  position: relative;
  z-index: 1;
  margin: 9px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.test-scenario-card .primary-button,
.test-scenario-card .secondary-button {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: auto;
}

.test-scenario-card button:disabled {
  opacity: .55;
  cursor: default;
}

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

.check-list,
.incident-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.check-item,
.incident-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 62px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.check-item:last-child,
.incident-item:last-child {
  border-bottom: 0;
}

.check-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.check-icon.pass {
  background: var(--green-soft);
  color: #66e098;
}

.check-icon.fail {
  background: var(--red-soft);
  color: #ff858d;
}

.check-item strong,
.check-item span,
.incident-item strong,
.incident-item span {
  display: block;
}

.check-item strong,
.incident-item strong {
  font-size: 11px;
  font-weight: 640;
}

.check-item span,
.incident-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.incident-item .alert-dot {
  margin-top: 5px;
}

.mobile-overlay {
  display: none;
}

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

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

  .admin-hero {
    grid-template-columns: 1fr;
  }

  .inventory-grid {
    grid-template-columns: 1.2fr .8fr .8fr auto;
  }

  .inventory-grid > :nth-child(4) {
    display: none;
  }

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

  .test-active-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 268px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    opacity: 0;
    pointer-events: none;
    background: rgba(0,0,0,.58);
    transition: opacity 180ms ease;
  }

  .app-shell.sidebar-open .mobile-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    left: 0;
    padding: 0 16px;
  }

  .main {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 28px) 16px 40px;
  }

  .mobile-menu {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: transparent;
    color: #fff;
  }

  .mobile-menu svg {
    width: 19px;
    height: 19px;
  }

  .language-switch {
    display: none;
  }

  .order-grid {
    grid-template-columns: 1.1fr 1.2fr .8fr;
  }

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

@media (max-width: 620px) {
  .topbar-actions .action-button span {
    display: none;
  }

  .topbar-actions .action-button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .products-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
  }

  .metric-card,
  .product-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .metric-card { min-height: 0; }
  .metric-note { margin-top: 16px; }
  .hero-card { min-height: 0; }

  .hero-card,
  .metric-card,
  .product-card,
  .stock-summary,
  .alert-card {
    padding: 20px;
  }

  .key-box {
    align-items: stretch;
    flex-direction: column;
  }

  .key-value {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .key-actions {
    width: 100%;
  }

  .key-actions .mini-button {
    flex: 1;
    justify-content: center;
  }

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

  .table-shell {
    overflow-x: auto;
  }

  .table-head,
  .order-row {
    min-width: 690px;
  }

  .table-head,
  .inventory-row {
    min-width: 630px;
  }

  .payment-grid {
    min-width: 720px;
  }

  .payment-history-grid {
    min-width: 980px;
  }

  .test-scenario-grid,
  .test-two-col {
    grid-template-columns: 1fr;
  }

  .test-active-head {
    flex-direction: column;
  }

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


/* Dealer financial tables: isolated styles shared by Admin and Dashboard.
   Keep the existing app's light/dark tokens; never force a new page background. */
.dealer-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  container: dealer-financial-table / inline-size;
}
.dealer-data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.dealer-data-table th,
.dealer-data-table td {
  text-align: left;
  vertical-align: top;
}
.dealer-data-table thead th {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: .01em;
}
.dealer-data-table tbody td {
  min-width: 0;
  padding: 14px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.dealer-data-table tbody tr:last-child td { border-bottom: 0; }
.dealer-data-table tbody tr:hover { background: var(--white-soft); }
.dealer-data-table .dealer-cell-primary {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.dealer-data-table .dealer-cell-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.dealer-data-table .dealer-cell-amount {
  display: inline-block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dealer-data-table .status-pill {
  max-width: 100%;
  vertical-align: top;
  white-space: normal;
  font-size: 10px;
  line-height: 1.4;
}
.dealer-data-table .status-pill::before { flex-shrink: 0; }
.dealer-data-table [data-admin-withdrawal-revealed] {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.dealer-data-table tbody td[data-label]::before { display: none; }

@container dealer-financial-table (max-width: 850px) {
  .dealer-data-table,
  .dealer-data-table tbody {
    display: block;
    width: 100%;
  }
  .dealer-data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .dealer-data-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }
  .dealer-data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 16px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }
  .dealer-data-table tbody tr:hover { background: var(--panel); }
  .dealer-data-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    line-height: 1.45;
  }
  .dealer-data-table tbody td.dealer-cell-wide { grid-column: 1 / -1; }
  .dealer-data-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.4;
    letter-spacing: .035em;
  }
  .dealer-data-table .dealer-cell-primary { font-size: 12px; }
  .dealer-data-table .dealer-cell-amount { font-size: 14px; }
  .dealer-data-table .dealer-cell-meta { font-size: 11px; }
}
@container dealer-financial-table (max-width: 420px) {
  .dealer-data-table tbody { padding: 8px; }
  .dealer-data-table tbody tr { padding: 12px; gap: 11px 12px; }
  .dealer-data-table .dealer-cell-amount { font-size: 13px; }
}

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.modal[tabindex="-1"]:focus {
  outline: none;
}

/* GPTX spreadsheet-style reporting grid: shared by customer, finance, inventory
   and admin reporting lists. It does not restyle forms, marketing or stat cards. */
.table-shell:has(> .table-head) {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-shell:has(> .table-head)::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.table-shell:has(> .table-head) > :is(.table-head, .order-row, .inventory-row, .payment-row) {
  box-sizing: border-box;
  min-height: 41px;
  gap: 0;
  margin: 0;
  padding: 0;
  align-items: stretch;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.table-shell:has(> .table-head) > .table-head {
  min-height: 40px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  color: var(--muted);
  text-transform: none;
  letter-spacing: .012em;
  font-size: 11px;
  font-weight: 670;
}
.table-shell:has(> .table-head) > :is(.table-head, .order-row, .inventory-row, .payment-row) > * {
  box-sizing: border-box;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  overflow-wrap: anywhere;
  align-content: center;
  line-height: 1.4;
}
.table-shell:has(> .table-head) > :is(.table-head, .order-row, .inventory-row, .payment-row) > :last-child {
  border-right: 0;
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row):nth-child(odd) {
  background: color-mix(in srgb, var(--panel) 87%, var(--panel-2));
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row):hover {
  background: var(--panel-2);
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row) .cell-title {
  font-size: 11px;
  line-height: 1.4;
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row) .cell-sub {
  font-size: 10px;
  margin-top: 3px;
  line-height: 1.35;
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row) .amount {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row) .status-pill {
  max-width: 100%;
  overflow-wrap: anywhere;
}
/* Keep every column aligned under its heading rather than collapsing into cards. */
@media (max-width: 820px) {
  .table-shell:has(> .table-head) > .table-head,
  .table-shell:has(> .table-head) > :is(.order-row, .inventory-row, .payment-row) {
    min-width: max(780px, 100%);
  }
  .table-shell:has(> .table-head) > :is(.table-head, .order-row, .inventory-row, .payment-row) > * {
    padding: 9px 11px;
  }
}
