/* ---- tokens.css, from the 卷不死 app ---- */
/* 卷不死 shared tokens.
   Color, type and control geometry are copied from Magpie 0.1.1246
   (internal/gui/assets/app.css), so the two windows read as one product.
   Change a value here only when Magpie changes it; motion values follow
   the better-ui rules and are marked where they differ from Magpie. */
:root {
  color-scheme: light;
  --bg: #f4f4f6;
  --card: #ffffff;
  --card-2: #f9f9fb;
  --pill: #f1f1f4;
  --pill-hover: #e9e9ee;
  --seg-track: #e6e6eb;
  --seg-thumb: var(--card);
  --seg-edge: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .08);
  --ctl-fg: #63636b;
  --line: #e3e3e8;
  --line-2: #ececf0;
  --fg: #1c1c21;
  --fg-2: #4b4b53;
  --muted: #85858d;
  --faint: #b9b9c2;
  --accent: #4f46e5;
  --accent-soft: #eeedfd;
  --accent-fg: #ffffff;
  --sel: #ecebfb;
  --green: #189a58;
  --green-soft: #e4f6ec;
  --red: #d64545;
  --red-soft: #fbe9e9;
  --amber: #b45309;
  --amber-soft: #fbf0df;
  --pop-bg: rgba(255, 255, 255, .94);
  --shadow: 0 16px 44px rgba(20, 22, 30, .16), 0 2px 8px rgba(20, 22, 30, .06), 0 0 0 .5px rgba(20, 22, 30, .1);
  --logo-invert: 0;

  /* Secondary text that carries meaning. Magpie's --muted is 3.4:1 on --bg;
     its own --ctl-fg is the 4.5:1 step, so informative text uses that. */
  --sub: var(--ctl-fg);

  /* Cards: a shadow ring in place of Magpie's 1px --line border, same look. */
  --shadow-border:
    0px 0px 0px 1px oklch(0 0 0 / 0.06),
    0px 1px 2px -1px oklch(0 0 0 / 0.06),
    0px 2px 4px 0px oklch(0 0 0 / 0.04);
  --shadow-border-hover:
    0px 0px 0px 1px oklch(0 0 0 / 0.08),
    0px 1px 2px -1px oklch(0 0 0 / 0.08),
    0px 2px 4px 0px oklch(0 0 0 / 0.06);
  --shadow-dialog: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .32), 0 2px 8px rgba(0, 0, 0, .12);
  --backdrop: rgba(0, 0, 0, .28);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text: 13px;
  --text-control: 12.5px;
  --text-button: 12px;
  --text-sub: 11.5px;
  --text-label: 11px;
  --text-title: 16px;
  --text-figure: 22px;

  /* Magpie's radii. Outer = inner + padding where surfaces nest:
     segment 8 = 6 + 2, menu 12 = 7 + 5. */
  --r-field: 6px;
  --r-control: 7px;
  --r-segment: 8px;
  --r-card: 12px;
  --r-dialog: 14px;
  --r-pill: 999px;

  --h-header: 50px;
  --h-row: 48px;
  --h-control: 27px;
  --h-control-lg: 30px;
  --h-field: 25px;
  --h-segment: 24px;
  --h-icon: 26px;

  /* better-ui motion, exact. */
  --press-scale: 0.96;
  --dur-press: 150ms;
  --dur-enter: 300ms;
  --dur-exit: 150ms;
  --stagger: 100ms;
  --ease-swap: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a1a1e; --card: #232327; --card-2: #1f1f23; --pill: #2d2d33; --pill-hover: #36363d;
    --seg-track: rgba(255, 255, 255, .035); --seg-thumb: rgba(255, 255, 255, .15);
    --seg-edge: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .3);
    --line: #333339; --line-2: #2c2c32; --fg: #ededf1; --fg-2: #b9b9c1; --muted: #8b8b94; --faint: #56565f; --ctl-fg: #a1a1aa;
    --accent: #a5b4fc; --accent-soft: #2b2c47; --accent-fg: #14142a; --sel: #33345a;
    --green: #6fd99b; --green-soft: #1e3a2b; --red: #f28b82; --red-soft: #45272a; --amber: #f2b544; --amber-soft: #3f3220;
    --pop-bg: rgba(38, 38, 43, .96);
    --shadow: 0 16px 44px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(255, 255, 255, .1);
    --logo-invert: 1;
    --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
    --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1a1e; --card: #232327; --card-2: #1f1f23; --pill: #2d2d33; --pill-hover: #36363d;
  --seg-track: rgba(255, 255, 255, .035); --seg-thumb: rgba(255, 255, 255, .15);
  --seg-edge: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .3);
  --line: #333339; --line-2: #2c2c32; --fg: #ededf1; --fg-2: #b9b9c1; --muted: #8b8b94; --faint: #56565f; --ctl-fg: #a1a1aa;
  --accent: #a5b4fc; --accent-soft: #2b2c47; --accent-fg: #14142a; --sel: #33345a;
  --green: #6fd99b; --green-soft: #1e3a2b; --red: #f28b82; --red-soft: #45272a; --amber: #f2b544; --amber-soft: #3f3220;
  --pop-bg: rgba(38, 38, 43, .96);
  --shadow: 0 16px 44px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(255, 255, 255, .1);
  --logo-invert: 1;
  --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
  --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
}

/* Windows faces, as Magpie sets them. */
:root.win {
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --code: "Cascadia Mono", Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace;
}

