.ms-form {
    padding: 18px;
    display: grid;
    gap: 14px;
}

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

.ms-field {
    display: grid;
    gap: 6px;
}

.ms-label {
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
}

.ms-input, .ms-select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #3a3a3a;
    background: #1f1f1f;
    color: var(--text);
    padding: 1rem .85rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ms-input:focus, .ms-select:focus {
    outline: none;
    border-color: color-mix(in oklab, var(--accent) 70%, #000 0%);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent);
}

.ms-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ms-check input {
    transform: translateY(2px);
}

.ms-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ms-btn:hover {
    transform: translateY(-1px);
}

.ms-btn--primary {
    background: var(--accent);
    color: #fff;
}

.ms-btn[disabled] {
    cursor: not-allowed;
    transform: none;
}

.ms-status {
    min-height: 22px;
    color: var(--muted);
}


/* small motion */
@media (prefers-reduced-motion: no-preference) {
    .ms-modal-card {
        opacity: 0;
        transform: translateY(6px);
        animation: ms-in .32s .05s ease forwards;
    }

    @keyframes ms-in {
        to {
            opacity: 1;
            transform: none;
        }
    }
}

/* ===== Footer ===== */
.ms-footer a {
    color: var(--muted);
    text-decoration: underline dotted;
}

/* ===== Mobile CTA (липкая) ===== */
.ms-cta-bar .ms-btn {
    flex: 1;
    height: 50px;
}

/* ===== Responsive ===== */
@media (max-width: 980px) {
    .ms-burger {
        display: inline-grid;
        place-items: center;
    }

    .ms-grid--3 {
        grid-template-columns: 1fr !important;
    }
}

/* Уважение к reduce motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== Modal base ===== */
.ms-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    align-items: center;
    justify-content: center;

}

.ms-modal[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

/* Документ: универсально (центр на десктопе, bottom-sheet на мобиле) */
.ms-modal__sheet {
    width: min(92vw, 640px);
    max-height: 92vh;
    overflow: auto;
    background: var(--panel, rgba(255, 255, 255, .06));
    border: 1px solid var(--border, rgba(255, 255, 255, .12));
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
    backdrop-filter: blur(30px) saturate(120%);
    padding: 18px 18px 20px;
    transform: translateY(8px) scale(.98);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}

.ms-modal[aria-hidden="false"] .ms-modal__sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ms-modal__overlay {
    position: absolute;
    inset: 0;
}

/* Заголовок/кнопка закрытия */
.ms-modal__title {
    margin: 4px 32px 6px 2px;
    font-size: clamp(20px, 3.2vw, 26px);
    font-weight: 800;
}

.ms-modal__subtitle {
    margin: 0 0 10px;
    color: var(--muted, #b7bdc6);
}

.ms-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: #fff;
    cursor: pointer;
}

.ms-modal__close:hover {
    transform: translateY(-1px);
}

/* На маленьких экранах — bottom sheet */
@media (max-width: 560px) {
    .ms-modal__sheet {
        width: 100vw;
        max-height: 82vh;
        border-radius: 16px 16px 0 0;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Фиксация body при открытой модалке */
body.ms-lock {
    overflow: hidden;
}

/* Доп. косметика формы внутри модалки (компактнее) */
.ms-modal .ms-modal-card {
    padding: 14px;
}

.ms-modal .ms-actions {
    gap: 10px;
}

@media (max-width: 420px) {
    .ms-modal .ms-actions .ms-btn {
        width: 100%;
    }
}

.ms-hint {
    color: var(--muted);
    font-size: .85rem;
}

.ms-textarea {
    min-height: 110px;
    resize: vertical;
}

.ms-status--ok {
    color: #6ee7a3;
}

.ms-status--err {
    color: #ff8692;
}

.ms-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .9rem;
}

/* Summary pills in modal */
.ms-summary{
  display:flex; flex-wrap:wrap; gap:8px;
  margin: 8px 0 14px;
}
.ms-pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:999px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  color:#fff; font-weight:600; font-size:.95rem;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  white-space:nowrap;
}
@media (max-width: 520px){
  .ms-summary{ gap:6px; }
  .ms-pill{ font-size:.9rem; }
}


.ms-modal .ms-modal-success {
  text-align:center;
  padding:32px 24px;
}
.ms-modal .ms-modal-success__title {
  margin:12px 0 6px;
  font-size:22px;
}
.ms-modal .ms-modal-success__text {
  color:var(--ms-muted,#b7b7b7);
  margin-bottom:16px;
}

.ms-modal .ms-modal-success__icon {
  width:88px;
  height:88px;
  margin:0 auto;
}
.ms-modal .ms-modal-success__icon svg {
  width:100%;
  height:100%;
  stroke-width:3;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.ms-modal .ms-modal-success__circle {
  stroke:rgba(255,255,255,.25);
}
.ms-modal .ms-modal-success__check  {
  stroke:#32d296;
  stroke-dasharray:48;
  stroke-dashoffset:48;
  animation:ms-modal-check 600ms ease forwards 200ms;
}

@keyframes ms-modal-check {
  to { stroke-dashoffset:0; }
}
