:root {
  color-scheme: light;
  --bg: #eef3f5;
  --panel: #ffffff;
  --panel-2: #f7fafc;
  --text: #17212b;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #0f9f6e;
  --warn: #9a6a00;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0f1417;
  --panel: #171d21;
  --panel-2: #1d252a;
  --text: #edf4f2;
  --muted: #9db0ab;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #3ddc97;
  --warn: #f0c36a;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
}

.login-card h1 {
  font-size: 30px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

.login-card button {
  min-height: 40px;
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.login-brand {
  margin-bottom: 4px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #ff9b9b;
  font-weight: 800;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 268px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
}

.menu {
  display: grid;
  gap: 7px;
}

.menu button,
.preview-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu button.active,
.menu button:hover,
.preview-link:hover {
  color: var(--text);
  border-color: rgba(61, 220, 151, 0.25);
  background: rgba(15, 159, 110, 0.08);
}

.preview-link {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  width: auto;
}

.main {
  margin-left: 268px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--muted);
  background: var(--panel);
  font-weight: 800;
}

.status button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  padding: 16px;
}

.metric-clickable {
  cursor: pointer;
}

.metric-clickable:hover {
  border-color: rgba(15, 159, 110, 0.35);
  background: #f0fdf4;
}

body.theme-dark .metric-clickable:hover {
  border-color: rgba(61, 220, 151, 0.35);
  background: rgba(61, 220, 151, 0.08);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.metric strong {
  font-size: 26px;
}

.panel {
  min-height: 420px;
  padding: 18px;
}

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

.dashboard-card,
.dashboard-panel,
.dashboard-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.dashboard-card {
  display: grid;
  min-height: 92px;
  gap: 6px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-card:hover,
.dashboard-row:hover {
  border-color: rgba(15, 159, 110, 0.35);
  background: rgba(15, 159, 110, 0.08);
}

.dashboard-card span,
.dashboard-card small,
.dashboard-row small {
  color: var(--muted);
  font-weight: 800;
}

.dashboard-card strong {
  font-size: 24px;
}

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

.dashboard-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.overview-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.overview-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.overview-list dt {
  color: var(--muted);
  font-weight: 800;
}

.overview-list dd {
  margin: 0;
  font-weight: 900;
}

.dashboard-row {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-row strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-row span {
  color: var(--accent);
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}

.quick-search {
  display: grid;
  min-width: min(360px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-search input,
.quick-search select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

.toolbar button {
  min-height: 40px;
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: 8px;
  padding: 0 13px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 900;
}

.toolbar button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary {
  color: var(--text) !important;
  border-color: var(--line) !important;
  background: var(--panel-2) !important;
}

.icon-close {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-2);
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.icon-close:hover {
  color: var(--text);
  background: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.danger {
  color: #9f1239 !important;
  border-color: rgba(225, 29, 72, 0.22) !important;
  background: rgba(225, 29, 72, 0.08) !important;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: var(--panel-2);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.table tbody tr:hover {
  background: rgba(15, 159, 110, 0.05);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(240, 195, 106, 0.24);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--warn);
  background: rgba(240, 195, 106, 0.08);
  font-weight: 800;
}

.pill.ok {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
}

.pill.warn {
  color: #a16207;
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.12);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.shop-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.shop-card-head,
.shop-actions,
.shop-badges,
.shop-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-card-head {
  justify-content: space-between;
}

.shop-card small,
.shop-webhook {
  color: var(--muted);
}

.shop-warning {
  padding: 10px 12px;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 14px;
  color: var(--warn);
  background: rgba(234, 179, 8, 0.1);
  font-size: 13px;
  line-height: 1.45;
}

.shop-badges,
.shop-actions {
  flex-wrap: wrap;
}

.shop-edit-row {
  align-items: end;
}

.shop-edit-row input,
.shop-edit-row select,
.shop-card > input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 900;
}

.status-dot.live {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
}

.product-form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-heading,
.form-actions,
.table-heading,
.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.scope-select {
  min-width: 260px;
  max-width: 360px;
}

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

.product-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.product-form input,
.product-form textarea,
.product-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

.product-form input:focus,
.product-form textarea:focus,
.product-form select:focus,
.side-panel input:focus,
.side-panel textarea:focus,
.side-panel select:focus {
  outline: 2px solid rgba(15, 159, 110, 0.2);
  border-color: rgba(15, 159, 110, 0.55);
}

.check-row {
  display: inline-flex !important;
  align-items: center;
  justify-content: start;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  grid-template-columns: none;
  gap: 8px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.inline-form .check-row {
  align-self: end;
  min-height: 42px;
  padding: 0;
}

.inline-form .account-active-toggle {
  width: fit-content;
  min-width: 92px;
}

.check-row input {
  appearance: none;
  flex: 0 0 34px;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.16);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.check-row input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease;
}

.check-row input:checked {
  border-color: rgba(15, 159, 110, 0.35);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 159, 110, 0.12);
}

.check-row input:checked::after {
  transform: translateX(14px);
}

.form-actions {
  justify-content: start;
}

.order-grid {
  grid-template-columns: 1.4fr 1fr 120px 150px;
}

.wallet-grid {
  grid-template-columns: 1fr 160px 180px 1.2fr;
}

.reseller-grid {
  grid-template-columns: 1fr 1fr 150px 180px;
}

.reseller-order-grid {
  grid-template-columns: minmax(220px, 1.4fr) 1fr 120px 1fr;
}

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

.ledger-section {
  margin-top: 18px;
}

.api-result {
  min-height: 120px;
  margin: 4px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #ffffff;
  white-space: pre-wrap;
}

.api-result.compact-result {
  min-height: 72px;
  max-height: 220px;
}

.shop-bank-tools {
  margin-top: -2px;
}

.positive {
  color: var(--accent);
  font-weight: 900;
}

.negative {
  color: #ff9b9b;
  font-weight: 900;
}

.form-actions button,
.row-actions button,
.form-heading button {
  min-height: 36px;
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: 8px;
  padding: 0 12px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.product-form button:not(.icon-close),
.table-wrap button:not(.icon-close),
.side-panel button:not(.icon-close),
.toolbar button:not(.icon-close) {
  min-height: 38px;
  border: 1px solid rgba(61, 220, 151, 0.28);
  border-radius: 10px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.inline-form > .form-submit-button {
  align-self: end;
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(15, 159, 110, 0.28);
  border-radius: 12px;
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #1d9bf0);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 159, 110, 0.14);
}

.inline-form > .form-submit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 159, 110, 0.18);
}

.table-wrap {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-title {
  font-weight: 700;
  color: var(--muted);
  margin-right: 4px;
}

.settings-subhead {
  display: grid;
  gap: 4px;
  margin: 8px 0 4px;
}

.settings-subhead h3,
.settings-subhead p {
  margin: 0;
}

.settings-subhead h3 {
  font-size: 18px;
}

.settings-subhead p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.menu-icon-settings input {
  font-size: 18px;
}

.wide-field {
  grid-column: 1 / -1;
}

.inline-result {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

body.modal-open {
  overflow: hidden;
}

.side-panel[hidden] {
  display: none !important;
}

.side-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  z-index: 20;
  display: grid;
  grid-template-rows: none;
  align-content: start;
  width: min(760px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 48px));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.32);
  transform: translate(-50%, -50%);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.side-panel-head {
  position: sticky;
  top: -18px;
  z-index: 2;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin: -18px -18px 0;
  padding: 18px 18px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.panel-form,
.side-panel label {
  display: grid;
  gap: 8px;
}

.panel-form {
  min-height: 0;
  overflow: visible;
  padding-right: 6px;
}

.panel-form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 4px -6px 0 0;
  padding: 12px 0 0;
  background: var(--panel);
}

.side-panel input,
.side-panel textarea,
.side-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

.side-panel textarea {
  min-height: 120px;
  resize: vertical;
}

#productEditPanel {
  width: min(720px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 48px));
}

.stock-panel {
  width: min(1080px, calc(100vw - 36px));
  max-height: min(840px, calc(100vh - 48px));
  grid-template-rows: none;
}

.stock-panel-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stock-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}

.stock-insights {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62));
}