/* ---- components.css, from the 卷不死 app ---- */
/* 卷不死 components: Magpie's controls, measured from its app.css, with
   better-ui press, enter/exit and icon-swap motion. Tokens live in tokens.css. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font: 400 var(--text)/1.4 var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: default; appearance: none; -webkit-appearance: none; text-align: center; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--code); font-size: 11.5px; }

/* ---- icons: one 16-unit grid, 1.5px rendered stroke beside 400-weight text */
.i { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.i * { vector-effect: non-scaling-stroke; }
.ic { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; }
.ic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ic .mask { width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.logo-openai { --logo: url("./icons/openai.svg"); }
.logo-anthropic { --logo: url("./icons/anthropic.svg"); }
.logo-opencode { --logo: url("./icons/opencode.svg"); }
.logo-qoder { --logo: url("./icons/qoder.svg"); }
.logo-magpie { --logo: url("./icons/magpie.svg"); }
.logo-xai { --logo: url("./icons/vendors/xai.svg"); }
.ic.generic { color: var(--muted); }
/* a mark inside a picture frame: Magpie Image's */
.ic.framed { position: relative; }
.ic.framed > .i { width: 100%; height: 100%; }
.ic.framed > .mask { position: absolute; inset: 21% 17% 15%; width: auto; height: auto; }
/* a set of agents as Magpie shows a routing group's providers: overlapping discs */
.ic-stack { display: inline-flex; flex: none; align-items: center; }
.ic-stack .disc { position: relative; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.ic-stack .disc + .disc { margin-inline-start: -4px; }
.ic-stack .disc:nth-child(1) { z-index: 3; }
.ic-stack .disc:nth-child(2) { z-index: 2; }
.ic-stack .disc > .ic { width: 13px; height: 13px; }

/* ---- buttons (Magpie .text / .text.action / .text.primary / .icon) ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: var(--text-button); color: var(--ctl-fg); white-space: nowrap;
  padding: 3px 7px; border-radius: var(--r-field);
  transition-property: scale, background-color, color, border-color, box-shadow, filter;
  transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.btn.action, .btn.primary { height: var(--h-control); padding: 0 10px; }
.btn.action { border: 1px solid var(--line); background: var(--card); color: var(--fg-2); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.btn.primary { border: 1px solid transparent; background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.btn.lg { height: var(--h-control-lg); padding: 0 14px; font-size: var(--text-control); border-radius: var(--r-segment); }
.btn.wide { width: 100%; }
a.btn { text-decoration: none; }
/* optical: an icon side gets 2px less than the text side */
.btn.lead-icon { padding-inline-start: 8px; }
.btn.trail-icon { padding-inline-end: 8px; }
.btn:not(:disabled):not([aria-disabled="true"]):active { scale: var(--press-scale); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; }
.btn[aria-busy="true"] { opacity: 1; }
.btn.link { color: var(--accent); padding-inline: 4px; }
.icon-btn {
  width: var(--h-icon); height: var(--h-icon); border-radius: var(--r-control);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  transition-property: scale, background-color, color; transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.icon-btn:not(:disabled):active { scale: var(--press-scale); }
.icon-btn[aria-expanded="true"] { background: var(--pill); color: var(--fg); }
@media (hover: hover) {
  .btn:not(.action):not(.primary):not(:disabled):hover { color: var(--fg); background: var(--pill); }
  .btn.link:not(:disabled):hover { color: var(--accent); background: var(--accent-soft); }
  .btn.action:not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--muted); background: var(--card-2); color: var(--fg); }
  .btn.primary:not(:disabled):not([aria-disabled="true"]):hover { filter: brightness(1.08); }
  .icon-btn:not(:disabled):hover { background: var(--pill); color: var(--fg); }
}

/* ---- icon swap: both icons stay in the DOM and cross-fade ---------------- */
.swap { display: inline-grid; flex: none; width: 14px; height: 14px; }
.swap > * { grid-area: 1 / 1; opacity: 0; scale: .25; filter: blur(4px); transition-property: opacity, scale, filter; transition-duration: var(--dur-enter); transition-timing-function: var(--ease-swap); }
.swap[data-show="add"] > [data-icon="add"],
.swap[data-show="busy"] > [data-icon="busy"],
.swap[data-show="done"] > [data-icon="done"] { opacity: 1; scale: 1; filter: blur(0); }
.swap [data-icon="busy"] .i { animation: spin .9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---- segmented control (Magpie .seg) ------------------------------------ */
.seg { display: inline-flex; padding: 2px; gap: 0; border-radius: var(--r-segment); background: var(--seg-track); }
.seg.bare { background: transparent; }
:root[data-theme="dark"] .seg.bare { background: var(--seg-track); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg.bare { background: var(--seg-track); } }
.seg button {
  height: var(--h-segment); padding: 0 12px; border-radius: var(--r-field);
  font-size: var(--text-control); color: var(--ctl-fg); white-space: nowrap;
  transition-property: color, background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.seg button[aria-pressed="true"], .seg button[aria-current="page"] { color: var(--fg); background: var(--seg-thumb); box-shadow: var(--seg-edge); }
@media (hover: hover) { .seg button:not([aria-pressed="true"]):not([aria-current="page"]):not(:disabled):hover { color: var(--fg-2); } }
.seg button:disabled { opacity: .45; }

/* ---- surfaces ------------------------------------------------------------ */
.label { display: block; padding: 14px 4px 6px; font-size: var(--text-label); font-weight: 600; letter-spacing: .05em; color: var(--sub); }
.lede { padding: 2px 4px 12px; color: var(--fg-2); }
.lede b { color: var(--fg); font-weight: 600; }
.list {
  background: var(--card); border-radius: var(--r-card);
  border: 1px solid transparent; box-shadow: var(--shadow-border);
  overflow: clip;
}
.row { display: flex; align-items: center; gap: 12px; min-height: var(--h-row); padding: 7px 12px 7px 14px; }
.row + .row { border-top: 1px solid var(--line-2); }
.row .who { flex: 1 1 auto; min-width: 0; }
.row .name { font-weight: 500; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: var(--text-sub); color: var(--sub); overflow: hidden; white-space: nowrap; }
.row .sub > span { overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.err { background: var(--red); }
.row .end { display: flex; align-items: center; gap: 8px; flex: none; margin-inline-start: auto; }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 4px 0; font-size: var(--text-control); color: var(--sub); }

/* a pop-up-button-like value pill (Magpie .field) */
.field {
  display: inline-flex; align-items: center; gap: 6px; height: var(--h-field); padding: 0 8px;
  border-radius: var(--r-field); background: var(--pill); font-size: var(--text-control);
}
.field .k { color: var(--sub); font-size: var(--text-sub); }
.field .v { font-weight: 500; }

/* status pill (Magpie .status.ok / .warn / .err) */
.status {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: var(--text-sub); line-height: 16px; font-weight: 500; padding: 2px 8px; border-radius: var(--r-pill);
  color: var(--ctl-fg); background: color-mix(in srgb, currentColor 12%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 26%, transparent);
}
.status.ok { color: var(--green); }
.status.warn { color: var(--amber); }
.status.err { color: var(--red); }

/* the notice Magpie shows above an import from a link */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; margin-bottom: 4px;
  border-radius: var(--r-card); background: var(--amber-soft);
  border: 1px solid transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent);
}
.notice .ic { width: 28px; height: 28px; color: var(--fg); }
.notice .copy { flex: 1 1 240px; min-width: 0; }
.notice .copy b { display: block; font-weight: 600; }
.notice .copy p { margin-top: 2px; color: var(--fg-2); font-size: var(--text-control); text-wrap: pretty; }
.notice .acts { display: flex; flex-wrap: wrap; gap: 6px; }

/* KPI strip (Magpie .led-strip) */
.strip { display: flex; align-items: center; gap: 12px; padding: 11px 12px 10px 15px; }
.strip .k { display: block; font-size: var(--text-label); color: var(--sub); }
.strip .v { display: block; margin-top: 2px; font-size: var(--text-figure); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ---- form controls ------------------------------------------------------- */
/* Magpie draws its own checkbox */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 14px; height: 14px; flex: none;
  display: inline-grid; place-content: center; vertical-align: middle;
  border: 1px solid var(--faint); border-radius: 4px; background: var(--card); color: var(--accent-fg);
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px; background: currentColor; transform: scale(0);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2l2 2L8 3' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2l2 2L8 3' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:disabled { opacity: .45; }
@media (hover: hover) { input[type="checkbox"]:not(:disabled):not(:checked):hover { border-color: var(--muted); } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-control); color: var(--fg-2); }

.input {
  height: var(--h-control); width: 100%; min-width: 0; padding: 0 9px; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--card); font-size: var(--text-control); outline: none;
  transition-property: border-color, box-shadow; transition-duration: 120ms; transition-timing-function: ease-out;
}
.input.lg { height: var(--h-control-lg); font-size: var(--text); }
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--red); }
.form-row { display: grid; gap: 5px; }
.form-row + .form-row { margin-top: 12px; }
.form-row > label { font-size: var(--text-control); color: var(--fg-2); }
.error { font-size: var(--text-sub); color: var(--red); }
.affix { position: relative; display: block; }
.affix > span { position: absolute; inset-block: 0; inset-inline-start: 9px; display: grid; place-items: center; color: var(--sub); pointer-events: none; }
.affix > .input { padding-inline-start: 22px; }
.affix > .icon-btn { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; }

