/* =========================================================================
   «Дизайн» своего алерта — форма из Fields виджета (26.09.2026)
   public/alert-widget-fields.js. Графит кабинета (токены bot-graphite.css):
   нейтральные поверхности, без свечений; оранжевый — только действие,
   выбранное и заполненная часть ползунка. Всё внутри .awf — кабинетные
   правила не задеваем и сами никуда не протекаем.
   Раскладка — по ширине самой формы (container query): две колонки в
   консоли студии, одна — в узкой панели, на планшете и телефоне.
   ========================================================================= */

.awf {
  --awf-bg: #1c1f24;
  --awf-sunken: #16181c;
  --awf-raised: #272c33;
  --awf-pop: #1f2328;
  --awf-bd: #30343b;
  --awf-bd-soft: #292d33;
  --awf-bd-inp: #3a3f47;
  --awf-bd-strong: #454b55;
  --awf-tx: #edf0f5;
  --awf-tx-2: #b4bcc8;
  --awf-tx-3: #8f98a6;
  --awf-accent: #ff6a2b;
  --awf-accent-tx: #ffb18f;
  --awf-accent-bg: #ff6a2b17;
  --awf-focus: #ff6a2b99;
  --awf-bad: #ef8f86;
  --awf-bad-bg: #ef8f8614;
  --awf-warn: #e3b25e;
  --awf-warn-bg: #e3b25e14;
  --awf-r: 8px;
  --awf-font: var(--font-body, 'Onest', system-ui, sans-serif);
  --awf-mono: var(--font-mono, 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace);

  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--awf-tx);
  font: 400 13px/1.45 var(--awf-font);
  letter-spacing: 0;
  text-transform: none;
}
.awf *, .awf *::before, .awf *::after { box-sizing: border-box; }
.awf [hidden] { display: none !important; }
.awf button { font-family: var(--awf-font); }
.awf :focus-visible { outline: 2px solid var(--awf-accent); outline-offset: 2px; }

/* ---- поиск по полям ---- */
.awf-top { padding: 0 0 10px; }
.awf-search { position: relative; display: block; }
.awf-search > svg { position: absolute; left: 12px; top: 12px; color: var(--awf-tx-3); pointer-events: none; }
.awf-search .awf-input { padding-left: 36px; }
.awf-search .awf-input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.4); cursor: pointer; }
.awf-nothing { margin: 4px 0 12px; padding: 14px; border: 1px dashed var(--awf-bd-strong); border-radius: 10px; font-size: 12.5px; color: var(--awf-tx-2); text-align: center; }

/* ---- группы ---- */
.awf-group { border-top: 1px solid var(--awf-bd-soft); }
.awf-group.is-first { border-top: 0; }
.awf-group-hd {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 0;
  cursor: pointer; list-style: none; user-select: none; border-radius: 6px;
}
.awf-group-hd::-webkit-details-marker { display: none; }
.awf-group-hd::marker { content: ''; }
.awf-group-title { margin: 0; font-size: 13.5px; line-height: 20px; font-weight: 600; color: var(--awf-tx); overflow-wrap: anywhere; }
.awf-count { font-size: 12px; font-weight: 500; color: var(--awf-tx-3); font-variant-numeric: tabular-nums; }
.awf-changed {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border: 1px solid var(--awf-bd); border-radius: 999px; font-size: 10.5px; font-weight: 500; color: var(--awf-tx-2); white-space: nowrap;
}
.awf-chev { display: inline-grid; margin-left: auto; color: var(--awf-tx-3); transition: transform .15s ease; }
.awf-group[open] > .awf-group-hd .awf-chev { transform: rotate(180deg); }
.awf-group-hd:hover .awf-chev { color: var(--awf-tx); }
.awf-group > .awf-grid { padding: 4px 0 18px; }

.awf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.awf-grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.awf-wide { grid-column: 1 / -1; }

/* ---- поле ---- */
.awf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.awf-label-row { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.awf-label { min-width: 0; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--awf-tx-2); overflow-wrap: anywhere; }
.awf-val { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--awf-tx); white-space: nowrap; font-variant-numeric: tabular-nums; }
.awf-tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px; flex: none;
  border: 1px solid var(--awf-bd); border-radius: 999px; font-size: 10.5px; font-weight: 500; color: var(--awf-tx-3);
}
.awf-hint { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--awf-tx-3); overflow-wrap: anywhere; }
.awf-err { margin: 0; font-size: 12px; line-height: 1.45; color: var(--awf-bad); overflow-wrap: anywhere; }
.awf-from { font-size: 11.5px; line-height: 1.4; color: var(--awf-tx-3); overflow-wrap: anywhere; }

