@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-soft: #eef3f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #059669;
  --accent-2: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --danger: #dc2626;
  --warn: #d97706;
  --info: #0284c7;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --sidebar-width: 18rem;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  /* B1 design tokens — spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  /* B1 design tokens — typography scale */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  /* B1 design tokens — elevation */
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #020617;
  --bg-soft: #0f172a;
  --panel: #0f172a;
  --panel-2: #1b2942;
  --panel-3: #243349;
  --text: #f1f5f9;
  --muted: #a8b6cb;
  --line: rgba(148, 163, 184, 0.32);
  --accent: #059669;
  --accent-2: #34d399;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #38bdf8;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.52;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dashboard-body {
  background:
    radial-gradient(circle at 12% 0%, rgba(16, 185, 129, 0.08), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
}

body.theme-dark.dashboard-body {
  background:
    radial-gradient(circle at 15% 0%, rgba(16, 185, 129, 0.11), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(56, 189, 248, 0.08), transparent 32%),
    linear-gradient(180deg, #020617 0%, #020617 100%);
}

body.modal-open,
body.sidebar-open {
  overflow: hidden;
}

[id$="Section"],
#categoryAssetForm,
#bulkProductForm,
#resellerCreditForm,
#resellerPriceRuleForm,
#resellerDepositForm,
#resellerOrderForm,
#shopSettingsForm {
  scroll-margin-top: 88px;
}

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

h1,
h2,
h3,
strong {
  color: var(--text);
}

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

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

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

.glass {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

a {
  color: var(--accent-2);
}

code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

/* Login */
.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(460px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.03em;
}

.login-card > .form-error {
  margin-top: -4px;
}

.login-card label,
.product-form label,
.stock-card label,
.quick-search,
.scope-select,
.topup-filter-bar label,
.stock-filter-panel label,
.check-row {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.login-card input:not([type="checkbox"]),
.product-form input:not([type="checkbox"]),
.product-form textarea,
.product-form select,
.stock-card textarea,
.stock-card input:not([type="checkbox"]),
.stock-card select,
.quick-search input:not([type="checkbox"]),
.quick-search select,
.side-panel input:not([type="checkbox"]),
.side-panel textarea,
.side-panel select,
.topup-filter-bar input:not([type="checkbox"]),
.topup-filter-bar select,
.admin-account-table .compact-control,
.shop-card input:not([type="checkbox"]),
.shop-card select,
.api-result {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-2);
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

select[multiple] {
  background-image: none;
  padding-right: 12px;
}

option {
  color: var(--text);
  background: var(--panel);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(16, 185, 129, 0.52);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.login-card button,
.form-actions button,
.row-actions button,
.form-heading button,
.table-heading button,
.toolbar button,
.product-form button:not(.icon-close),
.table-wrap button:not(.icon-close),
.side-panel button:not(.icon-close),
.button-link,
.action-button,
.form-submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 13px;
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.18);
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-card button:hover,
.form-actions button:hover,
.row-actions button:hover,
.form-heading button:hover,
.table-heading button:hover,
.toolbar button:hover,
.button-link:hover,
.action-button:hover,
.form-submit-button:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #22c55e 0%, #059669 100%);
  box-shadow: 0 16px 34px rgba(5, 150, 105, 0.22);
  filter: saturate(1.04);
}

.login-card button:active,
.form-actions button:active,
.row-actions button:active,
.form-heading button:active,
.table-heading button:active,
.toolbar button:active,
.button-link:active,
.action-button:active,
.form-submit-button:active {
  transform: translateY(0) scale(0.985);
}

.login-card button:focus-visible,
.form-actions button:focus-visible,
.row-actions button:focus-visible,
.form-heading button:focus-visible,
.table-heading button:focus-visible,
.toolbar button:focus-visible,
.button-link:focus-visible,
.action-button:focus-visible,
.form-submit-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.14),
    0 16px 34px rgba(5, 150, 105, 0.18);
}

/* --- Login UI v2: indigo badge + icon inputs + show/hide password --- */
.login-view {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px 30px;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
}

.login-badge {
  justify-self: center;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: linear-gradient(140deg, #818cf8 0%, #6366f1 55%, #4f46e5 100%);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.login-head {
  text-align: center;
  display: grid;
  gap: 4px;
}

.login-head h1 {
  font-size: 26px;
}

.login-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-input {
  position: relative;
  display: block;
}

.login-input .login-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.login-input input {
  padding-left: 40px !important;
}

.login-input input[name="password"] {
  padding-right: 44px !important;
}

.login-card button.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.login-card button.login-eye svg {
  width: 18px;
  height: 18px;
}

.login-card button.login-eye:hover {
  transform: translateY(-50%);
  background: var(--panel-3);
  color: var(--text);
  filter: none;
  box-shadow: none;
}

.login-card button.login-eye.is-on {
  color: #6366f1;
}

.login-card input:focus {
  border-color: rgba(99, 102, 241, 0.55) !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14) !important;
}

.login-card button.login-submit {
  margin-top: 4px;
  border-color: rgba(99, 102, 241, 0.4);
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.28);
}

.login-card button.login-submit:hover {
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
  box-shadow: 0 16px 34px rgba(79, 70, 229, 0.34);
}

@media (max-width: 480px) {
  .login-card {
    padding: 26px 20px;
    border-radius: 24px;
  }
}

.secondary,
button.secondary,
.button-link.secondary-link,
.action-button.secondary {
  color: var(--text) !important;
  border-color: var(--line) !important;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

.danger,
button.danger,
.action-button.danger,
.ghost-danger {
  color: #ffffff !important;
  border-color: rgba(220, 38, 38, 0.28) !important;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.18) !important;
}

/* Chart view/toggle buttons: overview dashboard + per-tab chart toggles.
   Bigger pill buttons; the selected one is filled (indigo) for clear contrast. */
.overview-dashboard-toggle,
.top-products-toggle,
.users-chart-toggle,
.wallet-chart-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-3) 12%);
}

.overview-dashboard-toggle button,
.top-products-toggle button,
.users-chart-toggle button,
.wallet-chart-toggle button {
  padding: 6px 14px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.overview-dashboard-toggle button:hover,
.top-products-toggle button:hover,
.users-chart-toggle button:hover,
.wallet-chart-toggle button:hover {
  color: var(--text) !important;
  background: var(--panel-3) !important;
}

.overview-dashboard-toggle button.active,
.top-products-toggle button.active,
.users-chart-toggle button.active,
.wallet-chart-toggle button.active {
  color: #053527 !important;
  border-color: transparent !important;
  background: #10b981 !important;
  box-shadow: none !important;
}

.action-button.warn {
  color: #78350f !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  background: #fef3c7 !important;
  box-shadow: none !important;
}

.action-button.info,
.avatar-button {
  color: #ffffff !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
  background: #0284c7 !important;
}

.action-button.ok {
  color: #ffffff !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.18) !important;
}

.account-save-button {
  white-space: nowrap;
}

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

.brand,
.brand-xl {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand > span,
.brand-xl > span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: #059669;
  font-weight: 900;
}

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

.brand strong {
  font-size: 16px;
  line-height: 1.1;
}

.brand small {
  color: var(--accent-2);
  font-size: 12px;
}

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

.login-copy p {
  margin: 0;
}

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

.login-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Shell */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: var(--sidebar-width);
  padding: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.sidebar-inner {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 22px 24px;
}

.sidebar-close {
  display: none;
}

.menu {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow-y: auto;
  padding: 16px;
}

.menu button,
.preview-link {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text);
  background: transparent;
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition:
    color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu button:hover,
.preview-link:hover {
  color: var(--text);
  background: var(--panel-3);
  transform: translateX(2px);
}

.menu button.active {
  color: var(--text);
  border-color: rgba(16, 185, 129, 0.34);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: inset 3px 0 0 #10b981;
}

.menu-icon {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 10px;
  color: inherit;
  background: var(--panel-3);
  font-size: 12px;
  font-weight: 900;
}

.menu button.active .menu-icon {
  color: #ffffff;
  background: #059669;
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.22);
}

.menu-icon i {
  font-size: 14px;
  line-height: 1;
}

.menu-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.menu-copy strong,
.menu-copy small {
  display: block;
  overflow: hidden;
  font-family: inherit;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: normal;
}

.menu-copy strong {
  color: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.menu-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.3;
}

.menu button.active .menu-copy small {
  color: var(--text);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  border: 0;
  background: rgba(2, 6, 23, 0.62);
}

.main,
.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 0 32px;
  color: var(--text);
}

.topbar-main,
.title-row,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

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

.topbar-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.eyebrow,
.status-label {
  margin: 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title-row h1,
#pageTitle {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-dot {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0 10px;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.live-dot::before,
.status-dot.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.12);
}

.status {
  display: grid;
  min-width: 210px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 14px;
  background: var(--panel-2);
}

.status-stack {
  align-content: center;
}

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

.theme-toggle,
.mobile-nav-toggle,
.sidebar-close,
.icon-close {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--panel);
  font-size: 20px;
  font-weight: 800;
  box-shadow: none;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-nav-toggle {
  display: none;
}

.theme-toggle:hover,
.mobile-nav-toggle:hover,
.sidebar-close:hover,
.icon-close:hover {
  color: var(--text);
  background: var(--panel-3);
  transform: translateY(-1px);
}

.admin-profile {
  position: relative;
}

.avatar-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 14px;
  padding: 0;
  box-shadow: none;
}

.admin-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  display: grid;
  width: 260px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mobile-quick-dock {
  position: fixed;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 65;
  display: none;
  grid-auto-flow: row;
  gap: 10px;
  pointer-events: none;
}

.mobile-quick-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 20px;
  font-weight: 800;
  pointer-events: auto;
}

.admin-menu-head {
  display: grid;
  gap: 3px;
}

.admin-menu-logout {
  min-height: 38px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 12px;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  font-weight: 800;
}

.summary,
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 32px 32px 0;
}

.content-panel,
.panel {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 24px 32px 56px;
}

/* Wide-screen readability: keep the content compact + centered instead of stretching
   edge-to-edge on large monitors (the topbar stays full-width). */
.summary,
.summary-v2,
.dashboard-summary,
.content-panel,
.overview-chart-card {
  max-width: 1560px;
  margin-left: auto;
  margin-right: auto;
}

.metric,
.dashboard-card,
.dashboard-panel,
.product-form,
.table-wrap,
.shop-card,
.stock-card,
.side-panel,
.empty,
.topup-history-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: none;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

body.theme-dark .metric,
body.theme-dark .dashboard-card,
body.theme-dark .dashboard-panel,
body.theme-dark .product-form,
body.theme-dark .table-wrap,
body.theme-dark .shop-card,
body.theme-dark .stock-card,
body.theme-dark .side-panel,
body.theme-dark .empty,
body.theme-dark .topup-history-panel {
  background: #0f172a;
}

.metric {
  display: grid;
  min-height: 104px;
  align-content: center;
  gap: 8px;
  padding: 18px 20px;
}

.metric span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.product-list-table td { font-variant-numeric: tabular-nums; }

.metric-clickable {
  cursor: pointer;
}

.metric-clickable:hover,
.dashboard-card:hover,
.dashboard-row:hover {
  border-color: rgba(16, 185, 129, 0.36);
  transform: translateY(-1px);
}

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

.dashboard-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 116px;
  align-items: center;
  gap: 16px;
  padding: 20px;
  color: var(--text);
  text-align: left;
}

.dashboard-card-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 16px;
  color: var(--accent-2);
  background: var(--accent-soft);
  font-size: 24px;
  font-weight: 900;
}

.dashboard-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-card-copy > span,
.dashboard-card small,
.dashboard-row small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.dashboard-card strong {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

.dashboard-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dashboard-row {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  color: var(--text);
  background: var(--panel-2);
  text-align: left;
}

.dashboard-row strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

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

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

.overview-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}

.overview-list div:last-child {
  border-bottom: 0;
}

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

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

/* Forms and grids */
.product-form,
.table-wrap,
.stock-card,
.stock-insights {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
}

.form-heading,
.table-heading,
.stock-insights-head,
.stock-list-head,
.shop-card-head,
.shop-actions,
.shop-badges,
.shop-edit-row,
.toolbar,
.table-toolbar,
.filter-toolbar,
.form-actions,
.row-actions,
.stock-insight-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-heading,
.table-heading,
.stock-insights-head,
.shop-card-head {
  justify-content: space-between;
}

.form-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-heading h2,
.table-heading h2,
.dashboard-panel h2,
.stock-insights h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.form-heading p,
.table-heading p,
.settings-subhead p,
.stock-insights-head small {
  margin: 4px 0 0;
  color: var(--muted);
}

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

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

.menu-icon-settings {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-action-label {
  align-self: end;
}

.account-active-toggle {
  min-height: 44px;
  align-self: end;
}

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

.wallet-grid,
.reseller-grid,
.reseller-order-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

.description-card {
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}

.description-card textarea {
  min-height: 168px;
}

.description-grid-panel .description-card textarea {
  min-height: 220px;
}

.inline-form {
  align-items: end;
}

.wide-field {
  grid-column: span 2;
}

.check-row {
  display: inline-flex !important;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  transition:
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.check-row > span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  line-height: 1.2;
}

.check-row input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: inline-block;
  width: 56px;
  height: 30px;
  flex: 0 0 56px;
  min-width: 56px !important;
  min-height: 30px !important;
  margin: 0;
  padding: 0 !important;
  border: 0;
  border-radius: 999px;
  background: #dbe4ef;
  box-sizing: border-box;
  overflow: hidden;
  vertical-align: middle;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.18),
    0 10px 24px rgba(15, 23, 42, 0.08);
  transition:
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.check-row input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.check-row input:checked {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

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

.check-row:hover {
  box-shadow: none;
}

.check-row:hover input {
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.2),
    0 14px 28px rgba(15, 23, 42, 0.1);
}

.check-row input:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.12),
    0 10px 24px rgba(15, 23, 42, 0.08);
}