/* amount chips (Magpie .chip; the chosen one as its picked model chips) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: var(--h-field); padding: 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); font-size: var(--text-button);
  transition-property: scale, border-color, background-color, color; transition-duration: var(--dur-press); transition-timing-function: ease-out;
}
.chip:not(:disabled):active { scale: var(--press-scale); }
.chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--accent); }
@media (hover: hover) { .chip:not([aria-pressed="true"]):hover { border-color: var(--accent); color: var(--accent); } }

/* ---- menu (Magpie .pop) -------------------------------------------------- */
.pop {
  position: fixed; inset: auto; margin: 0; width: 232px; padding: 5px;
  border: 1px solid transparent; border-radius: var(--r-card);
  background: var(--pop-bg); color: var(--fg); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: var(--shadow); overscroll-behavior: contain;
  transform-origin: top right;
  opacity: 0; scale: .96;
  transition-property: opacity, scale, display, overlay;
  transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.pop:popover-open { opacity: 1; scale: 1; }
@starting-style { .pop:popover-open { opacity: 0; scale: .96; } }
.pop .who { padding: 6px 8px 8px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.pop .who b { display: block; font-weight: 500; }
.pop .who span { font-size: var(--text-sub); color: var(--sub); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px;
  border-radius: var(--r-control); font-size: var(--text-control); text-align: start; color: var(--fg);
  transition-property: background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.menu-item .i { color: var(--muted); }
.menu-item:focus-visible { outline: none; background: var(--pill); }
@media (hover: hover) { .menu-item:hover { background: var(--pill); } }

/* ---- dialog (Magpie .modal .dialog with a framed editor) ----------------- */
.dialog {
  position: fixed; inset: 0; margin: auto; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid transparent; border-radius: var(--r-dialog); background: var(--card); color: var(--fg);
  box-shadow: var(--shadow-dialog);
  opacity: 0; translate: 0 -12px; filter: blur(4px);
  transition-property: opacity, translate, filter, display, overlay;
  transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.dialog[open] { opacity: 1; translate: 0 0; filter: blur(0); transition-duration: var(--dur-enter); }
@starting-style { .dialog[open] { opacity: 0; translate: 0 12px; filter: blur(4px); } }
.dialog::backdrop {
  background: var(--backdrop); -webkit-backdrop-filter: blur(8px) saturate(1.1); backdrop-filter: blur(8px) saturate(1.1);
  opacity: 0; transition-property: opacity, display, overlay; transition-duration: var(--dur-exit); transition-timing-function: ease-out; transition-behavior: allow-discrete;
}
.dialog[open]::backdrop { opacity: 1; transition-duration: var(--dur-enter); }
@starting-style { .dialog[open]::backdrop { opacity: 0; } }
.dialog .head { display: flex; align-items: center; gap: 10px; flex: none; min-height: 48px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line-2); }
.dialog .head h2 { flex: 1; font-size: var(--text); font-weight: 600; }
.dialog .head h2:focus { outline: none; }
.dialog .body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; }
.dialog .body p { color: var(--fg-2); }
.dialog .body p + p { margin-top: 8px; }
.dialog .bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; min-height: 48px; padding: 0 18px; border-top: 1px solid var(--line-2); }
.dialog .bar .grow { flex: 1; }

/* ---- staged entrance for an infrequent success moment -------------------- */
.enter > * { animation: enter var(--dur-enter) ease-out both; }
.enter > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.enter > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.enter > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.enter > :nth-child(n+5) { animation-delay: calc(var(--stagger) * 4); }
@keyframes enter { from { opacity: 0; filter: blur(4px); translate: 0 12px; } }

/* ---- reduced motion: movement, scale and blur become a cross-fade -------- */
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .btn:not(:disabled):active, .icon-btn:not(:disabled):active, .chip:not(:disabled):active { scale: 1; }
  .swap > * { scale: 1; filter: none; transition-property: opacity; }
  .swap [data-icon="busy"] .i { animation: none; }
  .pop, .pop:popover-open { scale: 1; }
  @starting-style { .pop:popover-open { scale: 1; } }
  .dialog, .dialog[open] { translate: none; filter: none; }
  @starting-style { .dialog[open] { translate: none; filter: none; } }
  .enter > * { animation-name: fade; }
}