.awf-reset {
  flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -4px -4px -4px auto; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--awf-tx-3); cursor: pointer;
}
.awf-val + .awf-reset { margin-left: 0; }
.awf-reset:hover { background: #ffffff0f; color: var(--awf-tx); }

/* текст, число, список */
.awf-input {
  display: block; width: 100%; min-width: 0; height: 38px; margin: 0; padding: 0 12px;
  border: 1px solid var(--awf-bd-inp); border-radius: var(--awf-r); background: var(--awf-sunken); color: var(--awf-tx);
  font: 400 13px/1.3 var(--awf-font); outline: 0; box-shadow: none; transition: border-color .15s ease;
}
.awf-input::placeholder { color: #6f7885; }
.awf-input:hover { border-color: var(--awf-bd-strong); }
.awf-input:focus, .awf-input:focus-visible { border-color: var(--awf-focus); outline: 0; box-shadow: 0 0 0 3px #ff6a2b1f; }
.awf-input:disabled { opacity: .55; cursor: default; }
.awf-textarea { height: auto; min-height: 76px; padding: 9px 12px; line-height: 1.45; resize: vertical; }
.awf-field.is-invalid .awf-input,
.awf-field.is-invalid .awf-color { border-color: var(--awf-bad); }

.awf-num { position: relative; }
.awf-num.has-unit .awf-input { padding-right: 40px; }
.awf-num .awf-input { -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
.awf-num .awf-input::-webkit-outer-spin-button,
.awf-num .awf-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.awf-suf { position: absolute; right: 12px; top: 0; height: 38px; display: flex; align-items: center; font-size: 13px; color: var(--awf-tx-3); pointer-events: none; }

.awf-select { position: relative; }
.awf-select select.awf-input { -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer; text-overflow: ellipsis; }
.awf-select > svg { position: absolute; right: 11px; top: 11px; color: var(--awf-tx-3); pointer-events: none; }
.awf-select option, .awf-select optgroup { background: var(--awf-pop); color: var(--awf-tx); }

/* ползунок */
.awf-range { padding-top: 2px; }
.awf-range input[type="range"] {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; margin: 0; padding: 0;
  background: transparent; cursor: pointer; accent-color: var(--awf-accent);
}
.awf-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--awf-accent) var(--awf-fill, 0%), #2a2e35 var(--awf-fill, 0%));
}
.awf-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid var(--awf-accent);
}
.awf-range input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #2a2e35; }
.awf-range input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--awf-accent); }
.awf-range input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--awf-accent); }
.awf-range input[type="range"]:focus-visible { outline: 0; }
.awf-range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px #ff6a2b40; }
.awf-range input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px #ff6a2b40; }
.awf-range-mm { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 10.5px; line-height: 14px; color: var(--awf-tx-3); font-variant-numeric: tabular-nums; }

