:root {
  --brand: #1f8a5b;
  --brand-dark: #176b45;
  --brand-soft: #eaf6ef;
  --ink: #18251f;
  --muted: #6d7d75;
  --line: #dfe7e2;
  --line-strong: #c8d5cd;
  --surface: #ffffff;
  --surface-soft: #f5f8f6;
  --danger: #b53b48;
  --warning: #8a651c;
  --shadow: 0 16px 42px rgba(25, 54, 39, .09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; background: var(--surface-soft); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.delete-confirm-dialog { width:min(420px, calc(100vw - 32px)); margin:auto; padding:0; border:1px solid var(--line); border-radius:16px; background:var(--surface); color:var(--ink); box-shadow:0 28px 80px rgba(15,23,42,.24); }
.delete-confirm-dialog::backdrop { background:rgba(15,23,42,.38); backdrop-filter:blur(5px); }
.delete-confirm-dialog form { margin:0; padding:22px; display:grid; grid-template-columns:38px minmax(0,1fr); gap:14px; }
.delete-confirm-mark { width:38px; height:38px; display:grid; place-items:center; border-radius:50%; background:#fff0f1; color:var(--danger); font-size:20px; font-weight:900; }
.notice-dialog .delete-confirm-mark { background:#fff2cf; color:#b45309; box-shadow:0 0 0 7px rgba(245,158,11,.1); }
.delete-confirm-copy h3 { margin:1px 0 7px; font-size:17px; }.delete-confirm-copy p { margin:0; color:var(--muted); font-size:12px; line-height:1.65; white-space:pre-wrap; }
.delete-confirm-actions { grid-column:1/-1; margin-top:8px; display:flex; justify-content:flex-end; gap:8px; }.delete-confirm-actions button { min-height:36px; }
a { color: inherit; }

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.boot-mark, .brand-symbol { display: grid; place-items: center; background: var(--brand); color: white; font-weight: 850; }
.boot-mark { width: 34px; height: 34px; border-radius: 10px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.auth-brand { position: relative; overflow: hidden; padding: 52px; display: flex; flex-direction: column; justify-content: space-between; background: #173f2d; color: white; }
.auth-brand::after { content: ""; position: absolute; width: 520px; height: 520px; right: -190px; bottom: -210px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.035), 0 0 0 140px rgba(255,255,255,.025); }
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.brand-symbol { width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.65); font-size: 12px; }
.auth-message { position: relative; z-index: 1; max-width: 610px; margin-bottom: 9vh; }
.auth-message h1 { max-width: 580px; margin: 0 0 20px; font-size: clamp(36px, 5vw, 64px); line-height: 1.08; letter-spacing: -.04em; }
.auth-message p { max-width: 510px; margin: 0; color: rgba(255,255,255,.72); font-size: 17px; line-height: 1.8; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px; }
.auth-form { width: min(430px, 100%); }
.eyebrow { color: var(--brand-dark); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-form h2 { margin: 12px 0 8px; font-size: 30px; letter-spacing: -.03em; }
.auth-form > p { margin: 0 0 30px; color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 7px; margin-top: 18px; }
.field label { color: #33443b; font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); outline: none; }
.field textarea { padding-block: 12px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,138,91,.12); }
.primary-btn, .secondary-btn, .text-btn, .icon-btn { border-radius: 8px; min-height: 40px; transition: .16s ease; }
.primary-btn { padding: 0 17px; border: 1px solid var(--brand); background: var(--brand); color: white; font-weight: 750; }
.primary-btn:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.secondary-btn { padding: 0 15px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 700; }
.secondary-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.danger-btn { min-height: 40px; padding: 0 13px; border: 1px solid #f0c4c9; border-radius: 8px; background: #fff7f8; color: var(--danger); font-weight: 750; }
.danger-btn:hover:not(:disabled) { border-color: var(--danger); background: #ffedef; }
.text-btn { padding: 0 6px; border: 0; background: transparent; color: var(--brand-dark); font-weight: 750; }
.wide { width: 100%; margin-top: 24px; }
.auth-switch { margin-top: 20px; color: var(--muted); text-align: center; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 246px; padding: 24px 16px 18px; display: flex; flex-direction: column; background: #173f2d; color: white; }
.sidebar .brand { padding: 0 8px 24px; }
.nav-label { margin: 18px 10px 8px; color: rgba(255,255,255,.42); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.nav { min-height: 0; flex: 1; display: grid; align-content: start; gap: 5px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.24) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255,255,255,.24); }
.nav-item { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; display: flex; align-items: center; gap: 11px; background: transparent; color: rgba(255,255,255,.72); text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.12); color: white; }
.nav-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.08); font-size: 14px; font-weight: 850; }
.sidebar-spacer { display: none; }
.sidebar-user { padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.user-row { display: grid; grid-template-columns: 36px minmax(0,1fr) 34px; align-items: center; gap: 9px; }
.avatar { display: grid; place-items: center; border-radius: 50%; background: #d9efe3; color: var(--brand-dark); font-weight: 850; }
.user-row .avatar { width: 36px; height: 36px; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy span { margin-top: 3px; color: rgba(255,255,255,.5); font-size: 10px; }
.icon-btn { width: 34px; padding: 0; border: 0; background: transparent; color: inherit; }
.icon-btn:hover { background: rgba(255,255,255,.08); }

.main-shell { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 8; height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
.topbar-title { font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.balance-pill { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; display: flex; align-items: center; gap: 7px; background: var(--surface); color: var(--muted); font-size: 12px; }
.balance-pill strong { color: var(--brand-dark); }
.storage-pill { background: var(--brand-soft); }
.topbar-content-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--brand-dark); font-size: 17px; cursor: pointer; }
.topbar-content-button:hover { border-color: var(--brand); background: var(--brand-soft); }
.platform-content-modal[hidden] { display: none; }
.platform-content-modal { position: fixed; inset: 0; z-index: 1300; padding: 22px; display: grid; place-items: center; background: rgba(8,18,32,.58); backdrop-filter: blur(3px); }
.platform-content-modal > section { width: min(560px, 94vw); max-height: min(760px, 90vh); overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.platform-content-modal header { min-height: 62px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.platform-content-modal header > div { display: flex; align-items: center; gap: 10px; }
.platform-content-modal header span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); }
.platform-content-modal header button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 20px; cursor: pointer; }
.platform-content-modal [data-platform-content-body] { max-height: calc(90vh - 62px); padding: 18px; overflow: auto; }
.platform-content-modal [data-platform-content-body] img { width: 100%; max-height: 430px; display: block; object-fit: contain; border-radius: 10px; background: var(--surface-soft); }
.platform-content-text { margin-top: 14px; color: var(--ink); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.platform-content-loading { min-height: 150px; display: grid; place-items: center; color: var(--muted); }
.platform-content-admin-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.platform-content-admin-preview { height: 210px; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.platform-content-admin-preview img { width: 100%; height: 100%; object-fit: contain; }
.platform-content-admin-grid textarea { width: 100%; padding: 12px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; }
.platform-content-admin-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.page { width: min(1280px, 100%); margin: 0 auto; padding: 30px; }
.page.admin-routing-page { width: 100%; max-width: 1680px; padding-inline: 20px; }
.page.generation-history-page { width: 100%; max-width: 1680px; padding-inline: 20px; }
.page.asset-workbench-page { width:100%; max-width:none; height:calc(100vh - 64px); padding:16px 18px 18px; overflow:hidden; background:#f4f6f8; }
.asset-workbench-head { height:48px; display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.asset-workbench-head h1 { margin:0; font-size:22px; letter-spacing:-.03em; }
.asset-workbench-head p { margin:4px 0 0; color:#64748b; font-size:11px; font-weight:650; }
.asset-head-actions { display:flex; align-items:center; gap:8px; }
.asset-head-actions .secondary-btn { min-height:32px; padding:0 11px; font-size:11px; }
.asset-ready { min-width:112px; height:32px; display:grid; place-items:center; border:1px solid #dce3eb; border-radius:10px; background:#fff; color:#64748b; font-size:11px; font-weight:750; }
.asset-module-tabs { width:max-content; height:42px; margin-bottom:14px; padding:4px; display:flex; align-items:center; gap:3px; border:1px solid #e1e6ed; border-radius:12px; background:#fff; }
.asset-module-tabs button { height:32px; padding:0 12px; border:0; border-radius:8px; background:transparent; color:#64748b; font-size:11px; font-weight:800; }
.asset-module-tabs button.active { background:#101827; color:#fff; box-shadow:0 4px 10px rgba(15,23,42,.16); }
.asset-module-tabs button:disabled { opacity:.78; cursor:default; }
.prompt-workbench { height:calc(100% - 56px); min-height:480px; display:grid; grid-template-columns:272px minmax(420px,1fr) 320px; gap:12px; }
.prompt-library-pane,.prompt-list-pane,.prompt-preview-pane { min-width:0; min-height:0; overflow:hidden; border:1px solid #e0e5ec; border-radius:14px; background:#fff; box-shadow:0 2px 8px rgba(15,23,42,.025); }
.prompt-library-pane,.prompt-list-pane,.prompt-preview-pane { display:flex; flex-direction:column; }
.prompt-library-pane>header,.prompt-list-pane>header,.prompt-preview-head { min-height:54px; padding:12px; display:flex; align-items:center; justify-content:space-between; gap:10px; border-bottom:1px solid #e8ecf1; }
.prompt-library-pane header strong,.prompt-list-pane header strong,.prompt-preview-head strong { display:block; color:#172033; font-size:13px; }
.prompt-library-pane header small,.prompt-list-pane header small,.prompt-preview-head small { display:block; margin-top:2px; color:#8190a5; font-size:9px; font-weight:650; }
.workbench-icon-btn { width:30px; height:30px; padding:0; border:1px solid #dbe3ec; border-radius:8px; background:#fff; color:#526277; font-size:16px; }
.workbench-icon-btn:hover { border-color:#94a3b8; color:#111827; }
.workbench-icon-btn.danger { color:#dc4754; }
.prompt-tree { padding:10px; overflow:auto; }
.prompt-tree-library { margin-bottom:6px; }
.prompt-tree-root,.prompt-tree-categories button { width:100%; border:0; display:grid; grid-template-columns:22px minmax(0,1fr) auto; align-items:center; text-align:left; color:#536176; background:transparent; }
.prompt-tree-root { height:36px; padding:0 8px; border-radius:9px; }
.prompt-tree-root.active { color:#192337; font-weight:800; }
.prompt-tree-root strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.prompt-tree-root em,.prompt-tree-categories em { min-width:20px; padding:2px 6px; border-radius:999px; background:#edf2f7; color:#66768c; font-size:9px; font-style:normal; font-weight:800; text-align:center; }
.prompt-tree-categories { margin-left:25px; padding-left:10px; border-left:1px solid #e0e6ed; }
.prompt-tree-categories button { position:relative; height:34px; padding:0 8px; border-radius:8px; font-size:10px; font-weight:700; }
.prompt-tree-categories button.active { background:#eef1f4; color:#111827; box-shadow:inset 4px 0 #354258; }
.prompt-list-pane>header { padding:10px 12px; }
.prompt-list-tools { display:flex; align-items:center; gap:7px; }
.prompt-list-tools label { width:min(260px,28vw); height:34px; padding:0 10px; display:flex; align-items:center; gap:7px; border:1px solid #dce3eb; border-radius:9px; color:#64748b; }
.prompt-list-tools input { width:100%; border:0; outline:0; color:#1f2937; background:transparent; font-size:10px; }
.prompt-list-tools .primary-btn,.prompt-list-tools .secondary-btn { min-height:34px; padding:0 11px; font-size:10px; }
.prompt-card-list { flex:1; min-height:0; padding:8px 10px 12px; overflow:auto; display:flex; flex-direction:column; gap:7px; }
.prompt-list-card { width:100%; padding:10px; border:1px solid #dce3eb; border-radius:10px; background:#fff; color:#1f2937; text-align:left; }
.prompt-list-card:hover,.prompt-list-card.active { border-color:#aab8c9; background:#fbfcfe; box-shadow:0 3px 10px rgba(15,23,42,.04); }
.prompt-list-card.active { box-shadow:inset 3px 0 #263247; }
.prompt-list-card>div { display:flex; align-items:center; gap:8px; }
.prompt-list-card strong { font-size:11px; }
.prompt-list-card span { padding:3px 7px; border-radius:999px; background:#edf2f7; color:#718096; font-size:8px; font-weight:800; }
.prompt-list-card p { margin:5px 0; overflow:hidden; color:#64748b; font-size:9px; line-height:1.4; text-overflow:ellipsis; white-space:nowrap; }
.prompt-list-card article { overflow:hidden; color:#233044; font-size:9.5px; line-height:1.45; text-overflow:ellipsis; white-space:nowrap; }
.prompt-list-empty,.prompt-preview-empty { flex:1; display:grid; place-content:center; gap:8px; color:#94a3b8; text-align:center; font-size:11px; }
.prompt-preview-empty span { font-size:32px; }
.prompt-preview-actions { display:flex; gap:6px; }
.prompt-preview-scroll { flex:1; min-height:0; padding:12px; overflow:auto; }
.prompt-preview-scroll h2 { margin:0; color:#152033; font-size:17px; }
.prompt-scene { margin:8px 0 13px; color:#64748b; font-size:10px; line-height:1.5; }
.prompt-copy-block { margin-bottom:10px; border:1px solid #dce3eb; border-radius:10px; overflow:hidden; }
.prompt-copy-block header { padding:8px 10px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #e7ebf0; background:#f8fafc; font-size:9px; }
.prompt-copy-block header span { color:#64748b; }
.prompt-copy-block>div { max-height:160px; padding:10px; overflow:auto; white-space:pre-wrap; color:#1f2937; font-size:10px; font-weight:600; line-height:1.65; }
.prompt-param { margin-bottom:7px; padding:9px; display:grid; gap:3px; border:1px solid #e1e6ed; border-radius:9px; }
.prompt-param strong { font-size:9px; }.prompt-param span { color:#64748b; font-size:9px; }
.prompt-workbench-editor { flex:1; min-height:0; padding:12px; overflow:auto; display:flex; flex-direction:column; gap:9px; }
.prompt-workbench-editor label { display:grid; gap:5px; color:#64748b; font-size:9px; font-weight:800; }
.prompt-workbench-editor input,.prompt-workbench-editor select,.prompt-workbench-editor textarea { width:100%; padding:8px 9px; border:1px solid #dbe3ec; border-radius:8px; outline:none; background:#fff; color:#1f2937; font:inherit; }
.prompt-workbench-editor textarea { min-height:58px; resize:vertical; line-height:1.5; }
.prompt-workbench-editor .prompt-editor-large textarea { min-height:105px; }
.prompt-editor-actions { margin-top:auto; padding-top:8px; display:flex; justify-content:flex-end; gap:7px; }
.prompt-editor-actions button { min-height:34px; font-size:10px; }
@media(max-width:1100px){.prompt-workbench{grid-template-columns:220px minmax(360px,1fr) 280px}.prompt-list-tools label{width:180px}}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.page-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.grid { display: grid; gap: 15px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.llm-provider-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.llm-provider-card .row-actions { margin-top:16px; }
.llm-model-chip { display:inline-flex; margin:2px 4px 2px 0; padding:4px 8px; border-radius:999px; background:var(--brand-soft); color:var(--brand-dark); font-size:11px; font-weight:700; }
.panel, .stat-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 1px rgba(20,45,32,.02); }
.panel { padding: 20px; }
.stat-card { min-height: 124px; padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 14px; font-size: 26px; letter-spacing: -.03em; }
.stat-card small { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.profile-grid { display: grid; grid-template-columns: minmax(260px,.72fr) minmax(0,1.28fr); gap: 15px; }
.profile-card { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.profile-card .avatar { width: 76px; height: 76px; font-size: 28px; }
.profile-card h2 { margin: 16px 0 5px; font-size: 20px; }
.profile-card p { margin: 0; color: var(--muted); }
.profile-action { margin-top: 14px; }
.security-panel { max-width: 760px; }
.security-form { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: end; gap: 14px; }
.security-form .field { margin-top: 0; }
.badge { display: inline-flex; align-items: center; min-height: 25px; margin-top: 14px; padding: 0 9px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.badge.warning { background: #fff4d8; color: var(--warning); }
.detail-list { margin: 0; display: grid; }
.detail-row { padding: 15px 0; display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 20px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--muted); font-size: 12px; }
.detail-row dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }
.section-head { margin: 30px 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.canvas-create-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.canvas-create-form .field { margin-top: 0; }
.canvas-create-form .canvas-title-field { width: min(280px, 100%); }
.canvas-create-form .canvas-kind-field { width: 160px; }
.canvas-create-form .field input, .canvas-create-form .field select { min-height: 40px; }
.canvas-preview { width: 132px; height: 78px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #eef2ef; color: var(--muted); font-size: 10px; }
.canvas-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.canvas-preview-generating { gap: 3px; align-content: center; background: var(--brand-soft); color: var(--brand-dark); }
.canvas-preview-generating strong { font-size: 10px; }
.canvas-preview-spinner { font-size: 20px; line-height: 1; animation: image-generation-spin .85s linear infinite; }
.canvas-list-table td { vertical-align: middle; }
.progress { height: 8px; margin-top: 17px; overflow: hidden; border-radius: 4px; background: #e9efeb; }
.progress > span { height: 100%; display: block; border-radius: inherit; background: var(--brand); }
.method-list { display: flex; flex-wrap: wrap; gap: 10px; }
.method { min-width: 150px; min-height: 58px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; display: flex; align-items: center; gap: 10px; background: var(--surface); }
.method.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,138,91,.1); }
.method-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 850; }
.package-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.package-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.package-card h3 { margin: 0; font-size: 15px; }
.package-card .price { margin: 18px 0 6px; font-size: 28px; font-weight: 850; }
.package-card p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.package-card button { width: 100%; }
.empty { min-height: 140px; display: grid; place-items: center; padding: 22px; border: 1px dashed var(--line-strong); border-radius: 11px; background: rgba(255,255,255,.55); color: var(--muted); text-align: center; }
.failure-notice { margin-bottom: 16px; padding: 15px 17px; display: flex; align-items: center; gap: 12px; border: 1px solid #f0c4c9; border-radius: 11px; background: #fff7f8; color: var(--danger); }
.failure-notice strong, .failure-notice span { display: block; }
.failure-notice span { color: #71424a; font-size: 12px; }
.image-generation-form { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; gap: 14px; }
.image-generation-form .field { margin-top: 0; }
.image-prompt-field, .image-reference-field { grid-column: span 2; }
.image-generation-form textarea { width: 100%; padding: 12px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; outline: none; }
.image-generation-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,138,91,.12); }
.field-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.form-actions { display: flex; align-items: end; min-height: 42px; }
.page.image-workbench-page { width:100%; max-width:none; height:calc(100vh - 64px); padding:16px 18px 18px; overflow:hidden; background:#f6f8f7; }
.image-workbench { height:100%; min-height:0; display:grid; grid-template-columns:minmax(340px,380px) minmax(0,1fr); grid-template-rows:minmax(0,1fr) 204px; align-items:stretch; gap:12px 14px; }
.image-workbench-sidebar { grid-row:1 / 3; min-height:0; padding-right:3px; display:grid; grid-template-columns:1fr; align-content:start; align-items:stretch; gap:7px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:rgba(31,138,91,.35) transparent; }
.image-workbench:not(.image-workbench-inpainting) .image-workbench-sidebar { grid-template-rows:auto minmax(min-content,1fr) minmax(min-content,1.2fr); align-content:stretch; overflow-y:auto; }
.image-workbench:not(.image-workbench-inpainting) .image-model-card { min-height:99px; padding-top:8px; }
.image-workbench:not(.image-workbench-inpainting) .image-content-card { min-height:0; padding-block:4px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-field > label:first-child { display:none; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-dropzone { min-height:62px; padding:8px 10px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-dropzone .image-reference-icon { width:34px; height:34px; font-size:18px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-dropzone strong { font-size:12px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-dropzone .image-reference-notice { margin-top:5px; padding:5px 7px; display:flex; font-size:10px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-dropzone .image-reference-notice b { width:18px; height:18px; font-size:11px; }
.image-workbench:not(.image-workbench-inpainting) [data-reference-list] { height:112px; min-height:112px; max-height:112px; margin-top:2px; display:block; overflow:hidden; }
.image-workbench:not(.image-workbench-inpainting) [data-reference-list] > .field-hint { height:100%; margin:0; padding-top:7px; display:flex; align-items:flex-start; box-sizing:border-box; color:#9aa7a0; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-list { min-height:0; height:112px; margin-top:0; grid-template-columns:repeat(var(--reference-grid-columns,3),var(--reference-thumbnail-size,104px)); grid-template-rows:repeat(var(--reference-grid-rows,1),var(--reference-thumbnail-size,104px)); align-content:start; align-items:start; justify-content:start; gap:var(--reference-grid-gap,8px); overflow:hidden; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-thumbnail { width:var(--reference-thumbnail-size,104px); height:var(--reference-thumbnail-size,104px); aspect-ratio:1; padding:0; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-expand { height:100%; border-radius:7px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-thumbnail img { width:100%; height:100%; object-fit:cover; border-radius:7px; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-thumbnail figcaption { display:none; }
.image-workbench:not(.image-workbench-inpainting) .image-reference-thumbnail > [data-reference-delete] { top:3px; right:3px; width:clamp(12px,20%,20px); height:clamp(12px,20%,20px); font-size:clamp(9px,16%,13px); }
.image-workbench-sidebar::-webkit-scrollbar,.image-workbench-results-body::-webkit-scrollbar { width:8px; }
.image-workbench-sidebar::-webkit-scrollbar-thumb,.image-workbench-results-body::-webkit-scrollbar-thumb { border:2px solid transparent; border-radius:10px; background:rgba(31,138,91,.32); background-clip:padding-box; }
.image-workbench-card, .image-workbench-results { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(20,45,32,.04); }
.image-workbench-card { padding:11px 12px; }
.image-workbench-card-head, .image-workbench-results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.image-workbench-card-head h2, .image-workbench-results-head h2 { margin:0; font-size:15px; letter-spacing:-.015em; }
.image-workbench-card-head p, .image-workbench-results-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.image-model-card .image-workbench-card-head p,.image-content-card .image-workbench-card-head p,.image-output-card .image-workbench-card-head p { display:none; }
.image-model-card select { min-height:36px; height:36px; }
.image-workbench-badge { flex: 0 0 auto; padding: 5px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); font-size: 10px; font-weight: 800; }
.image-inpainting-mode { margin-top: 10px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #b9ddc8; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); }
.image-inpainting-mode strong, .image-inpainting-mode span { display: block; }
.image-inpainting-mode strong { font-size: 12px; }
.image-inpainting-mode span { color: var(--muted); font-size: 10px; text-align: right; }
.image-workbench .field { margin-top:7px; }
.image-workbench .image-prompt-field, .image-workbench .image-reference-field { grid-column: auto; }
.image-workbench textarea { min-height: 132px; line-height: 1.65; }
.image-reference-dropzone { min-height:62px; padding:8px 10px; display:flex; align-items:center; gap:9px; border:1px dashed var(--line-strong); border-radius:9px; background:#fbfcfb; cursor:pointer; transition:.16s ease; }
.image-reference-dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.image-reference-dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.image-reference-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--brand-dark); font-size: 18px; }
.image-reference-dropzone strong, .image-reference-dropzone small { display: block; }
.image-reference-dropzone strong { color: var(--ink); font-size: 12px; }
.image-reference-dropzone small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.image-reference-dropzone .image-reference-notice { width:fit-content; margin-top:5px; padding:5px 7px; display:flex; align-items:center; gap:6px; border:1px solid #b9ddc8; border-radius:7px; background:var(--brand-soft); color:var(--brand-dark); font-size:10px; font-weight:750; line-height:1.4; }
.image-reference-notice b { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: white; font-size: 11px; }
.image-reference-list { margin-top: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.image-reference-thumbnail { position: relative; min-width: 0; margin: 0; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.image-reference-expand { position:static; width:100%; height:62px; padding:0; display:block; overflow:hidden; border:0; border-radius:5px; background:#edf2ef; cursor:zoom-in; }
.image-reference-expand img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 5px; transition:transform .16s ease; }
.image-reference-expand:hover img { transform:scale(1.035); }
.image-reference-thumbnail figcaption { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.image-reference-thumbnail > [data-reference-delete] { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,.68); color: #fff; cursor: pointer; }
.image-mask-preview { margin-top: 10px; padding: 8px; display: grid; grid-template-columns: 54px minmax(0,1fr) 24px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.image-mask-preview img { width: 54px; height: 54px; object-fit: contain; border-radius: 5px; background: repeating-conic-gradient(#dfe5e1 0 25%, #fff 0 50%) 50% / 12px 12px; }
.image-mask-preview strong, .image-mask-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-mask-preview strong { font-size: 11px; }
.image-mask-preview small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.image-mask-preview button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.68); color: #fff; cursor: pointer; }
.image-mask-editor-launch { width:100%; min-height:62px; padding:8px 10px; display:flex; align-items:center; gap:9px; border:1px dashed var(--line-strong); border-radius:9px; background:#fbfcfb; color:var(--ink); text-align:left; cursor:pointer; transition:.16s ease; }
.image-mask-editor-launch:hover { border-color: var(--brand); background: var(--brand-soft); }
.image-mask-editor-launch strong, .image-mask-editor-launch small { display: block; }
.image-mask-editor-launch strong { font-size: 12px; }
.image-mask-editor-launch small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
body.image-mask-editor-open { overflow: hidden; }
.image-mask-editor[hidden] { display: none; }
.image-mask-editor { position: fixed; inset: 0; z-index: 1200; padding: 24px; display: grid; place-items: center; background: rgba(8,18,32,.72); backdrop-filter: blur(3px); }
.image-mask-editor-dialog { width: min(1120px, 96vw); height: min(820px, 94vh); display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: #0d192c; color: #f6f8fb; box-shadow: 0 28px 80px rgba(0,0,0,.42); }
.image-mask-editor-toolbar, .image-mask-editor-controls { padding: 14px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.image-mask-editor-toolbar { justify-content: space-between; }
.image-mask-editor-title strong, .image-mask-editor-title span { display: block; }
.image-mask-editor-title strong { font-size: 16px; }
.image-mask-editor-title span { margin-top: 3px; color: #aebbd0; font-size: 11px; }
.image-mask-editor-actions { display: flex; gap: 8px; }
.image-mask-editor-controls { flex-wrap: wrap; background: #111f35; }
.image-mask-editor-controls label { min-width: 180px; display: flex; align-items: center; gap: 10px; color: #c6d0df; font-size: 11px; }
.image-mask-editor-controls label span { white-space: nowrap; }
.image-mask-editor-controls input { width: 120px; accent-color: var(--brand); }
.image-mask-editor-viewport { min-height: 0; padding: 24px; overflow: auto; background: repeating-conic-gradient(#172438 0 25%, #101d30 0 50%) 50% / 24px 24px; }
.image-mask-editor-surface { position: relative; margin: auto; overflow: hidden; background: #070d17; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.image-mask-editor-surface img, .image-mask-editor-surface canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.image-mask-editor-surface img { object-fit: fill; user-select: none; pointer-events: none; }
.image-mask-editor-surface canvas { z-index: 1; cursor: crosshair; touch-action: none; }
.image-mask-editor-hint { margin: 0; padding: 10px 18px 12px; color: #aebbd0; font-size: 11px; text-align: center; }
.image-output-grid { display:grid; grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr); gap:0 10px; }
.image-output-grid [data-image-fidelity-field] { width:100%; grid-column:1; justify-self:stretch; }
.image-output-grid select { min-width:0; min-height:34px; height:34px; padding:0 28px 0 9px; }
.image-output-grid [name="quantity"],.image-output-grid [name="output_format"] { min-height:32px; height:32px; font-size:11px; }
.image-custom-size { grid-column:1 / -1; min-height:90px; margin-top:7px; padding:8px 10px; border:1px solid #d8dedb; border-radius:10px; background:#f1f3f2; box-shadow:inset 0 1px 0 rgba(255,255,255,.75); color:#929c97; }
.image-workbench:not(.image-workbench-inpainting) .image-custom-size { min-height:67px; }
.image-custom-size.is-active { border-color:#f3c66d; background:linear-gradient(135deg,#fffaf0,#fff5d9); box-shadow:inset 0 1px 0 rgba(255,255,255,.9); color:inherit; }
.image-custom-size-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.image-custom-size-head strong { color:var(--ink); font-size:11px; }
.image-custom-size-head span { color:#b45309; font-size:9px; font-weight:800; text-align:right; }
.image-custom-size:not(.is-active) .image-custom-size-head strong,.image-custom-size:not(.is-active) .image-custom-size-head span { color:#929c97; }
.image-custom-size-inputs { margin-top:7px; display:grid; grid-template-columns:1fr auto 1fr; align-items:end; gap:7px; }
.image-custom-size-inputs label { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:7px; color:var(--muted); font-size:10px; font-weight:800; }
.image-custom-size-inputs input { width:100%; min-width:0; min-height:30px; height:30px; padding:0 8px; border:1px solid #e5b550; border-radius:7px; background:#fff; color:var(--ink); outline:none; }
.image-custom-size-inputs input:read-only { border-color:#d6dcda; background:#e4e8e6; color:#9ba4a0; cursor:not-allowed; }
.image-custom-size.is-active .image-custom-size-inputs input { border-color:#e5b550; background:#fff; color:var(--ink); cursor:text; }
.image-custom-size-inputs input:focus { border-color:#d99400; box-shadow:0 0 0 3px rgba(217,148,0,.12); }
.image-custom-size-inputs b { padding-bottom:7px; color:#b7791f; font-size:12px; }
.image-custom-size:not(.is-active) .image-custom-size-inputs b { color:#a5ada9; }
.image-output-summary { margin-top:7px; padding:6px 9px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-radius:8px; background:var(--surface-soft); font-size:10px; }
.image-output-summary span { color: var(--muted); }
.image-output-summary strong { font-size: 11px; text-align: right; }
.image-generate-button { width: 100%; margin-top: 12px; }
.image-workbench-results { min-width: 0; min-height:0; display: flex; flex-direction: column; overflow: hidden; }
.image-workbench-results-head { flex:0 0 auto; min-height:66px; padding:14px 16px; border-bottom:1px solid var(--line); }
.image-result-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.image-result-actions button { white-space: nowrap; }
.image-workbench-results-body { min-height:0; flex:1; padding:14px; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:rgba(31,138,91,.35) transparent; }
.image-chat-composer { position:relative; min-width:0; height:204px; padding:14px 16px 16px; overflow:hidden; border:1px solid rgba(31,138,91,.22); border-radius:18px; background:linear-gradient(145deg,rgba(255,255,255,.98),rgba(238,248,242,.98)); box-shadow:0 14px 38px rgba(20,69,43,.11),0 2px 8px rgba(20,69,43,.06); }
.image-chat-composer::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; background:radial-gradient(circle at 92% 110%,rgba(31,138,91,.13),transparent 35%); }
.image-chat-copy { position:relative; display:flex; align-items:baseline; gap:9px; }
.image-chat-copy label { color:var(--ink); font-size:13px; font-weight:850; }
.image-chat-copy span { color:var(--muted); font-size:10px; }
.image-chat-input { position:relative; height:100%; }
.image-workbench .image-chat-input textarea { width:100%; height:100%; min-height:0; max-height:none; padding:14px 142px 58px 14px; resize:none; border:1px solid rgba(31,138,91,.24); border-radius:13px; background:rgba(255,255,255,.92); box-shadow:inset 0 1px 3px rgba(15,23,42,.04); line-height:1.65; }
.image-workbench .image-chat-input textarea:focus { border-color:var(--brand); box-shadow:0 0 0 4px rgba(31,138,91,.1),inset 0 1px 3px rgba(15,23,42,.04); }
.image-chat-input .image-generate-button { position:absolute; right:9px; bottom:9px; width:auto; min-width:120px; min-height:42px; margin:0; padding:0 17px; border-radius:12px; box-shadow:0 9px 20px rgba(31,138,91,.22); font-size:12px; font-weight:850; }
.image-results-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; color: var(--muted); text-align: center; }
.image-results-empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-soft); color: #94a59c; font-size: 24px; }
.image-results-empty strong { margin-top: 17px; color: var(--ink); font-size: 14px; }
.image-results-empty span { max-width: 370px; margin-top: 8px; font-size: 11px; line-height: 1.65; }
.image-session-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); align-items:start; gap:10px; }
.image-session-card { position: relative; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.image-result-number { position: absolute; z-index: 2; top: 9px; right: 9px; min-width: 28px; padding: 5px 7px; border-radius: 6px; background: rgba(22,26,24,.74); color: #fff; font-size: 11px; font-weight: 800; text-align: center; }
.image-session-preview { width:100%; min-height:150px; padding:0; display:grid; place-items:center; border:0; background:#edf1ef; cursor:zoom-in; }
.image-session-preview img { width:100%; height:190px; display:block; object-fit:contain; background:#101512; }
.image-session-card figcaption { min-height: 54px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.image-session-card figcaption span { min-width: 0; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.image-session-card figcaption small { display: block; margin-top: 4px; color: var(--muted); }
.image-card-actions { display: flex; align-items: center; gap: 6px; }
.image-delete-button { border: 0; background: transparent; color: #a33a32; font-size: 10px; cursor: pointer; }
.image-creative-actions { padding: 9px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-top: 1px solid var(--line); }
.image-creative-actions button { padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--ink); font-size: 10px; cursor: pointer; }
.image-parameter-details { border-top: 1px solid var(--line); font-size: 10px; }
.image-parameter-details summary { padding: 9px 11px; color: var(--muted); cursor: pointer; }
.image-parameter-details dl { margin: 0; padding: 0 11px 10px; display: grid; gap: 5px; }
.image-parameter-details dl div { display: flex; justify-content: space-between; gap: 8px; }
.image-parameter-details dt { color: var(--muted); }
.image-parameter-details dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.image-download-button { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
.image-download-button:hover { border-color: var(--brand); color: var(--brand-dark); }
.image-session-pending-body { min-height:190px; padding:18px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; background:#f3f5f4; color:var(--muted); text-align:center; }
.image-generation-spinner { color: #18b7a5; font-size: 30px; line-height: 1; animation: image-generation-spin .85s linear infinite; }
.image-session-failed .image-session-pending-body { color: var(--danger); background: #fff4f5; }
.image-lightbox[hidden] { display: none; }
.image-lightbox { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; overflow: hidden; background: rgba(5,10,8,.94); }
.image-lightbox-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: grab; }
.image-lightbox-stage:active { cursor: grabbing; }
.image-lightbox img { max-width: calc(100vw - 32px); max-height: calc(100vh - 88px); object-fit: contain; transform-origin: center; border-radius: 6px; box-shadow: 0 18px 70px rgba(0,0,0,.45); user-select: none; }
.image-lightbox-close { position: absolute; z-index: 2; top: 18px; right: 22px; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(0,0,0,.48); color: #fff; font-size: 24px; cursor: pointer; }
.image-lightbox-toolbar { position: absolute; z-index: 2; left: 50%; bottom: 18px; display: flex; gap: 6px; transform: translateX(-50%); }
.image-lightbox-toolbar button { min-width: 38px; height: 36px; padding: 0 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: rgba(0,0,0,.58); color: #fff; cursor: pointer; }
.generation-viewer-backdrop { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(8,18,13,.72); backdrop-filter: blur(6px); }
.generation-viewer { width: min(1120px, 100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.28); }
.generation-viewer-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.generation-viewer-head h2 { margin: 0 0 4px; font-size: 18px; }
.generation-viewer-head p { margin: 0; color: var(--muted); }
.generation-viewer-head button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font-size: 24px; cursor: pointer; }
.generation-viewer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 20px; }
.generation-viewer-grid figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #f5f7f6; }
.generation-viewer-grid img { display: block; width: 100%; height: min(58vh, 620px); object-fit: contain; background: #eef2ef; }
.generation-viewer-grid figcaption { padding: 10px 12px; color: var(--muted); font-size: 13px; }
@keyframes image-generation-spin { to { transform: rotate(360deg); } }
.image-history { display: grid; gap: 14px; }
.image-task-card { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.image-task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.image-task-head strong, .image-task-head span { display: block; }
.image-task-head strong { max-width: 780px; overflow-wrap: anywhere; }
.image-task-head div > span { margin-top: 6px; color: var(--muted); font-size: 11px; }
.image-result-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.image-result-grid figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.image-preview { min-height: 180px; display: grid; place-items: center; background: #edf2ef; color: var(--muted); font-size: 11px; }
.image-preview img { width: 100%; height: 220px; object-fit: contain; background: #101512; }
.image-result-grid figcaption { padding: 10px; display: grid; gap: 9px; color: var(--muted); font-size: 11px; }
.image-result-grid figcaption button { justify-self: start; }
.muted { color: var(--muted); }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.generation-history-table { overflow: visible; }
.generation-history-table table { table-layout: fixed; }
.generation-history-table th, .generation-history-table td { padding: 11px 9px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.generation-history-table th:nth-child(1) { width: 14%; }
.generation-history-table th:nth-child(2) { width: 12%; }
.generation-history-table th:nth-child(3) { width: 8%; }
.generation-history-table th:nth-child(4) { width: 7%; }
.generation-history-table th:nth-child(5) { width: 10%; }
.generation-history-table th:nth-child(6) { width: 8%; }
.generation-history-table th:nth-child(7) { width: 20%; }
.generation-history-table th:nth-child(8) { width: 14%; }
.generation-history-table th:nth-child(9) { width: 7%; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 12px; font-size: 10px; font-weight: 800; }
.status.pending { background: #fff4d8; color: var(--warning); }
.status.paid, .status.recharge, .status.release { background: var(--brand-soft); color: var(--brand-dark); }
.status.charged_back, .status.reversal { background: #ffedef; color: var(--danger); }
.status.freeze, .status.settlement { background: #eef2ff; color: #4657a6; }
.status.healthy { background: var(--brand-soft); color: var(--brand-dark); }
.status.degraded, .status.unknown { background: #fff4d8; color: var(--warning); }
.status.unhealthy { background: #ffedef; color: var(--danger); }
.status.available { background: var(--brand-soft); color: var(--brand-dark); }
.status.maintenance { background: #fff4d8; color: var(--warning); }
.status.queued { background: #fff4d8; color: var(--warning); }
.status.running { background: #eef2ff; color: #4657a6; }
.status.succeeded { background: var(--brand-soft); color: var(--brand-dark); }
.status.failed { background: #ffedef; color: var(--danger); }
.status.cancelled { background: #edf0ee; color: var(--muted); }
.admin-panel { margin-top: 28px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: end; gap: 14px; }
.admin-form-grid .field { margin-top: 0; }
.admin-form-grid .span-two { grid-column: span 2; }
.admin-form-grid > button { min-height: 42px; justify-self: start; }
.admin-user-lookup, .admin-user-activity { margin-top: 18px; }
.admin-user-search { display: grid; grid-template-columns: minmax(260px,460px) auto; justify-content: start; gap: 10px; }
.admin-user-search input, .admin-user-control-card input { min-height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.admin-user-search-empty { margin-top: 16px; min-height: 90px; }
.admin-selected-user-head { margin-top: 18px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); font-size: 12px; }
.admin-selected-user-head > div { display: flex; align-items: center; gap: 10px; }
.admin-user-control-grid { margin: 12px 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.admin-user-control-card { padding: 14px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 10px; }
.admin-user-control-card strong, .admin-user-control-card small { display: block; }
.admin-user-control-card small { margin-top: 4px; color: var(--muted); }
.admin-user-control-card .row-actions { flex-wrap: wrap; }
.admin-storage-user-control { margin-top: 12px; max-width: 720px; }
.admin-period-tabs { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.admin-period-tabs button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.admin-period-tabs button.active { background: var(--ink); color: white; }
.admin-user-activity-table th button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; white-space: nowrap; cursor: pointer; }
.admin-generation-task-table th, .admin-generation-task-table td { vertical-align: top; white-space: normal; }
.admin-generation-task-table td:nth-child(2) { min-width: 220px; max-width: 360px; overflow-wrap: anywhere; }
.admin-failure-count { min-width: 28px; padding: 4px 7px; display: inline-block; border-radius: 999px; background: #ffedef; color: var(--danger); font-weight: 850; text-align: center; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.admin-routing-page .routing-health-table { overflow-x: visible; }
.admin-routing-page .routing-health-table th,
.admin-routing-page .routing-health-table td { padding-inline: 9px; white-space: normal; overflow-wrap: anywhere; }
.admin-routing-page .routing-health-table .row-actions { flex-wrap: wrap; gap: 4px 8px; }
.admin-routing-page .routing-health-table .mono { font-size: 10px; }
.compact-input { width: 170px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); outline: none; }
.compact-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,138,91,.12); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.loading { min-height: 220px; display: grid; place-items: center; color: var(--muted); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: min(480px, calc(100vw - 30px)); padding: 12px 16px; border-radius: 9px; background: #13251c; color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .grid.three, .package-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .profile-grid { grid-template-columns: 1fr; }
  .security-form { grid-template-columns: 1fr; }
  .image-generation-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .image-result-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .image-session-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .page.image-workbench-page { height:auto; min-height:calc(100vh - 64px); overflow:visible; }
  .image-workbench { height:auto; grid-template-columns:1fr; grid-template-rows:auto 620px 204px; }
  .image-workbench-sidebar { grid-row:auto; max-height:none; padding-right:0; overflow:visible; }
  .image-workbench:not(.image-workbench-inpainting) .image-workbench-sidebar { grid-template-rows:auto; overflow:visible; }
  .image-workbench:not(.image-workbench-inpainting) .image-model-card { min-height:0; padding-top:11px; }
  .image-workbench-results { min-height: 620px; }
}

@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { min-height: 100vh; padding: 28px 20px; }
  .app-shell { grid-template-columns: 1fr; padding-bottom: 72px; }
  .sidebar { inset: auto 0 0; width: 100%; height: 72px; padding: 8px; flex-direction: row; }
  .sidebar .brand, .sidebar .nav-label, .sidebar .sidebar-spacer, .sidebar-user { display: none; }
  .nav { width: 100%; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; }
  .nav-item { min-height: 56px; padding: 4px; flex: 1 0 72px; flex-direction: column; justify-content: center; gap: 3px; font-size: 10px; }
  .nav-icon { width: auto; height: auto; background: transparent; }
  .main-shell { grid-column: 1; }
  .topbar { padding: 0 14px; }
  .topbar-actions .secondary-btn { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .storage-pill { display: none; }
  .balance-pill { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .page { padding: 20px 14px; }
  .page.admin-routing-page { padding-inline: 14px; }
  .page.generation-history-page { padding-inline: 14px; }
  .admin-routing-page .routing-health-table { overflow-x: auto; }
  .page-head { display: block; }
  .grid.three, .grid.two, .package-grid { grid-template-columns: 1fr; }
  .detail-row { grid-template-columns: 100px minmax(0,1fr); gap: 10px; }
  .method { flex: 1 1 140px; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid .span-two { grid-column: auto; }
  .admin-user-search, .admin-user-control-grid { grid-template-columns: 1fr; }
  .admin-selected-user-head { align-items: flex-start; flex-direction: column; }
  .platform-content-admin-grid { grid-template-columns: 1fr; }
  .platform-content-admin-actions { grid-column: auto; }
  .image-generation-form, .image-result-grid, .image-session-grid { grid-template-columns: 1fr; }
  .image-prompt-field, .image-reference-field { grid-column: auto; }
  .image-workbench { min-height:auto; grid-template-rows:auto 520px 204px; }
  .image-workbench-results { min-height: 520px; }
  .image-workbench-results-head { display: grid; }
  .image-result-actions { flex-wrap: wrap; }
  .image-workbench-results-head .secondary-btn { justify-self: start; }
  .image-output-grid { grid-template-columns: 1fr; }
  .image-output-grid [data-image-fidelity-field] { width:100%; grid-column:auto; }
  .image-custom-size { grid-column:auto; }
  .image-custom-size-head { align-items:flex-start; flex-direction:column; gap:4px; }
  .image-custom-size-head span { text-align:left; }
  .image-workbench .image-chat-input textarea { padding-right:14px; padding-bottom:64px; }
  .canvas-create-form { display: grid; grid-template-columns: 1fr; }
  .canvas-create-form .canvas-title-field, .canvas-create-form .canvas-kind-field { width: 100%; }
}