/* forced colors keeps an edge where shadows draw one */
@media (forced-colors: active) {
  .btn.primary { background: ButtonText; color: ButtonFace; }
  .seg button[aria-pressed="true"], .seg button[aria-current="page"] { outline: 1px solid CanvasText; }
}

/* ---- panel.css ---- */
/* docker.juanbu.si. Above this file in style.css are the 卷不死 app's own
   tokens.css and components.css (Magpie's values), read from juanbu-desktop
   at build time; this file adds only the panel's page frame, the environment
   list and its details, the dialogs' forms, the sign-in card and the proxy
   table. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button:not(:disabled), a.btn, .icon-btn:not(:disabled), .chip, label.check, summary, select { cursor: pointer; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -100px; z-index: 40; padding: 6px 10px; border-radius: var(--r-control); background: var(--card); box-shadow: var(--shadow); }
.skip-link:focus { top: 8px; }
.sub-text { color: var(--sub); }
code, .code { font-family: var(--code); font-size: 11.5px; }
.stack { display: grid; gap: 12px; min-width: 0; }
.input.code { font-family: var(--code); font-size: 12px; }
.btn.primary.danger { background: var(--red); color: var(--card); }
.btn.action.danger { color: var(--red); }
@media (hover: hover) { .btn.action.danger:not(:disabled):hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, transparent); background: var(--red-soft); } }
.btn .ext { color: var(--faint); }
.btn[aria-busy="true"] { cursor: progress; }

/* ---- the bars --------------------------------------------------------------------- */
.bar-in { width: min(1240px, 100% - 32px); margin-inline: auto; display: flex; align-items: center; gap: 8px; }
.top { flex: none; height: var(--h-header); border-bottom: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg) 82%, transparent);
  position: sticky; top: 0; z-index: 20; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.top .bar-in { height: 100%; position: relative; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 600; letter-spacing: .01em; border-radius: var(--r-control); }
.brand .slash { color: var(--faint); font-weight: 400; }
.brand .light { font-weight: 500; color: var(--fg-2); }
.mark { width: 20px; height: 20px; flex: none; color: var(--fg); }
.mark .glyph { stroke: var(--bg); }
.top .seg { position: absolute; left: 50%; top: calc(50% + 1px); translate: -50% -50%; }
.seg a {
  display: inline-flex; align-items: center; height: var(--h-segment); padding: 0 12px; border-radius: var(--r-field);
  font-size: var(--text-control); color: var(--ctl-fg); white-space: nowrap;
  transition-property: color, background-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.seg a[aria-current="page"] { color: var(--fg); background: var(--seg-thumb); box-shadow: var(--seg-edge); }
@media (hover: hover) { .seg a:not([aria-current="page"]):hover { color: var(--fg-2); } }
.top .actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.account-btn { gap: 6px; padding-inline: 4px 8px; color: var(--fg-2); }
.avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--pill-hover); color: var(--fg-2); font-size: 11px; font-weight: 600; }
.account-btn .i { color: var(--muted); }

.site-foot { flex: none; font-size: var(--text-sub); color: var(--sub); }
.site-foot .bar-in { flex-wrap: wrap; gap: 6px 16px; padding: 14px 0 max(22px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); }
.site-foot .bar-in > :last-child { margin-inline-start: auto; }

