.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: background .2s ease, border-color .2s ease;
}

.form-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--text2);
    margin: 0 0 6px 2px;
}

.form-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s, background .15s;
}
.form-input:focus    { border-color: var(--primary); background: var(--surface-3); }
.form-input:disabled { opacity: .55; cursor: not-allowed; }
.form-input[readonly]{ opacity: .65; cursor: default; }

textarea.form-input {
    resize: vertical;
    min-height: 96px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    line-height: 1.5;
}

select.form-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background-image: none;
}
.select-wrap {
    position: relative;
}
.select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    pointer-events: none;
    background-color: var(--text-muted);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") center / contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") center / contain no-repeat;
}
select.form-input:disabled { cursor: not-allowed; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    cursor: pointer;
    transition: background .15s, transform .1s, opacity .15s;
    border: none;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(.97); }

.btn-primary { background: var(--text-strong); color: var(--bg); }
.btn-primary:not(:disabled):hover { background: var(--text); }

.btn-danger  { background: var(--primary); color: #fff; }
.btn-danger:not(:disabled):hover { background: var(--primary-hover); }

.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:not(:disabled):hover { color: var(--text-strong); border-color: var(--border-hover); background: var(--surface-2); }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    transition: background .15s, color .15s, transform .1s;
}
.btn-icon:not(:disabled):hover  { background: var(--surface-3); color: var(--text-strong); }
.btn-icon:not(:disabled):active { transform: scale(.92); }
.btn-icon:disabled              { opacity: .4; cursor: not-allowed; }

.alert {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert.is-visible { display: flex; }
.alert-ok  {
    background: var(--alert-ok-bg);
    color: var(--green);
    border-color: var(--alert-ok-border);
}
.alert-err {
    background: var(--alert-err-bg);
    color: var(--red);
    border-color: var(--alert-err-border);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-soft);
}
.section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-strong);
    text-transform: uppercase;
    letter-spacing: .12em;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s;
}
.switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform .2s, background .2s;
}
.switch input:checked + .switch-slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); background: #fff; }
.switch input:disabled + .switch-slider { opacity: .5; cursor: not-allowed; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 3px 9px;
    border-radius: 999px;
    line-height: 1;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-green   { background: var(--badge-green);  color: var(--green); }
.badge-red     { background: var(--badge-red);    color: var(--red); }
.badge-yellow  { background: var(--badge-yellow); color: var(--yellow); }
.badge-blue    { background: var(--badge-blue);   color: var(--blue); }
.badge-neutral { background: var(--surface-2);    color: var(--text-muted); }

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: #000000a6;
    backdrop-filter: blur(6px);
}
.modal-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 24px;
    transform: scale(.96) translateY(8px);
    transition: transform .25s cubic-bezier(.22, 1, .36, 1);
}
.modal.is-open .modal-card { transform: scale(1) translateY(0); }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.modal-head h3 {
    color: var(--text-strong);
    font-size: 16px;
    font-weight: 800;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.modal-close:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.modal[data-step="1"] [data-show-step="2"],
.modal[data-step="2"] [data-show-step="1"] { display: none; }

.modal-step-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}
.modal-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-hover);
    transition: background .2s, width .2s;
}
.modal[data-step="1"] .modal-step-dot:nth-child(1),
.modal[data-step="2"] .modal-step-dot:nth-child(2) {
    background: var(--primary);
    width: 18px;
    border-radius: 3px;
}

.tab-group {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
}
.tab {
    position: relative;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
    background: transparent;
    border: none;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--primary); color: #fff; }

.tab[data-dirty="1"]::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 2px var(--surface);
}
.tab.is-active[data-dirty="1"]::after {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary);
}