.compact-check,
.account-toggle {
  align-items: center;
  min-height: 32px;
  gap: 11px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.compact-check input,
.account-toggle input {
  display: block;
  width: 56px;
  height: 30px;
  flex: 0 0 56px;
  border-radius: 999px;
}

.compact-check input::after,
.account-toggle input::after {
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

.compact-check input:checked::after,
.account-toggle input:checked::after {
  transform: translateX(26px);
}

.compact-check span,
.account-toggle span {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  line-height: 1.2;
}

.shop-edit-row .check-row,
.account-status-stack .check-row,
.form-grid .check-row {
  align-self: center;
}

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

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

.api-result {
  min-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
}

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

.api-docs-body {
  min-height: 100vh;
  margin: 0;
  padding: 40px 18px 64px;
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 92%, #020617) 100%);
  color: var(--text);
}

.api-docs-body,
.api-docs-body * {
  box-sizing: border-box;
}

.api-docs-shell {
  display: grid;
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.api-docs-shell-wide {
  width: min(1280px, 100%);
}

.api-docs-shell,
.api-docs-shell-wide,
.api-docs-hero,
.api-docs-card,
.api-hero-copy,
.api-docs-grid,
.api-doc-summary,
.api-doc-summary > div,
.api-flow-grid,
.api-flow-card,
.api-endpoint-card-grid,
.api-endpoint-card-grid-duo,
.api-endpoint-card,
.api-call-card-grid,
.api-call-card {
  min-width: 0;
  max-width: 100%;
}

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

.api-docs-mobile-nav {
  display: none;
}

.api-docs-hero,
.api-docs-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 97%, transparent) 0%, color-mix(in srgb, var(--panel-2) 98%, transparent) 100%);
  box-shadow:
    0 24px 60px rgba(2, 6, 23, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.api-docs-hero {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.api-docs-card {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.api-hero-copy {
  display: grid;
  gap: 12px;
}

.api-hero-copy h1,
.api-section-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-lead {
  margin: 0;
  max-width: 860px;
  color: var(--muted);
  line-height: 1.72;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.api-docs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.api-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.api-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.api-doc-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.api-doc-summary-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.api-doc-summary > div,
.shop-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.api-doc-summary > div {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.api-doc-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.api-doc-summary code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.api-section-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.api-section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.api-step {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

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

.api-flow-card,
.api-endpoint-card,
.api-call-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: color-mix(in srgb, var(--panel-2) 94%, transparent);
}

.api-flow-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
}

.api-flow-card h3,
.api-endpoint-card h3,
.api-call-card h3 {
  margin: 0;
  font-size: 17px;
}

.api-flow-card p,
.api-endpoint-card p,
.api-call-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.api-endpoint-card-grid-duo {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.api-endpoint-card code,
.api-call-card code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.api-call-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.method-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.method-get {
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.method-post {
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.method-patch {
  border: 1px solid rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.api-note {
  border-left: 4px solid rgba(16, 185, 129, 0.52);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(16, 185, 129, 0.08);
  color: var(--muted);
  line-height: 1.72;
}

.api-check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.api-key-cell {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}

.api-key-cell code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.micro-button {
  min-height: 30px !important;
  border-radius: 10px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
}

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

.shop-warning {
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
}

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

.category-thumb {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: cover;
}

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

.icon-chip {
  display: inline-grid !important;
  width: 38px;
  height: 38px;
  min-height: 38px !important;
  place-items: center;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  padding: 0 !important;
  color: var(--text) !important;
  background: var(--panel-2) !important;
  box-shadow: none !important;
}

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

.inline-result {
  display: grid;
  gap: 12px;
}

.filter-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-toolbar .secondary.is-active {
  border-color: #059669 !important;
  color: #ffffff !important;
  background: #10b981 !important;
  font-weight: 700 !important;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35) !important;
}

.product-filter-field {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.product-filter-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 42px 0 14px;
  color: var(--text);
  background-color: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 10px 22px rgba(15, 23, 42, 0.08);
}

.product-pick-grid button {
  display: grid !important;
  min-height: 64px;
  align-content: center;
  justify-content: stretch !important;
  gap: 4px;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  padding: 12px !important;
  color: var(--text) !important;
  background: var(--panel-2) !important;
  text-align: left;
  box-shadow: none !important;
}

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

.shop-bank-tools {
  justify-content: flex-start;
}

/* Tables */
.table-wrap {
  overflow: hidden;
}

.table-shell {
  display: grid;
  max-width: 100%;
  min-width: 0;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.table-shell::-webkit-scrollbar,
.pagination-pages::-webkit-scrollbar {
  height: 10px;
}

.table-shell::-webkit-scrollbar-track,
.pagination-pages::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
}

.table-shell::-webkit-scrollbar-thumb,
.pagination-pages::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.55);
  background-clip: padding-box;
}

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

.stable-table {
  table-layout: fixed;
}

.compact-table {
  min-width: 640px;
}

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

.table th {
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 700;
}

.table tbody tr:hover {
  background: rgba(16, 185, 129, 0.04);
}

.product-table-shell {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  padding-right: 0;
  scroll-padding-inline-end: 0;
  white-space: normal;
  position: relative;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  cursor: auto;
}

.product-table-shell.is-dragging,
.mobile-data-shell.is-dragging {
  cursor: grabbing;
}

.product-horizontal-scroll {
  display: none;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
}

.product-horizontal-scroll-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-horizontal-slider {
  width: 100%;
  min-width: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.product-horizontal-slider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.18);
}

.product-horizontal-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -9px;
  border: 2px solid #ecfdf5;
  border-radius: 50%;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 18px rgba(5, 150, 105, 0.22);
}

.product-horizontal-slider::-moz-range-track {
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.18);
}

.product-horizontal-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid #ecfdf5;
  border-radius: 50%;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 18px rgba(5, 150, 105, 0.22);
}

.product-list-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.product-list-table th:nth-child(1),
.product-list-table td:nth-child(1) {
  width: 6%;
}

.product-list-table th:nth-child(2),
.product-list-table td:nth-child(2) {
  width: 16%;
}

.product-list-table th:nth-child(3),
.product-list-table td:nth-child(3) {
  width: 12%;
}

.product-list-table th:nth-child(4),
.product-list-table td:nth-child(4) {
  width: 9%;
}

.product-list-table th:nth-child(5),
.product-list-table td:nth-child(5) {
  width: 5%;
}

.product-list-table th:nth-child(6),
.product-list-table td:nth-child(6) {
  width: 8%;
}

.product-list-table th:nth-child(7),
.product-list-table td:nth-child(7) {
  width: 8%;
}

.product-list-table th:nth-child(8),
.product-list-table td:nth-child(8) {
  width: 8%;
}

.product-list-table th:nth-child(9),
.product-list-table td:nth-child(9) {
  width: 28%;
}

.product-list-table td.row-actions {
  display: table-cell !important;
  min-width: 0;
  vertical-align: middle;
}

.product-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.product-list-table td.row-actions button,
.product-action-grid button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  white-space: nowrap;
}

.table td,
.table code,
.table small,
.cell-stack {
  min-width: 0;
}

.cell-stack {
  display: grid;
  gap: 4px;
}

.cell-stack strong,
.cell-stack code,
.cell-stack span,
.cell-stack small {
  overflow-wrap: anywhere;
}

.table-badge,
.pill,
.status-pill,
.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.status-dot-mini {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

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

.warn,
.pill.warn,
.status-pill.warn,
.table-badge.warn {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
}

.danger,
.pill.danger,
.status-pill.danger,
.table-badge.danger {
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.32);
  background: rgba(225, 29, 72, 0.1);
}

.info,
.pill.info,
.status-pill.info,
.table-badge.info {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.32);
  background: rgba(14, 165, 233, 0.1);
}

.neutral,
.pill.neutral,
.status-pill.neutral,
.table-badge.neutral {
  color: var(--muted);
}

.positive {
  color: #059669;
}

.negative,
.blocked {
  color: #dc2626;
}

.compact-actions,
.ticket-actions {
  flex-wrap: wrap;
}

/* AW-7 (2026-07-10): action cells were wrapping buttons onto a 2nd line while the row still had
   free space (users "Chặn mua", token icon rows). On desktop the actions column now keeps ONE
   line at its intrinsic width — width:1% + nowrap makes the table hand the remaining space to
   the text columns instead; an over-wide table scrolls inside .table-shell. The ≤920px card
   layout below overrides these with its own grid. */
@media (min-width: 921px) {
  .row-actions {
    flex-wrap: nowrap;
  }

  .table td.row-actions {
    width: 1%;
    white-space: nowrap;
  }
}

.compact-actions button,
.compact-actions .table-badge {
  flex: 1 1 112px;
}

.button-mark {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.pagination-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.pagination-controls,
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.pagination-pages {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

.page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.page-size-label select {
  min-width: 78px;
  min-height: 34px;
  border-color: transparent;
  border-radius: 12px;
  padding: 0 34px 0 12px;
  background-color: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.page-button,
.pagination-gap {
  flex: 0 0 auto;
  white-space: nowrap;
}

.page-button {
  min-width: 38px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line);
  background: var(--panel-3);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.page-button.active {
  color: #ffffff;
  border-color: rgba(16, 185, 129, 0.42);
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 12px 24px rgba(5, 150, 105, 0.2);
}

.page-button:disabled {
  opacity: 0.42;
  box-shadow: none;
}

.pagination-gap {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
}

/* Wallet/top-up */
.wallet-balance-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.wallet-currency-pill {
  min-width: 78px;
}

.wallet-currency-pill.usdt {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.1);
}

.wallet-locks {
  display: grid;
  gap: 4px;
}

.topup-filter-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, 0.8fr) minmax(220px, 1.4fr) minmax(120px, 0.8fr);
  gap: 10px;
  align-items: end;
}

.topup-history-panel .table-shell {
  overflow-x: scroll;
  padding-bottom: 10px;
}

.topup-history-table {
  min-width: 1040px !important;
  table-layout: fixed;
}

.topup-history-table th:nth-child(1),
.topup-history-table td:nth-child(1) {
  width: 170px;
}

.topup-history-table th:nth-child(2),
.topup-history-table td:nth-child(2) {
  width: 220px;
}

.topup-history-table th:nth-child(3),
.topup-history-table td:nth-child(3),
.topup-history-table th:nth-child(4),
.topup-history-table td:nth-child(4) {
  width: 160px;
}

.topup-history-table th:nth-child(5),
.topup-history-table td:nth-child(5) {
  width: 170px;
  overflow: visible;
}

.topup-history-table th:nth-child(6),
.topup-history-table td:nth-child(6) {
  width: 180px;
}

.topup-status-menu {
  display: grid;
  width: max-content;
  max-width: 100%;
  gap: 7px;
}

.topup-status-menu summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.topup-status-menu summary::-webkit-details-marker {
  display: none;
}

.topup-status-menu .status-pill {
  gap: 6px;
  min-width: 124px;
  white-space: nowrap;
}

.topup-menu-caret {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-weight: 900;
}

.topup-status-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topup-status-option {
  min-height: 30px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 999px;
  padding: 0 12px;
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.topup-status-option.warn {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
}

/* Stock and side panels */
.side-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 120;
  display: grid;
  width: min(900px, calc(100vw - 36px));
  max-height: min(860px, calc(100dvh - 48px));
  gap: 16px;
  overflow-y: auto;
  padding: 20px;
  transform: translate(-50%, -50%);
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.36);
}

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

.side-panel-head h2 {
  margin: 0;
}

.panel-form {
  display: grid;
  gap: 14px;
}

.stock-panel {
  width: min(1120px, calc(100vw - 36px));
}

.stock-insights {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-2);
}

.stock-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) repeat(2, auto);
  gap: 10px;
  align-items: end;
}

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

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

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

.stock-list-card textarea {
  min-height: 160px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

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

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

.deposit-tier-head,
.deposit-tier-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 0.7fr) minmax(110px, auto) auto auto;
  gap: 10px;
  align-items: center;
}

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

.deposit-tier-row > strong {
  min-width: 110px;
  justify-self: end;
  text-align: right;
}

.deposit-tier-row .check-row {
  justify-self: end;
}

.deposit-tier-row [data-remove-tier] {
  min-width: 74px;
  min-height: 34px;
  justify-self: end;
  border-radius: 10px !important;
  padding: 0 12px !important;
  box-shadow: none !important;
}

.settings-row-builder {
  display: grid;
  gap: 10px;
}

.reward-tier-head,
.reward-tier-row {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.7fr) minmax(120px, auto) auto auto;
}

.reward-tier-row [data-remove-dice-reward],
.spin-segment-row [data-remove-spin-segment] {
  min-width: 74px;
  min-height: 34px;
  justify-self: end;
  border-radius: 10px !important;
  padding: 0 12px !important;
  box-shadow: none !important;
}

.spin-segment-head,
.spin-segment-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(92px, 0.55fr) minmax(130px, 0.8fr) minmax(92px, 0.55fr) minmax(220px, 1.4fr) auto;
  gap: 10px;
  align-items: center;
}

.spin-segment-rows {
  display: grid;
  gap: 10px;
}

.spin-segment-row > strong {
  min-width: 220px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.reward-tier-row > strong {
  min-width: 120px;
}

/* Admin accounts */
.admin-account-table {
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0 14px;
}

.admin-account-table td {
  vertical-align: top;
  padding-top: 16px;
  padding-bottom: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.admin-account-table th {
  padding-top: 0;
  padding-bottom: 12px;
  background: transparent;
}

.admin-account-table td:first-child {
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  padding-left: 14px;
}

.admin-account-table td:last-child {
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
  padding-right: 14px;
}

.admin-account-table .compact-control {
  display: block;
  width: 100% !important;
  min-height: 44px !important;
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;
  -webkit-border-radius: 18px !important;
  -moz-border-radius: 18px !important;
  clip-path: inset(0 round 18px);
  overflow: hidden;
  padding: 10px 16px !important;
  color: var(--text) !important;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel) 100%) !important;
  font-size: 13px;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 24px rgba(15, 23, 42, 0.04) !important;
  transition:
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-account-table select.compact-control {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  padding-right: 44px !important;
  border-radius: 18px !important;
  -webkit-border-radius: 18px !important;
  -moz-border-radius: 18px !important;
  background-color: #ffffff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(15, 23, 42, 0.04) !important;
}

.admin-account-table .compact-control,
.admin-account-table select.compact-control {
  background-clip: padding-box;
}

.admin-account-table .compact-control:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.42) !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1) !important;
}

.admin-account-table input.compact-control,
.admin-account-table select.compact-control {
  border-radius: 18px !important;
  -webkit-border-radius: 18px !important;
  -moz-border-radius: 18px !important;
}

.admin-account-table .account-edit-stack small,
.admin-account-table td > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.account-edit-stack,
.account-status-stack {
  display: grid;
  gap: 8px;
}

.account-status-stack {
  align-items: start;
}