/* переключатель */
.awf-f-checkbox { align-self: end; }
.awf-check-row { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.awf-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.awf-check-text { min-width: 0; font-size: 13px; line-height: 1.4; color: var(--awf-tx); overflow-wrap: anywhere; }
.awf-switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0;
  border: 1px solid var(--awf-bd-strong); border-radius: 999px; background: #2a2e35; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.awf-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: #9aa3b0; transition: transform .15s ease, background .15s ease;
}
.awf-switch:checked { background: var(--awf-accent); border-color: var(--awf-accent); }
.awf-switch:checked::after { transform: translateX(16px); background: #fff; }
.awf-check-row .awf-reset { margin: 0; }

/* цвет */
.awf-color {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px 0 8px;
  border: 1px solid var(--awf-bd-inp); border-radius: var(--awf-r); background: var(--awf-sunken); transition: border-color .15s ease;
}
.awf-color:hover { border-color: var(--awf-bd-strong); }
.awf-color:focus-within { border-color: var(--awf-focus); box-shadow: 0 0 0 3px #ff6a2b1f; }
.awf-swatch {
  position: relative; flex: none; width: 22px; height: 22px; border-radius: 6px; overflow: hidden;
  background:
    linear-gradient(var(--awf-sw, transparent), var(--awf-sw, transparent)),
    conic-gradient(#b4bcc8 25%, #454b55 0 50%, #b4bcc8 0 75%, #454b55 0) 0 0 / 8px 8px;
  box-shadow: inset 0 0 0 1px #ffffff2e;
}
.awf-swatch:focus-within { outline: 2px solid var(--awf-accent); outline-offset: 2px; }
.awf-native { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.awf-hex {
  flex: 1; width: 0; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; outline: 0;
  color: var(--awf-tx); font: 500 12.5px/1 var(--awf-mono);
}
.awf-hex:focus-visible { outline: 0; }
.awf-alpha { display: inline-flex; align-items: center; gap: 2px; flex: none; font-size: 12px; color: var(--awf-tx-3); }
.awf-pct {
  width: 3.1em; margin: 0; padding: 0; border: 0; background: transparent; color: var(--awf-tx-2);
  font: 500 12px/1 var(--awf-font); text-align: right; -moz-appearance: textfield; appearance: textfield;
}
.awf-pct::-webkit-outer-spin-button, .awf-pct::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* шрифт */
.awf-font { position: relative; }
.awf-font .awf-input { padding-right: 38px; }
.awf-font-btn {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--awf-tx-3); cursor: pointer;
}
.awf-font-btn:hover { background: #ffffff0a; color: var(--awf-tx); }
.awf-font-pop {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--awf-bd-strong); border-radius: 10px; background: var(--awf-pop); box-shadow: 0 14px 32px #0000008c;
}
.awf-font-pop.is-up { top: auto; bottom: calc(100% + 4px); }
.awf-font-list { flex: 1; min-height: 0; margin: 0; padding: 4px; list-style: none; overflow: auto; overscroll-behavior: contain; }
.awf-font-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 0 10px;
  border-radius: 6px; font-size: 14px; color: var(--awf-tx); cursor: pointer;
}
.awf-font-opt > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.awf-font-opt > small { flex: none; font: 400 11px/1 var(--awf-font); color: var(--awf-tx-3); }
.awf-font-opt:hover, .awf-font-opt.is-active { background: #2d323a; }
.awf-font-opt[aria-selected="true"] { color: var(--awf-accent-tx); }
.awf-font-none { padding: 10px; font-size: 12px; line-height: 1.45; color: var(--awf-tx-2); }
.awf-font-note { flex: none; margin: 0; padding: 8px 12px; border-top: 1px solid var(--awf-bd-soft); font-size: 11.5px; line-height: 1.45; color: var(--awf-tx-3); }

/* картинка, видео, звук */
.awf-media { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.awf-asset {
  display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 8px;
  border: 1px solid var(--awf-bd); border-radius: 10px; background: var(--awf-sunken);
}
.awf-asset.is-empty { border-style: dashed; border-color: var(--awf-bd-strong); background: transparent; }
.awf-asset.is-bad { border-color: #e3b25e66; background: var(--awf-warn-bg); }
.awf-thumb {
  position: relative; flex: none; width: 64px; height: 48px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; color: var(--awf-tx-3);
  background: conic-gradient(#25282e 25%, #1d2025 0 50%, #25282e 0 75%, #1d2025 0) 0 0 / 12px 12px;
}
.awf-thumb img, .awf-thumb video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.awf-asset-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.awf-asset-meta b { font-size: 12.5px; line-height: 17px; font-weight: 500; color: var(--awf-tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.awf-asset.is-empty .awf-asset-meta b { color: var(--awf-tx-2); }
.awf-asset-meta span { font-size: 11.5px; line-height: 16px; color: var(--awf-tx-3); overflow-wrap: anywhere; }
.awf-asset-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; flex: none; }
.awf-link-toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 2px;
  border: 0; border-radius: 6px; background: transparent; color: var(--awf-tx-2); font: 500 12px/1 var(--awf-font); cursor: pointer;
}
.awf-link-toggle:hover { color: var(--awf-tx); }
.awf-link-toggle[aria-expanded="true"] { color: var(--awf-tx); }
.awf-link { display: flex; gap: 8px; }
.awf-link .awf-input { flex: 1; }
.awf-link .awf-btn { height: 38px; }

/* кнопки */
.awf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; flex: none;
  border: 1px solid var(--awf-bd-strong); border-radius: var(--awf-r); background: var(--awf-raised); color: var(--awf-tx);
  font: 600 13px/1 var(--awf-font); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .15s ease, color .15s ease;
}
.awf-btn:hover { background: #2f353d; }
.awf-btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.awf-btn.ghost { border-color: transparent; background: transparent; color: var(--awf-tx-2); }
.awf-btn.ghost:hover { background: #ffffff0a; color: var(--awf-tx); }
.awf-btn:disabled { opacity: .45; cursor: default; }
.awf-btn:disabled:hover { background: transparent; color: var(--awf-tx-2); }
.awf-btn[aria-busy="true"] { cursor: progress; }
.awf-icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; flex: none;
  border: 1px solid var(--awf-bd-strong); border-radius: var(--awf-r); background: var(--awf-raised); color: var(--awf-tx-2); cursor: pointer;
}
.awf-icon-btn:hover { color: var(--awf-tx); background: #2f353d; }
.awf-icon-btn[aria-pressed="true"] { border-color: #ff6a2b88; background: var(--awf-accent-bg); color: var(--awf-accent-tx); }
.awf-textbtn {
  padding: 0; border: 0; background: transparent; color: var(--awf-accent-tx); cursor: pointer;
  font: 600 12.5px/1.4 var(--awf-font); text-decoration: underline; text-underline-offset: 3px;
}
.awf-textbtn:hover { color: #ffc7ad; }

/* заметки автора (скрытые поля) */
.awf-notes { margin: 0 0 12px; border: 1px solid var(--awf-bd); border-radius: 10px; background: var(--awf-sunken); }
.awf-notes > summary {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  list-style: none; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--awf-tx-2); border-radius: 10px;
}
.awf-notes > summary::-webkit-details-marker { display: none; }
.awf-notes > summary::marker { content: ''; }
.awf-notes > summary > svg:last-child { margin-left: auto; color: var(--awf-tx-3); transition: transform .15s ease; }
.awf-notes[open] > summary > svg:last-child { transform: rotate(180deg); }
.awf-notes ul { display: grid; gap: 10px; margin: 0; padding: 2px 14px 14px 35px; font-size: 12px; line-height: 1.5; color: var(--awf-tx-2); }
.awf-notes li { overflow-wrap: anywhere; }
.awf-notes li b { display: block; font-weight: 500; color: var(--awf-tx); }
.awf-notes li span { display: block; }

/* подвал, отмена, пусто */
.awf-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px;
  min-height: 48px; margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--awf-bd-soft);
}
.awf-foot-note { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--awf-tx-3); }
.awf-foot-note svg { flex: none; }
.awf-undo {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; padding: 9px 12px;
  border: 1px solid var(--awf-bd); border-radius: var(--awf-r); background: #22262c; font-size: 12.5px; line-height: 1.45; color: var(--awf-tx-2);
}
.awf-notice {
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid #e3b25e44; border-radius: var(--awf-r);
  background: var(--awf-warn-bg); font-size: 12.5px; line-height: 1.5; color: #f0d39e;
}
.awf-empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 18px;
  border: 1px dashed var(--awf-bd-strong); border-radius: 12px; font-size: 13px; line-height: 1.55; color: var(--awf-tx-2);
}
.awf-empty b { font-size: 14px; font-weight: 600; color: var(--awf-tx); }
.awf-empty p { margin: 0; overflow-wrap: anywhere; }
.awf-empty a { color: var(--awf-accent-tx); font-weight: 500; }
.awf-empty.is-error { border-style: solid; border-color: #ef8f8666; background: var(--awf-bad-bg); }
.awf-empty-note { margin: 0; padding: 12px 14px; border: 1px dashed var(--awf-bd-strong); border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--awf-tx-2); }

/* варианты: свои значения поверх «Дизайна» */
.awf.is-overrides .awf-field { padding: 10px 12px; border: 1px solid var(--awf-bd); border-radius: 10px; background: #191c20; }
.awf-reset.is-remove { display: inline-grid; }
.awf-add { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.awf-orphans { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: var(--awf-tx-3); }
.awf-orphan { display: inline-flex; align-items: center; gap: 6px; }
.awf-orphan code { font: 500 11.5px/1 var(--awf-mono); color: var(--awf-tx-2); }

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

/* ---- узкая форма: планшетная панель, телефон ---- */
/* Цвета короткие — на телефоне остаются парой, остальное — во всю ширину. */
@container (max-width: 399px) {
  .awf-grid > .awf-field:not(.awf-f-color),
  .awf-grid > .awf-f-color.has-alpha { grid-column: 1 / -1; }
  .awf-f-checkbox { align-self: stretch; }
}
@container (max-width: 299px) {
  .awf-grid > .awf-field { grid-column: 1 / -1; }
}
@container (max-width: 339px) {
  .awf-asset { flex-wrap: wrap; }
  .awf-asset-actions { width: 100%; justify-content: flex-start; }
  .awf-foot { flex-direction: column; align-items: flex-start; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 700px) {
    .awf-grid > .awf-field:not(.awf-f-color), .awf-grid > .awf-f-color.has-alpha { grid-column: 1 / -1; }
  }
}
@media (pointer: coarse) {
  .awf-reset { width: 36px; height: 36px; margin: -9px -9px -9px auto; }
  .awf-range input[type="range"] { height: 32px; }
  .awf-range input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; }
  .awf-range input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
  .awf-font-opt { min-height: 42px; }
  .awf-link-toggle { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .awf *, .awf *::before, .awf *::after { transition: none !important; }
}
