/* =====================================================================
 * Qserot Control — strict monochrome admin system
 * Pure black / white / gray themes. Semantic state uses shape and contrast.
 * ===================================================================== */

:root {
  color-scheme: dark;
  --bg: #080808;
  --bg-soft: #0d0d0d;
  --panel: #111111;
  --panel-raised: #171717;
  --panel-hover: #1d1d1d;
  --sidebar: rgba(5, 5, 5, 0.97);
  --text: #f7f7f5;
  --text-soft: #d1d1cd;
  --muted: #92928d;
  --faint: #686863;
  --line: rgba(190, 190, 184, 0.16);
  --line-strong: rgba(220, 220, 214, 0.30);
  --solid: #f7f7f5;
  --on-solid: #0a0a0a;
  --primary: #f7f7f5;
  --primary-strong: #d8d8d3;
  --primary-soft: rgba(247, 247, 245, 0.11);
  --cyan: #d8d8d3;
  --cyan-soft: rgba(216, 216, 211, 0.10);
  --green: #f7f7f5;
  --green-soft: rgba(247, 247, 245, 0.12);
  --amber: #b5b5af;
  --amber-soft: rgba(181, 181, 175, 0.11);
  --rose: #ededE9;
  --rose-soft: rgba(237, 237, 233, 0.10);
  --overlay: rgba(0, 0, 0, 0.74);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 32px rgba(0, 0, 0, 0.19);
  --accent-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: 252px;
  --topbar-height: 84px;
  --transition: 180ms ease;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #efefec;
  --bg-soft: #e8e8e4;
  --panel: #ffffff;
  --panel-raised: #fafaf8;
  --panel-hover: #f2f2ef;
  --sidebar: rgba(255, 255, 255, 0.92);
  --text: #111110;
  --text-soft: #353532;
  --muted: #6c6c67;
  --faint: #92928c;
  --line: rgba(40, 40, 37, 0.13);
  --line-strong: rgba(30, 30, 28, 0.27);
  --solid: #111110;
  --on-solid: #ffffff;
  --primary: #111110;
  --primary-strong: #2d2d2a;
  --primary-soft: rgba(17, 17, 16, 0.08);
  --cyan: #343431;
  --cyan-soft: rgba(52, 52, 49, 0.08);
  --green: #111110;
  --green-soft: rgba(17, 17, 16, 0.09);
  --amber: #666660;
  --amber-soft: rgba(102, 102, 96, 0.08);
  --rose: #222220;
  --rose-soft: rgba(34, 34, 32, 0.08);
  --overlay: rgba(0, 0, 0, 0.50);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.14);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
  --accent-shadow: 0 16px 40px rgba(0, 0, 0, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% -10%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 31rem),
    radial-gradient(circle at 34% 112%, color-mix(in srgb, var(--cyan) 7%, transparent), transparent 35rem),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

[hidden],
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.pre-line {
  white-space: pre-line;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.045em;
}

.page-heading p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
}

.domain-stat {
  color: inherit;
  text-decoration: none;
}

.domain-stat:hover {
  border-color: var(--text);
  transform: translateY(-2px);
}

.domain-quick .quick-action {
  min-height: 88px;
}

.builtin-payment-card {
  overflow: hidden;
  border-width: 2px;
}

.builtin-payment-card .eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.builtin-assets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 16px;
}

.builtin-asset {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  opacity: 0.72;
  transition: border-color var(--transition), opacity var(--transition), transform var(--transition);
}

.builtin-asset.is-enabled {
  border-color: var(--text);
  opacity: 1;
  transform: translateY(-1px);
}

.builtin-asset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.builtin-asset h3 {
  margin: 9px 0 4px;
  font-size: 18px;
}

.builtin-asset p,
.automation-note span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.automation-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.automation-note strong {
  flex: 0 0 auto;
  font-size: 12px;
}