/* ---- the page -------------------------------------------------------------------- */
.view { flex: 1; width: min(1240px, 100% - 32px); margin-inline: auto; padding: 18px 0 32px; }
.view:focus { outline: none; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 0 14px 4px; }
.head-copy { min-width: 0; }
.head-title { font-size: var(--text-title); font-weight: 600; }
.head-desc { margin-top: 2px; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.list-head .btn.primary { gap: 4px; flex: none; }
.head-acts { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }

/* one line of filters and figures above the list */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 0 10px; }
.toolbar .grow { flex: 1; }
.summary { font-size: var(--text-control); color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary b { color: var(--fg); font-weight: 600; }
.summary .sep { color: var(--faint); margin-inline: 5px; }
.checked-at { font-size: var(--text-sub); color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip .dot { width: 6px; height: 6px; }
.chip .chip-k { color: var(--sub); }
.chip[aria-pressed="true"] .chip-k { color: inherit; }
.chip.add { color: var(--ctl-fg); border-style: dashed; }
.chip.offline { color: var(--sub); }

/* a line saying what is going on: an error, a done operation, an old snapshot */
.note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border-radius: var(--r-card); font-size: var(--text-control); color: var(--fg); background: var(--pill); text-wrap: pretty; }
.note:empty { display: none; }
.note.err { color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 30%, transparent); }
.note.ok { background: var(--green-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.note.warn { background: var(--amber-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent); }
.foot-note { padding: 10px 4px 0; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }

/* ---- the environment list: one row each, its details folded under it --------------- */
.env-cols {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: minmax(136px, 1.1fr) 82px minmax(80px, .6fr) minmax(100px, .8fr) minmax(100px, .8fr) 116px 64px 116px minmax(200px, 1.6fr);
}
.env-head { padding: 0 10px 6px 6px; font-size: var(--text-label); font-weight: 600; letter-spacing: .04em; color: var(--sub); }
.env-head > :first-child { padding-inline-start: 28px; }
.env-head > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env + .env { border-top: 1px solid var(--line-2); }
.env-row { min-height: 52px; padding: 7px 10px 7px 6px; cursor: pointer; }
.env-row > * { min-width: 0; }
.env.open { background: var(--card-2); }
@media (hover: hover) { .env:not(.open) .env-row:hover { background: var(--card-2); } }
.env-toggle { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 6px 4px 2px; border-radius: var(--r-control); text-align: start; color: var(--fg); }
.env-toggle .chev { color: var(--muted); flex: none; transition-property: rotate; transition-duration: 150ms; transition-timing-function: ease-out; }
.env-toggle[aria-expanded="true"] .chev { rotate: 90deg; }
.env-title { min-width: 0; display: grid; }
.env-title .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-title .num-k { font-family: var(--code); font-size: 10.5px; color: var(--sub); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.item-note-text { min-width: 0; font-size: var(--text-control); font-weight: 400; line-height: 1.5; color: var(--fg-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.item-note .note-edit { padding: 2px 0; min-height: 28px; flex-shrink: 0; font-size: var(--text-button); font-weight: 400; }
.note-cell { min-width: 0; text-align: start; }
.note-cell .item-note { align-content: center; }
.env-row > .c-note { padding-block: 4px; }
.detail-note { margin: -6px 0 10px; }
/* a note is prose, not a proxy link: the text face, not the code one textarea.input gets */
textarea.input.note-input { font-family: var(--font); font-size: var(--text-control); font-weight: 400; line-height: 1.5; color: var(--fg); }
.cell-status { display: flex; align-items: center; gap: 6px; font-size: var(--text-control); color: var(--fg-2); }
.cell-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-two { display: grid; font-size: var(--text-control); color: var(--fg-2); }
.cell-two > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-two .k2 { font-size: var(--text-sub); color: var(--sub); }
.cell-two .mono { color: var(--fg); }
.cell-two .err-text { color: var(--red); }
.cell-two .warn-text { color: var(--amber); }
.cell-muted { font-size: var(--text-control); color: var(--sub); }
.c-sub2api .status { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.cell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.cell-actions .btn.action { min-width: 76px; }
.cell-actions .placeholder { width: 76px; }

/* the two quota windows, small: the bar is what is used, the figure what is left */
.qms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qm { min-width: 0; }
.qm-top { display: flex; justify-content: space-between; gap: 4px; font-size: var(--text-sub); line-height: 1.3; font-variant-numeric: tabular-nums; }
.qm-top .k { color: var(--sub); }
.qm-top .v { color: var(--fg); font-weight: 500; }
.qm-bar { display: block; height: 3px; margin-top: 3px; border-radius: 2px; background: var(--pill-hover); overflow: hidden; }
.qm-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.qm.moderate .qm-bar > i { background: var(--amber); }
.qm.high .qm-bar > i { background: var(--red); }
.qm.high .qm-top .v { color: var(--red); }
.qm.cached .qm-bar > i { background: var(--faint); }
.qm.cached .qm-top .v { color: var(--sub); font-weight: 400; }
.qm-more { font-size: var(--text-label); color: var(--sub); margin-top: 1px; }

/* details of one environment */
.env-detail { padding: 2px 16px 16px 34px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, 1.2fr); gap: 12px; }
.panel { min-width: 0; padding: 12px 14px; border-radius: var(--r-card); background: var(--card); border: 1px solid transparent; box-shadow: var(--shadow-border); }
.panel-k { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: var(--text-label); font-weight: 600; letter-spacing: .04em; color: var(--sub); }
.panel-k .k-note { font-weight: 400; letter-spacing: 0; }
.env-name { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; margin: -2px 0 10px; min-width: 0; }
.env-name b { font-weight: 600; overflow-wrap: anywhere; }
.env-name .btn.link { margin-inline-start: -4px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; font-size: var(--text-control); }
.kv dt { color: var(--sub); white-space: nowrap; }
.kv dd { min-width: 0; overflow-wrap: anywhere; color: var(--fg); }
.kv dd .k2 { display: block; color: var(--sub); font-size: var(--text-sub); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-field); background: var(--pill); font-size: var(--text-sub); color: var(--fg-2); white-space: nowrap; }
.detail-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-links .btn.action[aria-disabled="true"] { pointer-events: none; }
.detail-wide { margin-top: 12px; }
.sub2api-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--text-control); }
.sub2api-entry .field-help { flex-basis: 100%; font-size: var(--text-sub); color: var(--sub); }
.sub2api-entry .status { font-size: var(--text-sub); }

/* the Claude Code accounts Magpie sees in an environment */
.identity-account { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; font-size: var(--text-control); }
.identity-account + .identity-account { border-top: 1px solid var(--line-2); padding-top: 7px; margin-top: 7px; }
.identity-account > div { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.identity-account strong { font-weight: 500; overflow-wrap: anywhere; }
.identity-plan { font-size: var(--text-label); color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.identity-state { font-size: var(--text-sub); color: var(--sub); white-space: nowrap; }
.identity-state.current { color: var(--green); }
.identity-state.signed-out { color: var(--red); }
.identity-empty { font-size: var(--text-control); color: var(--sub); }
.identity-note { font-size: var(--text-sub); color: var(--sub); margin-top: 8px; text-wrap: pretty; }

/* Claude quota, in full: per account, per window, with reset times */
.quota-account + .quota-account { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.quota-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.quota-account-head > div { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.quota-account-name { font-size: var(--text-control); font-weight: 500; overflow-wrap: anywhere; }
.quota-account-name .mono { font-size: 10.5px; font-weight: 400; color: var(--sub); }
.quota-plan { color: var(--sub); font-size: var(--text-sub); }
.quota-windows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.quota-window { min-width: 0; }
.quota-window-head { display: flex; gap: 6px; justify-content: space-between; flex-wrap: wrap; font-size: var(--text-sub); }
.quota-window-head span { color: var(--fg-2); }
.quota-window-head strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.quota-track { height: 4px; border-radius: 2px; background: var(--pill-hover); overflow: hidden; margin-block: 4px; }
.quota-track > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.quota-track.unknown { background: repeating-linear-gradient(120deg, var(--line) 0 3px, var(--pill) 3px 6px); }
.quota-window.moderate .quota-track > span { background: var(--amber); }
.quota-window.high .quota-track > span { background: var(--red); }
.quota-track.moderate > span { background: var(--amber); }
.quota-track.high > span { background: var(--red); }
.quota-window-detail { font-size: var(--text-label); color: var(--sub); display: flex; gap: 2px 8px; justify-content: space-between; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.quota-source { font-size: var(--text-label); color: var(--sub); margin-top: 8px; overflow-wrap: anywhere; text-wrap: pretty; }
.quota-snapshot { border-top: 1px solid var(--line-2); padding-top: 6px; }
.quota-note { font-size: var(--text-sub); color: var(--amber); margin-bottom: 8px; text-wrap: pretty; }
.quota-note.quota-error { color: var(--red); }
.quota-empty { display: flex; align-items: flex-start; gap: 8px; color: var(--sub); font-size: var(--text-sub); text-wrap: pretty; }

/* Kiro-rs and the operation log, side by side under the list */
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 22px; align-items: start; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 0 8px 4px; }
.section-head h2 { font-size: var(--text); font-weight: 600; }
.section-head p { font-size: var(--text-sub); color: var(--sub); margin-top: 1px; text-wrap: pretty; }
.kiro-body { padding: 12px 14px; }
.kiro-body .quota-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.kiro-body .quota-heading h4 { font-size: var(--text-control); font-weight: 600; }
.kiro-body .quota-heading > span { font-size: var(--text-sub); color: var(--sub); }
.kiro-credit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block: 8px; }
.kiro-credit-grid > div { display: grid; gap: 2px; min-width: 0; }
.kiro-credit-grid .metric-label { font-size: var(--text-label); color: var(--sub); }
.kiro-credit-grid strong { font-size: 18px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kiro-body .field-help { font-size: var(--text-sub); color: var(--sub); }
.job { align-items: flex-start; }
.job .who { display: grid; gap: 1px; font-size: var(--text-control); }
.job .who > span:first-child { color: var(--fg); }
.job-message { font-size: var(--text-sub); color: var(--sub); overflow-wrap: anywhere; }
.job time { flex: none; font-size: var(--text-sub); color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 1px; }
.job .status { margin-top: 1px; }
.list-more { display: flex; justify-content: center; padding: 6px; border-top: 1px solid var(--line-2); }
.empty-state { padding: 22px 16px; text-align: center; color: var(--sub); font-size: var(--text-control); text-wrap: pretty; }

/* ---- menus ----------------------------------------------------------------------- */
.env-menu { width: 236px; max-height: calc(100dvh - 16px); overflow-y: auto; }
.pop .menu-sep { height: 1px; margin: 4px 6px; background: var(--line-2); }
.pop .menu-label { padding: 6px 8px 3px; font-size: var(--text-label); font-weight: 600; letter-spacing: .04em; color: var(--sub); }
.menu-item .ext { margin-inline-start: auto; color: var(--faint); }
.menu-item.danger, .menu-item.danger .i { color: var(--red); }
.menu-item:disabled, .menu-item[aria-disabled="true"] { opacity: .45; }
@media (hover: hover) { .menu-item:disabled:hover, .menu-item[aria-disabled="true"]:hover { background: none; } }
.menu-note { padding: 4px 8px 6px; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }

/* ---- dialogs: the forms in them ------------------------------------------------------ */
.dialog.wide { width: min(560px, calc(100vw - 32px)); }
.dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.dialog .head .eyebrow { display: block; font-size: var(--text-label); font-weight: 500; color: var(--sub); letter-spacing: .04em; }
.dialog .head .titles { flex: 1; min-width: 0; padding-block: 8px; }
.dialog .head .titles h2 { font-size: var(--text); font-weight: 600; }
.dialog .body { display: grid; gap: 12px; align-content: start; }
.dialog .body > p { margin: 0; }
.dialog .body p + p { margin-top: 0; }
.dialog .body .lead-text { color: var(--fg-2); font-size: var(--text-control); text-wrap: pretty; }
.form-row { display: grid; gap: 5px; min-width: 0; }
.form-row + .form-row { margin-top: 0; }
.form-row > label, .form-row > .label-text { font-size: var(--text-control); color: var(--fg-2); }
.form-row > label .opt { color: var(--sub); margin-inline-start: 6px; }
.hint, .field-help { font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; overflow-wrap: anywhere; }
.hint.mono { font-family: var(--code); }
select.input { appearance: none; -webkit-appearance: none; padding-inline-end: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 6.5 8 9.5l3-3' fill='none' stroke='%2385858d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px; }
textarea.input { height: auto; padding: 7px 9px; line-height: 1.45; resize: vertical; font-family: var(--code); font-size: 11.5px; }
.input:disabled, select.input:disabled { opacity: .55; }
.dialog .error:empty, .auth .error:empty { display: none; }
.dialog .error { font-size: var(--text-control); }
.preview-box { padding: 12px 14px; border-radius: var(--r-card); background: var(--green-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.preview-box h3 { font-size: var(--text-control); font-weight: 600; margin-bottom: 8px; }
.preview-box dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: var(--text-control); }
.preview-box dt { color: var(--sub); }
.preview-box dd { font-family: var(--code); font-size: 11.5px; overflow-wrap: anywhere; }
.preview-warning { margin-top: 8px; color: var(--amber); font-size: var(--text-control); }
.destructive-description { padding: 10px 12px; border-radius: var(--r-card); background: var(--red-soft); color: var(--fg); font-size: var(--text-control);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 30%, transparent); text-wrap: pretty; }
.enroll-options { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px 12px 10px; }
.enroll-options legend { padding-inline: 4px; font-size: var(--text-control); font-weight: 600; }
.enroll-options:disabled { opacity: .6; }
.enroll-check { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; font-size: var(--text-control); overflow-wrap: anywhere; }
.enroll-check input { margin-top: 2px; }
.enroll-check small { display: block; color: var(--sub); font-size: var(--text-label); font-family: var(--code); }
.model-choices { max-height: 200px; overflow: auto; overscroll-behavior: contain; padding-inline-end: 6px; }
.model-actions { display: flex; justify-content: flex-end; gap: 2px; }
.enroll-numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 4px; }
.more-info { font-size: var(--text-control); }
.more-info > summary { color: var(--accent); list-style: none; display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-field); }
.more-info > summary::-webkit-details-marker { display: none; }
.more-info > summary .i { transition-property: rotate; transition-duration: 150ms; transition-timing-function: ease-out; }
.more-info[open] > summary .i { rotate: 90deg; }
.more-info > :not(summary) { margin-top: 8px; }
.more-info .hint + .hint { margin-top: 6px; }
.node-guide { padding: 10px 12px; border-radius: var(--r-card); background: var(--pill); font-size: var(--text-control); }
.node-guide > summary { color: var(--fg); }
.node-guide > :not(summary) { margin-top: 8px; }
.node-guide code { overflow-wrap: anywhere; }
#account-setup-link { white-space: normal; height: auto; min-height: var(--h-control-lg); padding-block: 6px; }
#account-setup-status, #account-setup-target { overflow-wrap: anywhere; }
#account-setup-success { color: var(--green); }
#account-setup-code-row .btn, #account-setup-methods > .btn { justify-self: start; }
#account-setup-methods details .btn { margin-top: 8px; }

/* ---- the sign-in card and the terminal launcher --------------------------------------- */
.auth { flex: 1; display: grid; place-items: center; padding: 24px 16px 56px; }
.auth-card { width: min(100%, 340px); }
.auth-card.wide { width: min(100%, 460px); }
.auth-card .mark { width: 40px; height: 40px; margin-bottom: 12px; }
.auth-card h1 { font-size: var(--text-title); font-weight: 600; text-wrap: balance; }
.auth-card .lead { margin: 4px 0 16px; color: var(--sub); font-size: var(--text-control); text-wrap: pretty; }
.auth-card form { padding: 16px; display: grid; gap: 12px; }
.auth-card form .btn.primary { margin-top: 4px; }
.auth-card .after { margin-top: 12px; text-align: center; font-size: var(--text-sub); color: var(--sub); text-wrap: pretty; }
.launch-card { padding: 16px; display: grid; gap: 10px; }
.launch-card .launch-status { display: flex; align-items: center; gap: 8px; font-size: var(--text-control); color: var(--fg); }
.launch-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---- 代理与订阅 ------------------------------------------------------------------------ */
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px; padding-bottom: 10px; }
.filters .form-row > label { font-size: var(--text-sub); color: var(--sub); }
.ptable { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: var(--text-control); text-align: start; }
.ptable th { padding: 9px 12px; font-size: var(--text-label); font-weight: 600; letter-spacing: .04em; color: var(--sub); text-align: start; border-bottom: 1px solid var(--line-2); background: var(--card-2); }
.ptable td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
.ptable tbody tr:first-child td { border-top: 0; }
.ptable .select-cell { width: 34px; padding-inline: 14px 0; }
.ptable td strong { font-weight: 500; }
.ptable td code { display: block; overflow-wrap: anywhere; }
.ptable td { overflow-wrap: anywhere; }
.ptable .node-name-col { width: 22%; }
.ptable .note-col { width: 28%; }
.ptable .connection-col { width: 18%; }
.ptable .usage-col { width: 14%; }
.ptable .note-cell { vertical-align: middle; }
.ptable .library-source { display: block; margin-top: 2px; font-size: var(--text-sub); color: var(--sub); }
.protocol-label { display: inline-block; margin-bottom: 2px; font-family: var(--code); font-size: 10px; letter-spacing: .04em; color: var(--sub); }
.ptable .field-help { margin-top: 2px; }
.node-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.mobile-select-all { display: none; }
.selection-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 0 0 10px 4px; }
.selection-line .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.selection-summary { font-size: var(--text-control); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.subscription-info { display: grid; gap: 2px; min-width: 0; }
.subscription-table .note-col { width: 44%; }
.subscription-table .subscription-actions-col { width: 124px; }
.secret-field { font-family: var(--code); }
.route-info { padding: 0 4px 12px; }
.usage-note { padding: 0 4px 8px; }
.links-section { margin-top: 22px; }

/* ---- while the first answers are on their way ------------------------------------------ */
.sk { pointer-events: none; user-select: none; animation: sk-pulse 1.2s ease-in-out infinite alternate; }
.sk .bar { display: block; height: 10px; border-radius: 4px; background: var(--pill); }
.sk .bar.short { width: 60%; }
@keyframes sk-pulse { to { opacity: .55; } }

/* ---- narrower windows -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .env-cols { grid-template-columns: minmax(132px, 1.1fr) 82px minmax(100px, .8fr) minmax(100px, .8fr) 116px 116px minmax(180px, 1.5fr); }
  .env-cols > .c-browser, .env-cols > .c-sub2api { display: none; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-grid > .panel-quota { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .top .seg { position: static; translate: none; }
  .brand .light, .brand .slash { display: none; }
  .env-cols { grid-template-columns: minmax(128px, 1.1fr) 80px minmax(92px, .8fr) 110px 116px minmax(160px, 1.5fr); }
  .env-cols > .c-exit { display: none; }
  .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .view { padding-top: 12px; }
  .list-head { align-items: flex-start; }
  .env-head { display: none; }
  .env-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "env actions" "status status" "claude quota" "note note"; gap: 6px 12px; padding: 10px 12px 12px 6px; }
  .env-row > .c-env { grid-area: env; }
  .env-row > .c-note { grid-area: note; padding: 8px 0 0; margin-inline-start: 28px; border-block-start: 1px solid var(--line-2); }
  .note-cell::before { content: "备注"; display: block; margin-bottom: 4px; color: var(--sub); font-size: var(--text-sub); font-weight: 500; }
  .env-row > .c-actions { grid-area: actions; }
  .env-row > .c-status { grid-area: status; padding-inline-start: 28px; }
  .env-row > .c-claude { grid-area: claude; padding-inline-start: 28px; }
  .env-row > .c-quota { grid-area: quota; }
  .env-row > .c-quota:empty, .env-row > .c-claude:empty { display: none; }
  .env-cols > .c-exit, .env-cols > .c-browser, .env-cols > .c-sub2api { display: none; }
  .cell-actions .btn.action { min-width: 0; }
  .cell-actions .placeholder { display: none; }
  .env-detail { padding: 2px 12px 14px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .quota-windows { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; }
  .ptable tr { display: grid; grid-template-columns: 30px minmax(0, 1fr); padding: 12px 12px 12px 0; border-top: 1px solid var(--line-2); }
  .ptable tbody tr:first-child { border-top: 0; }
  .ptable td { border: 0; padding: 0 0 8px; }
  .ptable .select-cell { grid-row: 1 / 7; padding: 2px 0 0 12px; width: auto; }
  .ptable .note-cell { padding-block: 8px 0; margin-top: 4px; border-block-start: 1px solid var(--line-2); }
  .ptable td:last-child { padding-bottom: 0; }
  .ptable td.empty-state { grid-column: 1 / -1; }
  .subscription-table tr { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .mobile-select-all { display: inline-flex; }
  .site-foot .bar-in > :last-child { margin-inline-start: 0; }
}
@media (max-width: 480px) {
  .list-head { flex-direction: column; align-items: stretch; }
  .top .seg a { padding: 0 9px; }
  .account-btn .name { display: none; }
  .kiro-credit-grid { gap: 8px; }
  .kiro-credit-grid strong { font-size: 15px; }
  .enroll-numbers { grid-template-columns: minmax(0, 1fr); }
  .toolbar .summary { white-space: normal; line-height: 1.6; }
}

/* bigger targets for fingers; 16px keeps iOS from zooming into a focused field */
@media (pointer: coarse) {
  .btn.action, .btn.primary { height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
  .seg button, .seg a { height: 32px; }
  .chip { height: 32px; }
  .menu-item { height: 40px; }
  .input, .input.lg { height: 42px; font-size: 16px; }
  textarea.input, textarea.input.note-input { height: auto; font-size: 16px; }
  .env-toggle { min-height: 40px; }
}

/* motion only where it is welcome */
@media (prefers-reduced-motion: reduce) {
  .env-toggle .chev, .more-info > summary .i { transition-property: none; }
  .sk { animation: none; }
}
@media (forced-colors: active) {
  .qm-bar, .quota-track { border: 1px solid CanvasText; }
  .env.open { outline: 1px solid CanvasText; }
}

/* proxies: bigger "导入 Docker" hit area + room for the action buttons (2026-11-02) */
.ptable .node-actions .btn { height: var(--h-control); }
.ptable .node-actions .btn.import-docker { color: var(--accent); font-weight: 500; }
@media (min-width: 821px) { .ptable .actions-col { width: 270px; } .ptable .note-col { width: 20%; } .ptable .node-actions { flex-wrap: nowrap; } }
