:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #17181a;
  --muted: #747983;
  --line: #e5e7eb;
  --accent: #ec5e38;
  --accent-deep: #c94726;
  --soft: #fff1ec;
  --blue: #405b80;
  --shadow: 0 14px 45px rgba(18, 24, 38, .08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.shell { max-width: 1220px; margin: 0 auto; padding: 28px 26px 36px; }
.topbar { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 12px; font-size: 15px; font-weight: 800; letter-spacing: -.06em; }
.topbar h1 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .16em; font-weight: 700; }
.status-pill { margin-left: auto; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); padding: 8px 12px; font-size: 11px; }
.status-pill.ready { color: #24764e; border-color: #bfe8d1; background: #f0fff6; }
.status-pill.warn { color: #a35518; border-color: #f0d1ac; background: #fff8ee; }
.hero { margin: 38px 0 26px; display: flex; justify-content: space-between; gap: 30px; align-items: end; }
.hero h2 { margin: 10px 0 9px; max-width: 640px; font-size: clamp(30px, 4vw, 53px); line-height: 1.04; letter-spacing: -.065em; }
.hero-copy { margin: 0; max-width: 590px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.model-stack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: end; color: var(--blue); font-size: 11px; font-weight: 700; }
.model-stack span { padding: 9px 11px; border: 1px solid #cfdae7; border-radius: 999px; background: #f7faff; }
.model-stack i { color: #9aa1ad; font-style: normal; }
.workflow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid rgba(220, 223, 229, .8); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.wide-card { grid-column: 1 / -1; }
.step-card { position: relative; overflow: hidden; }
.step-card::after { content: attr(data-step); position: absolute; top: 14px; right: 18px; color: #f0f1f3; font-size: 58px; line-height: 1; font-weight: 900; letter-spacing: -.09em; pointer-events: none; }
.step-heading { display: flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.step-heading > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: var(--soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.step-heading h3 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.04em; }
.dropzone { display: grid; place-items: center; min-height: 196px; margin: 22px 0 17px; border: 1px dashed #c7cbd3; border-radius: 14px; background: #fafbfc; color: var(--muted); text-align: center; position: relative; overflow: hidden; transition: .2s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--soft); }
.dropzone input { display: none; }
.dropzone strong, .dropzone small { position: relative; z-index: 1; }
.dropzone strong { margin-top: 8px; color: var(--ink); font-size: 13px; }
.dropzone small { margin-top: 4px; font-size: 11px; }
.upload-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #d9dce2; border-radius: 12px; color: var(--accent); background: white; font-size: 24px; }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #f1f2f4; z-index: 2; }
.dropzone.has-image::after { content: "点击更换图片"; position: absolute; z-index: 3; bottom: 10px; padding: 6px 9px; color: white; background: rgba(0,0,0,.62); border-radius: 99px; font-size: 10px; }
.field-label { display: block; margin: 12px 0 7px; color: #4d5159; font-size: 11px; font-weight: 700; }
textarea, input[type="text"], select { border: 1px solid var(--line); background: #fbfbfc; color: var(--ink); outline: none; border-radius: 10px; }
textarea { width: 100%; padding: 11px 12px; resize: vertical; line-height: 1.6; font-size: 12px; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; padding: 10px 11px; font-size: 12px; }
textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus { border-color: #eaa18e; box-shadow: 0 0 0 3px rgba(236,94,56,.1); }
.inline-fields, .render-controls { display: flex; gap: 10px; margin-top: 13px; }
.inline-fields label, .render-controls label { flex: 1; display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
select { padding: 9px 10px; font-size: 12px; }
.primary, .secondary { border: 0; border-radius: 10px; font-weight: 800; transition: transform .15s, background .15s; }
.primary { width: 100%; margin-top: 17px; padding: 13px 15px; background: var(--accent); color: white; box-shadow: 0 8px 18px rgba(236, 94, 56, .23); }
.primary:hover { background: var(--accent-deep); transform: translateY(-1px); }
.primary:disabled, .secondary:disabled { opacity: .5; cursor: wait; transform: none; }
.primary span { float: right; font-size: 16px; }
.secondary { padding: 10px 14px; background: var(--ink); color: white; white-space: nowrap; }
.hint, .muted { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.empty-state { min-height: 292px; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.empty-state.compact { min-height: 150px; }
.empty-state span { color: #c6cad1; font-size: 36px; }
.empty-state p { margin: 9px 0 2px; color: #555a63; font-size: 12px; }
.empty-state small { font-size: 10px; }
.image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.image-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fafafa; position: relative; cursor: pointer; }
.image-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(236, 94, 56, .2); }
.image-card img { width: 100%; aspect-ratio: 9 / 12; object-fit: cover; display: block; }
.image-card .image-meta { padding: 8px; font-size: 10px; line-height: 1.4; color: var(--muted); }
.image-card .check { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: white; background: rgba(20,22,25,.5); font-size: 11px; }
.image-card.selected .check { background: var(--accent); }
.card-footer { display: flex; justify-content: space-between; margin-top: 13px; font-size: 10px; color: #555a63; }
.reference-actions { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 11px 12px; border: 1px solid #e1e6ee; border-radius: 11px; background: #f8faff; }
.reference-actions p { margin: 0; color: #7d8796; font-size: 10px; line-height: 1.5; }
.asset-picker-button { min-height: 36px; padding: 0 12px; background: #2563eb; }
.modal-open { overflow: hidden; }
.gm-panel textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 180px; padding: 13px; border: 1px solid #dfe3ee; border-radius: 12px; background: #f8f9fc; color: #27314a; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.gm-toolbar.compact { margin: 0; }
.gm-toolbar.compact select { min-width: 130px; }
.admin-page .pagination { margin-top: 18px; }
.gm-queue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.gm-queue-grid > div { padding: 11px; border: 1px solid #e6e9f0; border-radius: 10px; background: #f8f9fc; }
.gm-queue-grid span { display: block; margin-bottom: 5px; color: #7c8497; font-size: 11px; }
.gm-queue-grid strong { color: #27314a; font-size: 11px; line-height: 1.45; }
.asset-picker { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.asset-picker-backdrop { position: absolute; inset: 0; background: rgba(12, 20, 34, .58); backdrop-filter: blur(4px); }
.asset-picker-dialog { position: relative; display: flex; flex-direction: column; width: min(860px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: hidden; border: 1px solid #dfe5ee; border-radius: 18px; background: #fff; box-shadow: 0 30px 90px rgba(8, 16, 31, .28); }
.asset-picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 22px 17px; border-bottom: 1px solid #e8ebf0; }
.asset-picker-head h3 { margin: 4px 0 5px; font-size: 20px; letter-spacing: -.04em; }
.asset-picker-head small { color: #8490a2; font-size: 10px; }
.asset-picker-close { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid #e1e5eb; border-radius: 9px; color: #778194; background: #f8f9fb; font-size: 22px; line-height: 1; }
.asset-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; min-height: 180px; padding: 18px 22px; overflow-y: auto; }
.asset-picker-item { position: relative; min-width: 0; overflow: hidden; border: 1px solid #e0e5ec; border-radius: 12px; padding: 0; background: #f9fafc; text-align: left; }
.asset-picker-item img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.asset-picker-item > span { position: absolute; top: 8px; right: 8px; padding: 5px 7px; border-radius: 99px; color: #fff; background: rgba(20, 28, 43, .68); font-size: 9px; font-weight: 800; }
.asset-picker-item small { display: block; overflow: hidden; padding: 9px 10px; color: #647084; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.asset-picker-item.selected { border-color: #4e86e8; box-shadow: 0 0 0 2px rgba(37, 99, 235, .14); }
.asset-picker-item.selected > span { background: #2563eb; }
.asset-picker-item.existing { cursor: default; opacity: .68; }
.asset-picker-item.existing > span { background: #65758d; }
.asset-picker-loading, .asset-picker-empty { grid-column: 1 / -1; display: grid; min-height: 180px; place-items: center; color: #8490a2; font-size: 11px; }
.asset-picker-empty { padding: 55px 22px; text-align: center; }
.asset-picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 22px; border-top: 1px solid #e8ebf0; background: #fbfcfe; }
.asset-picker-foot > span { color: #65758d; font-size: 10px; font-weight: 700; }
.asset-picker-foot > div { display: flex; gap: 9px; }
.asset-picker-foot .secondary { background: #2563eb; }
.asset-picker-cancel { min-height: 38px; border: 1px solid #dfe4eb; border-radius: 9px; padding: 0 14px; color: #687386; background: #fff; font-size: 10px; font-weight: 800; }
.prompt-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 21px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.prompt-intro p { margin: 0; max-width: 650px; }
.prompt-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px; margin-top: 10px; background: #fcfcfd; }
.prompt-card.active { border-color: #eaa18e; background: #fff9f6; }
.prompt-card-head { display: flex; align-items: center; gap: 9px; }
.prompt-card input { accent-color: var(--accent); }
.prompt-card strong { font-size: 13px; }
.prompt-card textarea { margin-top: 9px; min-height: 74px; background: white; }
.prompt-details { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.prompt-detail { padding: 8px; border-radius: 8px; background: #f3f4f6; color: #626873; font-size: 10px; line-height: 1.5; }
.prompt-detail b { display: block; color: #373b43; margin-bottom: 3px; }
.switch-label { align-content: start; }
.switch-label input { display: none; }
.switch-label i { width: 40px; height: 22px; border-radius: 99px; background: #d9dce1; position: relative; transition: .2s; }
.switch-label i::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.switch-label input:checked + i { background: var(--accent); }
.switch-label input:checked + i::after { transform: translateX(18px); }
.selected-summary { margin-top: 19px; padding: 11px 12px; border-radius: 10px; background: #f6f7f8; color: var(--muted); font-size: 11px; }
.task-box { margin-top: 17px; padding: 14px; background: #f7f8fa; border-radius: 12px; }
.task-top { display: flex; justify-content: space-between; font-size: 12px; }
.task-top span { color: var(--accent); font-weight: 800; }
.progress { height: 7px; margin: 12px 0 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .3s; }
.task-box p { margin: 0; color: var(--muted); font-size: 11px; }
.video-result { margin-top: 17px; }
.video-result video { width: 100%; max-height: 520px; border-radius: 12px; background: #111; display: block; }
.video-link { display: inline-block; margin-top: 10px; color: var(--accent-deep); font-size: 11px; font-weight: 800; }
.auth-panel { max-width: 860px; margin: 64px auto 30px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 34px; align-items: center; }
.auth-copy h2 { margin: 10px 0; font-size: clamp(26px, 4vw, 42px); line-height: 1.05; letter-spacing: -.06em; }
.auth-copy p:not(.eyebrow) { margin: 0; max-width: 460px; color: var(--muted); line-height: 1.7; font-size: 13px; }
.auth-form { display: grid; gap: 11px; padding: 18px; border-radius: 14px; background: #fafafa; border: 1px solid var(--line); }
.auth-form label { display: grid; gap: 6px; color: #555a63; font-size: 11px; font-weight: 700; }
.auth-form .primary { margin-top: 2px; }
.auth-message { min-height: 18px; margin: 0; color: #b34a31; font-size: 11px; line-height: 1.5; }
.link-button, .text-button { border: 0; background: transparent; color: var(--accent-deep); font-size: 11px; font-weight: 800; padding: 5px 0; text-align: left; }
.topbar { flex-wrap: wrap; }
.account-bar { display: flex; align-items: center; gap: 9px; margin-left: 12px; }
.user-pill { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 10px; border-radius: 999px; color: var(--blue); background: #f1f6fc; font-size: 10px; }
.credit-pill { padding: 7px 10px; border-radius: 999px; color: #8b5b14; background: #fff7df; font-size: 10px; font-weight: 800; white-space: nowrap; }
.text-button { color: var(--muted); }
.asset-library { margin-bottom: 18px; }
.library-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.library-head h3 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.04em; }
.library-head .muted { margin-top: 5px; }
.library-controls { display: flex; align-items: center; gap: 8px; }
.library-controls select { min-width: 100px; }
.library-controls .secondary { padding: 9px 12px; font-size: 11px; }
.asset-empty { padding: 26px 8px 8px; color: var(--muted); font-size: 11px; }
.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 17px; }
.asset-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfc; min-width: 0; }
.asset-preview { aspect-ratio: 1 / 1; display: grid; place-items: center; background: #f0f1f3; overflow: hidden; }
.asset-preview img, .asset-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-card-body { padding: 9px; }
.asset-card-body strong, .asset-card-body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card-body strong { font-size: 11px; }
.asset-card-body small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.asset-actions { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.asset-actions a, .asset-actions button { border: 0; padding: 0; background: transparent; color: var(--accent-deep); font-size: 10px; font-weight: 800; text-decoration: none; }
.asset-actions .asset-delete { margin-left: auto; color: #9a6e65; }
.asset-actions .asset-use { color: var(--blue); }
.result-actions { display: flex; gap: 15px; }
.spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 850px) { .auth-panel { grid-template-columns: 1fr; margin-top: 34px; } .asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .library-head { display: block; } .library-controls { margin-top: 12px; } .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .account-bar { width: 100%; margin-left: 0; } }
footer { margin-top: 22px; text-align: center; color: #9ca0a8; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(500px, calc(100vw - 30px)); padding: 11px 15px; border-radius: 10px; background: #25272c; color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 850px) { .hero { display: block; } .model-stack { justify-content: start; margin-top: 18px; } }
@media (max-width: 650px) { .shell { padding: 18px 14px 30px; } .workflow-grid { grid-template-columns: 1fr; } .wide-card { grid-column: auto; } .card { padding: 17px; } .prompt-details { grid-template-columns: 1fr; } .prompt-intro { align-items: start; flex-direction: column; } .hero h2 { font-size: 36px; } }

/* Mobile app layout: one clear action per row, generous touch targets, no card crowding. */
@media (max-width: 650px) {
  html, body { min-width: 0; overflow-x: hidden; }
  body { -webkit-tap-highlight-color: transparent; }
  button, a, select, .dropzone { touch-action: manipulation; }
  .shell { width: 100%; padding: calc(16px + env(safe-area-inset-top)) 12px calc(28px + env(safe-area-inset-bottom)); }
  .topbar { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
  .brand-mark { width: 40px; height: 40px; }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
  .eyebrow { font-size: 9px; letter-spacing: .12em; }
  .status-pill { margin-left: 0; max-width: 112px; padding: 7px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
  .account-bar { grid-column: 1 / -1; width: 100%; margin: 3px 0 0; padding-top: 9px; justify-content: flex-start; flex-wrap: wrap; gap: 7px; border-top: 1px solid var(--line); }
  .user-pill { min-width: 0; flex: 1 1 150px; max-width: none; padding: 8px 10px; font-size: 10px; }
  .credit-pill { padding: 8px 9px; font-size: 10px; }
  .text-button { min-height: 36px; padding: 8px 3px; }
  .auth-panel { margin: 25px auto 20px; padding: 17px; gap: 20px; border-radius: 16px; }
  .auth-copy h2 { font-size: 32px; }
  .auth-copy p:not(.eyebrow) { font-size: 12px; line-height: 1.6; }
  .auth-form { gap: 12px; padding: 14px; }
  .auth-form input { min-height: 46px; }
  .hero { margin: 25px 0 18px; }
  .hero h2 { max-width: none; margin: 8px 0 9px; font-size: clamp(28px, 8vw, 34px); line-height: 1.08; }
  .hero-copy { font-size: 12px; line-height: 1.65; }
  .model-stack { justify-content: flex-start; gap: 5px; margin-top: 15px; }
  .model-stack span { padding: 8px 9px; font-size: 9px; }
  .model-stack i { font-size: 10px; }
  .workflow-grid { gap: 14px; }
  .card { padding: 16px; border-radius: 16px; }
  .step-card::after { top: 13px; right: 14px; font-size: 46px; }
  .step-heading { gap: 9px; }
  .step-heading > span { width: 28px; height: 28px; flex: 0 0 28px; }
  .step-heading h3 { font-size: 17px; }
  .dropzone { min-height: 172px; margin: 17px 0 16px; }
  .field-label { margin-top: 14px; }
  textarea { min-height: 104px; padding: 12px; font-size: 13px; }
  input[type="text"], input[type="email"], input[type="password"], select { min-height: 44px; padding: 10px 11px; font-size: 13px; }
  .inline-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
  .primary { min-height: 48px; margin-top: 15px; padding: 13px 14px; font-size: 13px; }
  .secondary { min-height: 44px; padding: 0 14px; font-size: 12px; }
  .hint, .muted { font-size: 10px; line-height: 1.5; }
  .empty-state { min-height: 230px; }
  .image-grid { gap: 9px; margin-top: 16px; }
  .image-card .image-meta { min-height: 38px; padding: 8px; font-size: 9px; }
  .card-footer { flex-wrap: wrap; gap: 5px 12px; margin-top: 12px; line-height: 1.45; }
  .reference-actions { align-items: stretch; flex-direction: column; gap: 9px; margin-top: 15px; }
  .asset-picker-button { width: 100%; }
  .asset-picker { align-items: end; padding: 0; }
  .asset-picker-dialog { width: 100%; max-height: 86vh; border-radius: 19px 19px 0 0; }
  .asset-picker-head { padding: 18px 15px 14px; }
  .asset-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; }
  .asset-picker-foot { align-items: stretch; flex-direction: column; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .asset-picker-foot > div { display: grid; grid-template-columns: 1fr 1.35fr; }
  .asset-picker-foot button { min-height: 44px; }
  .prompt-intro { gap: 12px; margin: 17px 0 9px; font-size: 11px; }
  .prompt-intro .secondary { width: 100%; }
  .prompt-card { padding: 12px; margin-top: 9px; }
  .prompt-card-head { gap: 8px; align-items: flex-start; }
  .prompt-card-head input { width: 18px; height: 18px; margin: 0; flex: 0 0 18px; }
  .prompt-card-head strong { min-width: 0; flex: 1; font-size: 12px; line-height: 1.35; }
  .prompt-card textarea { min-height: 116px; margin-top: 10px; }
  .prompt-details { gap: 6px; }
  .prompt-detail { padding: 8px; font-size: 10px; }
  .render-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
  .render-controls label { min-width: 0; }
  .switch-label { grid-column: 1 / -1; display: flex !important; align-items: center; justify-content: space-between; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfc; }
  .selected-summary { margin-top: 15px; padding: 12px; line-height: 1.5; }
  .task-box { margin-top: 15px; padding: 13px; }
  .video-result { margin-top: 15px; }
  .video-result video { max-height: 62vh; }
  .result-actions { flex-wrap: wrap; gap: 5px 15px; }
  .video-link { min-height: 32px; padding-top: 7px; }
  .asset-library { margin-bottom: 14px; }
  .library-head { gap: 12px; }
  .library-head h3 { font-size: 17px; }
  .library-head .muted { max-width: 270px; }
  .library-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
  .library-controls .secondary { min-width: 74px; }
  .asset-empty { padding: 22px 4px 4px; line-height: 1.55; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
  .asset-card-body { padding: 8px; }
  .asset-card-body strong { font-size: 10px; }
  .asset-card-body small { font-size: 8px; }
  .asset-actions { flex-wrap: wrap; gap: 7px 9px; }
  .asset-actions a, .asset-actions button { min-height: 28px; padding: 6px 0; font-size: 10px; }
  .asset-actions .asset-delete { margin-left: 0; }
  footer { margin-top: 18px; line-height: 1.5; }
}

@media (max-width: 380px) {
  .shell { padding-left: 10px; padding-right: 10px; }
  .topbar { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 7px; }
  .brand-mark { width: 38px; height: 38px; }
  .topbar h1 { font-size: 17px; }
  .status-pill { max-width: 98px; padding-left: 7px; padding-right: 7px; }
  .card { padding: 14px; }
  .model-stack span { padding-left: 7px; padding-right: 7px; }
  .step-heading h3 { font-size: 16px; }
}

/* Admin workspace */
.admin-topbar { align-items: center; }
.admin-topbar > .text-button { margin-left: 7px; text-decoration: none; }
.admin-user { margin-left: auto; padding: 8px 11px; border-radius: 999px; color: var(--blue); background: #f1f6fc; font-size: 10px; font-weight: 800; }
.admin-main { margin-top: 32px; }
.admin-guard { max-width: 720px; margin: 48px auto; text-align: center; }
.admin-guard h2 { margin: 9px 0; font-size: 30px; letter-spacing: -.05em; }
.admin-guard p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.7; }
.admin-back { display: inline-flex; align-items: center; margin-top: 13px; text-decoration: none; }
.admin-summary-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.admin-stat { padding: 17px; }
.admin-stat span, .admin-stat small { display: block; color: var(--muted); font-size: 10px; }
.admin-stat strong { display: block; margin: 8px 0 4px; font-size: 25px; letter-spacing: -.05em; }
.admin-stat small { font-size: 9px; }
.admin-note { margin-top: 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.admin-section { margin-top: 14px; }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.admin-section-head h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.05em; }
.admin-section-head .secondary { min-height: 38px; padding: 0 13px; font-size: 11px; }
.admin-section-head select { min-width: 145px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 11px; }
.admin-table th { padding: 9px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 700; text-align: left; white-space: nowrap; }
.admin-table td { padding: 11px 8px; border-bottom: 1px solid #f0f1f3; white-space: nowrap; vertical-align: middle; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.admin-table tr:last-child td { border-bottom: 0; }
.balance-number { color: #9a6512; }
.table-action { border: 0; padding: 6px 8px; border-radius: 7px; background: var(--soft); color: var(--accent-deep); font-size: 10px; font-weight: 800; }
.admin-mobile-list { display: none; }
.admin-lower-grid { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: 14px; }
.credit-form { display: grid; gap: 11px; }
.credit-form label { display: grid; gap: 6px; color: #555a63; font-size: 11px; font-weight: 700; }
.credit-form input, .credit-form select { min-height: 42px; }
.credit-form .primary { margin-top: 3px; }
.usage-status { display: inline-flex; padding: 4px 7px; border-radius: 99px; background: #f2f3f5; color: var(--muted); font-size: 9px; }
.usage-status.succeeded { background: #effbf3; color: #24764e; }
.usage-status.failed { background: #fff0ed; color: #b34a31; }
.compact-table { min-width: 670px; }
@media (max-width: 1000px) {
  .admin-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .admin-topbar { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .admin-topbar > .text-button { grid-column: 1 / -1; margin: 3px 0 0; padding-top: 9px; border-top: 1px solid var(--line); }
  .admin-user { margin-left: 0; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-main { margin-top: 23px; }
  .admin-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .admin-stat { padding: 13px; border-radius: 14px; }
  .admin-stat strong { font-size: 22px; }
  .admin-section-head { align-items: flex-start; }
  .admin-section-head h2 { font-size: 17px; }
  .admin-section-head select { min-width: 120px; max-width: 46%; }
  .admin-table-wrap { display: none; }
  .admin-mobile-list { display: grid; gap: 9px; }
  .admin-user-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfc; }
  .admin-user-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .admin-user-card-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .admin-user-card-head span { color: var(--muted); font-size: 9px; }
  .admin-user-card > p { margin: 5px 0 10px; color: var(--muted); font-size: 10px; }
  .admin-user-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .admin-user-card-grid span { padding: 8px; border-radius: 8px; background: #f1f2f4; color: var(--muted); font-size: 9px; }
  .admin-user-card-grid strong { display: block; margin-top: 3px; color: var(--ink); font-size: 12px; }
  .admin-user-card .table-action { margin-top: 10px; min-height: 36px; width: 100%; }
  .admin-lower-grid { grid-template-columns: 1fr; gap: 0; }
  .admin-section { padding: 15px; }
  .credit-form input, .credit-form select { min-height: 44px; }
  .credit-form .primary { min-height: 47px; }
}

/* Operations management console */
.admin-page { min-height: 100vh; background: #f5f6f8; color: #17191d; }
.gm-login-view[hidden], .gm-app[hidden] { display: none !important; }
.gm-auth-form [hidden] { display: none !important; }
.gm-login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 0%, #eef4ff 0, transparent 35%), #f5f6f8; }
.gm-login-card { width: min(430px, 100%); padding: 34px; border: 1px solid #e4e7ed; border-radius: 25px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(23,31,46,.1); }
.gm-login-brand { display: flex; align-items: center; gap: 13px; }
.gm-login-brand > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff; background: #12161f; font-size: 15px; font-weight: 900; letter-spacing: .08em; }
.gm-login-brand h1 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.05em; }
.gm-login-copy { margin: 25px 0 20px; color: #737985; font-size: 12px; line-height: 1.8; }
.gm-auth-tabs { display: flex; gap: 4px; margin-bottom: 17px; padding: 4px; border-radius: 12px; background: #f0f2f5; }
.gm-auth-tab { flex: 1; min-height: 34px; border: 0; border-radius: 9px; color: #757b85; background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.gm-auth-tab.active { color: #17191d; background: #fff; box-shadow: 0 2px 7px rgba(20,23,29,.08); }
.gm-auth-form { display: grid; gap: 12px; }
.gm-auth-form label, .gm-form label { display: grid; gap: 6px; color: #555c68; font-size: 11px; font-weight: 800; }
.gm-auth-form input, .gm-form input, .gm-form select, .gm-toolbar select { width: 100%; min-height: 44px; box-sizing: border-box; border: 1px solid #e1e4e9; border-radius: 10px; padding: 0 12px; color: #22252a; background: #fff; outline: none; font: inherit; }
.gm-auth-form input:focus, .gm-form input:focus, .gm-form select:focus, .gm-toolbar input:focus, .gm-toolbar select:focus { border-color: #8eaee5; box-shadow: 0 0 0 3px rgba(80,125,203,.12); }
.gm-primary, .gm-secondary { min-height: 40px; border: 0; border-radius: 10px; padding: 0 14px; font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
.gm-primary { color: #fff; background: #1d4f9e; box-shadow: 0 8px 18px rgba(29,79,158,.16); }
.gm-primary span { margin-left: 7px; }
.gm-secondary { color: #424954; background: #eef1f5; }
.gm-secondary:hover, .gm-primary:hover { filter: brightness(.97); }
.gm-auth-message, .gm-form-message { min-height: 17px; margin: 0; color: #a34a3d; font-size: 10px; line-height: 1.5; }
.gm-login-foot { margin: 22px 0 0; color: #979da8; font-size: 10px; text-align: center; }
.gm-login-foot code { padding: 3px 5px; border-radius: 5px; color: #404651; background: #eef0f3; }
.gm-app { min-height: 100vh; display: flex; }
.gm-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 238px; display: flex; flex-direction: column; padding: 25px 15px 17px; box-sizing: border-box; border-right: 1px solid #e0e3e9; background: #12161f; color: #fff; }
.gm-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 25px; }
.gm-brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #16233d; background: #d8e6ff; font-size: 12px; font-weight: 900; }
.gm-brand strong { display: block; font-size: 14px; letter-spacing: -.04em; }
.gm-brand small { display: block; margin-top: 3px; color: #8692a8; font-size: 8px; letter-spacing: .12em; }
.gm-admin-chip { display: flex; align-items: center; gap: 9px; margin: 0 5px 22px; padding: 11px 10px; border: 1px solid #2a3342; border-radius: 13px; background: #1a202c; }
.gm-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: #102342; background: #b9d2ff; font-size: 11px; font-weight: 900; }
.gm-admin-chip strong, .gm-admin-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-admin-chip strong { max-width: 150px; font-size: 10px; }
.gm-admin-chip small { max-width: 150px; margin-top: 3px; color: #8a96a9; font-size: 9px; }
.gm-nav { display: grid; gap: 4px; }
.gm-nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; border: 0; border-radius: 10px; padding: 0 12px; color: #9ca8bb; background: transparent; font: inherit; font-size: 11px; font-weight: 800; text-align: left; cursor: pointer; }
.gm-nav-item span { width: 17px; color: #768398; font-size: 16px; text-align: center; }
.gm-nav-item:hover { color: #fff; background: #1c2533; }
.gm-nav-item.active { color: #fff; background: #2b4e84; box-shadow: inset 3px 0 0 #9fc3ff; }
.gm-nav-item.active span { color: #d9e8ff; }
.gm-sidebar-foot { display: grid; grid-template-columns: auto 1fr; gap: 4px 7px; align-items: center; margin-top: auto; padding: 13px 11px 0; border-top: 1px solid #2a3342; color: #8b97ab; font-size: 10px; }
.gm-sidebar-foot small { grid-column: 2; color: #596679; font-size: 8px; }
.gm-live-dot { width: 6px; height: 6px; border-radius: 50%; background: #69d19a; box-shadow: 0 0 0 4px rgba(105,209,154,.12); }
.gm-content { flex: 1; min-width: 0; margin-left: 238px; }
.gm-topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; min-height: 78px; padding: 0 34px; border-bottom: 1px solid #e3e6eb; background: rgba(245,246,248,.9); backdrop-filter: blur(12px); }
.gm-topbar h1 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.05em; }
.gm-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.gm-last-refresh { color: #9aa1ad; font-size: 9px; }
.gm-menu-button { display: none; border: 0; color: #34425a; background: transparent; font-size: 20px; }
.gm-main { width: min(1320px, 100%); box-sizing: border-box; margin: 0 auto; padding: 32px 34px 50px; }
.gm-screen { display: none; animation: gmFade .18s ease; }
.gm-screen.active { display: block; }
@keyframes gmFade { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.gm-page-intro { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.gm-page-intro.compact { margin-bottom: 18px; }
.gm-page-intro h2 { margin: 4px 0 7px; font-size: 30px; letter-spacing: -.06em; }
.gm-page-intro p:not(.eyebrow) { max-width: 590px; margin: 0; color: #7d8490; font-size: 12px; line-height: 1.7; }
.gm-stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px; }
.gm-stat { min-height: 108px; box-sizing: border-box; padding: 17px; border: 1px solid #e3e6eb; border-radius: 15px; background: #fff; }
.gm-stat span, .gm-stat small { display: block; color: #8b929e; font-size: 10px; }
.gm-stat strong { display: block; margin: 12px 0 4px; color: #1a1d22; font-size: 24px; letter-spacing: -.05em; }
.gm-stat small { font-size: 9px; }
.gm-overview-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
.gm-panel { margin-top: 14px; padding: 20px; border: 1px solid #e3e6eb; border-radius: 16px; background: #fff; }
.gm-overview-grid .gm-panel { margin-top: 0; min-height: 145px; }
.gm-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.gm-panel-head h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.05em; }
.gm-status-badge { display: inline-flex; align-items: center; min-height: 24px; box-sizing: border-box; padding: 0 9px; border-radius: 99px; color: #7e8590; background: #f0f2f4; font-size: 9px; font-weight: 900; }
.gm-status-badge.active { color: #25754e; background: #eaf8ef; }
.gm-status-badge.disabled { color: #a6473b; background: #fff0ed; }
.gm-provider-detail { color: #747b87; font-size: 11px; line-height: 1.75; }
.gm-provider-channel { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; margin-top: 16px; padding-top: 15px; border-top: 1px solid #edf0f3; }
.gm-provider-channel > div { min-width: 0; }
.gm-provider-channel span, .gm-provider-channel strong, .gm-provider-channel small { display: block; }
.gm-provider-channel > div > span { color: #7d8592; font-size: 9px; }
.gm-provider-channel strong { margin: 4px 0 3px; overflow: hidden; color: #252b34; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.gm-provider-channel small { color: #929aa6; font-size: 9px; line-height: 1.45; }
.gm-provider-channel .gm-secondary { min-height: 34px; padding: 0 10px; }
.gm-quick-actions { display: grid; gap: 7px; }
.gm-quick-actions button { display: flex; align-items: center; justify-content: space-between; min-height: 37px; border: 1px solid #e6e9ee; border-radius: 9px; padding: 0 11px; color: #414955; background: #fafbfc; font: inherit; font-size: 10px; font-weight: 800; text-align: left; cursor: pointer; }
.gm-quick-actions button:hover { border-color: #c8d8ef; color: #1c4f9d; background: #f5f8ff; }
.gm-toolbar { display: flex; align-items: center; gap: 9px; }
.gm-search { flex: 1; display: flex; align-items: center; gap: 7px; min-height: 41px; box-sizing: border-box; border: 1px solid #e1e4e9; border-radius: 10px; padding: 0 10px; color: #9aa1ac; background: #fff; }
.gm-search:focus-within { border-color: #8eaee5; box-shadow: 0 0 0 3px rgba(80,125,203,.12); }
.gm-search input { flex: 1; min-width: 0; border: 0; outline: 0; color: #20242a; background: transparent; font: inherit; font-size: 11px; }
.gm-toolbar select { width: 160px; min-height: 41px; }
.gm-table-wrap { overflow-x: auto; }
.gm-table { width: 100%; min-width: 920px; border-collapse: collapse; font-size: 11px; }
.gm-table.compact { min-width: 760px; }
.gm-table th { padding: 10px 8px; border-bottom: 1px solid #e5e8ed; color: #8c94a0; font-size: 9px; font-weight: 800; text-align: left; white-space: nowrap; }
.gm-table td { padding: 12px 8px; border-bottom: 1px solid #f0f1f3; white-space: nowrap; vertical-align: middle; }
.gm-table tr:last-child td { border-bottom: 0; }
.gm-table td strong, .gm-table td small { display: block; }
.gm-table td small { margin-top: 3px; color: #949ba5; font-size: 9px; }
.gm-balance { color: #9c6814; }
.gm-row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.gm-row-button { border: 0; border-radius: 7px; padding: 7px 8px; color: #315b99; background: #edf3fc; font: inherit; font-size: 9px; font-weight: 900; cursor: pointer; }
.gm-row-button:hover { background: #dfeafb; }
.gm-mobile-list { display: none; }
.gm-billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gm-form { display: grid; gap: 11px; }
.gm-form .gm-primary, .gm-form .gm-secondary { margin-top: 2px; }
.gm-positive { color: #26784e !important; font-weight: 900; }
.gm-negative { color: #b04e42 !important; font-weight: 900; }
.gm-detail-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.gm-detail-grid > div { min-height: 58px; box-sizing: border-box; padding: 10px; border-radius: 9px; background: #f6f7f9; }
.gm-detail-grid span, .gm-detail-grid strong { display: block; }
.gm-detail-grid span { color: #8b929e; font-size: 9px; }
.gm-detail-grid strong { margin-top: 5px; color: #252a31; font-size: 11px; }
.gm-detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 14px; }
.gm-detail-assets h4 { margin: 0 0 8px; font-size: 12px; }
.gm-asset-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-top: 1px solid #f0f1f3; }
.gm-asset-row > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #315b99; background: #edf3fc; font-size: 11px; }
.gm-asset-row strong, .gm-asset-row small { display: block; }
.gm-asset-row strong { font-size: 10px; }
.gm-asset-row small { max-width: 700px; margin-top: 3px; overflow: hidden; color: #9299a4; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.gm-asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gm-asset-card { min-height: 130px; padding: 13px; border: 1px solid #e7e9ee; border-radius: 11px; background: #fafbfc; }
.gm-asset-card strong, .gm-asset-card small { display: block; }
.gm-asset-card strong { margin-top: 10px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.gm-asset-card small { margin-top: 4px; color: #949ba5; font-size: 9px; }
.gm-asset-card p { margin: 10px 0 0; overflow: hidden; color: #737b87; font-size: 9px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.gm-asset-kind { color: #5576aa; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.gm-empty { padding: 26px 8px; color: #9ba2ad; font-size: 11px; text-align: center; }
.gm-setting-list { display: grid; gap: 0; }
.gm-setting-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 47px; border-bottom: 1px solid #f0f1f3; color: #7b828e; font-size: 11px; }
.gm-setting-list > div:last-child { border-bottom: 0; }
.gm-setting-list strong { color: #29303a; font-size: 11px; text-align: right; }
.gm-toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(350px, calc(100vw - 40px)); padding: 11px 14px; border-radius: 10px; color: #fff; background: #1a2331; box-shadow: 0 12px 32px rgba(9,18,33,.2); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; font-size: 11px; }
.gm-toast.show { opacity: 1; transform: none; }
*[hidden] { display: none !important; }

/* FrameFlow workspace v2 */
.credit-entry { position: relative; border: 0; cursor: pointer; font: inherit; }
.credit-tooltip { position: absolute; top: calc(100% + 9px); left: 50%; transform: translate(-50%, -4px); padding: 7px 10px; border-radius: 8px; color: #fff; background: #111827; font-size: 12px; font-weight: 650; white-space: nowrap; opacity: 0; pointer-events: none; transition: .18s ease; box-shadow: 0 8px 20px rgba(15,23,42,.18); z-index: 20; }
.credit-tooltip::before { content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -4px; border: 4px solid transparent; border-bottom-color: #111827; }
.credit-entry:hover .credit-tooltip, .credit-entry:focus-visible .credit-tooltip { opacity: 1; transform: translate(-50%, 0); }
.video-only-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.video-only-grid .wide-card { grid-column: 1 / -1; }
.text-button { border: 0; background: transparent; color: var(--primary, #5b5bd6); cursor: pointer; font-weight: 650; }
.image-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(17,24,39,.82); color: #fff; font-size: 18px; cursor: pointer; z-index: 2; }
.image-card { position: relative; }
.image-studio-layout { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); gap: 22px; align-items: start; }
.image-config-card, .image-result-card { min-width: 0; }
.generated-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.generated-grid .image-card img { aspect-ratio: 9 / 12; object-fit: cover; }
.generated-grid .image-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.generated-grid .image-meta a { color: var(--primary, #5b5bd6); text-decoration: none; font-weight: 650; }
.generation-cost { margin: 15px 0 12px; padding: 12px 14px; border: 1px solid rgba(91,91,214,.2); border-radius: 12px; background: rgba(91,91,214,.055); color: #4343a8; font-size: 13px; font-weight: 700; }
.pagination, .picker-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }
.pagination button, .picker-pagination button { min-width: 78px; padding: 9px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: #fff; color: #374151; cursor: pointer; }
.pagination button:disabled, .picker-pagination button:disabled { opacity: .42; cursor: not-allowed; }
.pagination span, .picker-pagination span { color: #6b7280; font-size: 13px; }
.picker-pagination { margin: 12px 0 0; }
.account-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 22px; align-items: start; }
.account-form-card { min-width: 0; }
.account-form-card form { display: grid; gap: 10px; }
.account-form-card input { width: 100%; box-sizing: border-box; }
.account-form-card .primary { margin-top: 8px; }
.account-form-card:last-child { grid-column: 1 / -1; max-width: calc(50% - 10px); }
.form-feedback { min-height: 20px; margin: 2px 0 0; color: #4f46e5; font-size: 13px; }
.recharge-placeholder { padding: 18px; border: 1px dashed #d7dbea; border-radius: 14px; background: #fafbff; }
.recharge-placeholder strong { display: block; margin-bottom: 8px; font-size: 17px; }
.recharge-placeholder p { margin: 0 0 18px; color: #667085; line-height: 1.65; }
.recharge-placeholder button:disabled { opacity: .6; }
.asset-actions { flex-wrap: wrap; }
.asset-actions button:not(.asset-delete) { border: 0; background: transparent; color: var(--primary, #5b5bd6); padding: 0; cursor: pointer; font-weight: 650; }
.modal-open { overflow: hidden; }

@media (max-width: 1040px) {
  .image-studio-layout, .video-only-grid { grid-template-columns: 1fr; }
  .video-only-grid .wide-card { grid-column: auto; }
  .account-settings-grid { grid-template-columns: 1fr; }
  .account-form-card:last-child { grid-column: auto; max-width: none; }
}

@media (max-width: 720px) {
  .saas-topbar { gap: 10px; }
  .saas-topbar > div:first-of-type .eyebrow { display: none; }
  .saas-topbar h1 { font-size: 18px; }
  .account-bar { gap: 7px; }
  .user-pill { display: none; }
  .credit-entry { padding-inline: 10px; }
  .image-studio-layout, .account-settings-grid { gap: 14px; }
  .generated-grid { grid-template-columns: 1fr; }
  .render-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-picker-dialog { width: calc(100vw - 20px); max-height: 92vh; border-radius: 18px; }
  .asset-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saas-page-hero p { max-width: 100%; }
}
@media (max-width: 1100px) { .gm-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .gm-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .gm-sidebar { width: 235px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 14px 0 36px rgba(6,14,25,.15); }
  .gm-sidebar.open { transform: none; }
  .gm-content { margin-left: 0; width: 100%; }
  .gm-topbar { min-height: 66px; padding: 0 16px; gap: 9px; }
  .gm-menu-button { display: block; }
  .gm-topbar h1 { font-size: 18px; }
  .gm-last-refresh { display: none; }
  .gm-top-actions { gap: 5px; }
  .gm-top-actions .gm-secondary { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .gm-main { padding: 23px 14px 38px; }
  .gm-page-intro { display: block; margin-bottom: 17px; }
  .gm-page-intro .gm-primary { margin-top: 13px; }
  .gm-page-intro h2 { font-size: 25px; }
  .gm-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gm-stat { min-height: 94px; padding: 13px; border-radius: 13px; }
  .gm-stat strong { margin-top: 9px; font-size: 21px; }
  .gm-overview-grid, .gm-billing-grid { grid-template-columns: 1fr; gap: 0; }
  .gm-provider-channel { grid-template-columns: minmax(0, 1fr) auto; }
  .gm-provider-channel .gm-secondary { grid-column: 1 / -1; width: 100%; min-height: 42px; }
  .gm-panel { padding: 15px; border-radius: 13px; }
  .gm-toolbar { flex-wrap: wrap; }
  .gm-toolbar select { flex: 1; width: auto; min-width: 130px; }
  .gm-toolbar .gm-secondary { min-height: 41px; }
  .gm-table-wrap { display: none; }
  .gm-mobile-list { display: grid; gap: 8px; }
  .gm-user-card { padding: 12px; border: 1px solid #e7e9ee; border-radius: 11px; background: #fafbfc; }
  .gm-user-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .gm-user-head strong { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .gm-user-head > span { flex-shrink: 0; color: #7e8590; font-size: 9px; }
  .gm-user-card p { margin: 5px 0 10px; color: #8f96a1; font-size: 9px; }
  .gm-user-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .gm-user-metrics span { min-width: 0; padding: 8px; border-radius: 8px; color: #9299a4; background: #f0f2f5; font-size: 9px; }
  .gm-user-metrics strong { display: block; margin-top: 3px; overflow: hidden; color: #252b34; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .gm-user-card .gm-row-actions { margin-top: 10px; }
  .gm-row-actions .gm-row-button { flex: 1; min-height: 34px; }
  .gm-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gm-asset-grid { grid-template-columns: 1fr; }
  .gm-setting-list > div { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 0; }
  .gm-setting-list strong { text-align: left; }
  .gm-login-card { padding: 25px; border-radius: 20px; }
}

/* User SaaS workspace */
.saas-product { --accent: #2563eb; --accent-deep: #1d4ed8; --soft: #eff6ff; --blue: #315f9f; min-height: 100vh; background: #f5f7fb; color: #172033; }
.saas-auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); }
.saas-auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 46px 56px; color: #fff; background: radial-gradient(circle at 85% 14%, rgba(66,117,218,.36), transparent 32%), linear-gradient(145deg, #101827 0%, #17233a 58%, #111827 100%); }
.saas-auth-brand::after { content: ""; position: absolute; width: 540px; height: 540px; right: -270px; bottom: -300px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.saas-wordmark { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 11px; width: max-content; color: #fff; text-decoration: none; }
.saas-wordmark span, .saas-sidebar-brand > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #132340; background: #dbeafe; font-size: 15px; font-weight: 950; }
.saas-wordmark strong { font-size: 17px; letter-spacing: -.04em; }
.saas-auth-story { position: relative; z-index: 1; max-width: 610px; margin: auto 0; padding: 70px 0; }
.saas-auth-story .eyebrow { color: #93b4e8; }
.saas-auth-story h1 { margin: 17px 0 19px; color: #fff; font-size: clamp(43px, 5vw, 68px); line-height: 1.02; letter-spacing: -.07em; }
.saas-auth-story > p:not(.eyebrow) { max-width: 520px; margin: 0; color: #aebbd0; font-size: 14px; line-height: 1.8; }
.saas-feature-list { display: grid; gap: 13px; margin-top: 34px; }
.saas-feature-list span { display: flex; align-items: center; gap: 11px; color: #d9e2f0; font-size: 12px; }
.saas-feature-list i { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(156,190,244,.28); border-radius: 8px; color: #9fc2fa; background: rgba(255,255,255,.045); font-size: 9px; font-style: normal; font-weight: 900; }
.saas-auth-status { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; color: #91a0b8; font-size: 10px; }
.saas-online-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #43d39e; box-shadow: 0 0 0 4px rgba(67,211,158,.12); }
.saas-auth-main { display: grid; place-items: center; padding: 42px; background: #f7f8fb; }
.saas-auth-card { width: min(440px, 100%); padding: 34px; border: 1px solid #e2e6ee; border-radius: 19px; background: #fff; box-shadow: 0 26px 70px rgba(35,47,72,.09); }
.saas-auth-heading { margin-bottom: 25px; }
.saas-auth-heading h2 { margin: 8px 0 7px; color: #182033; font-size: 30px; letter-spacing: -.055em; }
.saas-auth-heading > p:not(.eyebrow) { margin: 0; color: #7a8495; font-size: 12px; line-height: 1.7; }
.saas-auth-card .auth-form { gap: 13px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.saas-auth-card .auth-form label { gap: 7px; color: #4b5567; font-size: 11px; font-weight: 800; }
.saas-auth-card input[type="text"], .saas-auth-card input[type="email"], .saas-auth-card input[type="password"] { min-height: 48px; border: 1px solid #dfe3eb; border-radius: 10px; padding: 0 13px; color: #1f2937; background: #fbfcfe; font-size: 13px; }
.saas-auth-card input:focus { border-color: #76a3f1; box-shadow: 0 0 0 3px rgba(37,99,235,.11); background: #fff; }
.saas-auth-submit { min-height: 49px; margin-top: 5px; border-radius: 10px; background: #2563eb; box-shadow: 0 10px 24px rgba(37,99,235,.22); font-size: 13px; }
.saas-auth-submit:hover { background: #1d4ed8; }
.saas-auth-switch { display: flex; align-items: center; justify-content: center; gap: 5px; color: #8a93a2; font-size: 11px; }
.saas-auth-switch .link-button { color: #2563eb; }
.saas-auth-security { margin: 21px 0 0; padding-top: 17px; border-top: 1px solid #edf0f4; color: #9aa2af; font-size: 9px; line-height: 1.6; text-align: center; }
.saas-workspace { min-height: 100vh; display: flex; }
.saas-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 232px; display: flex; flex-direction: column; padding: 24px 14px 17px; border-right: 1px solid #e2e6ee; background: #101724; color: #fff; }
.saas-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 25px; }
.saas-sidebar-brand strong, .saas-sidebar-brand small { display: block; }
.saas-sidebar-brand strong { font-size: 14px; letter-spacing: -.04em; }
.saas-sidebar-brand small { margin-top: 3px; color: #6f7f96; font-size: 8px; letter-spacing: .12em; }
.saas-nav { display: grid; gap: 4px; }
.saas-nav-item { display: flex; align-items: center; gap: 11px; min-height: 43px; border: 0; border-radius: 10px; padding: 0 12px; color: #8e9db3; background: transparent; font-size: 11px; font-weight: 800; text-align: left; }
.saas-nav-item > span { width: 17px; color: #6f8098; font-size: 15px; text-align: center; }
.saas-nav-item:hover { color: #fff; background: #182337; }
.saas-nav-item.active { color: #fff; background: #214f9d; box-shadow: inset 3px 0 0 #9fc4ff; }
.saas-nav-item.active > span { color: #d7e7ff; }
.saas-model-card { display: grid; gap: 5px; margin: 25px 5px 0; padding: 13px; border: 1px solid #27334a; border-radius: 12px; background: #151f30; }
.saas-model-card p { margin: 0 0 5px; color: #65758d; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.saas-model-card strong { color: #bec9d9; font-size: 9px; font-weight: 750; }
.saas-model-card i { color: #506079; font-size: 9px; font-style: normal; }
.saas-sidebar-foot { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; margin-top: auto; padding: 15px 10px 0; border-top: 1px solid #263044; color: #8b98aa; font-size: 9px; }
.saas-sidebar-foot small { grid-column: 2; color: #5c6b80; font-size: 8px; }
.saas-workspace-main { flex: 1; min-width: 0; margin-left: 232px; }
.saas-topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 13px; min-height: 76px; padding: 0 30px; border-bottom: 1px solid #e2e6ee; background: rgba(247,248,251,.92); backdrop-filter: blur(12px); }
.saas-topbar h1 { margin: 4px 0 0; color: #182033; font-size: 20px; letter-spacing: -.05em; }
.saas-topbar .status-pill { margin-left: auto; }
.saas-topbar .account-bar { margin-left: 0; }
.saas-topbar .user-pill { max-width: 210px; border: 1px solid #dfe5ef; color: #4d607c; background: #fff; }
.saas-topbar .credit-pill { border: 1px solid #d6e5ff; color: #245db0; background: #edf5ff; }
.saas-icon-button { min-height: 34px; border: 1px solid #e0e4eb; border-radius: 8px; padding: 0 10px; color: #6e7786; background: #fff; font-size: 10px; font-weight: 800; }
.saas-menu-button { display: none; border: 0; color: #46546a; background: transparent; font-size: 20px; }
.saas-content { width: min(1280px, 100%); margin: 0 auto; padding: 31px 30px 55px; }
.saas-user-screen { display: none; animation: saasFade .16s ease; }
.saas-user-screen.active { display: block; }
@keyframes saasFade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.saas-page-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.saas-page-hero.compact { margin-bottom: 17px; }
.saas-page-hero h2 { margin: 5px 0 7px; color: #151d2d; font-size: 31px; letter-spacing: -.06em; }
.saas-page-hero p:not(.eyebrow) { max-width: 650px; margin: 0; color: #7d8796; font-size: 12px; line-height: 1.7; }
.saas-workflow-status { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid #e0e5ed; border-radius: 11px; background: #fff; }
.saas-workflow-status span { color: #99a1af; font-size: 9px; font-weight: 800; white-space: nowrap; }
.saas-workflow-status span.active { color: #2563eb; }
.saas-workflow-status i { width: 18px; height: 1px; background: #dfe3e9; }
.saas-workflow-grid { gap: 14px; }
.saas-product .card { border: 1px solid #e1e6ee; border-radius: 15px; box-shadow: 0 8px 28px rgba(38,51,76,.055); }
.saas-product .step-card::after { color: #eff2f6; }
.saas-product .step-heading > span { color: #2563eb; background: #edf4ff; }
.image-mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0 14px; }
.image-mode-tab { position: relative; display: grid; grid-template-columns: 29px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 9px; min-height: 66px; border: 1px solid #dfe5ee; border-radius: 11px; padding: 11px 12px; color: #647084; background: #fbfcfe; font: inherit; text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.image-mode-tab > span { grid-row: 1 / 3; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: #64748b; background: #eef1f5; font-size: 13px; }
.image-mode-tab strong { align-self: end; color: #374151; font-size: 11px; }
.image-mode-tab small { align-self: start; margin-top: 2px; color: #929baa; font-size: 9px; line-height: 1.35; }
.image-mode-tab:hover { border-color: #acc5ef; background: #f8fbff; }
.image-mode-tab.active { border-color: #73a1ed; background: #f2f7ff; box-shadow: 0 0 0 2px rgba(37,99,235,.09); }
.image-mode-tab.active > span { color: #2563eb; background: #dfeeff; }
.image-mode-tab.active strong { color: #1d4ed8; }
.text-image-callout { min-height: 150px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 13px; margin: 14px 0 17px; border: 1px dashed #b9c9df; border-radius: 12px; padding: 24px; color: #546174; background: linear-gradient(145deg, #f8fbff, #f3f7fd); text-align: left; }
.text-image-callout > span { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; color: #2563eb; background: #dfeeff; font-size: 17px; }
.text-image-callout strong, .text-image-callout small { display: block; }
.text-image-callout strong { color: #334155; font-size: 12px; }
.text-image-callout small { max-width: 270px; margin-top: 5px; color: #8290a3; font-size: 10px; line-height: 1.5; }
.field-label b { margin-left: 4px; color: #2563eb; font-size: 9px; font-weight: 900; }
.saas-product .dropzone { border-color: #cbd5e1; background: #f9fbfe; }
.saas-product .dropzone:hover, .saas-product .dropzone.dragging { border-color: #5b8ee6; background: #f2f7ff; }
.saas-product .upload-icon { color: #2563eb; }
.saas-product textarea, .saas-product input[type="text"], .saas-product select { border-color: #dfe4ec; background: #fbfcfe; }
.saas-product textarea:focus, .saas-product input[type="text"]:focus, .saas-product input[type="email"]:focus, .saas-product input[type="password"]:focus, .saas-product select:focus { border-color: #76a3f1; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.saas-product .primary { background: #2563eb; box-shadow: 0 8px 18px rgba(37,99,235,.18); }
.saas-product .primary:hover { background: #1d4ed8; }
.saas-product .secondary { background: #18243a; }
.saas-product .image-card.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.16); }
.saas-product .image-card.selected .check { background: #2563eb; }
.saas-product .prompt-card.active { border-color: #9dbbf0; background: #f5f9ff; }
.saas-product .prompt-card input { accent-color: #2563eb; }
.saas-product .switch-label input:checked + i { background: #2563eb; }
.saas-product .task-top span { color: #2563eb; }
.saas-product .progress i { background: #2563eb; }
.saas-product .video-link, .saas-product .asset-actions a, .saas-product .asset-actions button { color: #2563eb; }
.saas-product .asset-library { margin-bottom: 0; }
.saas-product .asset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.saas-product .asset-card { border-color: #e1e6ee; border-radius: 12px; background: #fff; }
.saas-account-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.saas-account-card { min-height: 145px; }
.saas-account-card span, .saas-account-card small { display: block; color: #8a94a3; font-size: 10px; }
.saas-account-card strong { display: block; margin: 18px 0 7px; overflow: hidden; color: #1c2637; font-size: 23px; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.saas-account-card small { line-height: 1.6; }
.saas-auth-view[hidden], .saas-workspace[hidden] { display: none !important; }
@media (max-width: 980px) {
  .saas-auth-view { grid-template-columns: .9fr 1.1fr; }
  .saas-auth-brand { padding: 36px; }
  .saas-auth-story h1 { font-size: 46px; }
  .saas-workflow-status { display: none; }
  .saas-product .asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .saas-auth-view { display: block; min-height: 100vh; background: #f7f8fb; }
  .saas-auth-brand { min-height: 196px; padding: 24px; border-radius: 0 0 24px 24px; }
  .saas-auth-story { margin: 28px 0 0; padding: 0; }
  .saas-auth-story h1 { margin: 10px 0 7px; font-size: 32px; }
  .saas-auth-story > p:not(.eyebrow), .saas-feature-list { display: none; }
  .saas-auth-status { margin-top: auto; }
  .saas-auth-main { padding: 22px 14px 34px; }
  .saas-auth-card { margin-top: -30px; padding: 22px; border-radius: 16px; }
  .saas-sidebar { width: 232px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 16px 0 38px rgba(8,16,31,.18); }
  .saas-sidebar.open { transform: none; }
  .saas-workspace-main { margin-left: 0; }
  .saas-topbar { min-height: 67px; padding: 0 13px; gap: 8px; }
  .saas-menu-button { display: block; }
  .saas-topbar .eyebrow, .saas-topbar .status-pill, .saas-topbar .user-pill { display: none; }
  .saas-topbar h1 { font-size: 18px; }
  .saas-topbar .account-bar { width: auto; margin-left: auto; padding: 0; border: 0; }
  .saas-topbar .credit-pill { padding: 7px 8px; font-size: 9px; }
  .saas-icon-button { min-height: 32px; padding: 0 8px; }
  .saas-content { padding: 23px 12px 40px; }
  .saas-page-hero { display: block; margin-bottom: 17px; }
  .saas-page-hero h2 { font-size: 26px; }
  .saas-workflow-grid { grid-template-columns: 1fr; }
  .saas-workflow-grid .wide-card { grid-column: auto; }
  .saas-product .card { padding: 15px; border-radius: 13px; }
  .image-mode-tabs { gap: 7px; margin-top: 16px; }
  .image-mode-tab { grid-template-columns: 26px minmax(0, 1fr); column-gap: 7px; min-height: 62px; padding: 9px; }
  .image-mode-tab > span { width: 26px; height: 26px; }
  .image-mode-tab small { font-size: 8px; }
  .text-image-callout { min-height: 130px; padding: 19px; }
  .saas-product .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saas-account-grid { grid-template-columns: 1fr; gap: 10px; }
  .saas-account-card { min-height: 112px; }
}
*[hidden] { display: none !important; }