.advanced-settings {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.advanced-settings summary {
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.hint-text {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.empty-state {
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}

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

.compact-stats .stat {
  min-height: 112px;
}

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

/* Product lists are summaries, not detail pages. Keep every desktop row at a
   predictable scanning height while the editor retains the complete text. */
.product-list-copy {
  display: grid;
  min-width: 240px;
  max-width: 430px;
  gap: 5px;
}

.product-list-copy strong,
.product-list-copy .table-sub {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
}

.product-list-copy strong {
  color: var(--text);
  font-size: 12px;
  -webkit-line-clamp: 2;
}

.product-list-copy .table-sub {
  margin-top: 0;
  font-size: 10px;
  -webkit-line-clamp: 2;
}

@media (min-width: 721px) {
  .product-list-card .tbl td {
    height: 88px;
  }

  .product-list-card .tbl td:first-child {
    width: 74px;
  }

  .product-list-card .tbl td:nth-child(2) {
    width: 38%;
  }

  .product-list-card .img-thumb-wrap {
    width: 54px;
    height: 54px;
  }
}

.category-tree-name {
  display: block;
  padding-left: calc(var(--depth, 0) * 22px);
  color: var(--text);
  font-weight: 700;
}

.inline-field {
  max-width: 320px;
  margin: 0;
}

.domain-filters {
  align-items: flex-end;
}

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

.settings-keyval .v {
  overflow-wrap: anywhere;
}

.card-secret {
  user-select: all;
}

/* App shell */
.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 60;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition), box-shadow var(--transition);
}

.brand {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark,
.login-logo,
.login-mobile-logo {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--solid);
  border-radius: 12px;
  background: var(--solid);
  color: var(--on-solid);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.brand-copy,
.login-brand > span:last-child {
  min-width: 0;
}

.brand-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot,
.pulse-dot,
.hero-eyebrow i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
}

.workspace-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 16px 14px 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.workspace-card > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.workspace-card b {
  font-size: 12px;
}

.workspace-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  font-size: 10px;
  font-weight: 900;
}

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

