:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: #111315;
  color: #e8ecea;
  font-size: 14px;
  letter-spacing: 0;
  --bg: #111315;
  --panel: #171a1d;
  --panel-2: #1d2124;
  --line: #2b3034;
  --muted: #929b98;
  --text: #e8ecea;
  --green: #37c99a;
  --green-dark: #143b31;
  --amber: #f2b84b;
  --red: #f07878;
  --blue: #74a9ff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #0e1012; }
.login-panel { width: min(400px, 100%); border: 1px solid var(--line); background: var(--panel); padding: 30px; border-radius: 6px; box-shadow: 0 18px 60px #0008; }
.brand { height: 72px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.brand-login { height: auto; border: 0; padding: 0 0 28px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: #0c1713; background: var(--green); border-radius: 6px; flex: none; }
.brand-mark svg { width: 19px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.login-panel label, dialog label { display: grid; gap: 7px; color: #cbd1cf; font-size: 12px; margin-bottom: 16px; }
input, textarea, select { width: 100%; color: var(--text); background: #101315; border: 1px solid #343a3e; border-radius: 4px; padding: 10px 11px; outline: none; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 2px #37c99a22; }
.password-row { display: grid; grid-template-columns: 1fr 40px; gap: 7px; margin-bottom: 16px; }
.app-shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #15181a; border-right: 1px solid var(--line); }
nav { padding: 12px; display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #9da5a2; border-radius: 4px; padding: 10px 11px; cursor: pointer; text-align: left; }
.nav-item svg { width: 17px; }
.nav-item:hover { background: #202428; color: var(--text); }
.nav-item.active { color: #bff5e2; background: #18352d; }
.sidebar-foot { margin-top: auto; min-height: 60px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--muted); font-size: 12px; }
.sidebar-foot .icon-button { margin-left: auto; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #37c99a16; }
main { min-width: 0; }
.topbar { min-height: 98px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 28px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10px; margin: 0 0 5px; }
h1, h2 { margin: 0; font-weight: 620; }
h1 { font-size: 23px; }
h2 { font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.updated { color: var(--muted); font-size: 11px; margin-right: 5px; }
.primary, .secondary, .icon-button { border: 0; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; }
.primary { background: var(--green); color: #0a1813; padding: 0 14px; font-weight: 650; }
.primary:hover { background: #51dbad; }
.secondary { background: #272c30; border: 1px solid #373d41; padding: 0 14px; }
.wide { width: 100%; }
.icon-button { width: 38px; background: transparent; color: #aab1af; padding: 0; flex: none; }
.icon-button:hover { color: var(--text); background: #282d31; }
.icon-button svg, .primary svg { width: 16px; height: 16px; }
.bordered { border: 1px solid #343a3e; }
.metric-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.metric { min-height: 92px; padding: 18px 28px; border-right: 1px solid var(--line); }
.metric:last-child { border: 0; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; font-size: 24px; margin-top: 7px; font-weight: 560; }
.metric strong.green { color: var(--green); }.metric strong.amber { color: var(--amber); }.metric strong.blue { color: var(--blue); }
.view { display: none; padding: 22px 28px 40px; }
.active-view { display: block; }
.section-head { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filter { color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; min-height: 30px; padding: 0 10px; cursor: pointer; }
.filter:hover { color: var(--text); }.filter.active { color: #c8f5e5; background: var(--green-dark); border-color: #285c4d; }
.count-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.section-tools { display: flex; align-items: center; gap: 12px; }
.compact-number { width: 92px; min-height: 32px; box-sizing: border-box; padding: 7px 8px; }
.danger-button { color: #ffb4b4; border-color: #743f43; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }
td.account-check, th.account-check { width: 38px; text-align: center; }
td.account-check input, th.account-check input { width: 16px; height: 16px; accent-color: var(--green); }
.section-tools .secondary svg { width: 15px; height: 15px; }
#accounts-view .section-head, #accounts-view .section-tools { flex-wrap: wrap; }
#accounts-view .section-tools { gap: 8px; margin-bottom: 12px; }
.account-batch-result { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.settings-head { align-items: center; }
.settings-status { display: grid; gap: 4px; }
.settings-status strong { font-size: 13px; }
.credit-table { min-width: 620px; }
.credit-table td { height: 54px; }
.credit-input { width: 150px; padding: 8px 10px; }
.runtime-config { width: min(820px, 100%); }
.runtime-config-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.runtime-config-head > div { display: grid; gap: 4px; }
.runtime-config-head strong { font-size: 13px; }
.runtime-field { display: grid; gap: 8px; margin-bottom: 17px; color: #cbd1cf; font-size: 12px; }
.result-example { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: #141719; }
.result-example span { color: var(--muted); font-size: 11px; }
.result-example code { display: block; min-width: 0; max-width: 100%; color: #bff5e2; overflow-wrap: anywhere; word-break: break-all; font: 11px/1.5 "Cascadia Code", Consolas, monospace; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: #141719; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { color: #7f8986; font-size: 10px; font-weight: 550; text-transform: uppercase; text-align: left; height: 40px; padding: 0 13px; background: #181b1e; }
td { border-top: 1px solid #252a2d; padding: 12px 13px; vertical-align: middle; color: #cad0ce; }
tbody tr:hover { background: #191d20; }
.primary-cell { display: grid; gap: 3px; max-width: 330px; }
.primary-cell strong { color: var(--text); font-size: 12px; font-weight: 590; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.primary-cell small, .muted { color: var(--muted); font-size: 10px; }
.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 12px; font-size: 10px; border: 1px solid #38403d; background: #252a28; }
.badge.active, .badge.completed { color: #a9efd7; border-color: #285d4c; background: #19362d; }
.badge.quota, .badge.processing, .badge.queued { color: #f3cd81; border-color: #68522d; background: #352b1b; }
.account-quota-note { margin: 12px 2px 0; line-height: 1.5; }
.badge.dead, .badge.failed { color: #ffabab; border-color: #6c3538; background: #381e20; }
.badge.disabled { color: #afb5b3; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.task-actions { align-items: center; gap: 7px; }
.compact { min-height: 30px; padding: 0 10px; font-size: 11px; white-space: nowrap; }
.compact svg { width: 14px; height: 14px; }
.progress { width: 90px; height: 5px; overflow: hidden; background: #303538; border-radius: 3px; }
.progress span { display: block; height: 100%; background: var(--green); }
.empty { text-align: center; color: var(--muted); padding: 44px; }
.pagination { min-height: 46px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 11px; }
.pagination-range { margin-right: 5px; white-space: nowrap; }
.pagination-page { min-width: 64px; text-align: center; color: #cbd1cf; white-space: nowrap; }
.pagination .icon-button { width: 32px; min-height: 32px; border: 1px solid #343a3e; }
.pagination .icon-button:disabled { opacity: .35; cursor: default; background: transparent; }
.page-size { width: auto; min-width: 76px; height: 32px; padding: 0 28px 0 9px; color: #cbd1cf; background: #171a1d; border: 1px solid #343a3e; border-radius: 4px; outline: none; }
.page-size:focus { border-color: var(--green); box-shadow: 0 0 0 2px #37c99a22; }
.generation-form { width: min(920px, 100%); }
.generation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.generation-field { min-width: 0; display: grid; align-content: start; gap: 7px; color: #cbd1cf; font-size: 12px; }
.generation-prompt { grid-column: 1 / -1; }
.generation-prompt textarea { min-height: 128px; line-height: 1.55; }
.generation-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
#reference-media { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.generation-field input[type="file"] { min-height: 42px; padding: 5px; color: var(--muted); }
.generation-field input[type="file"]::file-selector-button { min-height: 30px; margin-right: 9px; padding: 0 10px; border: 1px solid #3a4246; border-radius: 4px; color: #d5dcda; background: #272c30; cursor: pointer; }
.generation-actions { display: flex; align-items: center; gap: 14px; min-height: 58px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.generation-toggle { display: inline-flex; align-items: center; gap: 8px; color: #cbd1cf; font-size: 12px; cursor: pointer; }
.generation-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.generation-cost { margin-left: auto; color: var(--amber); font-size: 12px; font-weight: 600; white-space: nowrap; }
.generation-result { width: min(920px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 13px 15px; border-left: 3px solid var(--green); color: #cfe9df; background: #14231f; }
.generation-result > div { min-width: 0; display: grid; gap: 4px; }
.generation-result strong { overflow-wrap: anywhere; }
dialog { width: min(600px, calc(100% - 32px)); color: var(--text); background: var(--panel); border: 1px solid #363c40; border-radius: 6px; padding: 22px; box-shadow: 0 22px 80px #000b; }
dialog::backdrop { background: #050607c7; backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.form-error { min-height: 17px; color: var(--red); font-size: 11px; margin: 8px 0 0; }
.batch-dialog { width: min(760px, calc(100% - 32px)); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.field-head > label:first-child { margin: 0; }
.file-button { position: relative; min-height: 32px; font-size: 11px; cursor: pointer; margin: 0; display: inline-flex; }
.file-button svg { width: 14px; height: 14px; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.batch-defaults { margin-top: 14px; }
.batch-progress { display: grid; gap: 9px; margin-top: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: #141719; }
.batch-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.batch-progress-head strong { color: #dce3e0; }
.batch-progress-head span { color: var(--muted); text-align: right; }
.batch-progress-track { height: 5px; overflow: hidden; border-radius: 3px; background: #303538; }
.batch-progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .2s ease; }
.batch-progress-track span.loading { width: 40%; animation: batch-loading 1.25s ease-in-out infinite alternate; }
.batch-results { max-height: 210px; overflow: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 4px; background: #101315; }
.batch-result { display: grid; grid-template-columns: 34px 70px minmax(0, 1fr); gap: 9px; align-items: start; padding: 9px 11px; border-bottom: 1px solid #252a2d; font-size: 11px; line-height: 1.45; }
.batch-result:last-child { border-bottom: 0; }
.batch-result-index { color: var(--muted); font-family: "Cascadia Code", Consolas, monospace; }
.batch-result-status { color: var(--green); }
.batch-result.failed .batch-result-status { color: var(--red); }
.batch-result.skipped .batch-result-status { color: var(--amber); }
.batch-result-message { color: #cbd1cf; overflow-wrap: anywhere; }
@keyframes batch-loading { from { transform: translateX(-70%); } to { transform: translateX(220%); } }
.secret-row { min-height: 70px; display: grid; grid-template-columns: 1fr 38px; gap: 8px; align-items: center; }
.secret-row code { overflow-wrap: anywhere; color: #c4f3e2; background: #101513; border: 1px solid #2c4e42; padding: 12px; border-radius: 4px; }
.params-dialog { width: min(760px, calc(100% - 32px)); }
.task-media { display: grid; gap: 18px; margin: 0 0 18px; }
.task-original-prompt { margin-bottom: 18px; }
.media-block { display: grid; gap: 8px; }
.media-block > span { color: #cbd1cf; font-size: 12px; }
.media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-card { min-width: 0; margin: 0; border: 1px solid #2e3438; border-radius: 4px; overflow: hidden; background: #0d1012; }
.media-card img, .media-card video { display: block; width: 100%; height: 110px; object-fit: contain; background: #080a0b; }
.media-card figcaption { padding: 6px 8px; color: #aeb8b4; font-size: 10px; }
.media-card audio { width: 100%; }
.media-error, .media-card .media-error { color: var(--red); font-size: 12px; }
.media-block > a { color: #a6e8d1; font-size: 12px; }
.media-audio { display: inline-block; padding: 10px; border: 1px solid #2e3438; border-radius: 4px; color: #cfe9df; background: #0d1012; font-size: 11px; }
.task-result-video { display: block; width: 100%; max-height: 360px; border: 1px solid #2e3438; border-radius: 4px; background: #080a0b; }
.failure-detail { border: 1px solid #6c3538; background: #381e20; padding: 14px; border-radius: 4px; margin-bottom: 18px; }
.failure-detail strong { color: #ffb4b4; font-size: 12px; }
.failure-detail p { color: #f3b3b3; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.params-block { display: grid; gap: 8px; }
.params-block + .params-block { margin-top: 18px; }
.params-block > span { color: #cbd1cf; font-size: 12px; }
.params-json { max-height: 55vh; overflow: auto; margin: 0; padding: 15px; border: 1px solid #2e3438; border-radius: 4px; color: #dbe3df; background: #0d1012; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.55 "Cascadia Code", Consolas, monospace; }
.hover-tooltip { position: fixed; z-index: 1000; width: max-content; max-width: min(420px, calc(100vw - 24px)); padding: 9px 11px; border: 1px solid #4a5155; border-radius: 4px; color: #f0f3f2; background: #252a2d; box-shadow: 0 10px 30px #000a; font-size: 11px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; opacity: 0; visibility: hidden; pointer-events: none; }
.hover-tooltip.show { opacity: 1; visibility: visible; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(380px, calc(100% - 40px)); background: #23282b; border: 1px solid #3b4245; border-left: 3px solid var(--green); border-radius: 4px; padding: 11px 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; box-shadow: 0 10px 35px #0008; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 850px) {
  .app-shell { grid-template-columns: 62px minmax(0, 1fr); }
  .sidebar .brand div, .nav-item span, .sidebar-foot span:not(.health-dot) { display: none; }
  .sidebar .brand { padding: 0 14px; }.nav-item { justify-content: center; padding: 10px; }
  .sidebar-foot { justify-content: center; padding: 0; }.sidebar-foot .icon-button { display: none; }
  .metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }.metric:nth-child(2) { border-right: 0; }.metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .topbar { align-items: flex-start; padding: 16px; }.updated { display: none; }.top-actions .primary span { display: none; }.top-actions .primary { width: 38px; padding: 0; }
  .metric { padding: 15px 16px; }.view { padding: 16px; }.section-head { align-items: stretch; flex-direction: column-reverse; }.section-tools { justify-content: space-between; }.form-grid { grid-template-columns: 1fr; gap: 0; }
  .pagination { justify-content: space-between; flex-wrap: wrap; padding-top: 8px; }.pagination-range { width: 100%; margin: 0; text-align: right; }
  .generation-grid, .generation-media, #reference-media { grid-template-columns: 1fr; }.generation-prompt { grid-column: auto; }.generation-actions { flex-wrap: wrap; }.generation-cost { order: 3; width: 100%; margin: 0; }.generation-result { align-items: flex-start; flex-direction: column; }
  .batch-result { grid-template-columns: 28px 54px minmax(0, 1fr); padding: 8px; gap: 6px; }
}