.stock-insights-head,
.stock-list-head,
.stock-insight-actions,
.stock-filter-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-insights-head {
  justify-content: space-between;
}

.stock-insights-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.stock-insights-head small {
  color: var(--muted);
  font-weight: 800;
}

.stock-insight-actions {
  flex-wrap: wrap;
  justify-content: end;
}

.stock-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) repeat(2, auto);
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.stock-filter-panel[hidden] {
  display: none !important;
}

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

.stock-list-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.stock-live-card {
  border-top: 3px solid var(--accent);
}

.stock-sold-card {
  border-top: 3px solid #ef4444;
}

.stock-list-head {
  justify-content: space-between;
}

.stock-list-card textarea {
  min-height: 150px;
  max-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.stock-table-scroll {
  min-height: 0;
  overflow: auto;
}

.delivery-scroll {
  max-height: min(340px, 42vh);
  overflow: auto;
  white-space: pre;
  overscroll-behavior: contain;
}

.deposit-tier-head,
.deposit-tier-row {
  display: grid;
  grid-template-columns: 160px 120px minmax(160px, 1fr) 90px 72px;
  gap: 8px;
  align-items: center;
}

.deposit-tier-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.deposit-tier-rows {
  display: grid;
  gap: 10px;
}

.deposit-tier-row strong {
  font-size: 16px;
}

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

.product-pick-grid button {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: var(--panel-2);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.product-pick-grid button:hover {
  border-color: var(--accent);
}

.product-pick-grid small {
  color: var(--muted);
}

body.theme-dark .sidebar {
  background: #12191d;
}

body.theme-dark .login-card input,
body.theme-dark .product-form input,
body.theme-dark .product-form textarea,
body.theme-dark .product-form select,
body.theme-dark .quick-search input,
body.theme-dark .quick-search select,
body.theme-dark .api-result,
body.theme-dark .side-panel input,
body.theme-dark .side-panel textarea,
body.theme-dark .side-panel select {
  background: #0f1518;
}

body.theme-dark .danger {
  color: #ffe4e4 !important;
  border-color: rgba(255, 119, 119, 0.24) !important;
  background: rgba(255, 119, 119, 0.15) !important;
}

.table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-chip {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.icon-chip:hover {
  border-color: var(--accent);
  background: rgba(61, 220, 151, 0.12);
}

.category-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.category-thumb {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #ffffff;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.table td code {
  color: var(--accent);
  font-family: Consolas, monospace;
}

.row-actions {
  justify-content: end;
}

@media (max-width: 920px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .preview-link {
    position: static;
    margin-top: 12px;
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .summary {
    grid-template-columns: 1fr;
  }

  .summary {
    display: grid;
  }

  .dashboard-grid,
  .dashboard-panels,
  .stock-panel-forms,
  .stock-list-grid,
  .product-pick-grid,
  .language-grid,
  .deposit-tier-head,
  .deposit-tier-row {
    grid-template-columns: 1fr;
  }

  .stock-insights-head,
  .stock-insight-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-filter-panel {
    grid-template-columns: 1fr;
  }

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

  .form-heading,
  .form-actions,
  .table-heading,
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Premium admin shell */
:root {
  --bg: #eef5f1;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-2: rgba(247, 250, 248, 0.94);
  --panel-3: #f8fbf9;
  --text: #10201a;
  --muted: #62736c;
  --line: rgba(16, 32, 26, 0.1);
  --line-strong: rgba(16, 32, 26, 0.16);
  --accent: #0f9f6e;
  --accent-2: #0891b2;
  --accent-soft: rgba(15, 159, 110, 0.1);
  --success: #0f9f6e;
  --warn: #b7791f;
  --danger-2: #be123c;
  --shadow: 0 18px 48px rgba(16, 32, 26, 0.1);
  --shadow-lg: 0 26px 72px rgba(16, 32, 26, 0.14);
}

body.theme-dark {
  --bg: #101714;
  --panel: rgba(19, 28, 24, 0.92);
  --panel-2: rgba(24, 36, 31, 0.94);
  --panel-3: #18231f;
  --text: #eef8f3;
  --muted: #a1b8ae;
  --line: rgba(238, 248, 243, 0.1);
  --line-strong: rgba(238, 248, 243, 0.16);
  --accent: #3ddc97;
  --accent-2: #22d3ee;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --success: #4ade80;
  --warn: #f0c36a;
  --danger-2: #fb7185;
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 30px 82px rgba(0, 0, 0, 0.42);
}

body.dashboard-body,
body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--panel-3) 100%);
}

.glass,
.metric,
.dashboard-card,
.dashboard-panel,
.dashboard-row,
.login-card,
.sidebar,
.status,
.product-form,
.side-panel,
.stock-card,
.table-wrap,
.empty {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.login-card,
.sidebar,
.status,
.metric,
.dashboard-card,
.dashboard-panel,
.dashboard-row,
.product-form,
.side-panel,
.stock-card,
.table-wrap,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-card {
  width: min(480px, 100%);
  padding: 26px;
}

.login-copy {
  display: grid;
  gap: 6px;
}

.login-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-meta,
.title-row,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.soft-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 900;
}

.sidebar {
  width: 292px;
  padding: 14px;
  background: var(--panel);
}

.sidebar-inner {
  display: grid;
  min-height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.brand-xl {
  margin: 0;
  padding: 6px;
}

.brand > span {
  box-shadow: inset 0 -14px 30px rgba(0, 0, 0, 0.12);
}

.menu {
  align-content: start;
  overflow: auto;
  padding-right: 2px;
}

.menu button,
.preview-link {
  min-height: 48px;
  gap: 10px;
  border-color: transparent;
  border-radius: 8px;
}

.menu button {
  align-items: center;
  padding: 8px 10px;
}

.menu button.active,
.menu button:hover,
.preview-link:hover {
  color: var(--text);
  border-color: rgba(15, 159, 110, 0.25);
  background: var(--accent-soft);
}

.menu-icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--panel-2);
  font-weight: 900;
}

.menu-copy {
  display: grid;
  gap: 2px;
}

.menu-copy strong,
.menu-copy small {
  display: block;
}

.menu-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
}

