.form-card { padding-bottom: 4px; }
.form-card form { padding: 16px 22px 22px; }
.form-card .card__head + form { padding-top: 4px; }

.form-section { padding: 6px 0 2px; }
.form-section + .form-section { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section__title { margin-bottom: 3px; font-size: 0.94rem; font-weight: 700; }
.form-section__hint { margin-bottom: 10px; color: var(--muted); font-size: 0.76rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 16px;
}
.form-grid--full { grid-template-columns: 1fr; margin-top: 15px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 600;
}
.field__required { color: var(--red); }
.field__control { position: relative; }
.field__help { color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.field__help ul { margin: 3px 0 0; padding-left: 16px; list-style: disc; }
.field__error { color: var(--red); font-size: 0.73rem; line-height: 1.45; }

.input,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.report-filter input,
.report-filter select {
    width: 100%;
    min-height: 41px;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface);
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.45;
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    appearance: none;
}

.field textarea { min-height: 88px; padding: 9px 11px; resize: vertical; }
.field select, .report-filter select {
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a71' stroke-width='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 11px center;
}
.field input::placeholder, .input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field input:hover, .field select:hover, .field textarea:hover, .input:hover { border-color: #b9c8be; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(14, 122, 75, 0.11);
}
.field input:disabled, .field select:disabled, .field textarea:disabled, .input:disabled {
    color: var(--muted);
    background: var(--surface-muted);
    cursor: not-allowed;
}
.field--error input, .field--error select, .field--error textarea { border-color: var(--red); background: #fffdfd; }
.field--error input:focus, .field--error select:focus, .field--error textarea:focus { box-shadow: 0 0 0 3px rgba(191, 61, 61, 0.1); }

.field--check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0 2px; }
.field--check .field__label { order: 2; font-weight: 500; }
.field--check .field__control { order: 1; display: flex; }
.field--check .field__help, .field--check .field__error { flex: 1 0 100%; padding-left: 25px; }
.field--check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-height: auto;
    margin: 0;
    accent-color: var(--green);
    cursor: pointer;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 21px;
    padding-top: 17px;
    border-top: 1px solid var(--border);
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    padding: 11px 13px;
    border: 1px solid var(--red-line);
    border-radius: 10px;
    color: var(--red-deep);
    background: var(--red-soft);
    font-size: 0.81rem;
    line-height: 1.55;
}
.form-alert .icon { width: 17px; height: 17px; margin-top: 2px; flex: 0 0 auto; }
.form-alert p + p { margin-top: 3px; }

/* Filter bars */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.filter-select { width: 165px; }
.filter-select select {
    width: 100%;
    min-height: 39px;
    padding: 6px 32px 6px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a71' stroke-width='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 10px center;
    font-size: 0.82rem;
    outline: none;
    appearance: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.filter-select select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(14, 122, 75, 0.11);
}
.filter-bar .btn { min-height: 39px; }

.search-field {
    position: relative;
    display: flex;
    align-items: center;
    width: 250px;
}
.search-field > .icon {
    position: absolute;
    left: 11px;
    z-index: 1;
    width: 16px;
    height: 16px;
    color: var(--muted-2);
    pointer-events: none;
}
.search-field input {
    width: 100%;
    min-height: 39px;
    padding: 8px 11px 8px 34px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface);
    font-size: 0.84rem;
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-field input::placeholder { color: var(--muted-2); }
.search-field input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(14, 122, 75, 0.11);
}

/* Password field */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
}
.password-toggle:hover { color: var(--text); background: var(--paper-2); }
.password-toggle .icon { width: 17px; height: 17px; }

/* Stock preview */
.stock-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 13px;
    padding: 9px 12px;
    border: 1px solid var(--blue-line);
    border-radius: 9px;
    color: #2c5872;
    background: var(--blue-soft);
    font-size: 0.78rem;
}
.stock-hint[hidden] { display: none; }
.stock-hint strong { color: var(--blue); font-weight: 700; }
.stock-hint.is-warning { border-color: var(--red-line); color: var(--red-deep); background: var(--red-soft); }
.stock-hint.is-warning strong { color: var(--red); }
.stock-hint.is-loading { opacity: 0.65; }

@media (max-width: 620px) {
    .form-grid { grid-template-columns: 1fr; gap: 13px; }
    .form-grid--full { margin-top: 13px; }
    .form-card form { padding: 14px 15px 17px; }
    .filter-bar { align-items: stretch; }
    .search-field { width: 100%; }
    .filter-select { width: calc(50% - 4px); }
    .filter-select select { width: 100%; }
    .filter-bar > .btn { flex: 1; }
    .form-actions .btn { flex: 1; }
}
