.rewrite-controls { display:grid; gap:10px; margin:0; padding:0; border:0; }
.rewrite-controls label { display:grid; gap:6px; }
.rewrite-controls select,.rewrite-controls button { min-height:36px; border:1px solid #dfe7f2; border-radius:8px; background:#ffffff; padding:6px 10px; color:inherit; }
.rewrite-controls small { color:#68758d; }
.rewrite-copy-dialog { position:fixed; inset:0; margin:auto; width:min(850px,94vw); max-height:85dvh; padding:20px; border:1px solid #dfe7f2; border-radius:16px; overflow:auto; }
.rewrite-copy-dialog::backdrop { background:#24203366; }
.rewrite-copy-dialog header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.rewrite-copy-row { display:grid; grid-template-columns:110px 1fr; gap:14px; padding:14px 0; border-bottom:1px solid #eee; }
.rewrite-copy-row img { width:110px; height:110px; object-fit:contain; }
.rewrite-copy-row textarea { box-sizing:border-box; width:100%; min-height:90px; margin-top:8px; }
.rewrite-style-preview img { width:90px; height:90px; object-fit:contain; }
@media(max-width:480px) { .rewrite-copy-row { grid-template-columns:70px 1fr; } .rewrite-copy-row img { width:70px;height:80px; } }

.rewrite-copy-dialog { color:#17243a; background:#fff; font:14px/1.6 system-ui,sans-serif; }
.rewrite-copy-dialog button,.rewrite-copy-dialog select { min-height:36px; border:1px solid #dfe7f2; border-radius:8px; padding:6px 12px; background:#ffffff; color:var(--yj-appearance-primary, #6d28d9); }
.rewrite-copy-dialog header button { flex-shrink:0; background:var(--yj-appearance-primary, #6d28d9); color:white; }
.rewrite-copy-row label { display:flex; gap:10px; align-items:center; }
.rewrite-copy-row textarea { border:1px solid #dfe7f2; border-radius:8px; padding:10px; font:inherit; resize:vertical; }
.rewrite-copy-row small { display:block; color:#68758d; white-space:pre-wrap; overflow-wrap:anywhere; }

.rewrite-controls select,.rewrite-controls button,.rewrite-copy-dialog select,.rewrite-copy-dialog button {font:inherit;cursor:pointer;box-sizing:border-box}
.rewrite-controls select {width:100%;min-height:42px;color:#26334a}
.rewrite-controls small {font-size:12px;line-height:1.5}
.rewrite-controls [hidden],.rewrite-copy-dialog [hidden] {display:none!important}
.rewrite-controls select:focus-visible,.rewrite-controls button:focus-visible,.rewrite-controls input:focus-visible,.rewrite-copy-dialog select:focus-visible,.rewrite-copy-dialog button:focus-visible {outline:2px solid var(--yj-appearance-primary, #6d28d9);outline-offset:2px}
.rewrite-controls textarea {box-sizing:border-box;width:100%;min-height:96px;border:1px solid #dfe7f2;border-radius:8px;padding:10px;font:inherit;resize:vertical}
.rewrite-style-upload {display:grid;gap:8px;min-width:0}
.rewrite-style-upload input[type=file] {box-sizing:border-box;width:100%;min-width:0;padding:10px;border:1px dashed #cbd5e1;border-radius:8px;background:var(--yj-upload-shell-bg, #f7f8fb);font:inherit;color:#64748b}
.rewrite-style-upload input::file-selector-button {margin-right:10px;padding:7px 12px;border:1px solid #dfe7f2;border-radius:6px;background:white;color:var(--yj-appearance-primary, #6d28d9);font:inherit;cursor:pointer}
.rewrite-style-preview {display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.rewrite-style-preview:empty {display:none}
.rewrite-style-preview-item {display:flex;flex-direction:column;align-items:center;gap:6px;width:90px}

/* Theme-aligned, readable selection; pricing remains driven by configuration. */
body[data-app-feature="rewrite"] #panelRewrite #rewriteModelBtns.rewrite-model-dropdown .model-btn.selected { background:color-mix(in srgb, var(--yj-appearance-primary, #6d28d9) 9%, white) !important; border:1px solid var(--yj-appearance-primary, #6d28d9) !important; box-shadow:none !important; }
body[data-app-feature="rewrite"] #panelRewrite #rewriteModelBtns.rewrite-model-dropdown .model-btn .model-name { color:#26334a !important; text-align:left !important; }
body[data-app-feature="rewrite"] #panelRewrite #rewriteModelBtns.rewrite-model-dropdown .model-btn.selected .model-name { color:var(--yj-appearance-primary, #6d28d9) !important; }
body[data-app-feature="rewrite"] #panelRewrite #rewriteModelBtns.rewrite-model-dropdown .model-btn .model-cost { color:#475569 !important; background:#f1f5f9 !important; border-color:#e2e8f0 !important; }
body[data-app-feature="rewrite"] #panelRewrite #rewriteModelBtns.rewrite-model-dropdown .model-btn.selected .model-cost { color:var(--yj-appearance-primary, #6d28d9) !important; background:white !important; border-color:currentColor !important; }

.rewrite-style-fold {display:block;border:1px solid #dfe7f2;border-radius:8px;padding:10px 12px;background:#fff}
.rewrite-style-fold summary {cursor:pointer;color:#334155;font-size:13px;font-weight:600}
.rewrite-style-fold[open] > :not(summary) {margin-top:10px}
.rewrite-style-fold small {display:block;color:#64748b;font-size:12px;line-height:1.5}

.rewrite-generation-summary {display:grid;gap:8px;padding-top:10px;border-top:1px solid #e2e8f0}
.reference-role-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0;}
.reference-role-grid button {min-width:0;min-height:72px;border:1px dashed #c7bbdf;border-radius:9px;background:#faf8ff;color:#563b84;font:inherit;font-weight:600;cursor:pointer;padding:8px;}
.reference-role-grid button:hover,.reference-role-grid button:focus-visible {border-color:#6d28d9;background:#f0e9ff;outline:2px solid #ddd0f8;outline-offset:2px;}
.reference-role-grid button:disabled {opacity:.5;cursor:not-allowed;}
