:root {
	--smartwoo-blue: #2563eb;
	--smartwoo-blue-dark: #1d4ed8;
	--smartwoo-navy: #172033;
	--smartwoo-muted: #667085;
	--smartwoo-border: #dce3ec;
	--smartwoo-soft: #f6f8fc;
	--smartwoo-success: #07883f;
	--smartwoo-danger: #b42318;
}

.smartwoo-wrap { max-width: 1180px; }
.smartwoo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 18px 0; }
.smartwoo-card { background: #fff; border: 1px solid #dcdcde; border-radius: 8px; padding: 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.smartwoo-card h2 { margin-top: 0; font-size: 14px; color: #50575e; }
.smartwoo-card strong { font-size: 22px; }
.smartwoo-card p:last-child { margin-bottom: 0; }
.smartwoo-narrow { max-width: 720px; }
.smartwoo-good { color: var(--smartwoo-success); }
.column-image img,
.smartwoo-wrap td img { max-width: 40px; height: auto; }
.smartwoo-wrap code { word-break: break-all; }

#smartwoo-product-optimizer .inside { margin: 0; padding: 0; }
#smartwoo-product-optimizer .postbox-header { border-bottom-color: var(--smartwoo-border); }
.smartwoo-generator { color: var(--smartwoo-navy); }
.smartwoo-generator [hidden] { display: none !important; }
.smartwoo-generator button[disabled] { cursor: not-allowed; opacity: .64; }
.smartwoo-generator button.is-busy { cursor: wait; opacity: .72; }
.smartwoo-generator .button-primary { background: var(--smartwoo-blue); border-color: var(--smartwoo-blue); }
.smartwoo-generator .button-primary:hover,
.smartwoo-generator .button-primary:focus { background: var(--smartwoo-blue-dark); border-color: var(--smartwoo-blue-dark); }
.smartwoo-generator button.button.button-hero { display: inline-flex !important; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 4px 16px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.smartwoo-generator button.button.button-hero .dashicons { display: inline-flex; flex: 0 0 18px; width: 18px; height: 18px; align-items: center; justify-content: center; margin: 0; font-size: 18px; line-height: 1; vertical-align: middle; }

.smartwoo-connect-prompt { display: flex; align-items: center; gap: 14px; padding: 22px; background: var(--smartwoo-soft); }
.smartwoo-connect-prompt > .dashicons { width: 38px; height: 38px; padding: 9px; color: #fff; background: var(--smartwoo-blue); border-radius: 10px; }
.smartwoo-connect-prompt div { flex: 1; }
.smartwoo-connect-prompt strong { display: block; font-size: 15px; }
.smartwoo-connect-prompt p { margin: 4px 0 0; color: var(--smartwoo-muted); }

.smartwoo-optimizer-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%); border-bottom: 1px solid var(--smartwoo-border); }
.smartwoo-optimizer-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.smartwoo-ai-mark { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; color: #fff; background: linear-gradient(145deg, #2563eb, #7c3aed); border-radius: 12px; box-shadow: 0 5px 14px rgba(37, 99, 235, .24); }
.smartwoo-ai-mark .dashicons { width: 24px; height: 24px; font-size: 24px; }
.smartwoo-optimizer-brand h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.smartwoo-optimizer-brand p { margin: 4px 0 0; overflow: hidden; color: var(--smartwoo-muted); text-overflow: ellipsis; white-space: nowrap; }
.smartwoo-account-pills { display: flex; flex: 0 0 auto; align-items: stretch; overflow: hidden; background: rgba(255, 255, 255, .8); border: 1px solid #d8e2f0; border-radius: 9px; }
.smartwoo-account-pills > span { display: flex; min-width: 82px; flex-direction: column; justify-content: center; padding: 7px 12px; border-left: 1px solid #e2e8f0; }
.smartwoo-account-pills > span:first-child { border-left: 0; }
.smartwoo-account-pills small { color: var(--smartwoo-muted); font-size: 10px; line-height: 1.25; text-transform: uppercase; letter-spacing: .04em; }
.smartwoo-account-pills strong { margin-top: 1px; color: var(--smartwoo-navy); font-size: 12px; white-space: nowrap; }

.smartwoo-tool-tabs-shell { display: flex; align-items: stretch; background: #fff; border-bottom: 1px solid var(--smartwoo-border); }
.smartwoo-tool-tabs { display: flex; min-width: 0; flex: 1; gap: 4px; padding: 10px 16px 0; }
.smartwoo-tool-tab { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 11px 14px 12px; color: #475467; background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 600; }
.smartwoo-tool-tab:hover { color: var(--smartwoo-blue); }
.smartwoo-tool-tab:focus-visible { outline: 2px solid var(--smartwoo-blue); outline-offset: -2px; }
.smartwoo-tool-tab.is-active { color: var(--smartwoo-blue); border-bottom-color: var(--smartwoo-blue); }
.smartwoo-tool-tab .dashicons { width: 18px; height: 18px; font-size: 18px; }
.smartwoo-tool-tab.is-disabled { position: relative; color: #98a2b3; cursor: not-allowed; }
.smartwoo-tool-tab.is-disabled:hover { color: #667085; }
.smartwoo-tool-tab.is-disabled::after { position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; width: 230px; padding: 8px 10px; color: #fff; background: #1f2937; border-radius: 6px; box-shadow: 0 5px 18px rgba(15, 23, 42, .2); content: attr(data-tooltip); font-size: 11px; font-weight: 500; line-height: 1.4; opacity: 0; pointer-events: none; transform: translate(-50%, -4px); transition: opacity .15s ease, transform .15s ease; }
.smartwoo-tool-tab.is-disabled:hover::after,
.smartwoo-tool-tab.is-disabled:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.smartwoo-tool-tab .smartwoo-tab-lock { width: 14px; height: 14px; margin-left: 1px; font-size: 14px; }
.smartwoo-upgrade-link { display: inline-flex; flex: 0 0 auto; align-self: center; align-items: center; gap: 6px; margin: 9px 16px 9px 8px; padding: 7px 11px; color: #6941c6; background: #f4f0ff; border: 1px solid #d9ccff; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap; }
.smartwoo-upgrade-link:hover,
.smartwoo-upgrade-link:focus { color: #53389e; background: #ebe3ff; border-color: #b9a2f6; box-shadow: none; }
.smartwoo-upgrade-link .dashicons { width: 14px; height: 14px; font-size: 14px; }
.smartwoo-upgrade-link .dashicons-external { width: 12px; height: 12px; margin-left: 1px; font-size: 12px; }

.smartwoo-generation-status { min-height: 0; padding: 0 22px; font-weight: 600; }
.smartwoo-generation-status:not(:empty) { min-height: 20px; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--smartwoo-border); }
.smartwoo-generation-status.is-error,
#smartwoo-bulk-status.is-error { color: var(--smartwoo-danger); background: #fff4f2; }
.smartwoo-status-upgrade-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; color: #8a1c13; font-weight: 700; }
.smartwoo-status-upgrade-link:hover,
.smartwoo-status-upgrade-link:focus { color: #64150f; }
.smartwoo-status-upgrade-link .dashicons { width: 14px; height: 14px; font-size: 14px; }
.smartwoo-generation-status.is-success,
#smartwoo-bulk-status.is-success { color: var(--smartwoo-success); background: #f0fdf4; }

.smartwoo-tool-panel { padding: 22px; background: #fff; }
.smartwoo-panel-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.smartwoo-complete-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.smartwoo-panel-intro h3 { margin: 0 0 4px; color: var(--smartwoo-navy); font-size: 16px; }
.smartwoo-panel-intro p { margin: 0; color: var(--smartwoo-muted); }

.smartwoo-options { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(150px, .7fr) minmax(190px, 1fr); gap: 14px; margin-bottom: 18px; padding: 16px; background: var(--smartwoo-soft); border: 1px solid var(--smartwoo-border); border-radius: 9px; }
.smartwoo-options label,
.smartwoo-image-controls label { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: #344054; font-weight: 600; }
.smartwoo-options label > span,
.smartwoo-image-controls label > span { font-size: 12px; }
.smartwoo-options input,
.smartwoo-options select,
.smartwoo-image-controls input,
.smartwoo-image-controls select,
.smartwoo-image-controls textarea { width: 100%; min-width: 0; border-color: #cfd8e5; border-radius: 5px; }
.smartwoo-options .smartwoo-wide-label { grid-column: 1 / -1; }

.smartwoo-content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.smartwoo-generator-section { min-width: 0; padding: 16px; background: #fff; border: 1px solid var(--smartwoo-border); border-radius: 9px; box-shadow: 0 1px 2px rgba(16, 24, 40, .03); }
.smartwoo-generator-section.is-wide { grid-column: 1 / -1; }
.smartwoo-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.smartwoo-section-heading h4 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.smartwoo-section-heading p { margin: 5px 0 0; color: var(--smartwoo-muted); font-size: 12px; line-height: 1.45; }
.smartwoo-existing-badge { padding: 2px 6px; color: #176b3a; background: #eaf8ef; border-radius: 10px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.smartwoo-field-limits { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 9px 10px; background: var(--smartwoo-soft); border: 1px solid #e2e8f0; border-radius: 6px; }
.smartwoo-field-limits .smartwoo-limit-label { color: #344054; font-size: 11px; font-weight: 700; }
.smartwoo-field-limits label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; color: #475467; font-size: 11px; font-weight: 600; }
.smartwoo-field-limits input[type="number"] { width: 76px; min-height: 28px; padding: 0 6px; border-color: #cfd8e5; border-radius: 4px; font-size: 12px; }
.smartwoo-field-limits small { color: var(--smartwoo-muted); font-size: 10px; }
.smartwoo-preview { margin-top: 13px; }
.smartwoo-preview textarea { display: block; width: 100%; min-height: 74px; padding: 9px 10px; border-color: #bfcadd; border-radius: 6px; line-height: 1.5; resize: vertical; }
.smartwoo-generator-section.is-wide .smartwoo-preview textarea { min-height: 170px; }
.smartwoo-preview textarea:focus { border-color: var(--smartwoo-blue); box-shadow: 0 0 0 1px var(--smartwoo-blue); }
.smartwoo-preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.smartwoo-preview-footer > div { display: flex; align-items: center; gap: 7px; }
.smartwoo-content-count { display: inline-flex; flex-wrap: wrap; gap: 5px 10px; color: var(--smartwoo-muted); font-size: 11px; }
.smartwoo-content-count .is-over-limit { color: var(--smartwoo-danger); font-weight: 700; }
.smartwoo-generator-section.is-over-limit { border-color: #f1a7a0; }
.smartwoo-discard,
.smartwoo-discard-images { color: var(--smartwoo-danger) !important; text-decoration: none !important; }

.smartwoo-image-layout { display: grid; grid-template-columns: minmax(245px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.smartwoo-image-controls { display: flex; flex-direction: column; gap: 14px; padding: 17px; background: var(--smartwoo-soft); border: 1px solid var(--smartwoo-border); border-radius: 9px; }
.smartwoo-image-control-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 10px; }
.smartwoo-image-controls textarea { resize: vertical; }
.smartwoo-image-results { position: relative; min-height: 320px; padding: 15px; background: #fbfcfe; border: 1px dashed #b9c5d6; border-radius: 10px; transition: opacity .15s ease; }
.smartwoo-image-results.is-loading { opacity: .55; }
.smartwoo-image-results.is-loading::after { position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px; border: 3px solid #cbd5e1; border-top-color: var(--smartwoo-blue); border-radius: 50%; content: ""; animation: smartwoo-spin .8s linear infinite; }
@keyframes smartwoo-spin { to { transform: rotate(360deg); } }
.smartwoo-image-empty { display: grid; min-height: 288px; place-content: center; justify-items: center; color: var(--smartwoo-muted); text-align: center; }
.smartwoo-image-empty .dashicons { width: 44px; height: 44px; margin-bottom: 10px; color: #94a3b8; font-size: 44px; }
.smartwoo-image-empty strong { color: #475467; font-size: 14px; }
.smartwoo-image-empty p { max-width: 360px; margin: 5px 0 0; }
.smartwoo-generated-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.smartwoo-generated-image { position: relative; display: block; overflow: hidden; margin: 0; background: #fff; border: 2px solid transparent; border-radius: 8px; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); cursor: pointer; }
.smartwoo-generated-image:has(.smartwoo-image-checkbox:checked) { border-color: var(--smartwoo-blue); }
.smartwoo-generated-image.is-imported::after { position: absolute; top: 9px; right: 9px; padding: 4px 7px; color: #fff; background: var(--smartwoo-success); border-radius: 12px; content: "Imported"; font-size: 10px; font-weight: 700; }
.smartwoo-generated-image img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.smartwoo-image-select,
.smartwoo-image-number { display: flex; align-items: center; gap: 5px; padding: 8px 9px; color: #344054; font-size: 11px; font-weight: 600; }
.smartwoo-image-select input { margin: 0; }
.smartwoo-image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--smartwoo-border); }

.smartwoo-optimizer-footer { display: flex; align-items: center; gap: 7px; padding: 11px 22px; color: var(--smartwoo-muted); background: var(--smartwoo-soft); border-top: 1px solid var(--smartwoo-border); font-size: 11px; }
.smartwoo-optimizer-footer .dashicons { width: 16px; height: 16px; color: var(--smartwoo-success); font-size: 16px; }
.smartwoo-product-account { margin-top: 12px; padding: 10px 12px; background: #f0f6fc; border-left: 4px solid #2271b1; }
.smartwoo-ai-selection { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 16px 22px 0; padding: 14px 16px; background: linear-gradient(135deg, #f7f8ff, #fbfcff); border: 1px solid #dce2f4; border-radius: 10px; }
.smartwoo-selection-intro { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.smartwoo-selection-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; color: #fff; background: var(--smartwoo-blue); border-radius: 9px; }
.smartwoo-selection-intro strong,
.smartwoo-selection-intro small { display: block; }
.smartwoo-selection-intro small { max-width: 430px; margin-top: 3px; color: var(--smartwoo-muted); font-size: 11px; line-height: 1.4; }
.smartwoo-selection-controls,
.smartwoo-advanced-selection { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.smartwoo-ai-selection label { display: grid; gap: 4px; min-width: 165px; margin: 0; font-size: 11px; font-weight: 700; }
.smartwoo-ai-selection select { min-height: 36px; }
.smartwoo-generator-section.is-locked { opacity: .68; background: #f8fafc; }
.smartwoo-entitlement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.smartwoo-entitlement-tools { grid-column: 1 / -1; }
.smartwoo-feature-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.smartwoo-feature-chips > span { display: inline-flex; align-items: center; gap: 4px; padding: 7px 10px; border-radius: 999px; font-weight: 600; }
.smartwoo-feature-chips .is-enabled { color: #176b3a; background: #eaf8ef; }
.smartwoo-feature-chips .is-disabled { color: #667085; background: #eef1f5; }
.smartwoo-muted { color: #667085; }

@media (max-width: 960px) {
	.smartwoo-optimizer-header { align-items: flex-start; flex-direction: column; }
	.smartwoo-image-layout { grid-template-columns: 1fr; }
	.smartwoo-image-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.smartwoo-image-controls > .button { align-self: end; }
}

@media (max-width: 782px) {
	.smartwoo-optimizer-header,
	.smartwoo-tool-panel { padding: 16px; }
	.smartwoo-account-pills { width: 100%; }
	.smartwoo-account-pills > span { flex: 1; min-width: 0; }
	.smartwoo-tool-tabs { overflow-x: auto; padding-left: 8px; }
	.smartwoo-upgrade-link { margin-right: 8px; }
	.smartwoo-tool-tab { flex: 0 0 auto; }
	.smartwoo-panel-intro { align-items: stretch; flex-direction: column; }
	.smartwoo-options,
	.smartwoo-content-grid,
	.smartwoo-entitlement-grid,
	.smartwoo-image-controls { grid-template-columns: 1fr; }
	.smartwoo-options .smartwoo-wide-label,
	.smartwoo-generator-section.is-wide { grid-column: auto; }
	.smartwoo-preview-footer { align-items: flex-start; flex-direction: column; }
	.smartwoo-preview-footer > div { flex-wrap: wrap; }
	.smartwoo-generated-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.smartwoo-connect-prompt { align-items: flex-start; flex-wrap: wrap; }
	.smartwoo-ai-selection { align-items: stretch; flex-direction: column; }
	.smartwoo-selection-controls { align-items: stretch; }
}

@media (max-width: 480px) {
	.smartwoo-account-pills { display: grid; grid-template-columns: 1fr; }
	.smartwoo-account-pills > span { border-top: 1px solid #e2e8f0; border-left: 0; }
	.smartwoo-account-pills > span:first-child { border-top: 0; }
	.smartwoo-generated-grid { grid-template-columns: 1fr; }
}
