/* MegaMotors — поля форм: подписи, поля ввода, списки, галочки, переключатели, плитки выбора */

[hidden] { display: none !important; }

/* Подписи и раскладка */
.form label { display: block; margin-bottom: 18px; font-size: 12.5px; font-weight: 600; color: #3b404b; letter-spacing: .01em; }
.form label > :is(input:not([type="checkbox"], [type="radio"]), select, textarea) { display: block; width: 100%; margin-top: 8px; }
.form label > .muted { display: block; margin-top: 7px; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: end; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 0 18px; align-items: end; }
.form-label { font-size: 12.5px; font-weight: 600; color: #3b404b; margin-bottom: 2px; }
.form-section { margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); font: 700 13px var(--display);
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }

/* Поля ввода и списки */
:is(.form, .filters, .form-inline, .crit-table, .chat-input) :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), select, textarea),
select {
  height: 42px; padding: 0 14px; border: 1px solid #e0dbd1; border-radius: 12px; background-color: #fcfbf9; color: var(--text);
  font: 500 14px var(--font); box-shadow: inset 0 1px 2px rgba(14, 17, 23, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s; }
:is(.filters, .form-inline, .crit-table, .chat-input) :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"]), select) {
  height: 38px; border-radius: 10px; }
:is(.form, .filters, .form-inline, .crit-table, .chat-input) :is(input, select, textarea):hover:not(:focus, :disabled, [type="checkbox"], [type="radio"]),
select:hover:not(:focus) { border-color: #cfc7b9; background-color: #fff; }
:is(.form, .filters, .form-inline, .crit-table, .chat-input) :is(input:not([type="checkbox"], [type="radio"]), select, textarea):focus, select:focus {
  outline: none; border-color: var(--brand); background-color: #fff; box-shadow: 0 0 0 4px rgba(244, 84, 60, .14); }
:is(input, textarea)::placeholder { color: #aca698; font-weight: 400; }
:is(input, select, textarea):disabled { background-color: #f3f1ec; color: var(--muted); cursor: not-allowed; box-shadow: none; }
.form textarea:not([hidden]) { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
:is(.form, .filters, .form-inline, .crit-table, .chat-input) select:not([multiple]) { padding-right: 40px; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737884' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px; }
input[type="date"] { padding-right: 10px; }
input[type="file"] { font: 500 13px var(--font); color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button { height: 40px; padding: 0 18px; margin-right: 14px; border: 1px dashed #cfc7b9; border-radius: 11px;
  background: var(--surface-2); color: var(--text); font: 600 13px var(--font); cursor: pointer; transition: border-color .15s, background .15s; }
input[type="file"]::file-selector-button:hover { border-color: var(--brand); background: var(--brand-soft); }
input.num { width: 110px; }
input.num.xs { width: 70px; }

/* Галочки и радиокнопки */
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex-shrink: 0;
  width: 18px; height: 18px; margin: 0; vertical-align: -4px; border: 1.5px solid #c9c2b5; border-radius: 6px; background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 10px; height: 10px; background: #fff; transform: scale(0); transition: transform .12s ease-out;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: linear-gradient(135deg, #ff6a50, #e2402a); border-color: #e2402a; }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover:not(:checked), input[type="radio"]:hover:not(:checked) { border-color: var(--brand-2); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(244, 84, 60, .18); }
label.check { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }

/* Плитки выбора (поля и события шаблонов) */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; margin: 12px 0 18px; }
.tpl-col { display: flex; flex-direction: column; gap: 8px; }
.tpl-col .crit-label { margin: 0 0 2px 2px; }
.tpl-grid label.check { margin: 0; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  font-size: 13px; line-height: 1.35; transition: border-color .15s, background .15s, box-shadow .15s; }
.tpl-grid label.check:hover { border-color: #ddd5c8; background: #fff; box-shadow: 0 4px 14px rgba(14, 17, 23, .05); }
.tpl-grid label.check:has(input:checked) { border-color: rgba(244, 84, 60, .42); background: linear-gradient(180deg, #fff, var(--brand-soft)); }
.tpl-events { margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.tpl-events > summary { cursor: pointer; font: 700 14px var(--display); list-style: none; display: flex; align-items: center; gap: 10px; }
.tpl-events > summary::-webkit-details-marker { display: none; }
.tpl-events > summary::before { content: "›"; color: var(--brand); font-size: 18px; transition: transform .15s; }
.tpl-events[open] > summary::before { transform: rotate(90deg); }

/* Переключатели (вкл / выкл) */
.switches { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 22px; }
label.switch { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0; padding: 15px 18px; background: var(--surface);
  border-bottom: 1px solid var(--line-2); font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; transition: background .15s; }
label.switch:last-child { border-bottom: 0; }
label.switch:hover { background: var(--surface-2); }
label.switch input { position: relative; width: 44px; height: 26px; border: 0; border-radius: 999px; background: #dcd6ca; vertical-align: middle;
  box-shadow: inset 0 1px 2px rgba(14, 17, 23, .12); transition: background .2s; }
label.switch input::before { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; clip-path: none;
  transform: none; box-shadow: 0 2px 5px rgba(14, 17, 23, .22); transition: transform .2s cubic-bezier(.3, .7, .4, 1); }
label.switch input:checked { background: linear-gradient(135deg, #ff6a50, #e2402a); }
label.switch input:checked::before { transform: translateX(18px); }
label.switch.inline { display: inline-flex; padding: 0; border: 0; background: none; justify-content: flex-start; gap: 12px; }
label.switch.inline:hover { background: none; }
label.check.del { display: inline-flex; margin: 0; padding: 7px 12px; border-radius: 10px; color: var(--bad); font-size: 12.5px; font-weight: 600; }
label.check.del:hover, label.check.del:has(input:checked) { background: var(--bad-soft); }
label.check.del input:checked { background: var(--bad); border-color: var(--bad); }
.card-foot { display: flex; justify-content: flex-end; margin-top: -4px; }

/* Кнопка во время выполнения действия */
.btn.loading, button.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after, button.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border-radius: 50%; border: 2px solid rgba(127, 127, 127, .35); border-top-color: var(--brand); animation: spin .7s linear infinite; }
.btn.primary.loading::after, .btn.brand.loading::after { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Панели фильтров и строчные формы */
.filters, .form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }

@media (max-width: 1000px) {
  .row2, .row3 { grid-template-columns: 1fr; }
}