.preview-link {
  position: static;
  inset: auto;
  justify-content: center;
  width: 100%;
  background: var(--panel-2);
}

.app-main {
  margin-left: 292px;
  padding: 22px;
}

.topbar {
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  position: relative;
  z-index: 1000;
}

.topbar-copy {
  min-width: 0;
}

.title-row {
  flex-wrap: wrap;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(15, 159, 110, 0.22);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--success);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
}

.topbar-actions {
  position: relative;
  justify-content: flex-end;
  flex-wrap: wrap;
  z-index: 1001;
}

.theme-toggle,
.avatar-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--panel-2);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle {
  font-size: 20px;
}

.theme-toggle:hover {
  border-color: rgba(15, 159, 110, 0.32);
  background: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.avatar-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  font-size: 13px;
  font-weight: 900;
}

.avatar-button:hover,
.avatar-button[aria-expanded="true"] {
  color: #ffffff;
  border-color: rgba(15, 159, 110, 0.42);
  background: linear-gradient(135deg, var(--accent), #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.admin-profile {
  position: relative;
  z-index: 1002;
}

.admin-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 5000;
  display: grid;
  min-width: 270px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel);
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.28);
}

.admin-menu-head {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 10px;
}

.admin-menu-head strong {
  color: var(--text);
  font-size: 14px;
}

