dialog form { max-height: min(780px, calc(100vh - 40px)); overflow: auto; }
dialog .form-grid { margin: 18px 22px 0; }

.plan-dialog { width: min(760px, calc(100vw - 30px)); background: #fbfafd; }
.plan-dialog form { overflow-x: hidden; }
.plan-dialog .dialog-head { background: #fff; padding: 22px 26px 20px; }
.plan-dialog .dialog-head h2 { font-size: 20px; font-weight: 650; }
.plan-dialog .dialog-head p { margin-top: 6px; }
.plan-dialog .close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; }
.plan-dialog .close:hover { background: #f3f1f6; color: #3d3942; }
.dialog-content { display: grid; gap: 16px; padding: 18px 22px; }
.form-section { padding: 18px; background: #fff; border: 1px solid #ece8f0; border-radius: 10px; }
.section-heading { margin-bottom: 16px; }
.section-heading h3 { margin: 0; font-size: 15px; font-weight: 650; color: #302d34; }
.section-heading p { margin-top: 5px; font-size: 12px; color: #99939f; }
.plan-identity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-dialog label.field { display: grid; gap: 7px; margin: 0; color: #625d68; font-size: 13px; font-weight: 550; }
.plan-dialog label.field input { height: 42px; font-weight: 400; }
.plan-dialog label.field small { min-height: 30px; color: #a39da8; font-size: 11px; line-height: 1.35; font-weight: 400; }
.limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.limit-card { position: relative; display: grid!important; grid-template-columns: 38px 1fr 88px; align-items: center; gap: 11px; min-height: 68px; margin: 0!important; padding: 11px 12px; border: 1px solid #e9e5ed; border-radius: 9px; background: #fcfbfd; color: #343038!important; }
.limit-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: #edf4ff; color: #1478ff; }
.limit-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.limit-card:focus-within { border-color: #72adff; box-shadow: 0 0 0 2px #1478ff12; background: #fff; }
.limit-copy { display: grid; gap: 3px; min-width: 0; }
.limit-copy b { font-size: 13px; font-weight: 620; }
.limit-copy small { color: #9d97a3; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.limit-card input { height: 36px; padding: 7px 8px; text-align: center; background: #fff; }
.limit-card.wide { grid-column: 1 / -1; grid-template-columns: 38px 1fr 146px; }
.input-suffix { display: grid; grid-template-columns: 86px 1fr; align-items: center; border: 1px solid #ded9e5; border-radius: 6px; background: #f5f3f7; overflow: hidden; }
.input-suffix:focus-within { border-color: #2481ff; box-shadow: 0 0 0 2px #2481ff16; }
.input-suffix input { width: 86px; border: 0; border-radius: 0; box-shadow: none!important; }
.input-suffix span { text-align: center; color: #8f8995; font-size: 10px; font-weight: 650; }
.plan-status { display: flex!important; align-items: center; justify-content: space-between; gap: 16px; margin: 0!important; padding: 16px 18px; border: 1px solid #e5ebf6; border-radius: 10px; background: #f6f9ff; color: #343038!important; cursor: pointer; }
.status-copy { display: grid; gap: 4px; }
.status-copy b { font-size: 13px; font-weight: 620; }
.status-copy small { color: #8e91a0; font-size: 11px; }
.plan-status input { position: absolute; opacity: 0; pointer-events: none; }
.plan-status i { position: relative; flex: 0 0 auto; width: 40px; height: 22px; border-radius: 20px; background: #c9c4ce; transition: .18s; }
.plan-status i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #27222f38; transition: .18s; }
.plan-status input:checked + i { background: #1478ff; }
.plan-status input:checked + i::after { transform: translateX(18px); }
.plan-dialog .dialog-actions { position: sticky; bottom: 0; margin: 0; padding: 15px 22px; background: #fff; box-shadow: 0 -8px 22px #39303f0a; }
.plan-dialog .dialog-actions button { min-width: 92px; }
.dialog-actions.split { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; }
.dialog-actions.split .danger { justify-self: start; }
.password-generator { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.password-generator button { white-space: nowrap; color: #1478ff; border-color: #bcd7ff; }

@media (max-width: 620px) {
  .plan-identity-grid, .limit-grid { grid-template-columns: 1fr; }
  .limit-card.wide { grid-column: auto; grid-template-columns: 38px 1fr 126px; }
  .input-suffix { grid-template-columns: 72px 1fr; }
  .input-suffix input { width: 72px; }
  .dialog-content { padding: 14px; }
  .form-section { padding: 15px; }
}
