/* Общие токены и контролы w52light. Социальные кнопки сохраняют стиль провайдера.
   Корзина использует прежнюю разметку и CSS; глобальные размеры её контролов не меняются. */
:root {
  --bg:#f4f8f9; --surface:#fff; --surface-soft:#edf3f4; --surface2:#edf3f4;
  --ink:#03111a; --ink2:#1e3a44; --muted:#627580; --line:#dce6e9;
  --accent:#0b7a75; --purple:#0b7a75; --accent-soft:#e4f3ef; --accent-bg:#e4f3ef;
  --danger:#a63238; --error:#a63238; --radius:14px;
  --control-height:44px; --control-radius:10px; --focus:#0b7a75;
}
/* Один CSS-chevron вместо нативной стрелки: одинаковый отступ в Chromium/WebKit. */
.context-picker select,.w52-product-context select {
  appearance:none; -webkit-appearance:none; padding-right:42px;
  background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);
  background-position:calc(100% - 21px) 50%,calc(100% - 16px) 50%;
  background-size:5px 5px; background-repeat:no-repeat;
}
.context-picker select:focus,.w52-product-context select:focus { box-shadow:none; outline:none; }
.context-picker select:focus-visible,.w52-product-context select:focus-visible { border-color:transparent; outline:2px solid var(--focus); outline-offset:0; }
.admin-shell { font-family:Onest,Arial,sans-serif; }
.admin-shell .btn { min-height:44px; border-radius:var(--control-radius); padding:10px 16px; font-size:14px; font-weight:500; line-height:1.4; }
body.admin-shell .btn:not(.secondary):not(.tertiary):not(.danger) { background:var(--accent); border-color:var(--accent); color:#fff; }
.admin-shell .btn.secondary { background:var(--surface); border-color:var(--line); color:var(--ink); }
.admin-shell .btn.tertiary { background:transparent; border-color:transparent; color:var(--accent); }
.admin-shell .btn.danger { background:var(--danger); color:white; }
.admin-shell .btn.secondary.danger { color:var(--danger); background:var(--surface); border-color:var(--danger); }
.admin-shell .btn:hover:not(:disabled) { transform:none; filter:brightness(.96); }
.admin-shell .btn:disabled { opacity:.5; cursor:not-allowed; transform:none; }
.admin-shell .btn:focus-visible,.admin-shell a:focus-visible { outline:2px solid var(--focus); outline-offset:3px; }
.admin-shell input:not([type=checkbox]):not([type=radio]),.admin-shell select,.admin-shell textarea { border-radius:var(--control-radius); min-height:44px; font:400 14px/1.5 Onest,Arial,sans-serif; }
.admin-shell input:focus,.admin-shell select:focus,.admin-shell textarea:focus { box-shadow:none; }
.admin-shell input:focus-visible,.admin-shell select:focus-visible,.admin-shell textarea:focus-visible { outline:2px solid var(--focus); outline-offset:1px; }
.admin-shell .panel { border-radius:var(--radius); }
.admin-shell .loading { padding:36px 20px; color:var(--muted); }
.admin-shell .catalog-actions { gap:8px; }
.admin-shell .catalog-actions .btn { white-space:nowrap; }
.admin-shell .catalog-intro { max-width:65ch; }
.admin-shell .table th { background:var(--surface-soft); }
.admin-shell .table th,.admin-shell .table td { padding:16px; vertical-align:top; }
.admin-shell .catalog-grid .table th:nth-child(3) { min-width:180px; }
.price-tiers { display:grid; gap:6px; margin:0; }
.price-tier { display:flex; gap:16px; justify-content:space-between; white-space:nowrap; font-variant-numeric:tabular-nums; }
.price-tier .range { color:var(--muted); }
.admin-shell .dlg { border:1px solid var(--line); border-radius:var(--radius); max-height:90dvh; overflow:auto; }
.admin-shell .dlg>.stack>.actions { position:sticky; bottom:-1px; background:var(--surface); padding:12px 0 0; border-top:1px solid var(--line); }
.promo-section { display:grid; gap:16px; }
.promo-section>.form-grid { align-items:start; }
.promo-section h3 { font-size:16px; margin:0; }
.promo-extra { border:1px solid var(--line); border-radius:var(--control-radius); padding:14px; }
.promo-extra summary { cursor:pointer; color:var(--accent); font-weight:500; }
.promo-extra[open]>.stack { margin-top:16px; }
@media(max-width:760px) {
 .admin-shell .btn { min-height:44px; }
 .admin-shell .catalog-actions { align-items:stretch; }
 .admin-shell .catalog-grid .table th:nth-child(3) { min-width:0; }
 .admin-shell .table td { padding:12px; }
 .admin-shell .catalog-dialog { min-width:0; }
 .admin-shell .dlg { padding:20px; }
 .price-tier { gap:12px; }
}
body.admin-shell .toolbar .btn:not(.secondary):not(.danger):not(.tertiary) { background:var(--surface); color:var(--ink); border-color:var(--line); }
/* Совместимость со старыми токенами размеров admin/base.css. */
:root { --ui-action-h:var(--control-height); --ui-action-sm:var(--control-height); }
body.admin-shell #app .btn.mini { min-height:var(--control-height); height:auto; padding:10px 12px; }
@media(max-width:820px) { body.admin-shell #app .w52-close { width:44px; min-width:44px; } }
body.admin-shell #app .tabs.w52-sidebar-nav a { min-height:var(--control-height); height:var(--control-height); }
.admin-shell .pager a { min-height:var(--control-height); }

/* UI-06: consistent checkbox alignment in administrative dialogs.
   Keep the entire label clickable and preserve native keyboard interaction. */
.admin-shell .catalog-dialog .check {
  display:grid;
  grid-template-columns:20px minmax(0,1fr);
  align-items:center;
  gap:10px;
  min-height:44px;
  margin:0;
  padding:8px 0;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.admin-shell .catalog-dialog .check input[type=checkbox] {
  width:18px;
  height:18px;
  min-height:18px;
  margin:0;
  justify-self:center;
  accent-color:var(--accent);
}
.admin-shell .catalog-dialog .form-grid > * { min-width:0; }

/* UI-06: normalize real admin dialogs without touching their API behavior. */
body.admin-shell dialog.dlg {
  width:min(560px,calc(100vw - 24px));
  max-width:min(560px,calc(100vw - 24px));
  max-height:calc(100dvh - 28px);
  overflow-x:hidden;
  overscroll-behavior:contain;
  padding:clamp(18px,3vw,28px);
}
body.admin-shell dialog.dlg:has(.catalog-dialog) {
  width:min(800px,calc(100vw - 24px));
  max-width:min(800px,calc(100vw - 24px));
}
body.admin-shell dialog.dlg > form.stack,
body.admin-shell dialog.dlg .catalog-dialog,
body.admin-shell dialog.dlg .form-grid > *,
body.admin-shell dialog.dlg .field { min-width:0; max-width:100%; }
body.admin-shell dialog.dlg .form-grid {
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px 18px;
  align-items:start;
}
body.admin-shell dialog.dlg .field input,
body.admin-shell dialog.dlg .field select,
body.admin-shell dialog.dlg .field textarea {
  display:block;
  box-sizing:border-box;
  min-width:0;
  width:100%;
  max-width:100%;
}
body.admin-shell dialog.dlg .field .hint {
  display:block;
  overflow-wrap:anywhere;
}
body.admin-shell dialog.dlg .check {
  display:grid;
  grid-template-columns:20px minmax(0,1fr);
  align-items:center;
  column-gap:10px;
  min-height:44px;
  padding:7px 0;
  margin:0;
  line-height:1.45;
  cursor:pointer;
  overflow-wrap:anywhere;
}
body.admin-shell dialog.dlg .check input[type="checkbox"] {
  width:18px;
  height:18px;
  min-height:18px;
  margin:0;
  justify-self:center;
  accent-color:var(--accent);
}
body.admin-shell dialog.dlg .catalog-dialog fieldset {
  min-width:0;
  padding:16px;
  border-radius:var(--control-radius);
}
body.admin-shell dialog.dlg .catalog-dialog .tier-row,
body.admin-shell dialog.dlg .catalog-dialog .catalog-row {
  min-width:0;
  gap:12px;
}
body.admin-shell dialog.dlg > form.stack > .actions {
  position:sticky;
  bottom:-1px;
  z-index:2;
  display:flex;
  justify-content:flex-start;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  min-height:66px;
  margin:0;
  padding:12px 0 2px;
  border-top:1px solid var(--line);
  background:var(--surface);
}
body.admin-shell .w52-orders-filter { align-items:end; }
body.admin-shell .w52-orders-filter > .field { flex:1 1 230px; }
body.admin-shell .w52-orders-filter > .btn { flex:0 0 auto; }
body.admin-shell .w52-orders-summary { align-items:center; }
body.admin-shell .w52-orders-summary h2 { margin:0; min-width:0; }
body.admin-shell .w52-orders-summary > .actions { margin:0; min-width:0; }
@media(max-width:760px) {
  body.admin-shell dialog.dlg .form-grid { grid-template-columns:minmax(0,1fr); }
  body.admin-shell dialog.dlg .catalog-dialog .tier-row,
  body.admin-shell dialog.dlg .catalog-dialog .catalog-row {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  body.admin-shell dialog.dlg .tier-row > .btn,
  body.admin-shell dialog.dlg .catalog-row > .btn { grid-column:1/-1; justify-self:start; }
  body.admin-shell .w52-orders-filter > .field { flex:1 1 100%; }
  body.admin-shell .w52-orders-summary { align-items:flex-start; }
}
@media(max-width:480px) {
  body.admin-shell dialog.dlg .catalog-dialog .tier-row,
  body.admin-shell dialog.dlg .catalog-dialog .catalog-row {
    grid-template-columns:minmax(0,1fr);
  }
  body.admin-shell dialog.dlg > form.stack > .actions > .btn { flex:1 1 130px; }
}

/* UI-06 promo mode: two clear choices, with an explicit manual-code input. */
body.admin-shell .promo-code-options {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
body.admin-shell dialog.dlg .promo-code-options .check {
  min-width:0;
  padding:12px;
  border:1px solid var(--line);
  border-radius:var(--control-radius);
  background:var(--surface);
}
body.admin-shell dialog.dlg .promo-code-options .check:has(input:checked) {
  border-color:var(--accent);
  background:var(--accent-bg);
}
body.admin-shell dialog.dlg .promo-code-options .check input[type="radio"] {
  width:18px;
  height:18px;
  min-height:18px;
  margin:0;
  justify-self:center;
  accent-color:var(--accent);
}
@media(max-width:480px){
  body.admin-shell .promo-code-options { grid-template-columns:minmax(0,1fr); }
}

/* UI-06: dense user/admin tables keep useful column widths on large screens,
   but scroll inside the card instead of breaking email or date into characters.
   At <=1000px the existing container-query card layout takes over. */
body.admin-shell .w52-users-wrap,
body.admin-shell .w52-admins-wrap {
  max-width:100%; min-width:0; overflow-x:auto; overscroll-behavior-x:contain;
}
@container (min-width:1001px) {
  body.admin-shell .w52-users-wrap .w52-data-table {
    table-layout:auto; min-width:1390px; width:100%;
  }
  body.admin-shell .w52-admins-wrap .w52-data-table {
    table-layout:auto; min-width:1160px; width:100%;
  }
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(1) { min-width:160px; }
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(2) { min-width:228px; }
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(3) { min-width:150px; }
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(5) { min-width:175px; }
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(6),
  body.admin-shell .w52-users-wrap .w52-data-table th:nth-child(7) { min-width:138px; }
  body.admin-shell .w52-admins-wrap .w52-data-table th:last-child { min-width:210px; }
}
body.admin-shell .w52-users-wrap .user-email { overflow-wrap:anywhere; }
body.admin-shell .w52-admins-wrap .table .actions { gap:8px; }
