:root {
  --ink: #17211c;
  --muted: #758078;
  --line: #e4e8e4;
  --surface: #ffffff;
  --soft: #f5f7f5;
  --accent: #b9f55d;
  --accent-ink: #223511;
  --dark: #17211c;
  --danger: #c54a50;
  --warning: #a96c10;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #eff2ef;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; background: var(--dark); color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: var(--dark); font-weight: 900; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: #98a39c; margin-top: 2px; font-size: 11px; }
nav { display: grid; gap: 6px; }
.nav-item { border: 0; color: #aeb8b1; background: transparent; border-radius: 10px; padding: 12px 13px; text-align: left; display: flex; gap: 12px; align-items: center; }
.nav-item span { font-size: 19px; width: 20px; text-align: center; }
.nav-item:hover, .nav-item.active { background: #2a352f; color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid #334039; padding: 18px 10px 0; color: #8f9a93; }
.sidebar-foot small { font-size: 10px; }
.health { display: flex; align-items: center; gap: 8px; color: #dbe2dd; font-size: 12px; margin-bottom: 7px; }
.health i { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px #b9f55d18; }
main { padding: 34px 42px 60px; overflow: hidden; }
header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 38px); letter-spacing: -.045em; }
h2 { font-size: 18px; letter-spacing: -.025em; }
.eyebrow { color: #8a958d; font-size: 10px; letter-spacing: .18em; font-weight: 800; margin-bottom: 7px; }
.header-actions { display: flex; gap: 10px; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; font-weight: 700; font-size: 13px; }
.button.primary { background: var(--dark); color: #fff; }
.button.primary:hover { background: #2a352f; }
.button.secondary { background: var(--accent); color: var(--accent-ink); }
.button.ghost { background: transparent; border-color: #d7dcd8; color: var(--ink); }
.button.danger-outline { color: var(--danger); border-color: #e7c4c6; }
.view { display: none; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.metric { padding: 20px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 74px; height: 74px; border-radius: 50%; right: -25px; top: -28px; background: var(--tone, #edf0ed); }
.metric small { color: var(--muted); display: block; margin-bottom: 12px; }
.metric strong { font-size: 30px; letter-spacing: -.05em; }
.metric em { display: block; color: var(--muted); font-style: normal; font-size: 11px; margin-top: 4px; }
.grid.two { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; margin-bottom: 14px; }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.tag { font-size: 9px; font-weight: 900; letter-spacing: .12em; border-radius: 99px; padding: 6px 9px; }
.tag.green { color: #39551f; background: #e9fbd1; }
.api-card label { display: block; color: var(--muted); font-size: 11px; margin: 14px 0 6px; }
.copy-row { display: flex; align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.copy-row code { padding: 10px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; flex: 1; }
.copy-row button { border: 0; border-left: 1px solid var(--line); padding: 10px 12px; background: #fff; color: var(--muted); font-size: 11px; }
.protocols { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.protocols span { padding: 5px 8px; background: #f0f4ef; color: #5d675f; border-radius: 6px; font-size: 10px; font-weight: 700; }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.pipeline li { display: flex; align-items: center; gap: 13px; }
.pipeline b { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 12px; }
.pipeline li:first-child b { background: var(--accent); }
.pipeline strong, .pipeline small { display: block; }
.pipeline strong { font-size: 13px; }
.pipeline small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-head { padding: 22px 22px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
.accounts-table { min-width: 980px; table-layout: fixed; }
.accounts-table th:nth-child(1) { width: 19%; }
.accounts-table th:nth-child(2) { width: 15%; }
.accounts-table th:nth-child(3) { width: 13%; }
.accounts-table th:nth-child(4) { width: 17%; }
.accounts-table th:nth-child(5) { width: 8%; }
.accounts-table th:nth-child(6) { width: 28%; }
th { color: #929b95; text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: #fafbfa; }
th, td { padding: 13px 18px; border-top: 1px solid var(--line); }
td { font-size: 12px; color: #48524b; }
td strong { color: var(--ink); }
.empty-row { color: var(--muted); text-align: center; padding: 36px; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 5px 8px; font-size: 10px; font-weight: 800; background: #eff2ef; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #99a29c; }
.status.active, .status.succeeded { color: #3a6418; background: #edf9df; }
.status.active::before, .status.succeeded::before { background: #6ab329; }
.status.registering, .status.running { color: #695d11; background: #fff7ce; }
.status.registering::before, .status.running::before { background: #e7b421; animation: pulse 1s infinite; }
.status.error, .status.failed, .status.disabled { color: #8b3439; background: #fde9ea; }
.status.error::before, .status.failed::before, .status.disabled::before { background: #d55c61; }
.status.needs_action { color: #85550c; background: #fff1da; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.account-actions { display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
.mini-button, .text-button { border: 0; background: transparent; color: #465249; font-size: 11px; font-weight: 700; }
.mini-button { border: 1px solid var(--line); padding: 7px 9px; border-radius: 7px; white-space: nowrap; }
.mini-button:hover { border-color: #9ca59e; }
.mini-button.primary-mini { background: #e9fbd1; border-color: #cceba9; color: #38551d; }
.toggle { width: 34px; height: 19px; border: 0; border-radius: 99px; background: #cfd5d0; padding: 2px; }
.toggle::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; transition: transform .18s; box-shadow: 0 1px 2px #0002; }
.toggle.on { background: #7dbb3d; }
.toggle.on::after { transform: translateX(15px); }
.muted { color: var(--muted); font-size: 11px; }
.log-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.log-entry { display: grid; grid-template-columns: 150px 62px 110px 1fr; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.log-entry:last-child { border: 0; }
.log-level { font-weight: 800; text-transform: uppercase; }
.log-level.error { color: var(--danger); }
.log-level.warn { color: var(--warning); }
.log-scope { color: #6b756e; }
dialog { width: min(700px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 80px #14201842; }
dialog::backdrop { background: #17211ca8; backdrop-filter: blur(3px); }
.modal { padding: 25px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-button { border: 0; background: var(--soft); border-radius: 50%; width: 32px; height: 32px; font-size: 20px; color: var(--muted); }
.modal-copy { color: var(--muted); line-height: 1.6; font-size: 12px; margin: 18px 0 12px; }
textarea { width: 100%; min-height: 190px; resize: vertical; border: 1px solid #ccd3cd; border-radius: 10px; padding: 13px; font: 11px/1.6 ui-monospace, Consolas, monospace; outline: none; }
textarea:focus { border-color: #7c9370; box-shadow: 0 0 0 3px #b9f55d30; }
.key-input { width: 100%; border: 1px solid #ccd3cd; border-radius: 10px; padding: 12px 13px; outline: none; font: 12px ui-monospace, Consolas, monospace; }
.key-input:focus { border-color: #7c9370; box-shadow: 0 0 0 3px #b9f55d30; }
.modal.compact { max-width: 560px; }
.preview { margin-top: 10px; padding: 11px 12px; border-radius: 8px; font-size: 11px; background: #eff7e8; color: #496337; }
.preview.empty { background: var(--soft); color: var(--muted); }
.preview.error { background: #fdebec; color: #963e44; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--dark); color: white; padding: 12px 16px; border-radius: 9px; font-size: 12px; transform: translateY(80px); opacity: 0; transition: .22s; box-shadow: 0 10px 30px #0003; }
.toast.show { transform: translateY(0); opacity: 1; }
@keyframes pulse { 50% { opacity: .35; } }
.image-form { display: grid; gap: 15px; }
.image-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.image-form input, .image-form select { width: 100%; padding: 10px 12px; border: 1px solid #ccd3cd; border-radius: 8px; background: #fff; color: var(--ink); }
.image-form textarea { min-height: 90px; font-size: 13px; line-height: 1.6; }
.reference-file-list { border: 1px solid var(--line); border-radius: 8px; background: var(--soft); padding: 9px 11px; min-height: 38px; }
.reference-file-list p { margin: 0; }
.reference-file-list ol { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.reference-file-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 11px; }
.reference-file-order { color: #496337; font: 600 11px ui-monospace, Consolas, monospace; }
.reference-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-entry-kind { color: var(--muted); font: 10px ui-monospace, Consolas, monospace; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.image-grid { align-items: start; }
.image-result-panel { min-height: 390px; }
.image-results figure { margin: 0 0 18px; }
.image-results img { width: 100%; max-height: 560px; object-fit: contain; border-radius: 10px; background: var(--soft); }
.image-results figcaption { color: var(--muted); font-size: 12px; margin-top: 8px; }
.image-warning { color: var(--warning); font-size: 12px; line-height: 1.6; }
.request-preview { margin: 15px 0 0; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); font: 11px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 650px; overflow: auto; }
.image-thumbnail { display: inline-flex; flex-direction: column; gap: 5px; margin-right: 8px; color: var(--muted); text-decoration: none; font-size: 10px; }
.image-thumbnail img { width: 70px; height: 54px; object-fit: contain; border-radius: 6px; background: var(--soft); }
.plain-api-key { color: #2b4f2e; white-space: nowrap; user-select: text; }
.key-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.key-cell .plain-api-key { overflow: hidden; text-overflow: ellipsis; }
.copy-key { border: 1px solid var(--line); background: var(--soft); color: var(--muted); border-radius: 6px; padding: 4px 6px; font-size: 10px; white-space: nowrap; }
.copy-key:hover { color: var(--ink); border-color: #aab4ac; }
.prompt-ellipsis { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.embedded-scheduler { display: grid; gap: 14px; margin-top: 14px; }
.embedded-scheduler > .metrics { margin: 0; }
.embedded-scheduler > .panel { border-radius: 10px; }
.embedded-scheduler .panel-head { padding: 18px 20px 0; }
.embedded-scheduler .pool-settings { padding-inline: 20px; }
.status.processing, .status.pending { color: #695d11; background: #fff7ce; }
.status.ready { color: #3a6418; background: #edf9df; }
.status.busy { color: #345a76; background: #e7eff7; }
.status.cooling, .status.quota { color: #85550c; background: #fff1da; }
.pool-settings { display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); gap: 12px; padding: 0 22px 20px; }
.pool-settings label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.pool-settings input, .pool-settings select { min-width: 0; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 74px 1fr; }
  .sidebar { padding: 22px 10px; }
  .brand { padding: 0 8px 24px; }
  .brand div, .nav-item:not(.active) span + *, .sidebar-foot small, .health span { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; font-size: 0; }
  .nav-item span { font-size: 20px; }
  main { padding: 28px 22px 50px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 10; width: 100%; height: 62px; bottom: 0; top: auto; padding: 7px 12px; display: block; }
  .brand, .sidebar-foot { display: none; }
  nav { display: grid; grid-template-columns: repeat(6, 1fr); }
  .nav-item { min-height: 48px; }
  main { padding: 22px 14px 90px; }
  header { align-items: flex-start; }
  .header-actions .ghost { display: none; }
  .button { padding: 9px 11px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .pool-settings { grid-template-columns: repeat(2,minmax(0,1fr)); padding-inline: 14px; }
  .metric { padding: 15px; }
  .log-entry { grid-template-columns: 1fr 55px; }
  .log-entry span:nth-child(n+3) { grid-column: 1 / -1; }
}
