:root {
  color-scheme: dark;
  --bg: #05060a;
  --surface: #0b0c11;
  --surface-2: #11131a;
  --surface-3: #1d2028;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: #9ca3af;
  --blue: #0ea5e9;
  --blue-2: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #f43f5e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 35% -10%, rgba(14, 165, 233, 0.18), transparent 30rem),
    radial-gradient(circle at 95% 10%, rgba(37, 99, 235, 0.12), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.auth-only .sidebar,
body.auth-only .topbar,
body.auth-only .stats-grid {
  display: none;
}

body.auth-only .main {
  margin-left: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

body.auth-only #workspace {
  width: 100%;
}

body.auth-only .feature-gate {
  margin: 0 auto;
}

button, input { font: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: rgba(6, 7, 11, 0.96);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: grid;
  grid-template-columns: 40px 1fr 24px;
  gap: 12px;
  align-items: center;
  padding: 34px 16px 18px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.45);
  font-weight: 800;
}

.brand strong { display: block; font-size: 20px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.collapse { border: 0; background: transparent; color: var(--muted); font-size: 24px; }

.quick-search {
  margin: 0 16px 22px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #111116;
  color: var(--muted);
}

.quick-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.nav { padding: 0 16px 18px; }
.nav p {
  margin: 28px 8px 10px;
  color: #767b88;
  font-size: 12px;
  font-weight: 700;
}

.nav a {
  height: 36px;
  padding: 0 10px;
  color: #a7abb7;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  margin: 2px 0;
  font-weight: 600;
  font-size: 14px;
}

.nav a span { width: 18px; color: #b7bcc8; }
.nav a b {
  margin-left: auto;
  min-width: 27px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: white;
  font-size: 11px;
  text-align: center;
}

.nav a:hover, .nav a.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}
.nav a.active { outline: 1px solid var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.account { margin-top: auto; padding: 16px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.main {
  min-height: 100vh;
  margin-left: 256px;
  padding: 48px 32px;
}

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

.eyebrow { color: #60a5fa; font-size: 13px; font-weight: 700; }
h1 { margin: 6px 0 4px; font-size: clamp(34px, 5vw, 56px); line-height: 0.95; letter-spacing: -0.05em; }
h2 { margin: 0; font-size: 18px; }
p { color: var(--muted); margin: 0; }

.top-actions { display: flex; gap: 10px; }
.ghost, .primary, .pill {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: white;
  background: var(--surface-2);
  min-height: 42px;
  padding: 0 14px;
}
.primary { border: 0; background: linear-gradient(135deg, var(--blue), var(--blue-2)); font-weight: 800; }
.pill { min-height: 34px; border-radius: 999px; color: var(--muted); }
.pill.active { color: #7dd3fc; background: rgba(14, 165, 233, 0.16); border-color: rgba(14, 165, 233, 0.5); }

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

.stat-card, .panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 19, 26, 0.96), rgba(10, 12, 17, 0.96));
  box-shadow: var(--shadow);
}

.stat-card { padding: 18px; position: relative; overflow: hidden; }
.stat-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -35px;
  top: -35px;
  background: var(--accent, var(--blue));
  opacity: 0.12;
  border-radius: 50%;
}
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-card strong { display: block; font-size: 28px; margin: 10px 0 4px; letter-spacing: -0.04em; }
.stat-card small { color: #6ee7b7; font-weight: 700; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.panel { padding: 22px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.filters { display: flex; gap: 10px; align-items: center; }
.filters input, .filters select, .form-inline input, .form-inline select, .form-inline textarea {
  width: 220px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-3);
  color: white;
  outline: 0;
  padding: 0 12px;
}
.form-inline textarea { width: min(520px, 100%); min-height: 120px; padding: 12px; }
.form-inline { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.settings-grid > div { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); }
.settings-grid b { display: block; margin-bottom: 8px; }
.api-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.api-list code { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.04); color: #93c5fd; }
.mini-list { display: grid; gap: 8px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { color: #767b88; font-size: 12px; text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid rgba(255,255,255,0.055); color: #d8dce6; }
.product-cell { display: flex; align-items: center; gap: 12px; }
.product-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #20242f; }
.product-cell strong { display: block; color: white; margin-bottom: 3px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }
.badge.active { background: rgba(34, 197, 94, 0.13); color: #86efac; }
.badge.off { background: rgba(244, 63, 94, 0.13); color: #fda4af; }

.side-panel { position: sticky; top: 20px; }
.chart { height: 170px; display: flex; align-items: end; gap: 10px; padding: 22px 6px 8px; }
.bar { flex: 1; min-height: 14px; border-radius: 999px 999px 5px 5px; background: linear-gradient(180deg, #38bdf8, #2563eb); position: relative; }
.bar span { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); color: #767b88; font-size: 11px; }
.bot-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  margin: 26px 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
}
.status-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(34,197,94,.12); }
.categories { display: grid; gap: 10px; }
.category-row { display: flex; justify-content: space-between; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); color: #d8dce6; }
.category-row b { color: white; }

.orders-panel { margin-top: 18px; }
.order-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.order-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.order-card:hover, .category-row:hover, .action-row:hover, .row-action:hover { border-color: rgba(14, 165, 233, 0.55); transform: translateY(-1px); }
.order-card strong { display: block; margin-bottom: 8px; }
.order-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.row-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(14, 165, 233, 0.14);
  color: #7dd3fc;
  cursor: pointer;
}
.danger-action {
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.35);
}
.promo-builder { display: grid; gap: 14px; margin: 12px 0; }
.rule-box { border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
.rule-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.rule-head select { max-width: 240px; min-height: 38px; }
.price-rule-row { display: grid; grid-template-columns: auto 86px auto minmax(120px,1fr) auto 34px; gap: 8px; align-items: center; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(0,0,0,.16); }
.price-rule-row[data-rule-row] { grid-template-columns: 28px minmax(145px,1.1fr) auto 76px auto 92px auto minmax(64px,auto) 34px; }
.modal-section .price-rule-row input { width: 100%; min-width: 0; margin: 0; }
.price-rule-row strong { min-width: 0; white-space: nowrap; }
.price-rule-row span { color: var(--muted); white-space: nowrap; }
.icon-danger { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; color: #ff4d4f; background: rgba(244,63,94,.08); border-radius: 8px; cursor: pointer; font-weight: 900; }
.muted-line { color: var(--muted); font-size: 13px; }
.modal-section .mini-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); white-space: nowrap; }
.modal-section .mini-check input { width: 16px; height: 16px; }
.category-row, .action-row {
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.action-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: #d8dce6;
}
.action-row b { color: white; font-size: 18px; }
.action-row small { color: #7dd3fc; font-weight: 800; }
.bar {
  border: 0;
  cursor: pointer;
}

.empty { padding: 30px; text-align: center; color: var(--muted); }
.stack { display: grid; gap: 18px; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; margin-bottom: 18px; border: 1px solid rgba(245,158,11,.35); border-radius: 18px; background: rgba(245,158,11,.10); }
.notice h3 { margin: 0 0 4px; }
.stock-config-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; margin-bottom: 16px; border: 1px solid rgba(14,165,233,.28); border-radius: 18px; background: linear-gradient(135deg, rgba(14,165,233,.18), rgba(34,197,94,.08)); }
.stock-config-hero h3 { margin: 4px 0 6px; font-size: 24px; letter-spacing: -0.04em; }
.stock-status { white-space: nowrap; border-radius: 999px; padding: 9px 12px; font-size: 12px; font-weight: 800; }
.stock-status.on { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.35); }
.stock-status.off { background: rgba(244,63,94,.15); color: #fda4af; border: 1px solid rgba(244,63,94,.35); }
.stock-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.toggle-card { display: grid; grid-template-columns: minmax(0,1fr) 118px; gap: 12px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); }
.toggle-card b { display: block; margin-bottom: 4px; color: white; }
.toggle-card span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.toggle-card select, .stock-number-grid input, .stock-number-grid select { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.stock-number-grid { margin-bottom: 16px; }
.stock-note { margin-bottom: 0; }
.stock-toolbar { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.stock-toolbar input { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.stock-pills { margin-bottom: 10px; }
.stock-items-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; margin: 10px 0 14px; padding-right: 4px; }
.stock-item-row { display: grid; grid-template-columns: 18px minmax(0,1fr) auto auto; gap: 8px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.03); }
.stock-item-data { display: block; font-size: 12px; line-height: 1.45; word-break: break-all; white-space: pre-wrap; color: #dbeafe; }
.stock-item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stock-status-tag { white-space: nowrap; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700; }
.stock-status-tag.available { background: rgba(34,197,94,.15); color: #86efac; }
.stock-status-tag.sold { background: rgba(148,163,184,.15); color: #cbd5e1; }
.stock-status-tag.reserved { background: rgba(245,158,11,.15); color: #fcd34d; }
.stock-status-tag.invalid, .stock-status-tag.returned, .stock-status-tag.replaced { background: rgba(244,63,94,.12); color: #fda4af; }
.stock-add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stock-add-row input { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.stock-batch-details { margin-top: 14px; }
.stock-batch-details summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.product-menu .row-action.active { border-color: rgba(14,165,233,.9); background: rgba(14,165,233,.18); color: #7dd3fc; }
.stock-modal-card { width: min(960px, calc(100vw - 32px)); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.stock-modal-body { overflow: auto; flex: 1; min-height: 0; padding: 4px 2px 12px; }
.stock-modal-body .stock-items-list { max-height: min(46vh, 420px); }
.stock-modal-body h3 { margin: 16px 0 8px; font-size: 13px; color: #60a5fa; text-transform: uppercase; letter-spacing: .04em; }
.stock-modal-body .wide-textarea { min-height: 110px; }
.stock-hint-card { padding: 14px; border: 1px dashed rgba(14,165,233,.35); border-radius: 14px; background: rgba(14,165,233,.06); color: var(--muted); font-size: 13px; line-height: 1.5; }
.toolbar, .tabs, .pills { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { min-height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.toolbar input { min-width: min(460px, 100%); }
.bulkbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid rgba(14,165,233,.35); border-radius: 14px; background: rgba(14,165,233,.10); }
.drag { border: 0; background: transparent; color: var(--muted); cursor: grab; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; display: inline-block; border-radius: 999px; background: #374151; position: relative; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.mini-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.mini-stats div, .metric-list div, .mini-card { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); padding: 16px; }
.mini-stats span, .metric-list span { display: block; color: var(--muted); font-size: 13px; }
.mini-stats b, .metric-list b { display: block; font-size: 26px; margin-top: 6px; }
.orders-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px 0 0; color: var(--muted); }
.metric-list { display: grid; gap: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.mini-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-card h3 { margin: 0 0 6px; }
.category-card { justify-content: flex-start; }
.category-card > div:nth-of-type(1) { flex: 1; min-width: 0; }
.category-card > div:nth-of-type(2) { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.category-select { display: inline-flex; align-items: center; cursor: pointer; }
.category-select input { width: 18px; height: 18px; accent-color: var(--blue); }
.setup { display: grid; gap: 10px; margin: 18px 0; }
.feature-gate { max-width: 680px; margin: 60px auto; padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(180deg, rgba(17,19,26,.96), rgba(10,12,17,.96)); text-align: center; box-shadow: var(--shadow); }
.feature-gate h2 { font-size: 28px; margin-bottom: 10px; }
.wide-textarea { width: 100%; min-height: 130px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-3); color: white; padding: 12px; margin: 8px 0 12px; outline: 0; }
.category-row { border: 1px solid var(--line); }
pre { white-space: pre-wrap; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.04); color: #d8dce6; max-height: 240px; overflow: auto; }
#loginForm { margin-top: 18px; text-align: left; }
#loginForm button { grid-column: 1 / -1; }
.form-grid textarea { min-height: 120px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 12px; outline: 0; resize: vertical; }
.product-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(135deg, rgba(14,165,233,.14), rgba(37,99,235,.05)); }
.product-hero h2 { font-size: 24px; margin-bottom: 6px; }
.product-toolbar { display: grid; grid-template-columns: auto auto minmax(260px, 1fr) 190px; gap: 10px; align-items: center; margin-bottom: 14px; }
.product-toolbar.single-action { grid-template-columns: auto minmax(260px, 1fr) 190px; }
.product-toolbar.product-toolbar-bulk { grid-template-columns: auto auto auto minmax(260px, 1fr) 190px; }
.product-toolbar input, .product-toolbar select { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.product-list { display: grid; gap: 10px; }
.product-row { display: grid; grid-template-columns: 24px 30px minmax(280px,1fr) 120px 90px 120px 58px 150px; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); cursor: pointer; }
.product-row:hover { border-color: rgba(14,165,233,.45); background: rgba(14,165,233,.06); }
.product-row.active { border-color: rgba(14,165,233,.9); background: linear-gradient(90deg, rgba(14,165,233,.16), rgba(14,165,233,.05)); box-shadow: inset 3px 0 0 var(--blue), 0 0 0 1px rgba(14,165,233,.18); }
.product-cell p { margin-top: 4px; font-size: 12px; color: #7f8797; }
.product-price b { display: block; color: white; }
.product-price span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.product-menu { display: flex; gap: 6px; flex-wrap: wrap; }
.wide-modal { width: min(760px, 100%); }
.modal-section { padding: 14px; margin: 12px 0; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); }
.modal-section h3 { margin: 0 0 12px; font-size: 13px; color: #60a5fa; text-transform: uppercase; letter-spacing: .04em; }
.modal-section label { display: grid; gap: 7px; margin-bottom: 12px; color: #d8dce6; font-size: 13px; font-weight: 700; }
.modal-section input, .modal-section select, .modal-section textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: white; padding: 0 12px; outline: 0; }
.modal-section textarea { min-height: 96px; padding: 12px; resize: vertical; }
.modal-section small { color: var(--muted); }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-row { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 10px !important; }
.check-row input { width: auto; min-height: auto; }
.product-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.product-summary-card { position: relative; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); }
.product-summary-card::after { content: ''; position: absolute; width: 80px; height: 80px; right: -30px; top: -30px; border-radius: 50%; background: var(--accent); opacity: .18; }
.product-summary-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.product-summary-card strong { display: block; font-size: 28px; margin: 8px 0 3px; }
.product-summary-card small { color: #93c5fd; font-weight: 700; }
.product-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 16px; align-items: start; }
.product-row.v2 { grid-template-columns: 24px 28px minmax(320px,1fr) 130px 100px 80px 58px 150px; }
.product-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 800; border: 1px solid var(--line); }
.tag.sale { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.35); }
.tag.warn { background: rgba(245,158,11,.12); color: #fbbf24; }
.tag.danger { background: rgba(244,63,94,.14); color: #fda4af; }
.tag.ok { background: rgba(34,197,94,.12); color: #86efac; }
.tag.info { background: rgba(14,165,233,.14); color: #7dd3fc; }
.product-price del { display: block; color: #7f8797; font-size: 12px; margin-top: 2px; }
.modal-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.modal-tab { min-height: 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--muted); padding: 0 12px; cursor: pointer; }
.modal-tab.active { color: #7dd3fc; background: rgba(14,165,233,.16); border-color: rgba(14,165,233,.55); }
.product-modal-grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 14px; align-items: start; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.modal-preview-side { position: sticky; top: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); }
.modal-preview-side h3 { margin: 0 0 12px; color: #60a5fa; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.preview-phone { border: 1px solid rgba(14,165,233,.25); border-radius: 22px; padding: 12px; background: radial-gradient(circle at top, rgba(14,165,233,.14), transparent 12rem), #07080d; }
.preview-phone pre { max-height: 420px; margin: 0; border-radius: 16px; background: rgba(255,255,255,.055); color: #e5e7eb; line-height: 1.55; }
.wide-modal { width: min(980px, 100%); max-height: 92vh; overflow: auto; }
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.modal.open { display: grid; }
.modal-card {
  width: min(680px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #0b0c11;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal-head, .modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: white;
  font-size: 24px;
  cursor: pointer;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 22px 0;
}
.form-grid label, .check-row {
  display: grid;
  gap: 8px;
  color: #d8dce6;
  font-size: 13px;
  font-weight: 700;
}
.form-grid input, .form-grid select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-3);
  color: white;
  padding: 0 12px;
  outline: 0;
}
.check-row {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.modal-actions { justify-content: flex-end; }
.modal-card.wide-modal { width: min(1040px, calc(100vw - 40px)); max-height: 92vh; overflow: auto; }
.product-modal-fields { display: block; margin: 18px 0; }
.product-modal-fields .form-grid { margin: 0 0 12px; }
.product-modal-fields .modal-tabs { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.product-modal-fields .modal-tab { width: auto; min-width: auto; height: 36px; border-radius: 999px; }
.product-modal-fields .modal-section { margin: 0; }
.product-modal-fields .product-modal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.product-modal-fields .modal-preview-side { position: sticky; top: 0; }
.product-modal-fields .tab-panel { display: none; }
.product-modal-fields .tab-panel.active { display: block; }
.product-modal-fields input, .product-modal-fields select, .product-modal-fields textarea { font-size: 14px; }
.product-row.v2 { grid-template-columns: 22px 24px minmax(240px,1fr) 110px 78px 58px 46px minmax(120px,150px); gap: 10px; padding: 12px; }
.product-menu .row-action { padding: 6px 9px; font-size: 12px; }
.product-layout > .panel { min-width: 0; }
.product-row.v2 .product-cell { min-width: 0; }
.product-row.v2 .product-cell strong, .product-row.v2 .product-cell p, .product-row.v2 .product-cell small { overflow: hidden; text-overflow: ellipsis; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  border: 1px solid rgba(14, 165, 233, 0.45);
  border-radius: 14px;
  padding: 12px 16px;
  background: #0b1220;
  color: white;
  box-shadow: var(--shadow);
  z-index: 70;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(34, 197, 94, 0.45); background: #071a12; }
.toast.error { border-color: rgba(244, 63, 94, 0.55); background: #220812; }
.toast.warning { border-color: rgba(245, 158, 11, 0.55); background: #211404; }
.variable-help { margin: 12px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14,165,233,.06); }
.variable-help h3 { margin: 0 0 6px; font-size: 15px; }
.variable-help p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.variable-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.variable-chip { display: grid; gap: 4px; padding: 10px; border: 1px solid rgba(14,165,233,.18); border-radius: 12px; background: rgba(0,0,0,.18); color: var(--text); text-align: left; cursor: pointer; }
.variable-chip:hover { border-color: rgba(14,165,233,.5); background: rgba(14,165,233,.12); }
.variable-chip code { color: #7dd3fc; font-weight: 800; }
.variable-chip span { color: var(--muted); font-size: 12px; }

.order-stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.orders-layout-v2 { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 18px; align-items: start; }
.order-toolbar input { flex: 1; min-width: 280px; }
.order-list-v2 { display: grid; gap: 12px; }
.order-card-v2 { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); cursor: pointer; transition: .18s ease; }
.order-card-v2.ticket-card { grid-template-columns: minmax(0,1fr); }
.order-card-v2.ticket-card .order-main,
.order-card-v2.ticket-card .order-grid,
.order-card-v2.ticket-card .order-actions { grid-column: 1; }
.order-card-v2.ticket-card .order-main b { word-break: break-word; white-space: normal; line-height: 1.35; }
.order-card-v2.ticket-card .order-grid strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.order-card-v2:hover, .order-card-v2.active { border-color: rgba(14,165,233,.75); background: rgba(14,165,233,.08); transform: translateY(-1px); }
.order-main { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.order-main b { display: block; color: #fff; }
.order-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.order-grid { grid-column: 2; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 12px; border-radius: 14px; background: rgba(0,0,0,.16); }
.order-grid small, .order-grid span { display: block; color: var(--muted); font-size: 12px; }
.order-grid strong { display: block; color: #fff; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; }
.order-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); white-space: nowrap; }
.order-status.pending { color: #fde68a; background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.35); }
.order-status.paid { color: #7dd3fc; background: rgba(14,165,233,.14); border-color: rgba(14,165,233,.35); }
.order-status.delivered { color: #86efac; background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.35); }
.order-status.failed, .order-status.cancelled { color: #fda4af; background: rgba(244,63,94,.14); border-color: rgba(244,63,94,.35); }
.order-detail-panel h3 { margin: 0 0 8px; font-size: 14px; color: #dbeafe; }
.order-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.order-detail-head b, .order-detail-head span { display: block; }
.detail-section { padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.detail-section pre { white-space: pre-wrap; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.22); color: #d1fae5; }
.mini-tx { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); margin-bottom: 8px; }
.mini-tx span { color: var(--muted); }
.timeline-row { display: grid; grid-template-columns: 14px 1fr; gap: 10px; margin: 10px 0; }
.timeline-row > span { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); margin-top: 5px; box-shadow: 0 0 0 5px rgba(14,165,233,.12); }
.timeline-row small { display: block; color: var(--muted); margin-top: 3px; }
.detail-actions { grid-column: auto; margin-top: 12px; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.order-alert { margin: 14px 0 0; padding: 12px; border-radius: 14px; color: #fecdd3; background: rgba(244,63,94,.13); border: 1px solid rgba(244,63,94,.34); font-weight: 700; }
.note-save { margin-top: 10px; min-height: 36px; }
.timeline-row code { display: none; margin-top: 6px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.05); color: #bfdbfe; font-size: 11px; white-space: pre-wrap; }
.timeline-row code.show { display: block; }
.tech-log-toggle { margin-top: 6px; border: 0; background: transparent; color: #7dd3fc; padding: 0; font-size: 12px; font-weight: 700; cursor: pointer; }

@media (max-width: 1100px) {
  .stats-grid, .product-summary-grid, .order-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid, .product-layout, .product-modal-grid, .product-modal-fields .product-modal-grid, .orders-layout-v2 { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .order-list { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; max-height: 420px; }
  .main { margin-left: 0; padding: 28px 16px; }
  .topbar, .panel-head { flex-direction: column; align-items: stretch; }
  .stats-grid, .order-list, .mini-stats, .orders-layout, .orders-layout-v2, .order-grid, .card-grid, .product-summary-grid, .order-stats-grid { grid-template-columns: 1fr; }
  .filters, .toolbar, .tabs, .pills, .notice { flex-direction: column; align-items: stretch; }
  .filters input, .filters select, .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .form-grid, .settings-grid, .api-list, .form-grid.two, .product-toolbar, .product-row, .stock-config-grid { grid-template-columns: 1fr; }
  .toggle-card { grid-template-columns: 1fr; }
  .stock-config-hero { flex-direction: column; align-items: flex-start; }
  .product-hero { flex-direction: column; align-items: stretch; }
  .price-rule-row, .price-rule-row[data-rule-row] { grid-template-columns: 1fr 1fr; }
  .price-rule-row strong { grid-column: 1 / -1; }
  .variable-grid { grid-template-columns: 1fr; }
}