.nav {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.nav-single { margin-bottom: 6px; }

.nav-section { margin: 3px 0; }

.nav-group-toggle {
  display: grid;
  width: 100%;
  min-height: 48px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 760;
  text-align: left;
  cursor: pointer;
}

.nav-group-toggle:hover { background: var(--panel-hover); color: var(--text); }

.nav-group-chevron { color: var(--muted); transition: transform var(--transition); }
.nav-section:not(.open) .nav-group-chevron { transform: rotate(180deg); }
.nav-children { display: none; padding-left: 24px; }
.nav-section.open .nav-children { display: block; }

.nav-item {
  display: grid;
  width: 100%;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.nav-item:hover {
  border-color: var(--line);
  background: var(--panel-hover);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.active {
  border-color: var(--solid);
  background: var(--solid);
  color: var(--on-solid);
}

.ico,
.stat-icon,
.quick-icon {
  display: grid;
  place-items: center;
}

.ico {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 0;
  opacity: 0.88;
}

.ico svg {
  width: 15px;
  height: 15px;
}

.nav-label {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-arrow {
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity var(--transition), transform var(--transition);
}

.nav-item:hover .nav-arrow,
.nav-item.active .nav-arrow {
  opacity: 1;
  transform: none;
}

.main {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px clamp(18px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-right,
.session-chip,
.connection-pill {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
  gap: 13px;
}

.topbar-right {
  gap: 9px;
}

.language-picker { margin: 0; }
.language-picker select { min-height: 40px; width: auto; max-width: 128px; padding: 7px 30px 7px 10px; border-radius: 10px; background: var(--panel); }

.topbar-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.topbar-kicker span {
  color: var(--text-soft);
}

.topbar-kicker i {
  font-style: normal;
}

.page-title {
  max-width: 58vw;
  overflow: hidden;
  margin-top: 2px;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 820;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-pill,
.session-chip {
  height: 40px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
}

.session-avatar {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--solid);
  color: var(--on-solid);
  font-size: 10px;
  font-weight: 900;
}

.session-info {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: relative;
  flex: 0 0 auto;
}

.account-menu-trigger {
  min-width: 0;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--text);
}

.account-menu-chevron {
  display: inline-grid;
  width: 14px;
  place-items: center;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  transition: transform var(--transition);
}

.account-menu-trigger[aria-expanded="true"] .account-menu-chevron {
  transform: rotate(180deg);
}

.account-menu-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  right: 0;
  width: min(306px, calc(100vw - 24px));
  overflow: hidden;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-raised);
  box-shadow: var(--shadow);
}

.account-menu-item {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  background: var(--panel-hover);
  color: var(--text);
}

.account-menu-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.account-menu-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

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

.account-menu-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-divider {
  height: 1px;
  margin: 6px 5px;
  background: var(--line);
}

.account-menu-logout {
  color: var(--muted);
}

.content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 44px);
}

.sidebar-mask {
  position: fixed;
  z-index: 55;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.icon-btn.menu-btn,
.icon-btn.sidebar-close {
  display: none;
}

/* Buttons */
.btn,
.icon-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel-raised);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.btn:hover,
.icon-btn:hover {
  border-color: var(--text);
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.btn:active,
.icon-btn:active {
  transform: translateY(0);
}

.btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.btn-primary,
.btn-success,
.btn-danger {
  border-color: var(--solid);
  background: var(--solid);
  color: var(--on-solid);
}

.btn-danger {
  border-style: double;
}

.btn-soft,
.btn-glass,
.btn-refresh {
  background: var(--panel);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  border-color: var(--line);
  color: var(--text);
}

.btn-sm {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
}

.btn-lg {
  min-height: 46px;
  padding: 12px 18px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  padding: 0;
  border-radius: 10px;
}

.topbar-icon {
  background: var(--panel);
}

.refresh-icon {
  font-size: 17px;
}

/* Cards and typography */
.card {
  min-width: 0;
  margin-bottom: 18px;
  padding: clamp(18px, 2.2vw, 28px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.card h2,
.card h3,
.plain-heading {
  margin-top: 0;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.card h2,
.plain-heading {
  margin-bottom: 8px;
  font-size: clamp(17px, 1.7vw, 21px);
}

.card h3 {
  margin: 26px 0 11px;
  font-size: 14px;
}

.desc,
.hint,
.stat-extra,
.schema-field-detail {
  color: var(--muted);
}

.desc {
  margin: 5px 0 18px;
}

.hint,
.help-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--panel-raised);
  font-size: 12px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.section-head,
.toolbar,
.form-row,
.form-actions,
.section-head-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.section-head {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head > div:first-child {
  min-width: 0;
}

.section-head h2,
.section-head .desc {
  margin-bottom: 0;
}

.toolbar {
  margin: 16px 0;
}

.toolbar-spread {
  align-items: center;
  justify-content: space-between;
}

.form-row {
  align-items: stretch;
  margin: 13px 0;
}

.form-row > .field,
.toolbar > .field {
  min-width: min(100%, 190px);
  flex: 1 1 190px;
}

.field-grow {
  flex-grow: 2 !important;
}

.form-actions,
.modal-actions {
  margin-top: 20px;
}

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

.divider {
  height: 1px;
  margin: 24px 0;
  background: var(--line);
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 32px 0 14px;
}

.section-title span,
.card-eyebrow {
  color: var(--faint);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.section-title h2 {
  margin: 3px 0 0;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* Forms */
.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  margin: 11px 0;
}

.field > span:first-child {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: var(--panel-raised);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input,
select {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 108px;
  padding: 11px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 11%, transparent);
  background: var(--panel);
}

.textarea-sm {
  min-height: 92px;
}

.textarea-md {
  min-height: 170px;
}

.textarea-lg {
  min-height: 310px;
}

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

.checkbox-line {
  display: flex;
  min-height: 42px;
  align-items: center;
  grid-template-columns: none;
  gap: 9px;
}

.align-end {
  align-self: end;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 43px;
  height: 24px;
  flex: 0 0 43px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-raised);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.slider::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform var(--transition), background var(--transition);
}

.switch input:checked + .slider {
  border-color: var(--solid);
  background: var(--solid);
}

.switch input:checked + .slider::before {
  background: var(--on-solid);
  transform: translateX(19px);
}

.switch input:focus-visible + .slider {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* Tables become readable cards on phones. */
.table-wrap {
  width: 100%;
  margin: 14px 0 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-raised);
}

.tbl {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  text-align: left;
}

.tbl th,
.tbl td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tbl th {
  background: var(--panel-hover);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tbl td {
  max-width: 360px;
  color: var(--text-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl tbody tr:hover td {
  background: var(--panel-hover);
}

/* Shared single/multi-select controls for maintainable lists. */
.bulk-toolbar {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  margin: 14px 0 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-hover);
}

.bulk-select-all {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.bulk-checkbox {
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  accent-color: var(--solid);
  cursor: pointer;
}

.bulk-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.bulk-summary {
  min-width: 86px;
  color: var(--muted);
  font-size: 11px;
}

.bulk-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.bulk-select-cell {
  width: 44px;
  max-width: 44px !important;
  text-align: center !important;
}

.tbl tbody tr.is-selected td {
  background: var(--panel-hover);
}

.empty {
  padding: 28px 16px !important;
  color: var(--muted) !important;
  text-align: center;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

/* Status is conveyed through text, border, and pattern—not color. */
.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-raised);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.badge.ok {
  border-color: var(--text);
  background: var(--solid);
  color: var(--on-solid);
}

.badge.warn {
  border-style: dashed;
}

.badge.err {
  border-style: double;
  border-width: 3px;
}

.badge.info {
  border-color: var(--text-soft);
}

.output {
  max-width: 100%;
  max-height: 620px;
  margin: 14px 0 0;
  padding: 15px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #050505;
  color: #eeeeeb;
  font: 11px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

:root[data-theme="light"] .output {
  background: #171716;
  color: #f5f5f2;
}

.output.ok {
  border-style: solid;
}

.output.err {
  border-style: double;
  border-width: 3px;
}

.raw-details {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.raw-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

/* Dashboard */
.dashboard-hero {
  position: relative;
  display: grid;
  min-height: 310px;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  align-items: center;
  gap: 28px;
  padding: clamp(26px, 4.4vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    radial-gradient(circle at 78% 28%, color-mix(in srgb, var(--text) 10%, transparent), transparent 33%),
    linear-gradient(135deg, var(--panel-raised), var(--panel));
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.hero-copy h1 {
  max-width: 680px;
  margin: 15px 0 10px;
  font-size: clamp(30px, 4.3vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.hero-copy p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 17px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-visual {
  position: relative;
  min-height: 220px;
}

.hero-ring {
  position: absolute;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.ring-a {
  inset: 13px 18px;
}

.ring-b {
  inset: 45px 50px;
  border-style: dashed;
}

.hero-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--solid);
  border-radius: 22px;
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: 0 0 0 12px color-mix(in srgb, var(--solid) 10%, transparent);
  transform: translate(-50%, -50%) rotate(4deg);
}

.hero-core svg {
  width: 32px;
  height: 32px;
}

.hero-float {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  box-shadow: var(--shadow-soft);
}

.hero-float b {
  color: var(--text);
  font-size: 11px;
}

.float-a {
  top: 22px;
  right: 0;
}

.float-b {
  bottom: 24px;
  left: 0;
}

.alert {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
}

.alert > span:first-child {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-weight: 900;
}

.alert b,
.alert p {
  margin: 0;
}

.alert p,
.alert a {
  color: var(--muted);
  font-size: 11px;
}

.alert a {
  font-weight: 800;
}

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

.quick-action {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.quick-action:hover {
  border-color: var(--text);
  background: var(--panel-hover);
  transform: translateY(-2px);
}

.quick-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel-raised);
}

.quick-icon svg {
  width: 20px;
  height: 20px;
}

.quick-action > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.quick-action b,
.quick-action small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action small {
  color: var(--muted);
  font-size: 10px;
}

.quick-action i {
  color: var(--muted);
  font-style: normal;
}

.stat {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.stat.ok {
  border-style: solid;
  border-color: var(--line-strong);
}

.stat.warn {
  border-style: dashed;
}

.stat.err {
  border-style: double;
  border-width: 3px;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel-raised);
}

.stat-icon svg {
  width: 16px;
  height: 16px;
}

.stat-spark {
  width: 43px;
  height: 17px;
  border-bottom: 1px solid var(--muted);
  opacity: 0.38;
  transform: skewY(-13deg);
}

.stat-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 5px;
  overflow: hidden;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 850;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-extra {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 10px;
}

/* Catalog, products, records */
.catalog-shell {
  display: grid;
  grid-template-columns: minmax(270px, 0.34fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.catalog-sidebar {
  min-width: 0;
}

.catalog-sidebar > .card {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.catalog-main {
  min-width: 0;
}

.cat-tree {
  max-height: 430px;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-raised);
}

.cat-node {
  display: grid;
  width: 100%;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px calc(10px + min(var(--depth), 8) * 16px);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}

.cat-node:last-child {
  border-bottom: 0;
}

.cat-node:hover,
.cat-node.selected {
  background: var(--panel-hover);
  color: var(--text);
}

.cat-node.selected {
  box-shadow: inset 3px 0 0 var(--text);
}

.cat-branch {
  color: var(--faint);
  font-family: monospace;
}

.cat-copy {
  display: grid;
  min-width: 0;
}

.cat-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-count {
  display: grid;
  min-width: 26px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 850;
}

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

.catalog-filters .btn {
  align-self: end;
  margin-bottom: 11px;
}

.img-thumb-wrap {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-hover);
  color: var(--faint);
  font-size: 8px;
  font-weight: 900;
}

.img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-uploader {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-raised);
}

.product-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.product-image-item {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
}

.product-image-item > img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--panel-hover);
}

.product-image-item figcaption,
.product-image-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 11px;
}

.product-image-order {
  justify-content: center;
  padding-top: 0;
}

.product-image-empty {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
}

.product-image-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.category-icon-uploader {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
}

.category-icon-preview {
  position: relative;
  width: 56px;
  height: 56px;
}

.category-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.category-icon-preview button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
}

.category-icon-empty {
  color: var(--muted);
  font-size: 11px;
}

.product-title-cell {
  display: grid;
  min-width: 145px;
  gap: 3px;
}

.product-title-cell small {
  max-width: 300px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-overview {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1.2fr);
  align-items: start;
  gap: 18px;
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.product-gallery figure {
  position: relative;
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-raised);
}

.product-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery figcaption {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 2px 6px;
  border: 1px solid #4a4a47;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.76);
  color: #ffffff;
  font-size: 9px;
}

.image-placeholder {
  display: grid;
  min-height: 240px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--panel-raised);
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.keyval {
  display: grid;
  grid-template-columns: minmax(110px, 0.32fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.keyval > span {
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.keyval > span:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.keyval .k {
  background: var(--panel-raised);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.keyval .v {
  color: var(--text-soft);
  font-size: 12px;
}

.sku-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 11px 0;
}

.schema-field {
  margin: 9px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
}

.schema-field-name {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 850;
}

.schema-field-detail {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.cover-preview,
.identity-result,
.payment-qr {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 13px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-raised);
}

.cover-preview img,
.identity-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
}

.payment-qr {
  width: fit-content;
  flex-direction: column;
  align-items: center;
}

.payment-qr img {
  width: 210px;
  height: 210px;
  object-fit: contain;
  background: #ffffff;
}

.payment-qr span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.result-panel > h3 {
  margin-top: 22px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 5px;
  margin: 16px 0;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-raised);
}

.tab {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  border-color: var(--solid);
  background: var(--solid);
  color: var(--on-solid);
}

/* Modal and toast */
.modal-root {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  padding: clamp(18px, 3vw, 28px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(100%, 1040px);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.toast-root {
  position: fixed;
  z-index: 130;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 750;
  animation: toast-in 180ms ease-out;
}

.toast.err {
  border-style: double;
  border-width: 3px;
}

.toast.info {
  background: var(--panel-raised);
  color: var(--text);
}

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

.spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login */
.login-overlay {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  overflow-y: auto;
  background: var(--bg);
}

.login-shell {
  display: grid;
  width: min(1120px, 100%);
  min-height: min(710px, calc(100vh - 68px));
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-showcase {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(30px, 5vw, 66px);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--panel-raised);
  background-size: 38px 38px;
}

.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand > span:last-child {
  display: grid;
}

.login-brand small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.login-showcase-copy {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.login-eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.login-showcase h2 {
  margin: 17px 0;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.login-showcase-copy p {
  max-width: 490px;
  color: var(--muted);
  font-size: 15px;
}

.login-feature-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.login-feature-grid > span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
}

.feature-dot {
  width: 7px;
  height: 7px;
  grid-row: 1 / 3;
  margin-top: 5px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--text);
}

.login-feature-grid b,
.login-feature-grid small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-feature-grid b {
  font-size: 10px;
}

.login-feature-grid small {
  color: var(--muted);
  font-size: 9px;
}

.showcase-orb {
  position: absolute;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  opacity: 0.55;
}

.orb-one {
  width: 330px;
  height: 330px;
  top: -140px;
  right: -100px;
}

.orb-two {
  width: 210px;
  height: 210px;
  right: 45px;
  bottom: -135px;
  border-style: dashed;
}

.login-card {
  display: flex;
  width: 100%;
  max-width: 440px;
  align-self: center;
  justify-self: center;
  flex-direction: column;
  padding: clamp(30px, 5vw, 56px);
}

.login-form-head {
  margin-bottom: 20px;
}

.login-form-head h1 {
  margin: 8px 0 5px;
  font-size: clamp(26px, 3.2vw, 37px);
  letter-spacing: -0.055em;
}

.login-sub {
  margin: 0;
  color: var(--muted);
}

.login-mobile-logo {
  display: none;
  margin-bottom: 18px;
}

.login-error {
  margin: 9px 0;
  padding: 11px 12px;
  border: 3px double var(--line-strong);
  border-radius: 9px;
  background: var(--panel-raised);
  color: var(--text);
  font-size: 12px;
}

.login-safe {
  margin-top: 17px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.login-safe span {
  margin-right: 4px;
  color: var(--text);
}

/* Breakpoints */
@media (max-width: 1180px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connection-pill {
    display: none;
  }

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

@media (max-width: 960px) {
  :root {
    --topbar-height: 72px;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    width: min(86vw, 314px);
    transform: translateX(-102%);
  }

  .sidebar.open {
    box-shadow: 22px 0 80px rgba(0, 0, 0, 0.55);
    transform: translateX(0);
  }

  .icon-btn.sidebar-close {
    display: grid;
    margin-left: auto;
  }

  .icon-btn.menu-btn {
    display: grid;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    padding-inline: 16px;
  }

  .content {
    padding: 18px 16px 34px;
  }

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

  .catalog-sidebar > .card {
    position: static;
  }

  .cat-tree {
    max-height: 320px;
  }

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

  .hero-visual {
    display: none;
  }

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

  .login-showcase {
    display: none;
  }

  .login-card {
    min-height: 620px;
    justify-content: center;
  }

  .login-mobile-logo {
    display: grid;
  }
}

@media (max-width: 720px) {

  .builtin-assets {
    grid-template-columns: 1fr;
  }

  .automation-note {
    flex-direction: column;
  }
  .account-menu-trigger .session-info,
  .account-menu-trigger .account-menu-chevron,
  .btn-refresh span:last-child {
    display: none;
  }

  .account-menu-trigger {
    width: 40px;
    min-width: 40px;
    justify-content: center;
    padding: 0;
  }

  .btn-refresh {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .topbar-right {
    gap: 6px;
  }

  .page-title {
    max-width: 46vw;
    font-size: 17px;
  }

  .topbar-kicker {
    display: none;
  }

  .account-menu-panel {
    position: fixed;
    top: calc(var(--topbar-height) - 3px);
    right: 12px;
  }

  .content {
    padding-inline: 12px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 16px;
  }

  .page-heading > .btn {
    width: 100%;
  }

  .compact-stats,
  .locale-editor {
    grid-template-columns: 1fr;
  }

  .card {
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 13px;
  }

  .dashboard-hero {
    min-height: 0;
    padding: 27px 20px;
    border-radius: 15px;
  }

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

  .quick-grid,
  .card-grid,
  .catalog-filters,
  .loc-row,
  .product-gallery {
    grid-template-columns: 1fr;
  }

  .product-gallery figure {
    aspect-ratio: 16 / 11;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .form-row,
  .toolbar:not(.toolbar-spread) {
    align-items: stretch;
    flex-direction: column;
  }

  .form-row > .field,
  .toolbar > .field {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .section-head {
    gap: 10px;
  }

  .section-head-actions {
    width: 100%;
  }

  .section-head-actions .btn {
    flex: 1;
  }

  .bulk-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 11px;
  }

  .bulk-select-all {
    min-height: 32px;
  }

  .bulk-summary {
    min-width: 0;
  }

  .bulk-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bulk-actions .btn {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .responsive-table tbody {
    display: grid;
    gap: 10px;
  }

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

  .responsive-table td {
    display: grid;
    max-width: none;
    grid-template-columns: minmax(90px, 0.42fr) minmax(0, 0.58fr);
    gap: 10px;
    padding: 10px 11px;
    border-bottom: 1px solid var(--line);
    text-align: right;
  }

  .responsive-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-align: left;
    text-transform: uppercase;
  }

  .responsive-table td.bulk-select-cell {
    width: 100%;
    max-width: none !important;
  }

  .responsive-table td.bulk-select-cell > .bulk-checkbox {
    justify-self: end;
  }

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

  .responsive-table td[colspan] {
    display: block;
    text-align: center;
  }

  .responsive-table td[colspan]::before {
    display: none;
  }

  .responsive-table td > .img-thumb-wrap,
  .responsive-table td > .btn,
  .responsive-table td > .badge {
    justify-self: end;
  }

  .responsive-table td > .product-title-cell {
    min-width: 0;
  }

  .keyval {
    grid-template-columns: minmax(92px, 0.4fr) minmax(0, 0.6fr);
  }

  .modal-root {
    align-items: end;
    padding: 0;
  }

  .modal,
  .modal.wide {
    width: 100%;
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .login-overlay {
    padding: 0;
  }

  .login-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .login-card {
    min-height: 100vh;
    padding: 28px 22px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
    padding-inline: 12px;
  }

  .topbar-right .language-picker {
    display: none;
  }

  .page-title {
    max-width: calc(100vw - 228px);
  }
}

@media (max-width: 430px) {
  .hero-actions,
  .form-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .btn,
  .form-actions .btn,
  .modal-actions .btn {
    width: 100%;
  }

  .toolbar-spread {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-spread > .btn {
    width: 100%;
  }

  .quick-action {
    padding: 13px;
  }

  .responsive-table td {
    grid-template-columns: minmax(80px, 0.38fr) minmax(0, 0.62fr);
  }
}

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

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

.security-setup {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.security-qr {
  width: min(256px, 72vw);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.security-secret {
  display: grid;
  width: 100%;
  gap: 6px;
}

.security-secret code {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 11px 12px;
  text-align: center;
  letter-spacing: .08em;
}

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