.ab-gen-page {
    gap: 24px;
}

.ab-gen-expanded.amazon-layout {
    grid-template-columns: 1fr;
    align-items: start;
}

.ab-gen-expanded .insights-form {
    width: 100%;
    max-width: 100%;
}

.ab-gen-expanded .control-chips {
    flex-wrap: wrap;
    gap: 12px;
}

.ab-gen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ab-gen-header .section-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.ab-gen-chips {
    justify-content: flex-end;
    min-width: 320px;
    display: grid;
    gap: 12px;
}

.ab-gen-grid {
    grid-template-columns: minmax(0, 2fr);
}

.ab-gen-two-col {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 16px;
    align-items: start;
}

.ab-gen-right {
    display: flex;
    justify-content: flex-end;
}

.ab-gen-expanded .control-chip {
    min-width: 240px;
}

.ab-gen-expanded .search-main-row {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ab-gen-expanded .search-action-row {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.asin-block {
    background: linear-gradient(145deg, #f7f7f8 0%, #ffffff 80%);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.asin-block .field-group-heading {
    margin-bottom: 4px;
}

.primary-button--alt {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    border: 1px solid rgba(59, 130, 246, 0.4);
    opacity: 0.9;
}

.asin-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    width: 100%;
}

.asin-field .field__group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.asin-remove {
    min-width: 44px;
    height: 44px;
    border-radius: 12px;
}

.form-actions__controls {
    justify-content: flex-start;
}

.ab-gen-expanded .search-settings-row {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px 12px;
    padding: 10px 12px;
    background: rgba(248, 250, 252, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
}

.abgen-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.abgen-search-form {
    border-radius: 24px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.abgen-status {
    align-self: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.abgen-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
}

.abgen-panel {
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
    padding: 24px;
    display: grid;
    gap: 18px;
}

.abgen-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.abgen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.abgen-card {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 18px;
    padding: 16px;
    display: grid;
    gap: 12px;
    position: relative;
    background: rgba(248, 250, 252, 0.7);
    min-height: 180px;
}

.abgen-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.abgen-card__asin {
    font-size: 0.85rem;
    color: var(--muted);
}

.abgen-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.abgen-card__price {
    font-weight: 600;
    color: #2563eb;
}

.abgen-card__select {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: white;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.abgen-card__select[data-selected="true"] {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.abgen-selection {
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 24px;
    display: grid;
    gap: 16px;
    box-shadow: 0 20px 36px rgba(15, 23, 42, 0.3);
}

.abgen-selection header h3 {
    margin: 0;
}

.abgen-selection__list {
    display: grid;
    gap: 12px;
}

.abgen-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
}

.abgen-chip button {
    background: transparent;
    border: none;
    color: rgba(248, 250, 252, 0.9);
    cursor: pointer;
    font-weight: 600;
}

.abgen-generate {
    width: 100%;
}

.abgen-footer {
    position: relative;
    min-height: 32px;
}

.abgen-save-toast {
    position: fixed;
    left: 24px;
    bottom: 24px;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.4);
}

.abgen-save-toast a {
    color: #a5b4fc;
    font-weight: 600;
}

.ab-detail-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 220;
}

.ab-detail-modal[hidden] {
    display: none;
}

.ab-detail-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(3px);
}

.ab-detail-modal__dialog {
    position: relative;
    background: white;
    border-radius: 18px;
    width: min(1200px, 96%);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
    padding: 16px;
}

.ab-detail-modal__body {
    padding: 8px;
}

.ab-detail-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
}

.abgen-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.abgen-modal[hidden] {
    display: none;
}

.abgen-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}

.abgen-modal__dialog {
    position: relative;
    background: white;
    border-radius: 24px;
    width: min(1200px, 95%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
}

.abgen-modal__header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.abgen-modal__content {
    overflow: auto;
    padding: 24px;
}

.abgen-diagram {
    display: grid;
    gap: 16px;
}

.abgen-diagram__columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.abgen-column {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 12px;
    display: grid;
    gap: 6px;
    background: rgba(248, 250, 252, 0.8);
}

.abgen-column img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: white;
}

.abgen-diagram__rows {
    display: grid;
    gap: 12px;
}

.abgen-row {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.abgen-row__label {
    font-weight: 600;
}

.abgen-row__values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.abgen-value {
    border-radius: 12px;
    padding: 10px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid transparent;
}

.abgen-value[data-highlight="true"] {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
    color: #1d4ed8;
}

.abgen-empty {
    padding: 12px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.8);
    text-align: center;
    color: var(--muted);
}

@media (max-width: 980px) {
    .abgen-stage {
        grid-template-columns: 1fr;
    }
}