.admin-menu-head small {
  color: var(--muted);
  font-weight: 800;
}

.admin-menu-logout {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: 10px;
  color: #9f1239;
  background: rgba(225, 29, 72, 0.08);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-align: left;
  padding: 0 12px;
}

.admin-menu-logout:hover {
  border-color: rgba(225, 29, 72, 0.34);
  background: rgba(225, 29, 72, 0.13);
}

.api-key-cell {
  display: grid;
  gap: 6px;
  max-width: 360px;
}

.api-key-cell code {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--accent);
  background: var(--panel-2);
  font-size: 12px;
  line-height: 1.45;
}

.micro-button {
  width: max-content;
  min-height: 28px;
  border: 1px solid rgba(15, 159, 110, 0.25);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: rgba(15, 159, 110, 0.08);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.micro-button:hover {
  border-color: rgba(15, 159, 110, 0.45);
  background: rgba(15, 159, 110, 0.14);
}

body.theme-dark .check-row input:checked {
  background: var(--accent);
}

.status-stack {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.status-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status strong {
  color: var(--text);
  font-size: 13px;
}

.dashboard-summary {
  gap: 10px;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 104px;
  padding: 15px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.metric span {
  letter-spacing: 0.04em;
}

.metric strong {
  font-size: 28px;
}

.metric-clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.content-panel {
  border: 0;
  padding: 0;
  background: transparent;
}

.product-form,
.table-wrap,
.dashboard-card,
.dashboard-panel {
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow: hidden;
}

.table th {
  color: var(--muted);
  letter-spacing: 0.06em;
}

.form-actions button,
.row-actions button,
.form-heading button,
.login-card button {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.form-actions button:hover,
.row-actions button:hover,
.form-heading button:hover,
.login-card button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 159, 110, 0.16);
}

@media (max-width: 1180px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 920px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .sidebar-inner {
    min-height: auto;
  }

  .app-main,
  .main {
    margin-left: 0;
    padding: 16px;
  }
}