.account-toggle,
.compact-check {
  width: fit-content;
  min-height: auto;
  gap: 11px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.account-toggle input,
.compact-check input {
  display: inline-block;
  width: 56px;
  height: 30px;
  flex: 0 0 56px;
  margin: 0;
  border-radius: 999px;
  box-sizing: border-box;
  overflow: hidden;
  vertical-align: middle;
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #dbe4ef;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.98),
    0 10px 26px rgba(15, 23, 42, 0.08);
}

.account-toggle input::after,
.compact-check input::after {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.account-toggle input:checked,
.compact-check input:checked {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.account-toggle input:checked::after,
.compact-check input:checked::after {
  transform: translateX(26px);
}

.account-toggle:hover,
.compact-check:hover {
  transform: none;
}

.account-toggle:hover input,
.compact-check:hover input {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.98),
    0 14px 30px rgba(15, 23, 42, 0.1);
}

/* Mobile */
@media (max-width: 1280px) {
  .summary,
  .dashboard-summary,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .wallet-grid,
  .reseller-grid,
  .reseller-order-grid,
  .language-grid,
  .description-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  :root {
    --sidebar-width: 18rem;
  }

  html,
  body {
    overflow-x: hidden;
  }

  .sidebar {
    top: 8px;
    bottom: 8px;
    left: 8px;
    inset: 8px auto 8px 8px;
    width: min(360px, calc(100vw - 16px));
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.28);
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .sidebar-inner {
    min-height: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: inherit;
    overflow: hidden;
  }

  .sidebar-head {
    padding: 18px 18px 16px;
  }

  .menu {
    padding: 12px;
  }

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

  .sidebar-close,
  .mobile-nav-toggle {
    display: inline-grid;
  }

  .main,
  .app-main {
    margin-left: 0;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 6px 10px;
    min-height: auto;
    margin: 8px 8px 0;
    padding: 10px 12px 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  }

  .topbar-main,
  .topbar-actions {
    width: auto;
  }

  .topbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: flex-start;
    align-self: start;
  }

  .topbar-main {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .topbar-copy {
    gap: 3px;
    text-align: left;
    align-items: start;
  }

  .theme-toggle,
  .mobile-nav-toggle,
  .sidebar-close,
  .avatar-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 11px;
  }

  .mobile-nav-toggle {
    margin-top: 0;
    flex: 0 0 36px;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
    line-height: 1;
  }

  .title-row {
    justify-content: flex-start;
    gap: 7px;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .summary,
  .dashboard-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 8px 0;
    max-height: none;
    overflow: visible;
  }

  .content-panel,
  .panel {
    padding: 14px 8px 112px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .dashboard-grid,
  .dashboard-panels,
  .shop-grid,
  .stock-panel-forms,
  .stock-list-grid,
  .product-pick-grid,
  .api-doc-summary,
  .form-grid,
  .wallet-grid,
  .reseller-grid,
  .reseller-order-grid,
  .language-grid,
  .stock-filter-panel,
  .deposit-tier-head,
  .deposit-tier-row {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 92px;
    padding: 15px;
    border-radius: 20px;
  }

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

  .dashboard-card,
  .dashboard-panel,
  .product-form,
  .table-wrap,
  .shop-card,
  .stock-card {
    border-radius: 22px;
    padding: 15px;
  }

  .dashboard-grid,
  .dashboard-panels,
  .shop-grid,
  .stock-panel-forms,
  .stock-list-grid {
    gap: 12px;
    margin-bottom: 12px;
  }

  .form-heading,
  .table-heading,
  .stock-insights-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-heading h2,
  .table-heading h2,
  .dashboard-panel h2,
  .stock-insights h2 {
    font-size: 20px;
  }

  .dashboard-row,
  .overview-list div {
    border-radius: 14px;
  }

  .filter-toolbar {
    flex-wrap: wrap;
  }

  .toolbar,
  .table-toolbar,
  .filter-toolbar,
  .form-actions,
  .row-actions,
  .stock-insight-actions {
    gap: 8px;
  }

  .form-actions button,
  .toolbar button,
  .table-toolbar button {
    flex: 1 1 180px;
  }

  .table.responsive-table:not(.topup-history-table) {
    display: block;
    min-width: 0;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) thead {
    display: none;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) tbody {
    display: grid;
    gap: 10px;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) tr {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td {
    display: grid;
    grid-template-columns: minmax(104px, 34%) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.row-actions,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.ticket-actions {
    /* AW-7: auto-fit packs 3+ small/icon buttons per row on mobile (was a fixed 2-col grid
       that stretched icon buttons and stacked extra rows). */
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.row-actions::before,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.ticket-actions::before {
    grid-column: 1 / -1;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.row-actions > button,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.row-actions > .table-badge,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.ticket-actions > button,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.ticket-actions > .table-badge {
    width: 100%;
    min-width: 0;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td:last-child {
    border-bottom: 0;
  }

  .table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    isolation: isolate;
    /* .table-wrap is a single-column grid. Without an explicit track it grows
       to the widest child's min-content (e.g. a table forced to min-width 680px),
       overflowing the wrap and CLIPPING the heading / action buttons on mobile.
       Cap the track to the container so children stay within the viewport and
       the inner scroll shell handles horizontal scrolling instead. */
    grid-template-columns: minmax(0, 1fr);
  }

  /* Search box inside a column-flipped .table-heading: its `flex: 0 1 260px`
     basis maps to the MAIN axis, which is vertical once the heading is column,
     so the input ballooned to 260px tall. Reset the basis to auto so the 34px
     height applies and the input stretches to full width via align-items. */
  .table-heading .table-search {
    flex: 0 0 auto;
  }

  /* A shell carrying a horizontal-scroll table that does NOT stack into cards
     must scroll on the x-axis. .mobile-stack-shell forces overflow:visible
     (correct only for stacked-card tables), which clipped scroll-only tables
     and made their off-screen columns unreachable. Restore auto for that case. */
  .table-shell:has(.mobile-scroll-table:not(.mobile-stack-table)) {
    overflow-x: auto !important;
  }

  .mobile-data-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: min(58vh, 520px);
    overflow: auto;
    overscroll-behavior: contain;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    touch-action: auto;
    padding-bottom: 6px;
  }

  .mobile-data-shell .table.mobile-scroll-table {
    display: table !important;
    width: max-content !important;
    min-width: max(680px, 100%) !important;
    max-width: none !important;
  }

  .mobile-data-shell .admin-account-table {
    min-width: 720px !important;
  }

  .mobile-data-shell .stable-table {
    min-width: 700px !important;
  }

  .product-horizontal-scroll {
    display: none !important;
  }

  .mobile-data-shell .table.mobile-scroll-table thead {
    display: table-header-group !important;
  }

  .mobile-data-shell .table.mobile-scroll-table tbody {
    display: table-row-group !important;
  }

  .mobile-data-shell .table.mobile-scroll-table tr {
    display: table-row !important;
  }

  .mobile-data-shell .table.mobile-scroll-table td,
  .mobile-data-shell .table.mobile-scroll-table th {
    display: table-cell !important;
    white-space: normal;
  }

  .mobile-data-shell .table.mobile-scroll-table td::before {
    display: none !important;
    content: none !important;
  }

  .topup-history-table.responsive-table {
    display: table !important;
    min-width: 1040px !important;
  }

  .topup-history-table.responsive-table thead {
    display: table-header-group !important;
  }

  .topup-history-table.responsive-table tbody {
    display: table-row-group !important;
  }

  .topup-history-table.responsive-table tr {
    display: table-row !important;
  }

  .topup-history-table.responsive-table td,
  .topup-history-table.responsive-table th {
    display: table-cell !important;
  }

  .topup-history-table.responsive-table td::before {
    display: none !important;
  }

  .product-table-shell {
    overflow: visible;
    padding-bottom: 0;
  }

  .product-table-shell .table.product-list-table.responsive-table {
    min-width: 0 !important;
    table-layout: auto;
  }

  .product-table-shell .table.product-list-table.responsive-table thead {
    display: none;
  }

  .product-table-shell .table.product-list-table.responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .product-table-shell .table.product-list-table.responsive-table tr {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
  }

  .product-table-shell .table.product-list-table.responsive-table td {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: auto !important;
    min-width: 0 !important;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .product-table-shell .table.product-list-table.responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .product-table-shell .table.product-list-table.responsive-table td:last-child {
    border-bottom: 0;
  }

  .product-table-shell .table.product-list-table.responsive-table td.row-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .product-table-shell .table.product-list-table.responsive-table td.row-actions::before {
    grid-column: 1 / -1;
  }

  .product-table-shell .table.product-list-table.responsive-table .product-action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 6px;
  }

  .product-table-shell .table.product-list-table.responsive-table td.row-actions button {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 13px;
  }

  .product-filter-toolbar-mobile {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .product-mobile-list {
    display: grid;
    gap: 12px;
    padding-bottom: 8px;
  }

  .product-mobile-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    overflow: hidden;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
  }

  .product-mobile-head,
  .product-mobile-title,
  .product-mobile-metrics,
  .product-mobile-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .product-mobile-head,
  .product-mobile-title,
  .product-mobile-metrics {
    padding-top: 12px;
  }

  .product-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .product-mobile-code {
    display: grid;
    gap: 5px;
  }

  .product-mobile-code code {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.01em;
  }

  .product-mobile-code.compact small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .product-mobile-title {
    display: grid;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .product-mobile-title strong {
    font-size: 18px;
    line-height: 1.25;
  }

  .product-mobile-title small {
    color: var(--muted);
    line-height: 1.35;
  }

  .product-mobile-metrics span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .product-mobile-metrics strong {
    overflow-wrap: anywhere;
    font-size: 15px;
    line-height: 1.3;
  }

  .product-mobile-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .product-mobile-metrics > div {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 9px 10px;
    background: var(--panel-2);
  }

  .product-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 0;
    padding-bottom: 14px;
  }

  .product-mobile-actions button {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 800;
  }

  .mobile-stack-shell {
    overflow: visible !important;
    max-height: none !important;
    padding-bottom: 0 !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table thead {
    display: none !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table tbody {
    display: grid !important;
    gap: 12px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table tr {
    display: grid !important;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td {
    display: grid !important;
    grid-template-columns: minmax(96px, 32%) minmax(0, 1fr);
    gap: 10px;
    width: auto !important;
    min-width: 0 !important;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    white-space: normal !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td::before {
    display: block !important;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td:last-child {
    border-bottom: 0;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.row-actions,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.ticket-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.row-actions::before,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.ticket-actions::before {
    grid-column: 1 / -1;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.row-actions > button,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.row-actions > .table-badge,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.ticket-actions > button,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table td.ticket-actions > .table-badge {
    width: 100%;
    min-width: 0;
    min-height: 36px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.mobile-stack-single td:not(.row-actions):not(.ticket-actions) {
    grid-template-columns: 1fr;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.mobile-stack-single td::before {
    margin-bottom: 2px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.admin-account-table {
    border-spacing: 0;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.admin-account-table td {
    background: transparent;
    padding-left: 12px !important;
    padding-right: 12px !important;
    border-radius: 0 !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.admin-account-table td:first-child,
  .mobile-stack-shell .table.responsive-table.mobile-stack-table.admin-account-table td:last-child {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table.topup-history-table {
    min-width: 0 !important;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table tbody,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table tbody {
    gap: 10px;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table tr,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table tr {
    border-radius: 18px;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table td,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table td {
    padding: 9px 11px;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack {
    gap: 3px;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack strong,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack strong {
    font-size: 14px;
    line-height: 1.3;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack small,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table .cell-stack small {
    font-size: 11px;
    line-height: 1.35;
  }

  .order-mobile-shell .compact-actions,
  .wallet-mobile-shell .compact-actions {
    gap: 6px;
  }

  .order-mobile-shell .compact-actions button,
  .order-mobile-shell .compact-actions .table-badge,
  .wallet-mobile-shell .compact-actions button,
  .wallet-mobile-shell .compact-actions .table-badge {
    min-height: 34px;
    font-size: 12.5px;
  }

  .wallet-mobile-shell .wallet-balance-cell {
    grid-template-columns: 1fr;
    gap: 6px;
    justify-items: start;
  }

  .wallet-mobile-shell .wallet-currency-pill {
    min-width: 0;
    width: fit-content;
  }

  .wallet-mobile-shell .wallet-locks span {
    font-size: 13px;
    line-height: 1.35;
  }

  .pagination-bar,
  .pagination-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .side-panel {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .mobile-quick-dock {
    display: grid;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .summary,
  .dashboard-summary {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .title-row h1,
  #pageTitle {
    font-size: 18px;
    line-height: 1.06;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

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

  .title-row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .topbar-main {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    margin: 8px 8px 0;
    padding: 9px 10px 10px;
    border-radius: 18px;
  }

  .live-dot {
    min-height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }

  .admin-menu {
    right: -4px;
    width: min(260px, calc(100vw - 24px));
  }

  .theme-toggle,
  .mobile-nav-toggle,
  .sidebar-close,
  .avatar-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: 10px;
  }

  .mobile-quick-dock {
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    gap: 8px;
  }

  .mobile-quick-button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 18px;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td:not(.row-actions):not(.ticket-actions) {
    grid-template-columns: 1fr;
  }

  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.row-actions,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td.ticket-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pagination-bar {
    gap: 10px;
  }

  .page-size-label,
  .pagination-pages {
    width: 100%;
  }

  .pagination-pages {
    justify-content: flex-start;
  }

  .content-panel,
  .panel {
    padding: 12px 8px 108px;
  }

  .description-grid,
  .reward-tier-head,
  .reward-tier-row,
  .spin-segment-head,
  .spin-segment-row {
    grid-template-columns: 1fr;
  }

  .reward-tier-head,
  .spin-segment-head {
    display: none;
  }

  .reward-tier-row,
  .spin-segment-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
  }

  .reward-tier-row > strong,
  .spin-segment-row > strong,
  .reward-tier-row [data-remove-dice-reward],
  .spin-segment-row [data-remove-spin-segment] {
    justify-self: stretch;
    min-width: 0;
    text-align: left;
  }

  .dashboard-card,
  .dashboard-panel,
  .product-form,
  .table-wrap,
  .shop-card,
  .stock-card,
  .side-panel,
  .empty,
  .topup-history-panel {
    border-radius: 18px;
    padding: 13px;
  }

  .metric {
    min-height: 84px;
    padding: 14px;
  }

  .metric span {
    font-size: 12px;
  }

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

  .form-grid,
  .wallet-grid,
  .reseller-grid,
  .reseller-order-grid,
  .language-grid,
  .ticket-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .table-toolbar,
  .filter-toolbar,
  .form-actions,
  .row-actions,
  .stock-insight-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar > *,
  .table-toolbar > *,
  .filter-toolbar > *,
  .form-actions > *,
  .row-actions > *,
  .stock-insight-actions > * {
    width: 100%;
  }

  .form-actions button,
  .row-actions button,
  .form-heading button,
  .table-heading button,
  .toolbar button,
  .table-toolbar button,
  .product-form button:not(.icon-close),
  .table-wrap button:not(.icon-close),
  .side-panel button:not(.icon-close),
  .action-button,
  .form-submit-button {
    flex: 0 0 auto !important;
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td,
  .table.responsive-table:not(.topup-history-table):not(.mobile-scroll-table) td:not(.row-actions):not(.ticket-actions) {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mobile-stack-shell .table.responsive-table.mobile-stack-table td::before {
    margin-bottom: 0;
  }

  .product-mobile-card {
    gap: 9px;
  }

  .product-mobile-head,
  .product-mobile-title,
  .product-mobile-metrics,
  .product-mobile-actions {
    padding-left: 12px;
    padding-right: 12px;
  }

  .product-mobile-head,
  .product-mobile-title,
  .product-mobile-metrics {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .product-mobile-title strong {
    font-size: 17px;
  }

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

  .product-mobile-actions {
    grid-template-columns: 1fr 1fr;
    padding-bottom: 12px;
  }

  .product-mobile-actions button {
    min-height: 36px;
  }

  .order-mobile-shell .table.responsive-table.mobile-stack-table td.row-actions,
  .wallet-mobile-shell .table.responsive-table.mobile-stack-table td.row-actions {
    grid-template-columns: 1fr;
  }

  .admin-menu {
    right: -2px;
    width: min(280px, calc(100vw - 20px));
  }
}

@media (max-width: 1100px) {
  .api-doc-summary-4,
  .api-flow-grid,
  .api-endpoint-card-grid,
  .api-endpoint-card-grid-duo,
  .api-call-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .api-docs-body {
    padding: 12px 8px 24px;
    overflow-x: hidden;
  }

  .api-docs-shell,
  .api-docs-shell-wide {
    gap: 12px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .api-docs-hero,
  .api-docs-card {
    padding: 14px 12px;
    border-radius: 18px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .api-docs-mobile-nav {
    position: sticky;
    top: 8px;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0 0 4px;
    margin-top: -2px;
  }

  .api-docs-mobile-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    line-height: 1.35;
    white-space: normal;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  .api-docs-hero-actions {
    display: none;
  }

  .api-doc-summary-4,
  .api-flow-grid,
  .api-endpoint-card-grid,
  .api-endpoint-card-grid-duo,
  .api-call-card-grid {
    grid-template-columns: 1fr;
  }

  .api-doc-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .api-docs-grid {
    grid-template-columns: 1fr;
  }

  .api-section-title {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .api-step {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }

  .hero-lead {
    max-width: none;
    font-size: 13px;
    line-height: 1.62;
  }

  .api-hero-copy h1 {
    font-size: 28px;
    line-height: 1.18;
  }

  .api-chip-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .api-chip {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 8px 12px;
    line-height: 1.35;
  }

  .api-flow-card,
  .api-endpoint-card,
  .api-call-card {
    padding: 14px 12px;
    gap: 8px;
    border-radius: 18px;
  }

  .api-doc-summary > div {
    padding: 14px 12px;
  }

  .api-endpoint-card code,
  .api-call-card code,
  .api-doc-summary code {
    font-size: 11.5px;
    line-height: 1.6;
  }

  .api-result {
    min-height: 0;
    max-height: none;
    padding: 12px;
    border-radius: 16px;
    font-size: 11.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .compact-result {
    min-height: 0;
    max-height: none;
  }

  .api-chip-row {
    gap: 8px;
  }

  .api-flow-number {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .api-flow-card h3,
  .api-endpoint-card h3,
  .api-call-card h3,
  .api-section-title h2 {
    font-size: 18px;
  }

  .api-note,
  .api-section-title p,
  .api-flow-card p,
  .api-endpoint-card p,
  .api-call-card p {
    font-size: 13px;
    line-height: 1.62;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .api-docs-mobile-nav {
    grid-template-columns: 1fr 1fr;
  }

  .api-docs-mobile-link {
    font-size: 10.5px;
    padding: 8px 8px;
  }

  .api-hero-copy h1 {
    font-size: 24px;
  }

  .api-docs-body {
    padding-left: 8px;
    padding-right: 8px;
  }

  .hero-lead,
  .api-note,
  .api-section-title p,
  .api-flow-card p,
  .api-endpoint-card p,
  .api-call-card p {
    font-size: 12.5px;
    line-height: 1.58;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.api-docs-body,
.api-docs-shell,
.api-docs-shell-wide,
.api-docs-card,
.api-docs-hero,
.api-doc-summary,
.api-doc-summary > div,
.api-docs-grid,
.api-endpoint-card-grid,
.api-endpoint-card,
.api-flow-grid,
.api-flow-card,
.api-call-card-grid,
.api-call-card,
.api-chip-row,
.api-chip,
.api-result,
.api-note,
.api-section-title,
.api-section-title h2,
.api-section-title p,
.api-hero-copy,
.api-hero-copy h1,
.hero-lead {
  min-width: 0;
  max-width: 100%;
}

.api-hero-copy h1,
.hero-lead,
.api-note,
.api-section-title p,
.api-flow-card p,
.api-endpoint-card p,
.api-call-card p,
.api-doc-summary code,
.api-endpoint-card code,
.api-call-card code,
.api-result {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.api-doc-summary code,
.api-endpoint-card code,
.api-call-card code {
  white-space: normal;
}

.settings-security-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(320px, 1fr);
  gap: 14px;
}

.settings-security-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--panel-soft);
  display: grid;
  gap: 12px;
  align-content: start;
}

.settings-security-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.twofactor-setup-block,
.twofactor-disable-block {
  display: grid;
  gap: 10px;
}

.twofactor-disable-block {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.twofactor-setup-intro {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.twofactor-qr {
  width: 150px;
  max-width: 100%;
  border-radius: 14px;
  background: #ffffff;
  padding: 8px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.compact-empty {
  min-height: 0;
  padding: 18px;
  text-align: left;
}

.settings-game-stack {
  display: grid;
  gap: 18px;
  margin: 14px 0 6px;
}

.settings-overview-cards,
.guide-editor-section,
.guide-editor-rows {
  display: grid;
  gap: 12px;
}

.settings-overview-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-overview-cards article,
.guide-editor-note,
.guide-editor-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 86%, var(--panel-2) 14%);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
}

.settings-overview-cards article {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.settings-overview-cards span,
.guide-editor-note span {
  color: var(--muted);
}

.legacy-import-summary code,
.legacy-import-note code {
  font-size: 0.94em;
}

.legacy-import-grid small {
  color: var(--muted);
}

.legacy-file-drop {
  border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.legacy-file-drop.is-drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  transform: translateY(-1px);
}

.legacy-drop-hint {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.legacy-import-options {
  align-items: center;
}

.legacy-import-note {
  gap: 8px;
}

.legacy-import-result {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
}

.settings-overview-cards strong {
  color: var(--text);
  font-size: 17px;
}

.settings-guard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 90%, #f8fafc 10%);
}

.settings-guard strong,
.settings-guard span {
  display: block;
}

.settings-guard strong {
  color: var(--text);
  margin-bottom: 4px;
}

.settings-guard span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-guard.is-locked {
  border-color: rgba(245, 158, 11, 0.26);
  background: rgba(245, 158, 11, 0.08);
}

.settings-guard.is-unlocked {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

[data-sensitive-setting][disabled],
[data-sensitive-action][disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}

.metric-value-default {
  display: block;
}

.metric-value-compact {
  display: block;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.03em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.metric-value-time {
  font-variant-numeric: tabular-nums;
}

.guide-editor-form {
  gap: 18px;
}

.guide-full-editor {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--accent-soft) 80%, transparent) 0, transparent 32%),
    color-mix(in srgb, var(--panel) 92%, var(--panel-2) 8%);
}

.guide-full-editor textarea {
  min-height: 460px;
  resize: vertical;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
}

.guide-editor-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--panel) 30%);
}

.guide-editor-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.guide-editor-toggle strong {
  display: block;
  color: var(--text);
}

.guide-editor-toggle span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.guide-editor-note {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
  border-color: rgba(20, 184, 166, 0.22);
  background: color-mix(in srgb, var(--accent-soft) 68%, var(--panel) 32%);
}

.guide-editor-section {
  padding-top: 4px;
}

.guide-editor-head,
.guide-editor-row {
  display: grid;
  gap: 10px;
  align-items: center;
}

.guide-command-head,
.guide-command-row {
  grid-template-columns: minmax(92px, 0.55fr) minmax(140px, 0.9fr) minmax(220px, 1.5fr) auto;
}

.guide-editor-head {
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.guide-editor-row {
  padding: 12px;
}

.guide-block-row {
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr) minmax(220px, 1fr) minmax(160px, 0.8fr) auto;
  align-items: end;
}

.settings-game-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, transparent) 0%, color-mix(in srgb, var(--panel-2) 96%, transparent) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 36px rgba(15, 23, 42, 0.05);
}

.settings-game-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-game-head h3 {
  margin: 10px 0 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.settings-game-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 760px;
}

.settings-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.settings-inline-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent);
}

.settings-inline-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
}

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

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

.settings-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.settings-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-parse-summary {
  min-width: min(360px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel-2) 95%, transparent);
  color: var(--muted);
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.55;
}

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

.settings-parse-summary.is-valid {
  border-color: rgba(16, 185, 129, 0.24);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--panel) 28%);
}

.settings-parse-summary.is-warning {
  border-color: rgba(217, 119, 6, 0.28);
  background: color-mix(in srgb, rgba(217, 119, 6, 0.14) 72%, var(--panel) 28%);
}

@media (max-width: 960px) {
  .settings-security-grid {
    grid-template-columns: 1fr;
  }

  .settings-overview-cards,
  .guide-command-head,
  .guide-command-row,
  .guide-block-row {
    grid-template-columns: 1fr;
  }

  .guide-editor-head {
    display: none;
  }

  .guide-editor-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .twofactor-setup-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-game-head,
  .settings-inline-switch,
  .settings-toolbar {
    flex-direction: column;
  }

  .settings-chip-row {
    justify-content: flex-start;
  }

  .settings-inline-note {
    text-align: left;
  }

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

  .settings-toolbar-actions,
  .settings-parse-summary {
    width: 100%;
  }
}

.guide-docs-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(126, 198, 188, 0.25), transparent 28%),
    radial-gradient(circle at top right, rgba(41, 77, 126, 0.18), transparent 30%),
    linear-gradient(180deg, #e9f8f6 0%, #f4f8ff 100%);
  color: #0d203b;
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

.guide-scroll-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  height: 4px;
  background: rgba(15, 44, 74, 0.1);
  pointer-events: none;
}

.guide-scroll-rail span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16cfa5, #80fff1);
  box-shadow: 0 0 18px rgba(22, 207, 165, 0.55);
  transition: width 0.12s ease-out;
}

.guide-scroll-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(116, 197, 183, 0.55);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0b3650;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(24, 45, 78, 0.16);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(14px);
}

.guide-scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.guide-scroll-top:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 20px 42px rgba(24, 45, 78, 0.2);
}

.guide-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
  display: grid;
  gap: 18px;
}

.guide-hero,
.guide-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(182, 206, 228, 0.85);
  border-radius: 30px;
  box-shadow: 0 18px 48px rgba(24, 45, 78, 0.08);
  backdrop-filter: blur(18px);
}

.guide-hero {
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  gap: 26px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.guide-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #6a7b98;
  text-transform: uppercase;
}

.guide-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.guide-lead {
  margin: 14px 0 0;
  color: #445776;
  font-size: 18px;
  line-height: 1.72;
}

.guide-hero-actions,
.guide-chip-row,
.guide-nav,
.guide-grid,
.guide-admin-grid,
.guide-command-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.guide-command-list-detailed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-command-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(199, 216, 235, 0.86);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.guide-command-item small {
  color: #5d6f85;
  line-height: 1.55;
}

.guide-custom-content {
  border-color: rgba(22, 207, 165, 0.28);
}

.guide-custom-image {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  margin-top: 14px;
  border: 1px solid rgba(199, 216, 235, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 42px rgba(13, 32, 59, 0.12);
}

.guide-hero-actions {
  margin-top: 22px;
}

.guide-chip-row {
  margin-top: 20px;
}

.guide-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(116, 197, 183, 0.4);
  background: rgba(228, 255, 250, 0.9);
  color: #173e4d;
  font-size: 13px;
  font-weight: 700;
}

.guide-hero-visual {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 0;
}

.guide-shot {
  margin: 0;
  border: 1px solid rgba(196, 214, 232, 0.95);
  border-radius: 26px;
  background: rgba(246, 249, 255, 0.96);
  box-shadow: 0 18px 40px rgba(22, 45, 77, 0.1);
}

.guide-shot-browser {
  padding: 14px;
}

.guide-hero-summary {
  display: grid;
  gap: 14px;
}

.guide-shot-top {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
}

.guide-shot-top span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d3ddef;
}

.guide-shot-admin {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
}

.guide-shot-sidebar {
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, #0f1b30 0%, #102843 100%);
  color: #eaf4ff;
}

.guide-shot-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #a6fff3, #18d1a4);
  color: #0f1b30;
  font-weight: 900;
}

.guide-shot-menu {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  font-size: 12px;
}

.guide-shot-menu span {
  opacity: 0.8;
}

.guide-shot-menu .active {
  opacity: 1;
  font-weight: 800;
}

.guide-shot-content {
  padding: 14px;
  border-radius: 22px;
  background: rgba(233, 241, 255, 0.9);
  display: grid;
  gap: 14px;
}

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

.guide-shot-metrics div,
.guide-shot-table span,
.guide-phone-search,
.guide-phone-cards div,
.guide-phone-nav span {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(199, 216, 235, 0.95);
}

.guide-shot-metrics div {
  padding: 12px;
  display: grid;
  gap: 4px;
}

.guide-shot-metrics strong {
  font-size: 22px;
}

.guide-shot-metrics small {
  color: #607392;
}

.guide-shot-table {
  display: grid;
  gap: 8px;
}

.guide-shot-table span {
  min-height: 42px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  color: #516581;
  font-size: 0.79rem;
  line-height: 1.35;
}

.guide-shot-phone {
  display: none;
}

.guide-phone-notch {
  width: 70px;
  height: 10px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.guide-phone-screen {
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, #0e1830 0%, #15253f 100%);
  display: grid;
  gap: 12px;
}

.guide-phone-head {
  display: flex;
  justify-content: space-between;
  color: #eef4ff;
}

.guide-phone-search {
  height: 34px;
}

.guide-phone-cards {
  display: grid;
  gap: 8px;
}

.guide-phone-cards div {
  height: 58px;
  background: rgba(22, 42, 72, 0.9);
  border-color: rgba(47, 86, 134, 0.95);
}

.guide-phone-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.guide-phone-nav span {
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.06);
}

.guide-phone-nav .active {
  background: linear-gradient(135deg, #9ef9eb, #19d3a9);
}

.guide-nav {
  position: sticky;
  top: 10px;
  z-index: 20;
  padding: 12px 14px;
  border: 1px solid rgba(182, 206, 228, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 28px rgba(24, 45, 78, 0.08);
  align-items: center;
  align-self: start;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-padding-inline: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.guide-nav::-webkit-scrollbar {
  display: none;
}

.guide-nav.guide-nav-floating {
  position: fixed;
  top: 10px;
  left: 50%;
  width: min(1180px, calc(100% - 32px));
  transform: translateX(-50%);
  z-index: 72;
}

.guide-nav-spacer {
  display: none;
}

.guide-nav a {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  color: #183153;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.guide-nav a:hover {
  background: rgba(211, 255, 244, 0.9);
}

.guide-nav a.guide-nav-active {
  background: linear-gradient(135deg, #d3fff4 0%, #a9fff1 100%);
  color: #092f45;
  box-shadow: 0 10px 22px rgba(22, 207, 165, 0.2);
  transform: translateY(-1px);
}

.guide-card {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.guide-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(116, 197, 183, 0.15);
  color: #0a6b55;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.guide-tip,
.guide-warn {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 0 12px 12px 0;
  font-size: 13px;
  line-height: 1.65;
}

.guide-tip {
  border-left: 3px solid rgba(116, 197, 183, 0.7);
  background: rgba(228, 255, 250, 0.7);
  color: #1e3d4f;
}

.guide-warn {
  border-left: 3px solid rgba(245, 158, 11, 0.7);
  background: rgba(255, 251, 235, 0.8);
  color: #92400e;
}

.guide-section-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.guide-step,
.guide-number {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #dafcf5, #c0fff3);
  color: #10354d;
  font-weight: 900;
}

.guide-step {
  flex-shrink: 0;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.guide-section-head h2,
.guide-mini-card h3,
.guide-info-card h3,
.guide-panel-card h3 {
  margin: 0;
}

.guide-section-head p,
.guide-mini-card p,
.guide-info-card p,
.guide-panel-card p,
.guide-illustration-card figcaption {
  margin: 8px 0 0;
  color: #59708f;
  line-height: 1.72;
}

.guide-grid {
  display: grid;
}

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

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

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

.guide-mini-card,
.guide-info-card,
.guide-panel-card,
.guide-illustration-card {
  border-radius: 24px;
  border: 1px solid rgba(201, 217, 236, 0.95);
  background: rgba(248, 251, 255, 0.92);
  padding: 20px;
}

.guide-number {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  margin-bottom: 12px;
}

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

.guide-stack {
  display: grid;
  gap: 14px;
}

.guide-list,
.guide-ordered {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #1e3557;
  line-height: 1.7;
}

.guide-list li + li,
.guide-ordered li + li {
  margin-top: 8px;
}

.guide-command-list {
  margin-top: 14px;
}

.guide-command-list code {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 27, 48, 0.94);
  color: #ecf6ff;
  font-weight: 700;
}

.guide-diagram {
  width: 100%;
  height: auto;
  display: block;
}

.guide-illustration-card {
  display: grid;
  gap: 14px;
}

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

.guide-process {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.guide-process-node {
  padding: 18px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef7ff 100%);
  border: 1px solid rgba(197, 215, 236, 0.98);
  display: grid;
  gap: 6px;
}

.guide-process-arrow {
  font-size: 28px;
  color: #4c678b;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .guide-hero,
  .guide-split {
    grid-template-columns: 1fr;
  }

  .guide-hero-visual {
    min-height: 0;
  }

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

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

@media (max-width: 760px) {
  .guide-shell {
    width: min(100% - 16px, 100%);
    padding: 12px 0 40px;
    gap: 12px;
  }

  .guide-hero,
  .guide-card {
    padding: 18px 16px;
    border-radius: 20px;
  }

  .guide-hero-visual {
    display: none;
  }

  .guide-nav {
    top: 8px;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 16px;
  }

  .guide-nav.guide-nav-floating {
    top: 8px;
    width: min(100% - 16px, 100%);
  }

  .guide-nav a {
    padding: 7px 11px;
    font-size: 12px;
  }

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

  .guide-grid-2,
  .guide-admin-grid,
  .guide-process,
  .guide-command-list-detailed {
    grid-template-columns: 1fr;
  }

  .guide-section-head {
    gap: 10px;
  }

  .guide-process-arrow {
    display: none;
  }

  .guide-scroll-top {
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .guide-grid-4,
  .guide-grid-3,
  .guide-grid-2 {
    grid-template-columns: 1fr;
  }

  .guide-hero h1 {
    font-size: 22px;
  }

  .guide-chip-row {
    gap: 6px;
  }

  .guide-chip {
    padding: 4px 10px;
    font-size: 11px;
  }
}

/* ==========================================================================
   API reference layout
   ========================================================================== */

.api-ref-body {
  --api-ref-bg: #ffffff;
  --api-ref-bg-code: #0a2540;
  --api-ref-bg-code-2: #1a2c4e;
  --api-ref-fg: #0a2540;
  --api-ref-muted: #425466;
  --api-ref-light: #6b7c93;
  --api-ref-accent: #635bff;
  --api-ref-accent-soft: #eef0ff;
  --api-ref-border: #e3e8ee;
  --api-ref-border-soft: #f2f4f7;
  --api-ref-sidebar-w: 240px;
  --api-ref-code-w: 460px;
  margin: 0;
  min-height: 100vh;
  background: var(--api-ref-bg);
  color: var(--api-ref-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.api-ref-body,
.api-ref-body * {
  box-sizing: border-box;
}

.api-ref-body a {
  color: var(--api-ref-accent);
  text-decoration: none;
}

.api-ref-body a:hover {
  text-decoration: underline;
}

.api-ref-body code,
.api-ref-body pre {
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.api-ref-body p code,
.api-ref-body li code,
.api-ref-body td code,
.api-ref-body h1 code,
.api-ref-body h2 code,
.api-ref-body h3 code,
.api-ref-body h4 code {
  background: var(--api-ref-accent-soft);
  color: var(--api-ref-accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
}

.api-ref-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--api-ref-border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.api-ref-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.api-ref-brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--api-ref-accent), #00d4ff);
}

.api-ref-brand small {
  color: var(--api-ref-light);
  font-size: 13px;
  font-weight: 400;
}

.api-ref-topnav {
  margin-left: auto;
  display: flex;
  gap: 20px;
  font-size: 14px;
}

.api-ref-topnav a {
  color: var(--api-ref-muted);
}

.api-ref-topnav a.active {
  color: var(--api-ref-accent);
  font-weight: 600;
}

.api-ref-layout {
  display: grid;
  grid-template-columns: var(--api-ref-sidebar-w) 1fr;
  max-width: 1400px;
  margin: 0 auto;
}

.api-ref-sidebar {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  padding: 28px 16px 60px 24px;
  border-right: 1px solid var(--api-ref-border);
}

.api-ref-sidebar h4 {
  margin: 22px 0 8px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--api-ref-light);
}

.api-ref-sidebar h4:first-child {
  margin-top: 0;
}

.api-ref-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.api-ref-sidebar li a {
  display: block;
  padding: 4px 8px;
  border-left: 3px solid transparent;
  border-radius: 5px;
  color: var(--api-ref-muted);
  font-size: 13.5px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.api-ref-sidebar li a:hover {
  background: var(--api-ref-border-soft);
  text-decoration: none;
}

.api-ref-sidebar li a.active {
  color: #092f45;
  background: linear-gradient(135deg, #d3fff4 0%, #a9fff1 100%);
  border-left-color: #16cfa5;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(22, 207, 165, 0.16);
  transform: translateX(2px);
}

.api-ref-content {
  min-width: 0;
}

.api-ref-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--api-ref-code-w);
  gap: 40px;
  padding: 48px 40px;
  border-bottom: 1px solid var(--api-ref-border-soft);
}

.api-ref-prose {
  max-width: 640px;
}

.api-ref-prose h1 {
  margin: 0 0 16px;
  font-size: 32px;
  letter-spacing: -0.01em;
}

.api-ref-prose h2 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -0.005em;
  scroll-margin-top: 80px;
}

.api-ref-prose h4 {
  margin: 24px 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--api-ref-light);
  font-weight: 700;
}

.api-ref-prose p {
  margin: 8px 0 12px;
  color: var(--api-ref-muted);
  line-height: 1.6;
}

.api-ref-prose strong {
  color: var(--api-ref-fg);
}

.api-ref-prose ul {
  padding-left: 20px;
  color: var(--api-ref-muted);
}

.api-ref-prose ul li {
  margin: 4px 0;
}

.api-ref-lede {
  font-size: 17px;
  line-height: 1.55;
}

.api-ref-note {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--api-ref-accent);
  border-radius: 0 6px 6px 0;
  background: var(--api-ref-accent-soft);
  font-size: 14px;
}

.api-ref-note.warn {
  border-color: #d97706;
  background: #fff7ed;
}

.api-ref-note.danger {
  border-color: #cd3d64;
  background: #fef2f2;
}

.api-ref-note p {
  margin: 0;
  color: var(--api-ref-fg);
}

.api-ref-code-col {
  position: sticky;
  top: 80px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.api-ref-code-block {
  overflow: hidden;
  border-radius: 8px;
  background: var(--api-ref-bg-code);
  box-shadow: 0 4px 16px rgba(10, 37, 64, 0.12);
}

.api-ref-code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--api-ref-bg-code-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #d6e0f0;
  font-size: 12px;
}

.api-ref-code-head .label {
  color: #8ba4c4;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.api-ref-code-head .path {
  color: #d6e0f0;
  font-size: 12px;
  word-break: break-all;
}

.api-ref-code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: #f6f9fc;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

.api-ref-tbl {
  width: 100%;
  margin: 8px 0 4px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.api-ref-tbl th,
.api-ref-tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--api-ref-border);
  text-align: left;
  vertical-align: top;
}

.api-ref-tbl th {
  background: var(--api-ref-border-soft);
  color: var(--api-ref-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-ref-tbl td {
  color: var(--api-ref-muted);
}

.api-ref-tbl td:first-child {
  color: var(--api-ref-fg);
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.api-ref-params {
  margin: 8px 0;
  border-top: 1px solid var(--api-ref-border);
}

.api-ref-param {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--api-ref-border);
}

.api-ref-param-name {
  color: var(--api-ref-fg);
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.api-ref-param-name .type {
  display: block;
  margin-top: 3px;
  color: var(--api-ref-light);
  font-size: 11.5px;
  font-weight: 400;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.api-ref-param-desc {
  color: var(--api-ref-muted);
  font-size: 14px;
}

.api-ref-param-desc p {
  margin: 0;
}

.api-ref-endpoint-path {
  color: var(--api-ref-fg);
  font-size: 13.5px;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.api-ref-body .method {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.api-ref-body .method.get {
  background: #e1f5e1;
  color: #1b7e3a;
}

.api-ref-body .chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.api-ref-body .chip.s200 {
  background: #e1f5e1;
  color: #1b7e3a;
}

.api-ref-body .chip.s400,
.api-ref-body .chip.s401 {
  background: #fde9c9;
  color: #b45309;
}

.api-ref-body .chip.s404,
.api-ref-body .chip.s405,
.api-ref-body .chip.s422 {
  background: #fde9e9;
  color: #b91c1c;
}

@media (max-width: 1200px) {
  .api-ref-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-ref-code-col {
    position: static;
  }
}

@media (max-width: 900px) {
  .api-ref-layout {
    grid-template-columns: 1fr;
  }

  .api-ref-sidebar {
    position: static;
    height: auto;
    overflow: visible;
    padding: 16px 14px 0;
    border-right: 0;
    border-bottom: 1px solid var(--api-ref-border);
  }

  .api-ref-sidebar ul {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .api-ref-sidebar li {
    flex: 0 0 auto;
  }

  .api-ref-sidebar li a {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--api-ref-border);
    border-radius: 999px;
    background: #fff;
    white-space: nowrap;
  }

  .api-ref-section {
    gap: 18px;
    padding: 24px 16px;
  }

  .api-ref-topbar {
    padding: 0 14px;
  }

  .api-ref-topnav {
    gap: 12px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .api-ref-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .api-ref-topnav {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .api-ref-prose h1 {
    font-size: 26px;
  }

  .api-ref-param {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .api-ref-code-block pre {
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
  }
}

/* API docs mobile refresh: same swipe rail behavior as guide docs. */
.api-ref-scroll-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: 100%;
  height: 4px;
  background: rgba(15, 44, 74, 0.1);
  pointer-events: none;
}

.api-ref-scroll-rail span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16cfa5, #80fff1);
  box-shadow: 0 0 18px rgba(22, 207, 165, 0.55);
  transition: width 0.12s ease-out;
}

.api-ref-scroll-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 88;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(116, 197, 183, 0.55);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0b3650;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(24, 45, 78, 0.16);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.94);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(14px);
}

.api-ref-scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.api-ref-scroll-top:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 20px 42px rgba(24, 45, 78, 0.2);
}

.api-ref-section {
  margin: 18px 22px;
  border: 1px solid rgba(182, 206, 228, 0.78);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 48px rgba(24, 45, 78, 0.08);
  backdrop-filter: blur(18px);
}

.api-ref-sidebar {
  margin-top: 18px;
  border-radius: 24px;
}

.api-ref-sidebar h4:first-child {
  margin-top: 6px;
}

.api-ref-nav-spacer {
  display: none;
}

@media (max-width: 900px) {
  .api-ref-topbar {
    position: relative;
    top: auto;
    min-height: 0;
    padding: 16px;
  }

  .api-ref-layout {
    display: block;
    max-width: none;
  }

  .api-ref-sidebar {
    position: relative !important;
    top: auto !important;
    z-index: 60;
    width: min(100% - 16px, 100%);
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 10px auto 0;
    padding: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border: 1px solid rgba(182, 206, 228, 0.82) !important;
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(24, 45, 78, 0.08);
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .api-ref-sidebar::-webkit-scrollbar {
    display: none;
  }

  .api-ref-sidebar.api-ref-nav-floating {
    position: fixed !important;
    top: 8px !important;
    left: 50%;
    width: min(100% - 16px, 100%);
    margin: 0;
    transform: translateX(-50%);
    z-index: 86;
  }

  .api-ref-sidebar h4 {
    display: none !important;
  }

  .api-ref-sidebar ul {
    display: flex !important;
    flex: 0 0 auto;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    list-style: none;
  }

  .api-ref-sidebar li {
    flex: 0 0 auto;
    display: flex !important;
  }

  .api-ref-sidebar li a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 8px 13px !important;
    border: 1px solid rgba(182, 206, 228, 0.82) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: #183153 !important;
    font-size: 13px !important;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
  }

  .api-ref-sidebar li a.active {
    border-color: transparent !important;
    background: linear-gradient(135deg, #d3fff4 0%, #a9fff1 100%) !important;
    color: #092f45 !important;
    box-shadow: 0 10px 22px rgba(22, 207, 165, 0.2);
  }

  .api-ref-content {
    width: min(100% - 16px, 100%);
    margin: 0 auto;
    padding: 10px 0 42px !important;
    overflow: hidden;
  }

  .api-ref-section {
    margin: 12px 0;
    padding: 20px 16px !important;
    border-radius: 22px;
  }

  .api-ref-prose,
  .api-ref-code-col,
  .api-ref-code-block {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .api-ref-prose h1 {
    font-size: clamp(26px, 8vw, 40px);
    line-height: 1.08;
    letter-spacing: -0.03em;
  }

  .api-ref-lede {
    font-size: 16px;
    line-height: 1.68;
  }

  .api-ref-endpoint-path,
  .api-ref-body p code,
  .api-ref-body li code,
  .api-ref-body td code {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .api-ref-code-block pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
  }

  .schema-table,
  .api-ref-tbl {
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .api-ref-scroll-top {
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .api-ref-brand {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .api-ref-brand small {
    display: block;
    width: 100%;
    margin-left: 46px;
    font-size: 12px;
  }

  .api-ref-topnav {
    gap: 16px;
  }
}

/* ==========================================================================
   ENHANCEMENT — Dashboard sparkline cards, mobile dock v2, breadcrumb
   Loai bo: fade-in animation (gay trang trang), onboarding tooltip
   ========================================================================== */

/* --- Sparkline metric card --- */
.metric-spark {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 130px;
  gap: 8px;
  padding: 20px 22px 14px;
  position: relative;
  overflow: hidden;
}
.metric-spark-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-range-tabs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-3) 12%);
}

.metric-range-tabs button {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.metric-range-tabs button.active {
  color: #064e3b;
  background: rgba(16, 185, 129, 0.18);
}

body.theme-dark .metric-range-tabs button.active {
  color: #a7f3d0;
}

.metric-spark-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.metric-spark-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}
.metric-spark-trend.up   { color: #047857; background: rgba(16,185,129,0.12); }
.metric-spark-trend.down { color: #be123c; background: rgba(225,29,72,0.1); }
.metric-spark-trend.flat { color: var(--muted); background: var(--panel-3); }
.metric-spark-value {
  font-size: clamp(22px, 2.1vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
  align-self: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric-spark-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.metric-spark-canvas {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}
body.theme-dark .metric-spark-canvas { opacity: 0.26; }
/* Keep the card text above the sparkline so values/sub-labels stay readable. */
.metric-spark > div { position: relative; z-index: 1; }

.metric-spark.metric-clickable {
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.metric-spark.metric-clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.45);
}

.overview-period-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 2px 0 14px;
}
.overview-period {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 90%, var(--panel-3) 10%);
}
.overview-period-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.overview-period-rev {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.overview-period-cnt {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .overview-period-strip { grid-template-columns: 1fr; }
}

.overview-panels-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 920px) {
  .overview-panels-row { grid-template-columns: 1fr; }
}
.ov-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 16px 18px;
}
body.theme-dark .ov-panel { background: #0f172a; }
.ov-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.ov-live-pill {
  font-size: 11px;
  font-weight: 500;
  color: #2dd48f;
  background: rgba(45, 212, 143, 0.14);
  padding: 2px 9px;
  border-radius: 999px;
}
.ov-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 2px;
  text-align: center;
}
.ov-act-list { display: flex; flex-direction: column; gap: 12px; }
.ov-act-row { display: flex; gap: 10px; align-items: flex-start; }
.ov-act-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.ov-act-body { flex: 1; min-width: 0; }
.ov-act-text { font-size: 13px; line-height: 1.4; }
.ov-act-amt { color: var(--muted); }
.ov-act-time { font-size: 11px; color: var(--muted); margin-top: 1px; }
.top-prod-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.top-prod-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
}
.top-prod-name {
  width: 190px;
  flex-shrink: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-prod-bar {
  flex: 1;
  height: 8px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
}
.top-prod-bar > span {
  display: block;
  height: 8px;
  background: #10b981;
  border-radius: 999px;
}
.top-prod-val {
  width: 96px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .top-prod-name { width: 120px; }
  .top-prod-val { width: 72px; }
}

/* Command palette (⌘K) */
.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  min-width: 220px;
  max-width: 340px;
}
.cmdk-trigger:hover { border-color: rgba(16, 185, 129, 0.4); }
.cmdk-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-trigger kbd { font-size: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
@media (max-width: 820px) {
  .cmdk-trigger span, .cmdk-trigger kbd { display: none; }
  .cmdk-trigger { min-width: 0; padding: 8px 10px; }
}
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 16, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdk-panel {
  width: min(640px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.cmdk-input-wrap input { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font-size: 15px; }
.cmdk-input-wrap kbd { font-size: 11px; background: var(--panel-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.cmdk-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 10px 4px; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.cmdk-item:hover, .cmdk-item:focus { background: var(--panel-3); }
.cmdk-item i { width: 18px; text-align: center; color: var(--muted); }
.cmdk-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-sub { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.cmdk-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* Product list Đợt 2: toolbar search, filter chips, right-aligned numbers, stock bar, row menu */
.table-search {
  height: 34px;
  flex: 0 1 260px;
  margin-left: auto;
  min-width: 160px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
}
.table-search:focus { outline: none; border-color: rgba(16, 185, 129, 0.5); }
.chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip-filter:hover { color: var(--text); border-color: var(--muted); }
.chip-filter.is-active { background: #10b981; color: #053527; border-color: transparent; }
.chip-filter .chip-count { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.chip-filter.is-active .chip-count { opacity: 0.9; }
.product-list-table th.r, .product-list-table td.r { text-align: right; }
.product-list-table tr.is-off { opacity: 0.5; }
.product-list-table tr.is-off:hover { opacity: 0.8; }
.product-list-table td.row-actions { white-space: nowrap; }
.product-list-table td.row-actions .icon-btn + .icon-btn { margin-left: 6px; }
.stock-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.stock-bar { display: inline-block; width: 44px; height: 5px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.stock-bar > span { display: block; height: 5px; border-radius: 99px; background: #10b981; }
.stock-out { color: #e24b4a; }
.stock-out .stock-bar > span { background: #e24b4a; }
.row-menu-pop {
  position: fixed;
  z-index: 250;
  min-width: 168px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row-menu-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.row-menu-pop button:hover { background: var(--panel-3); }
.row-menu-pop button.danger { color: #e24b4a; }
.row-menu-pop button.danger:hover { background: rgba(226, 75, 74, 0.12); }
.row-menu-pop svg { flex-shrink: 0; color: var(--muted); }
.row-menu-pop button.danger svg { color: #e24b4a; }

/* #5 Sticky action column — always visible without horizontal scroll. */
.product-list-table th:last-child,
.product-list-table td.row-actions {
  position: sticky;
  right: 0;
  background: var(--panel);
  z-index: 2;
  box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.3);
}
body.theme-dark .product-list-table th:last-child,
body.theme-dark .product-list-table td.row-actions { background: #0f172a; }
.product-list-table td.row-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.product-list-table td.row-actions .icon-btn svg { width: 16px; height: 16px; }

/* #6 Best-seller chip + important-updates card */
.chip-filter.chip-hot { border-color: rgba(217, 119, 6, 0.45); color: #d97706; }
.chip-filter.chip-hot.is-active { background: #f0b429; color: #3a2a00; border-color: transparent; }
.product-alerts {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: inset 3px 0 0 #d97706;
}
body.theme-dark .product-alerts { background: #0f172a; }
.pa-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pa-head i { color: #d97706; }
.pa-badge { font-size: 11px; font-weight: 500; background: rgba(217, 119, 6, 0.15); color: #d97706; padding: 1px 8px; border-radius: 999px; }
.pa-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.pa-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* #2/#3/#4 Form helpers */
.req { color: #e24b4a; }
.field-hint { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); font-weight: 400; }
.form-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(86, 168, 245, 0.1);
  border: 1px solid rgba(86, 168, 245, 0.25);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text);
  margin: 8px 0;
}
.form-note i { color: #56a8f5; margin-top: 2px; }
.form-section-label {
  grid-column: 1 / -1;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 10px 0 2px;
}

/* Floating centered toast notifications */
.toast-host {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: min(92vw, 440px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  color: var(--text);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
body.theme-dark .toast { background: #111c30; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast i { margin-top: 2px; font-size: 16px; }
.toast span { flex: 1; white-space: pre-line; line-height: 1.45; }
.toast-close { background: transparent; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast-success i { color: #10b981; }
.toast-error i { color: #e24b4a; }
.toast-warning i { color: #d97706; }
.toast-info i { color: #2f7ed8; }

.stock-line-count { font-size: 12px; color: #10b981; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Topbar notification bell */
.notif-wrap { position: relative; }
.notif-bell {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.notif-bell:hover { border-color: var(--muted); }
.notif-bell.has-alerts i { color: #d97706; }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e24b4a;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 86vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  z-index: 200;
  overflow: hidden;
}
.notif-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.notif-head i { color: #d97706; }
.notif-body { padding: 6px 14px 12px; max-height: 60vh; overflow-y: auto; }
.notif-body .pa-row { padding: 7px 0; }

/* Stock panel polish */
#stockMeta { display: flex; gap: 6px; flex-wrap: wrap; margin: 5px 0 0; }
.stock-chip { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.stock-chip.g { background: rgba(16, 185, 129, 0.14); color: #10b981; }
.stock-danger { box-shadow: inset 3px 0 0 #e24b4a; }

/* Discount redesign: mode segment + tier builder */
.discount-mode-seg { display: inline-flex; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.discount-mode-seg button { border: 0 !important; background: transparent !important; color: var(--muted) !important; font-size: 13px; padding: 6px 14px; border-radius: 7px; cursor: pointer; box-shadow: none !important; }
.discount-mode-seg button.on { background: #10b981 !important; color: #053527 !important; font-weight: 500; }
.discount-builder { padding: 4px 2px 6px; }
.discount-builder > label { display: block; margin-bottom: 8px; }
.discount-builder .primary {
  background: #10b981; color: #053527; border: 0; border-radius: 9px;
  padding: 9px 18px; font-weight: 500; cursor: pointer; font-size: 13px;
}
.discount-note {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9px; padding: 9px 12px; font-size: 12px; color: var(--text); margin: 8px 0 12px;
}
.discount-note i { color: #10b981; margin-top: 2px; }
.tier-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tier-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
}
.tier-mut { color: var(--muted); font-size: 12px; }
.tier-row input, .tier-row select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 8px; color: var(--text); font-size: 13px;
}
.tier-row .t-minq { width: 64px; }
.tier-row .t-val { width: 120px; }
.tier-row .t-type { min-width: 140px; }
.tier-del { margin-left: auto; background: transparent; border: 0; color: #e24b4a; cursor: pointer; font-size: 15px; padding: 2px 6px; }
.btn-dashed {
  background: transparent !important; border: 1px dashed var(--line) !important; color: var(--muted) !important;
  border-radius: 9px; padding: 7px 14px; cursor: pointer; font-size: 13px; box-shadow: none !important;
}
.btn-dashed:hover { border-color: rgba(16, 185, 129, 0.5) !important; color: var(--text) !important; }
.discount-builder .form-grid input:not([type="checkbox"]),
.discount-builder .form-grid select,
.discount-builder .form-grid textarea,
.discount-builder > label select,
#tierProductSelect {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-2);
  outline: none;
}
.discount-builder .form-grid input:focus,
.discount-builder .form-grid select:focus,
#tierProductSelect:focus {
  border-color: rgba(16, 185, 129, 0.52);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.tier-row input, .tier-row select { border-radius: 9px; min-height: 38px; }
/* Discount list: compact icon actions (Sửa / Tắt / Xóa) on one row. The global
   .row-actions has flex-wrap:wrap + full-size text buttons, which the table
   auto-layout squeezed so "Xóa" dropped to a 2nd line. Icon buttons fit ~120px so
   the row never wraps and dense groups don't overflow. Tooltips keep the labels. */
.discount-product-group td.row-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}
.discount-product-group td.row-actions .icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  border-radius: 10px;
}
.discount-product-group td.row-actions .icon-btn svg {
  width: 17px;
  height: 17px;
}

/* Discount v2: builder head (product + audience), combo tier rows, bulk bar */
.discount-builder-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; margin-bottom: 10px; }
.discount-builder-head > label { flex: 1 1 300px; margin-bottom: 0; }
.tier-audience { display: flex; flex-direction: column; gap: 6px; }
.tier-audience-label { font-size: 12px; color: var(--text); }
.tier-audience-seg { display: inline-flex; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; padding: 3px; align-self: flex-start; }
.tier-audience-seg button { border: 0 !important; background: transparent !important; color: var(--muted) !important; font-size: 13px; padding: 6px 13px; border-radius: 7px; cursor: pointer; box-shadow: none !important; }
.tier-audience-seg button.on { background: #8b7ff5 !important; color: #15103a !important; font-weight: 500; }
.tier-user-input { margin-top: 4px; max-width: 260px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; color: var(--text); font-size: 13px; }

.tier-grp { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.tier-grp-price { background: rgba(139, 127, 245, 0.16); color: #5a48c0; }
.tier-grp-gift { background: rgba(16, 185, 129, 0.14); color: #07875a; }
body.theme-dark .tier-grp-price { color: #b3a8fb; }
body.theme-dark .tier-grp-gift { color: #5fcf9f; }
.tier-row .t-minq { width: 60px; }
.tier-row .t-ptype { min-width: 140px; }
.tier-row .t-pval { width: 112px; }
.tier-row .t-gift { width: 60px; }

.discount-bulk-bar { display: flex; align-items: center; gap: 10px; background: #f1f0fb; border: 1px solid rgba(139, 127, 245, 0.35); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
body.theme-dark .discount-bulk-bar { background: #16223c; border-color: rgba(139, 127, 245, 0.3); }
.discount-bulk-count { font-weight: 600; color: var(--text); }
.discount-bulk-bar [data-bulk="enable"] { margin-left: auto; }
.discount-bulk-clear {
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  color: var(--muted) !important; cursor: pointer; font-size: 13px; text-decoration: underline;
  padding: 0 8px !important; min-height: auto !important; font-weight: 400 !important;
}
.discount-pick { width: 38px; text-align: center; }
.discount-pick input { width: 16px; height: 16px; cursor: pointer; accent-color: #8b7ff5; }

/* Searchable, stock/sold-aware product picker for the discount builder */
.product-picker { position: relative; width: 100%; }
.product-picker-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 42px; background: var(--panel-2) !important; border: 1px solid var(--line) !important;
  border-radius: 12px; padding: 9px 12px !important; color: var(--text) !important; font-size: 13px;
  cursor: pointer; box-shadow: none !important; font-weight: 400 !important;
}
.product-picker-trigger:hover { border-color: rgba(16, 185, 129, 0.45) !important; }
.product-picker-trigger i { color: var(--muted); font-size: 12px; }
.product-picker-label { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-picker-label.is-placeholder { color: var(--muted); }
/* In-flow panel: pushes the note + tier rows down instead of floating over them. */
.product-picker-panel {
  margin-top: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.product-picker-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.product-picker-search i { color: var(--muted); font-size: 13px; }
.product-picker-search input { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font-size: 13px; }
.product-picker-list {
  max-height: 420px; overflow-y: auto; padding: 10px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 8px;
  align-content: start;
}
.product-picker-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: 100%;
  background: var(--panel-2) !important; border: 1px solid var(--line) !important; border-radius: 10px;
  padding: 10px !important; cursor: pointer; text-align: left; box-shadow: none !important;
  font-weight: 400 !important; color: var(--text) !important; min-height: 0 !important;
}
.product-picker-item:hover { background: var(--panel-3) !important; border-color: rgba(16, 185, 129, 0.45) !important; }
.product-picker-item.is-selected { background: rgba(16, 185, 129, 0.12) !important; border-color: rgba(16, 185, 129, 0.5) !important; }
.pp-name {
  color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pp-sku { color: var(--muted); font-size: 11px; }
.pp-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; padding-top: 2px; }
.pp-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
/* Light theme (default): darker text so numbers read clearly on white. */
.pp-in { background: rgba(16, 185, 129, 0.14); color: #07875a; font-weight: 600; }
.pp-out { background: rgba(226, 75, 74, 0.13); color: #c0322f; font-weight: 600; }
.pp-sold { background: rgba(139, 127, 245, 0.16); color: #5a48c0; font-weight: 600; }
body.theme-dark .pp-in { color: #5fcf9f; }
body.theme-dark .pp-out { color: #f0848a; }
body.theme-dark .pp-sold { color: #b3a8fb; }
.product-picker-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.order-sales-panel {
  margin-bottom: 18px;
}

.order-sales-heading {
  align-items: flex-start;
}

.order-sales-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.order-sales-report {
  display: grid;
  gap: 14px;
}

.order-sales-groups {
  display: grid;
  gap: 14px;
}

.order-sales-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-3) 8%);
}

.order-sales-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-sales-group header strong,
.order-sales-group header small {
  display: block;
}

.order-sales-group header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.order-sales-group header b {
  color: var(--accent-2);
  font-size: 18px;
}

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

/* --- Mobile dock v2 --- */
.mobile-dock-v2 {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom,0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 66;
  display: none;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 6px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 16px 40px rgba(15,23,42,0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.mobile-dock-v2-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 62px;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 6px 8px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.mobile-dock-v2-item:active { transform: scale(0.94); }
.mobile-dock-v2-item.active {
  color: #059669;
  border-color: rgba(16,185,129,0.28);
  background: rgba(16,185,129,0.1);
}
.mobile-dock-v2-icon { font-size: 20px; line-height: 1; }

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
}
.breadcrumb-sep { color: var(--muted); opacity: 0.45; font-size: 10px; }
.breadcrumb-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.breadcrumb-item.current { color: var(--accent-2); font-weight: 700; }
.breadcrumb-item button {
  display: inline; border: 0; padding: 0; color: inherit;
  background: transparent; font: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.breadcrumb-item button:hover { color: var(--text); }

/* --- Summary v2 with sparkline --- */
.summary-v2 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 16px;
  padding: 24px 32px 0;
}

@media (max-width: 1280px) {
  .summary-v2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 920px) {
  .summary-v2 { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 12px 8px 0; }
  .metric-spark { min-height: 110px; padding: 14px 15px 10px; border-radius: 20px; }
  .metric-spark-value { font-size: 22px; }
  .mobile-dock-v2 { display: flex; }
  .content-panel, .panel { padding-bottom: 100px; }
}
@media (max-width: 560px) {
  .summary-v2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mobile-dock-v2 { left: 8px; right: 8px; transform: none; border-radius: 20px; }
.mobile-dock-v2-item { flex: 1; min-width: 0; }
  .metric-spark { min-height: 96px; padding: 12px 13px 8px; border-radius: 18px; }
  .metric-spark-value { font-size: 20px; }
}

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

.settings-backup-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 22px;
  padding: 18px;
  background: color-mix(in srgb, var(--panel) 94%, white 6%);
}

.settings-backup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.settings-backup-head h3 {
  margin: 8px 0 6px;
}

.settings-backup-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-backup-meta {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.settings-backup-meta strong {
  color: var(--text);
}

.compact-grid {
  gap: 14px;
}

.settings-backup-unified {
  display: grid;
  gap: 14px;
}

.settings-backup-row {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 22px;
  padding: 18px;
  background: color-mix(in srgb, var(--panel) 94%, white 6%);
}

.settings-backup-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.settings-backup-row-head h4 {
  margin: 8px 0 6px;
  font-size: 18px;
}

.settings-backup-row-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-backup-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 12px;
  align-items: end;
}

.settings-backup-actions > label {
  min-width: 120px;
}

.settings-backup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.settings-backup-stats strong {
  color: var(--text);
}

.settings-backup-fullbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
}

.settings-backup-fullbar strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.settings-backup-fullbar span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-backup-global-compact {
  margin: 4px 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 95%, white 5%);
}

.backup-shop-select-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.backup-shop-select-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.backup-shop-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--panel) 94%, white 6%);
}

.backup-shop-chip.active {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.08);
}

.backup-shop-chip span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 700;
}

.backup-shop-chip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.backup-shop-select-grid-compact .backup-shop-chip {
  padding: 10px 12px;
  border-radius: 14px;
}

.backup-shop-select-grid-compact .backup-shop-chip span {
  font-size: 13px;
}

.backup-shop-select-grid-compact .backup-shop-chip small {
  font-size: 11px;
}

.compact-subhead {
  margin-top: 18px;
}

@media (max-width: 920px) {
  .settings-backup-grid {
    grid-template-columns: 1fr;
  }

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

  .settings-backup-row-head {
    flex-direction: column;
  }

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

  .settings-backup-fullbar {
    flex-direction: column;
    align-items: stretch;
  }

  .backup-shop-select-grid {
    grid-template-columns: 1fr;
  }

  .backup-shop-select-grid-compact {
    grid-template-columns: 1fr;
  }
}
/* Discount editor */
.settings-accordion {
  border: 1px solid var(--border, rgba(148, 163, 184, 0.25));
  border-radius: 18px;
  margin: 14px 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.settings-accordion summary {
  cursor: pointer;
  font-weight: 800;
  padding: 14px 16px;
  color: var(--text, #0f172a);
}

.settings-accordion .form-grid {
  padding: 0 16px 16px;
}

.settings-accordion label.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.2);
}

/* AW-8: lighter NESTED accordion inside a settings form — groups rarely-touched fields
   (Telegram topics, preset-managed Bank API tech fields, Binance API) so the form shows
   only what admins actually adjust. Inputs stay in the DOM, so form submit and the
   sensitive-lock toggle keep working with the block collapsed. */
.settings-subaccordion {
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin: 10px 0 14px;
  background: rgba(148, 163, 184, 0.06);
  overflow: hidden;
}

.settings-subaccordion > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 14px;
}

.settings-subaccordion[open] > summary {
  color: var(--text, #0f172a);
  border-bottom: 1px dashed var(--line);
}

.settings-subaccordion .form-grid,
.settings-subaccordion .settings-subhead {
  padding-left: 14px;
  padding-right: 14px;
}

.settings-subaccordion .form-grid {
  padding-bottom: 14px;
  padding-top: 10px;
}

/* DISC-9b: "Đang áp dụng" product card grid (standalone — no popup max-height) */
.discount-rule-grid {
  max-height: none;
  overflow: visible;
  padding: 4px 0 10px;
}

/* DISC-8: user-discount product-exclusion checklist */
.ud-exclude-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 14px;
  padding: 10px 14px 14px;
  max-height: 260px;
  overflow-y: auto;
}

.settings-accordion label.is-disabled input,
.settings-accordion label.is-disabled select,
.settings-accordion label.is-disabled textarea {
  cursor: not-allowed;
}

/* --- Row action buttons: compact icon-only (keeps .secondary/.danger colours) --- */
.product-action-grid button.icon-btn,
.product-mobile-actions button.icon-btn,
.row-actions button.icon-btn {
  min-height: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  gap: 0;
}

.product-action-grid button.icon-btn svg,
.product-mobile-actions button.icon-btn svg,
.row-actions button.icon-btn svg {
  width: 17px;
  height: 17px;
}

.reseller-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* === UX quick wins: loading state (A2), focus ring (A3), empty-state polish (A4) === */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  color: var(--muted);
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.loading-state .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: adminSpin 0.7s linear infinite;
}
@keyframes adminSpin {
  to { transform: rotate(360deg); }
}
.empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === A7: per-page primary action button === */
.primary-action {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.18s ease;
}
.primary-action:hover {
  background: var(--accent-2);
}
.table-heading .primary-action {
  margin-left: auto;
}

/* === B7: metric card category indicator (colored dot before label) === */
.metric-money > span::before,
.metric-user > span::before,
.metric-order > span::before,
.metric-support > span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  margin-right: 7px;
  vertical-align: middle;
}
.metric-money > span::before { background: var(--accent); }
.metric-user > span::before { background: var(--info); }
.metric-order > span::before { background: var(--accent-2); }
.metric-support > span::before { background: var(--warn); }

/* === B3: form section labels (group fields inside the grid) === */
.form-section-label {
  grid-column: 1 / -1;
  width: 100%;
  margin: 6px 0 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === C1: sidebar group headers (collapsible since 2026-07-15) === */
.menu-group-label {
  padding: 14px 14px 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

button.menu-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 0;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  padding: 12px 14px 8px;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

button.menu-group-toggle:hover {
  color: var(--text, #0f172a);
  background: transparent;
  transform: none;
}

.menu-group-caret {
  font-size: 10px;
  transition: transform 0.18s ease;
  transform: rotate(-90deg);
}

.menu-group-toggle[aria-expanded="true"] .menu-group-caret { transform: rotate(0deg); }

.menu-group-items[hidden] { display: none; }

/* === C2: Settings page tabs === */
.settings-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.settings-tab {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.settings-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* === Number legibility: secondary <small> on its own line (fixes cramped Giá/Tồn/Đã bán) === */
.table td > small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.3;
}

/* === Orders tab redesign (UI-50): active KPI card + collapsed create-order form === */
.metric.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
  background: var(--accent-soft);
}
.order-create-details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  overflow: hidden;
}
.order-create-details > .order-create-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.order-create-details > .order-create-summary::-webkit-details-marker { display: none; }
.order-create-details > .order-create-summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.15s ease;
}
.order-create-details[open] > .order-create-summary::before { transform: rotate(90deg); }
.order-create-details > .order-create-summary small {
  color: var(--muted);
  font-weight: 400;
  font-size: var(--text-xs);
}
.order-create-details > .order-create-summary:hover { background: var(--panel-3); }
.order-create-details .product-form {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
}

/* === Orders table: icon action buttons + sticky action column (match Sản phẩm) === */
.order-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.order-row-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.order-row-actions .icon-btn i { font-size: 14px; line-height: 1; }
.order-row-actions .icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.order-row-actions .icon-btn.icon-btn-ok:hover {
  border-color: #10b981; color: #047857; background: rgba(16, 185, 129, 0.12);
}
.order-row-actions .icon-btn.icon-btn-warn:hover {
  border-color: #f59e0b; color: #92400e; background: rgba(245, 158, 11, 0.14);
}
.order-row-actions .icon-btn.icon-btn-danger:hover {
  border-color: #ef4444; color: #be123c; background: rgba(239, 68, 68, 0.12);
}
/* Sticky right action column for the orders table (only bites when it scrolls horizontally) */
.order-mobile-shell .table thead th:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--panel-2);
}
.order-mobile-shell .table tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.25);
}

/* === In-app confirm modal (replaces native confirm()) === */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  padding: 20px;
  animation: appModalFade 0.12s ease;
}
@keyframes appModalFade { from { opacity: 0; } to { opacity: 1; } }
.app-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
  padding: 24px;
  max-width: 420px;
  width: 100%;
}
.app-modal-msg {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}
.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* === Orders status chart: donut + breakdown side panel (fills the empty sides) === */
.orders-chart-grid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 28px;
  align-items: center;
}
@media (max-width: 760px) {
  .orders-chart-grid { grid-template-columns: 1fr; gap: 18px; }
}
.orders-chart-breakdown {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.ocb-row { display: flex; flex-direction: column; gap: 7px; }
.ocb-top { display: flex; align-items: center; gap: 9px; }
.ocb-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.ocb-label { color: var(--text); font-weight: 500; font-size: 14px; }
.ocb-count { margin-left: auto; color: var(--text); font-weight: 700; font-size: 14px; white-space: nowrap; }
.ocb-count small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.ocb-bar { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.ocb-bar i { display: block; height: 100%; border-radius: 999px; transition: width 0.3s ease; }

/* UI audit 2026-07-02 (P2 list-first): create-forms gập lại thành 1 dòng, list nổi lên đầu */
.create-collapse { margin-bottom: 14px; border: 1px dashed var(--border, #d1d5db); border-radius: 12px; background: var(--surface-2, transparent); }
.create-collapse > summary.create-collapse-summary { cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none; user-select: none; }
.create-collapse > summary.create-collapse-summary::-webkit-details-marker { display: none; }
.create-collapse[open] { border-style: solid; }
.create-collapse[open] > summary.create-collapse-summary { border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 8px; }
.create-collapse > form, .create-collapse > .form-body { padding: 0 16px 16px; }

/* W3 (UI vòng 2): sidebar cuộn được khi màn hình thấp/phóng to + nút × thu gọn cột trên desktop */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
body.sidebar-collapsed .sidebar { display: none; }
body.sidebar-collapsed .main,
body.sidebar-collapsed .app-main { margin-left: 0; }
#sidebarReopenButton {
  position: fixed; top: 14px; left: 14px; z-index: 90;
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 18px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
body.sidebar-collapsed #sidebarReopenButton { display: flex; }

/* W1 (UI vòng 2): shimmer nhẹ dưới canvas trong lúc chart đang dựng (deferred 1 frame) */
.overview-chart-canvas-wrap { background: linear-gradient(100deg, var(--surface-2,#f3f4f6) 30%, rgba(0,0,0,0.04) 50%, var(--surface-2,#f3f4f6) 70%); background-size: 200% 100%; animation: chartShimmer 1.1s ease-in-out infinite; border-radius: 10px; }
.overview-chart-canvas-wrap canvas { position: relative; z-index: 1; }
.overview-chart-canvas-wrap.is-drawn { background: none; animation: none; }
@keyframes chartShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Group-1 Intelligence (2026-07-15) ─────────────────────────────────── */
.intel-strip { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--panel, rgba(148,163,184,.08)); border: 1px solid rgba(148,163,184,.18); display: flex; flex-direction: column; gap: 10px; }
.intel-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.intel-title { font-weight: 700; font-size: 12px; letter-spacing: .08em; color: var(--muted, #64748b); }
.intel-chip { border: 0; cursor: pointer; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; background: rgba(217,119,6,.14); color: #b45309; }
.intel-chip.danger { background: rgba(226,75,74,.14); color: #dc2626; }
.intel-chip:hover { filter: brightness(1.08); }
.intel-ok { color: #059669; font-weight: 600; }
.intel-deltas { gap: 18px; }
.intel-delta { display: flex; gap: 12px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.intel-delta b { font-size: 12px; color: var(--muted, #64748b); text-transform: uppercase; letter-spacing: .05em; }
.intel-delta i { font-style: normal; font-weight: 700; }
.intel-delta i.d-up { color: #059669; }
.intel-delta i.d-down { color: #dc2626; }
.intel-delta i.d-flat { color: var(--muted, #64748b); }
.intel-note { font-size: 12px; color: var(--muted, #64748b); margin-left: auto; }
/* 2026-07-16 compact strip: 3 period cards + one bottom line (health · goal) */
.intel-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; position: relative; }
.intel-cards .intel-note { position: absolute; right: 2px; top: -18px; margin: 0; }
.intel-card { border: 1px solid rgba(148,163,184,.2); border-radius: 12px; padding: 8px 12px; background: var(--panel-2, rgba(255,255,255,.35)); min-width: 0; }
.intel-card-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted, #64748b); }
.intel-card-head i, .intel-card-sub i { font-style: normal; font-weight: 700; }
.intel-card .d-up { color: #059669; }
.intel-card .d-down { color: #dc2626; }
.intel-card .d-flat { color: var(--muted, #64748b); }
.intel-card-rev { font-size: 17px; font-weight: 800; margin: 2px 0; }
.intel-card-sub { display: flex; gap: 12px; font-size: 12px; color: var(--muted-strong, #475569); flex-wrap: wrap; }
.intel-bottom { font-size: 13px; gap: 10px; }
.intel-sep { width: 1px; height: 16px; background: rgba(148,163,184,.35); display: inline-block; }
.intel-goal-inline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
@media (max-width: 900px) {
  .intel-cards { grid-template-columns: 1fr; }
  .intel-cards .intel-note { position: static; }
  .intel-goal-inline { white-space: normal; max-width: none; }
}
.an-scroll { overflow-x: auto; }
.an-heat { border-collapse: collapse; font-size: 11px; min-width: 900px; }
.an-heat th { padding: 3px 4px; color: var(--muted, #64748b); font-weight: 600; text-align: left; white-space: nowrap; }
.an-heat td { padding: 1px; }
.an-cell { display: flex; align-items: center; justify-content: center; min-width: 30px; height: 24px; border-radius: 5px; color: #fff; font-weight: 600; font-size: 10px; }
.an-cell-empty { background: rgba(148,163,184,.12); color: var(--muted, #64748b); }
.an-cohort .an-cell { min-width: 52px; }
.an-note { margin: 10px 2px 2px; font-size: 12.5px; color: var(--muted, #64748b); }
.an-funnel { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.an-funnel-row { display: grid; grid-template-columns: 150px 1fr 90px; gap: 12px; align-items: center; }
.an-funnel-label { font-weight: 600; font-size: 13.5px; }
.an-funnel-bar { background: rgba(148,163,184,.14); border-radius: 999px; height: 22px; overflow: hidden; }
.an-funnel-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#2563eb,#10b981); }
.an-conv { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; padding: 8px 2px; }
.an-seg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.an-seg { border: 1px solid rgba(148,163,184,.2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.an-seg-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.an-seg-rev { font-size: 20px; font-weight: 800; }
.an-seg-meta { font-size: 12.5px; color: var(--muted, #64748b); }
.an-seg-hint { font-size: 12.5px; color: #b45309; }
.an-seg-champions { border-color: rgba(16,185,129,.5); }
.an-seg-at_risk { border-color: rgba(217,119,6,.5); }
.an-seg-hibernating { border-color: rgba(100,116,139,.5); }
.an-adopt { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); gap: 10px; margin: 12px 0; }
.an-adopt div { text-align: center; border: 1px solid rgba(148,163,184,.2); border-radius: 12px; padding: 10px 6px; }
.an-adopt b { display: block; font-size: 20px; }
.an-adopt span { font-size: 12px; color: var(--muted, #64748b); }
.an-pairs td { vertical-align: top; }
.notif-events { max-height: 300px; overflow-y: auto; }
.notif-event.notif-fresh { background: rgba(37,99,235,.07); border-radius: 8px; }
/* round-2 intelligence */
.intel-health { gap: 22px; font-size: 13px; }
.an-topwins { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.an-topwin { display: flex; gap: 8px; align-items: baseline; border: 1px solid rgba(148,163,184,.22); border-radius: 10px; padding: 7px 12px; font-size: 13px; }
.an-topwin b { font-size: 14px; }
.an-hourly { margin-top: 14px; font-size: 13px; }
.an-hourly-row { display: flex; align-items: flex-end; gap: 3px; margin-top: 8px; overflow-x: auto; }
.an-hourbar { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 22px; }
.an-hourbar span { display: block; width: 16px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg,#2563eb,#10b981); }
.an-hourbar small { font-size: 9px; color: var(--muted, #64748b); }
.an-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .an-two-col { grid-template-columns: 1fr; } }
.an-tier { display: grid; grid-template-columns: 70px 1fr 46px 50px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.an-tier-label { font-weight: 800; letter-spacing: .04em; }
.an-tier-bar { background: rgba(148,163,184,.14); border-radius: 999px; height: 14px; overflow: hidden; }
.an-tier-bar span { display: block; height: 100%; border-radius: 999px; }
.an-ltv-row { display: flex; align-items: flex-end; gap: 14px; padding: 10px 4px; }
.an-ltv { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.an-ltv > span { display: block; width: 34px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg,#8b5cf6,#2563eb); }
.an-ltv small { font-size: 11px; color: var(--muted, #64748b); }
.an-action-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 4px; border-bottom: 1px dashed rgba(148,163,184,.18); font-size: 13px; flex-wrap: wrap; }
.an-action-name { font-weight: 700; min-width: 120px; }
.an-action-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; border-radius: 999px; padding: 4px 10px; }
.an-action-badge.reward { background: rgba(16,185,129,.16); color: #059669; }
.an-action-badge.winback { background: rgba(217,119,6,.16); color: #b45309; }
.an-explain { background: rgba(37,99,235,.06); border: 1px solid rgba(37,99,235,.22); border-radius: 12px; padding: 10px 14px; margin: 10px 0 14px; }
.an-explain-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.an-explain ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.an-explain li { font-size: 12.8px; line-height: 1.5; color: var(--muted-strong, #475569); }
/* Group-2: cost/P&L intelligence */
.stock-cost-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.stock-cost-backfill { grid-column: 1 / -1; }
.stock-cost-backfill summary { cursor: pointer; font-weight: 700; font-size: 13px; padding: 4px 0; }
.stock-cost-backfill form { margin-top: 8px; }
.stock-chip.stock-exp-dead { background: rgba(226,75,74,.16); color: #dc2626; font-weight: 700; }
.stock-chip.stock-exp-soon { background: rgba(217,119,6,.16); color: #b45309; font-weight: 700; }
.an-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.an-range-label { font-size: 12.5px; color: var(--muted, #64748b); }
.an-pnl-totals { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 12px; }
.an-pnl-totals > div { border: 1px solid rgba(148,163,184,.22); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.an-pnl-totals > div span { font-size: 11.5px; color: var(--muted, #64748b); }
.an-pnl-totals > div b { font-size: 15px; }
.an-profit-pos { color: #059669; }
.an-profit-neg { color: #dc2626; }
.an-miss { color: #b45309; font-weight: 600; }
.an-coverage-warn { background: rgba(217,119,6,.09); border: 1px solid rgba(217,119,6,.3); border-radius: 10px; padding: 9px 13px; font-size: 12.8px; margin: 8px 0; line-height: 1.5; }
.an-dead-row td { background: rgba(226,75,74,.05); }
.an-exp-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 14px; }
.an-exp-chip { border: 1px solid rgba(148,163,184,.22); border-radius: 12px; padding: 8px 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 92px; }
.an-exp-chip b { font-size: 18px; }
.an-exp-chip span { font-size: 11.5px; color: var(--muted, #64748b); }
.an-exp-chip small { font-size: 10.5px; color: var(--muted, #64748b); }
.an-exp-chip.an-exp-dead:not(.an-exp-empty) { background: rgba(226,75,74,.1); border-color: rgba(226,75,74,.4); }
.an-exp-chip.an-exp-dead:not(.an-exp-empty) b { color: #dc2626; }
.an-exp-chip.an-exp-hot:not(.an-exp-empty) { background: rgba(217,119,6,.1); border-color: rgba(217,119,6,.4); }
.an-exp-chip.an-exp-hot:not(.an-exp-empty) b { color: #b45309; }
.an-exp-chip.an-exp-warm:not(.an-exp-empty) { background: rgba(234,179,8,.08); border-color: rgba(234,179,8,.35); }
.an-exp-chip.an-exp-empty { opacity: .55; }
/* Group-3B: audit logs */
.audit-filters { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.audit-filters label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.audit-filters select {
  min-width: 220px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 40px 8px 12px;
  color: var(--text);
  background-color: var(--panel-2);
  outline: none;
}
.audit-filters select:focus { border-color: rgba(37, 99, 235, 0.5); }
.audit-money-row td { background: rgba(226,75,74,.05); }
.audit-money-badge { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; border-radius: 999px; padding: 2px 7px; background: rgba(226,75,74,.16); color: #dc2626; }
/* Group-3E: monthly goal pacing */
.intel-goal { align-items: center; gap: 12px; flex-wrap: wrap; }
.an-goalbar { position: relative; flex: 1 1 160px; min-width: 120px; max-width: 340px; height: 12px; border-radius: 999px; background: rgba(148,163,184,.18); overflow: hidden; }
.an-goalbar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg,#2563eb,#10b981); }
.an-goalbar em { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #d97706; }
/* Group-3G: shops compare */
.an-shopbar { height: 6px; border-radius: 999px; background: rgba(148,163,184,.15); overflow: hidden; margin-top: 4px; max-width: 220px; }
.an-shopbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#2563eb,#10b981); }
/* Group-3F: user 360 panel */
.u360-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.u360-cards > div { border: 1px solid rgba(148,163,184,.22); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.u360-cards span { font-size: 11px; color: var(--muted, #64748b); }
.u360-cards b { font-size: 15px; }
.u360-cards small { font-size: 11px; color: var(--muted, #64748b); }
.u360-actions { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.u360-offers { font-size: 12.5px; margin: 6px 0 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.u360-h { margin: 14px 0 6px; font-size: 14px; }
/* Group-3C: message templates */
.tpl-field textarea { font-family: inherit; font-size: 13px; }
.tpl-field code { background: rgba(37,99,235,.1); border-radius: 4px; padding: 1px 5px; }
/* Group-3+: VIP tuần */
.vip-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; border-radius: 999px; padding: 2px 7px; background: rgba(139,92,246,.16); color: #7c3aed; }
.vip-week-panel { margin-top: 14px; border: 1px solid rgba(139,92,246,.3); border-radius: 12px; padding: 10px 14px; background: rgba(139,92,246,.05); }
.vip-week-panel summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.vip-week-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 10px 0 4px; }
.vip-week-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.vip-week-form input[type="number"], .vip-week-form select { min-height: 38px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--panel-2); color: var(--text); width: 120px; }
.vip-week-form .check-row { flex-direction: row; align-items: center; }
.vip-week-form .form-actions { display: flex; gap: 10px; margin: 0; }
/* Group-3+: bulk cost CSV panel */
.bulk-cost-panel { border: 1px solid rgba(37,99,235,.25); border-radius: 12px; padding: 12px 14px; margin: 8px 0 12px; background: rgba(37,99,235,.04); }
.bulk-cost-panel textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel-2); color: var(--text); font-family: ui-monospace, monospace; font-size: 12.5px; }
/* Group-3+ #4: mobile polish for the analytics/ops tables (2026-07-16) */
@media (max-width: 720px) {
  /* Wide data tables: smooth horizontal scroll + sticky first column so the row
     label stays visible while swiping across money columns. */
  .table-shell { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-shell .table { min-width: 640px; }
  .table-shell .table th:first-child,
  .table-shell .table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--panel, #fff);
    box-shadow: 6px 0 8px -6px rgba(15, 23, 42, 0.18);
  }
  .table-shell .table th, .table-shell .table td { padding: 8px 9px; font-size: 12.5px; }
  /* Summary chip rows scroll in one line instead of stacking a tall column. */
  .an-pnl-totals { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .an-pnl-totals > div { min-width: 132px; flex: 0 0 auto; }
  .an-exp-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .an-exp-chip { flex: 0 0 auto; }
  .audit-filters { gap: 10px; }
  .audit-filters select { min-width: 0; flex: 1 1 160px; }
  .an-head-actions { width: 100%; }
  .vip-week-form { gap: 10px; }
  .vip-week-form input[type="number"], .vip-week-form select { width: 100%; }
  .u360-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-action-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .intel-card-rev { font-size: 15.5px; }
}
/* Template v2: advanced full-receipt editor + preview bubble */
.tpl-advanced { border: 1px solid rgba(139,92,246,.3); border-radius: 12px; padding: 10px 14px; background: rgba(139,92,246,.04); margin: 6px 0; }
.tpl-advanced summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.tpl-preview { margin: 8px 0 14px; }
.tpl-chat-bubble { max-width: 480px; border-radius: 14px 14px 14px 4px; padding: 10px 14px; background: var(--panel-2, #f1f5f9); border: 1px solid rgba(148,163,184,.25); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
/* 3A-gộp: staff role — hide owner-territory forms (backend enforces the real wall) */
body.role-staff #productForm,
body.role-staff #bulkProductForm,
body.role-staff #categoryAssetForm,
body.role-staff #walletForm,
body.role-staff .stock-cost-backfill ~ .bulk-hidden-placeholder, /* no-op safety */
body.role-staff #overviewDashboardCard .goal-edit,
body.role-staff #setGoalButton { display: none !important; }
/* product table row action buttons that mutate the catalog (stock/Kho buttons stay) */
body.role-staff #productTable button[data-action="edit"],
body.role-staff #productTable button[data-action="delete"],
body.role-staff #exportOrdersCsvButton,
body.role-staff #exportUsersCsvButton { display: none !important; }
