:root {
  --bg: oklch(0.97 0.004 220);
  --surface: oklch(0.995 0.002 220);
  --surface-soft: oklch(0.978 0.004 220);
  --text: oklch(0.27 0.02 230);
  --muted: oklch(0.5 0.018 230);
  --line: oklch(0.89 0.01 220);
  --line-strong: oklch(0.75 0.018 220);
  --accent: oklch(0.44 0.055 183);
  --accent-dark: oklch(0.35 0.05 183);
  --good-bg: oklch(0.94 0.025 165);
  --good-text: oklch(0.39 0.075 165);
  --warn-bg: oklch(0.95 0.038 82);
  --warn-text: oklch(0.42 0.09 72);
  --bad-bg: oklch(0.95 0.025 25);
  --bad-text: oklch(0.43 0.12 25);
  --neutral-bg: oklch(0.93 0.008 220);
  --neutral-text: oklch(0.4 0.022 225);
  --header-bg: oklch(0.23 0.025 220);
  --header-surface: oklch(0.29 0.026 220);
  --header-text: oklch(0.94 0.006 210);
  --header-muted: oklch(0.74 0.018 210);
  --danger-fill: oklch(0.48 0.13 25);
  --danger-fill-hover: oklch(0.4 0.12 25);
  --focus-ring: oklch(0.68 0.08 183 / 0.45);
  --shadow: 0 1px 2px oklch(0.2 0.015 220 / 0.08);
  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-height: 100%; max-width: 100%; overflow-x: clip; }
body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: clip; background: var(--bg); line-height: 1.5; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; }
a, button, input, select, textarea { outline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus-ring); }

.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid oklch(0.16 0.02 220); }
.site-header__inner { max-width: 1440px; min-height: 64px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: stretch; gap: clamp(1.25rem, 2.6vw, 2.75rem); }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; min-width: 196px; color: var(--header-text); text-decoration: none; }
.brand:hover { color: var(--header-text); }
.brand__mark { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; flex: 0 0 auto; border: 1px solid oklch(0.58 0.04 183); border-radius: 0.3rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 0.9rem; font-weight: 600; line-height: 1.35; }
.brand small { color: var(--header-muted); font-size: 0.69rem; letter-spacing: 0.01em; }
.main-nav { display: flex; align-items: stretch; gap: 0.15rem; flex: 1; }
.main-nav a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 0.72rem; border-bottom: 2px solid transparent; color: var(--header-muted); font-size: 0.82rem; font-weight: 510; letter-spacing: 0.02em; text-decoration: none; }
.main-nav a:hover { background: var(--header-surface); color: var(--header-text); }
.main-nav a.is-active { border-bottom-color: var(--accent); color: var(--header-text); font-weight: 600; }
.account-controls { margin-left: auto; display: flex; align-items: center; gap: 0; color: var(--header-text); font-size: 0.78rem; white-space: nowrap; }
.account-controls > * { min-height: 44px; display: inline-flex; align-items: center; padding: 0 0.7rem; border-left: 1px solid oklch(1 0 0 / 0.09); }
.account-controls form { padding: 0; }
.account-controls form .header-action { min-height: 44px; padding: 0 0.7rem; }
.branch-switcher select { max-width: 10rem; min-height: 44px; border: 1px solid oklch(1 0 0 / 0.18); background: var(--header-surface); color: var(--header-text); }
.branch-name { color: var(--header-text); font-weight: 600; }
.user-name { color: var(--header-muted); }
.header-action { border: 0; border-left: 1px solid oklch(1 0 0 / 0.09); background: transparent; color: var(--header-text); cursor: pointer; letter-spacing: 0.02em; }
.header-action:hover { background: var(--header-surface); color: var(--header-text); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.page-shell { max-width: 1440px; min-height: calc(100vh - 132px); margin: 0 auto; padding: clamp(1rem, 2vw, 1.6rem) 1.5rem; }
.site-footer { max-width: 1440px; margin: 0 auto; padding: 1rem 1.5rem 2rem; color: var(--muted); font-size: 0.78rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin: 0.1rem 0 0; font-family: var(--font-ui); font-size: 1.65rem; font-weight: 600; line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; }
.page-heading__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); word-break: break-all; }
.text-link { font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.login-body { min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: var(--operations-sidebar) minmax(0, 1fr); }
.login-rail { position: fixed; inset: 0 auto 0 0; z-index: 10; width: var(--operations-sidebar); display: flex; justify-content: center; border-right: 1px solid var(--line); background: var(--surface); }
.login-brand { width: 40px; height: 40px; display: grid; place-items: center; margin-top: 14px; border-radius: 8px; background: var(--text); color: var(--surface); font-family: "Aptos Display", "PingFang SC", sans-serif; font-size: 18px; font-weight: 600; }
.login-workspace { grid-column: 2; min-width: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr); }
.login-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.login-topbar__title { display: flex; align-items: baseline; gap: 10px; }
.login-topbar__title h1 { margin: 0; font-family: "Aptos Display", "PingFang SC", sans-serif; font-size: 18px; font-weight: 600; line-height: 1.35; }
.login-topbar__title span, .login-topbar__status { color: var(--muted); font-size: 12px; }
.login-topbar__status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.login-topbar__status i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.login-content { min-width: 0; display: grid; place-items: center; padding: 40px 24px 64px; }
.login-panel { width: min(100%, 400px); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 28px oklch(20% 0.008 80 / 0.08); }
.login-panel__header { margin-bottom: 22px; }
.login-panel__header h2 { margin: 4px 0 0; font-family: "Aptos Display", "PingFang SC", sans-serif; font-size: 22px; font-weight: 600; line-height: 1.4; }
.login-panel__header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.login-form .field { margin-bottom: 14px; }
.login-form .field label { margin-bottom: 5px; font-size: 12px; font-weight: 600; }
.login-form input:not([type="submit"]) { min-height: 42px; border-color: var(--line-strong); border-radius: 5px; background: var(--surface); }
.login-form .login-form__submit { width: 100%; margin-top: 4px; border-color: oklch(75% 0.14 96); border-radius: 5px; background: var(--accent); color: var(--text); }
.login-form .login-form__submit:hover { background: oklch(79% 0.17 96); color: var(--text); }
.login-panel__help { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; text-align: center; }

.toast-container { position: fixed; top: 1rem; left: 0; right: 0; z-index: 100; pointer-events: none; }
.toast-wrapper { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; padding: 0 1rem; pointer-events: none; transition: transform 230ms cubic-bezier(0.21, 1.02, 0.73, 1); will-change: transform; }
.toast-content { display: flex; width: min(28rem, calc(100vw - 2rem)); min-height: 3.5rem; align-items: flex-start; gap: 0.75rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.45rem; background: var(--surface); box-shadow: 0 8px 24px oklch(0.2 0.015 220 / 0.16); pointer-events: auto; animation: toast-enter 350ms cubic-bezier(0.21, 1.02, 0.73, 1) both; will-change: transform, opacity; }
.toast-icon { display: inline-flex; width: 1.8rem; height: 1.8rem; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 0.35rem; }
.toast-icon svg, .toast-close svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast-wrapper--notice .toast-icon { color: var(--good-text); background: var(--good-bg); }
.toast-wrapper--alert .toast-icon { color: var(--bad-text); background: var(--bad-bg); }
.toast-message { min-width: 0; flex: 1; align-self: center; color: var(--text); font-size: 0.82rem; line-height: 1.5; overflow-wrap: anywhere; }
.toast-close { display: inline-flex; width: 2rem; height: 2rem; flex: 0 0 auto; align-items: center; justify-content: center; margin: -0.1rem -0.1rem -0.1rem 0; padding: 0; border: 1px solid transparent; border-radius: 0.35rem; background: transparent; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--surface-soft); color: var(--text); }
.toast-wrapper[data-exiting="true"] .toast-content { animation: toast-exit 400ms cubic-bezier(0.06, 0.71, 0.55, 1) forwards; }

@keyframes toast-enter {
  from { transform: translate3d(0, -150%, 0) scale(0.96); opacity: 0; }
  to { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}

@keyframes toast-exit {
  from { transform: translate3d(0, 0, -1px) scale(1); opacity: 1; }
  to { transform: translate3d(0, -150%, -1px) scale(0.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .toast-content { animation: none; }
  .toast-wrapper[data-exiting="true"] .toast-content { animation: toast-fade-out 400ms ease forwards; }
}

@keyframes toast-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; margin-bottom: 1.25rem; }
.metric { display: block; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 0.5rem; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.metric:hover { border-color: var(--line-strong); color: inherit; }
.metric__value { display: block; font-size: 1.7rem; font-weight: 750; line-height: 1; margin-bottom: 0.45rem; }
.metric__label { display: block; font-weight: 650; font-size: 0.88rem; }
.metric__hint { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 0.2rem; }
.metric--profit { border-top: 3px solid var(--good-text); }
.profit-metrics .metric__value { font-variant-numeric: tabular-nums; }
.profit-totals { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; margin-bottom: 1.25rem; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: var(--surface); }
.profit-totals dl { display: flex; gap: 2rem; margin: 0; }
.profit-totals dt { color: var(--muted); font-size: 0.7rem; }
.profit-totals dd { margin: 0.1rem 0 0; font-size: 1rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.profit-totals p { max-width: 520px; margin: 0; color: var(--muted); font-size: 0.72rem; text-align: right; }
.profit-table td { vertical-align: middle; }
.profit-positive { color: var(--good-text); }
.profit-negative { color: var(--bad-text); }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 0.5rem; box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; min-width: 0; }
.panel--soft { background: var(--surface-soft); }
.panel--danger { border-left: 4px solid var(--bad-text); }
.panel--warning { border-left: 4px solid var(--warn-text); }
.panel__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.8rem; margin-bottom: 0.8rem; }
.panel__header h2, .panel__header h3 { margin: 0; }
.panel h2 { font-size: 1.05rem; }
.panel h3 { font-size: 0.9rem; margin: 1rem 0 0.35rem; }

.badge { display: inline-block; padding: 0.17rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.02em; white-space: nowrap; }
.badge--good { color: var(--good-text); background: var(--good-bg); }
.badge--warn { color: var(--warn-text); background: var(--warn-bg); }
.badge--bad { color: var(--bad-text); background: var(--bad-bg); }
.badge--neutral { color: var(--neutral-text); background: var(--neutral-bg); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0.45rem; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { background: var(--surface-soft); color: var(--muted); text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0; }
th, td { padding: 0.68rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }

.definition-list { display: grid; grid-template-columns: minmax(120px, 0.38fr) minmax(0, 1fr); gap: 0.45rem 0.9rem; margin: 0; }
.definition-list dt { color: var(--muted); font-size: 0.76rem; }
.definition-list dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline__meta { color: var(--muted); font-size: 0.72rem; margin-top: 0.2rem; }

form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { margin-bottom: 0.8rem; }
.field label { display: block; font-size: 0.76rem; font-weight: 700; margin-bottom: 0.25rem; }
.field small { display: block; color: var(--muted); margin-top: 0.2rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="datetime-local"], select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 0.35rem; background: white; color: var(--text); padding: 0.55rem 0.62rem; }
textarea { min-height: 7rem; resize: vertical; }
textarea.tall { min-height: 15rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.checkbox { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: 0.35rem; background: var(--surface-soft); }
.checkbox input { margin-top: 0.2rem; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--accent-dark); border-radius: 0.3rem; background: var(--accent); color: var(--surface); padding: 0.55rem 0.9rem; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.02em; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--accent-dark); color: var(--surface); }
.button--secondary { border-color: var(--line-strong); background: white; color: var(--text); }
.button--secondary:hover { background: var(--surface-soft); color: var(--text); }
.button--danger { border-color: var(--bad-text); background: var(--danger-fill); color: var(--surface); }
.button--danger:hover { background: var(--danger-fill-hover); color: var(--surface); }
.button--small { min-height: 44px; padding: 0.4rem 0.65rem; font-size: 0.72rem; }
.button-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 0.45rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; min-width: 150px; flex: 1; }

.source-markdown, .json-block { margin: 0; padding: 0.9rem; max-height: 38rem; overflow: auto; white-space: pre-wrap; word-break: break-word; background: #111a1f; color: #dce5e8; border-radius: 0.35rem; font: 0.76rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.json-block { max-height: 18rem; }
.identity-offer { border-top: 3px solid var(--accent); }
.identity-offer--proposed { border-top-color: #986c14; }
.warning-box { padding: 0.75rem; border: 1px solid #e5ca8c; background: var(--warn-bg); border-radius: 0.4rem; color: var(--warn-text); }
.empty-state { padding: 1.6rem; text-align: center; background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 0.45rem; color: var(--muted); }
.empty-state strong { color: var(--text); }
.empty-state p { margin: 0.35rem 0 0; }
.validation-errors { padding: 0.75rem; margin-bottom: 0.8rem; border: 1px solid #e3a29f; border-radius: 0.4rem; background: var(--bad-bg); color: var(--bad-text); }
.validation-errors ul { margin: 0.35rem 0 0; }
.search-bar { display: flex; gap: 0.55rem; align-items: end; flex-wrap: wrap; }
.search-bar .field { margin: 0; flex: 1; min-width: 240px; }
.filter-links { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.7rem; }
.filter-links a { padding: 0.3rem 0.48rem; border: 1px solid var(--line); border-radius: 0.3rem; background: white; text-decoration: none; font-size: 0.72rem; }
.filter-links a.active { border-color: var(--accent); background: var(--good-bg); font-weight: 700; }
.task-entry { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.task-entry h2 { margin: 0.2rem 0 0.35rem; }
.task-entry p:last-child { margin-bottom: 0; max-width: 860px; }

.page-heading--compact { align-items: center; margin-bottom: 0.9rem; }
.page-heading--compact p:last-child { margin-bottom: 0; }
.queue-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); }
.queue-column { position: relative; min-width: 0; min-height: 17.5rem; padding: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.queue-column:last-child { border-right: 0; }
.queue-column--unpublish { box-shadow: inset 0 3px 0 var(--warn-text); }
.queue-column--failed { box-shadow: inset 0 3px 0 var(--bad-text); }
.queue-column__header, .queue-column__header > div { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.queue-column__header { min-height: 4rem; padding: 0.85rem 1rem 0.75rem; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.queue-column__header h2 { font-size: 0.9rem; font-weight: 600; margin: 0; }
.queue-column__index { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 0.7rem; }
.queue-count { min-width: 2rem; font-size: 1.45rem; font-weight: 600; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.queue-column--unpublish .queue-count { color: var(--warn-text); }
.queue-column--failed .queue-count { color: var(--bad-text); }
.queue-column__instruction { min-height: 2.7rem; margin: 0.65rem 0; color: var(--muted); font-size: 0.75rem; }
.queue-list { flex: 1; min-height: 0; padding: 0 1rem; }
.queue-item { display: block; min-height: 64px; padding: 0.7rem 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.queue-item:hover { color: var(--text); background: var(--surface-soft); box-shadow: -1rem 0 var(--surface-soft), 1rem 0 var(--surface-soft); }
.queue-item strong, .queue-item span { display: block; overflow-wrap: anywhere; }
.queue-item strong { font-size: 0.8rem; font-weight: 600; line-height: 1.5; }
.queue-item span { margin-top: 0.18rem; color: var(--muted); font-size: 0.7rem; line-height: 1.5; }
.queue-column--failed .queue-item span { color: var(--bad-text); }
.queue-item--action > a { display: block; color: var(--text); font-size: 0.8rem; font-weight: 600; line-height: 1.5; text-decoration: none; }
.queue-item--action form, .queue-item--action .button { margin-top: 0.55rem; }
.queue-empty { display: grid; min-height: 7.5rem; place-items: center; margin: 0; color: var(--muted); font-size: 0.75rem; text-align: center; }
.queue-empty::before { content: "—"; display: block; margin-bottom: -2.5rem; color: var(--line-strong); }
.queue-column__footer { display: flex; min-height: 44px; align-items: center; margin: 0 1rem; border-top: 1px solid var(--line); color: var(--text); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-decoration: none; }
.queue-column__footer::after { content: "→"; margin-left: auto; color: var(--muted); }
.queue-column__footer:hover { color: var(--text); }
.operations-strip { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 0.95fr); border: 1px solid var(--line-strong); background: var(--surface); margin-bottom: 1rem; }
.operation-block { min-width: 0; padding: 0.9rem 1rem; border-right: 1px solid var(--line); }
.operation-block:last-child { border-right: 0; }
.operation-block header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; }
.operation-block h2 { margin: 0; font-size: 0.86rem; font-weight: 600; }
.operation-block header a { color: var(--text); font-size: 0.72rem; text-underline-offset: 3px; }
.operation-block p { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.73rem; line-height: 1.65; }
.operation-block p + p { margin-top: 0.2rem; }
.compact-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0.65rem 0 0; }
.compact-stats div { min-width: 0; }
.compact-stats div + div { padding-left: 0.8rem; border-left: 1px solid var(--line); }
.compact-stats dt { color: var(--muted); font-size: 0.68rem; }
.compact-stats dd { margin: 0.1rem 0 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.background-status { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 0.75rem; padding: 0 0.9rem; border: 1px solid var(--line); border-top: 0; background: var(--surface-soft); color: var(--muted); font-size: 0.74rem; }
.background-status > span { display: inline-flex; align-items: center; gap: 0.4rem; }
.background-status > span::before { content: ""; width: 0.45rem; height: 0.45rem; flex: 0 0 auto; border-radius: 50%; background: var(--good-text); box-shadow: 0 0 0 3px var(--good-bg); }
.background-status strong { color: var(--text); font-variant-numeric: tabular-nums; }
.background-status a { color: var(--text); font-weight: 600; }
.table-actions { width: 1%; white-space: nowrap; }
.pagy.series-nav { display: flex; justify-content: center; align-items: center; gap: 0.35rem; padding: 1rem 0; font-size: 0.78rem; }
.pagy.series-nav a { display: inline-grid; min-width: 2rem; min-height: 2rem; place-items: center; padding: 0.25rem; border: 1px solid transparent; color: var(--text); font-weight: 700; text-decoration: none; }
.pagy.series-nav a[href]:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.pagy.series-nav a[aria-current="page"] { border-color: var(--line-strong); background: var(--surface-soft); }
.pagy.series-nav a[aria-disabled="true"] { color: var(--muted); }
.advanced-records > summary { cursor: pointer; padding: 0.9rem 0; border-top: 1px solid var(--line-strong); font-size: 0.85rem; font-weight: 700; }
.advanced-records[open] > summary { margin-bottom: 1rem; }

.segmented-nav { display: flex; gap: 0; min-width: 0; overflow-x: auto; margin-bottom: 0.8rem; border-bottom: 1px solid var(--line-strong); }
.segmented-nav a { display: inline-flex; align-items: center; gap: 0.38rem; padding: 0.48rem 0.68rem; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 0.75rem; white-space: nowrap; }
.segmented-nav a.is-active { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }
.task-filter__count { min-width: 1.3em; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.task-results-summary { display: flex; align-items: baseline; gap: 0.35rem; min-height: 1.4rem; margin: 0 0 0.55rem; color: var(--muted); font-size: 0.72rem; }
.task-results-summary strong { color: var(--text); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.task-records { min-width: 0; }
.task-records .records-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 1rem; align-items: start; }
.task-records__table-wrap { min-width: 0; max-width: 100%; overflow-x: hidden; }
.task-records__table { width: 100%; min-width: 0; table-layout: fixed; }
.task-records__column-product { width: 29%; }
.task-records__column-progress { width: 21%; }
.task-records__column-next-step { width: 20%; }
.task-records__column-account { width: 16%; }
.task-records__column-updated-at { width: 14%; }
.task-records__table th { padding: 0.58rem 0.65rem; }
.task-records__table td { min-width: 0; height: 64px; padding: 0.58rem 0.65rem; vertical-align: middle; overflow-wrap: anywhere; }
.task-records .operation-table td:first-child { min-width: 0; }
.task-records__row { cursor: pointer; }
.task-records__row:hover, .task-records__row.is-selected { background: var(--surface-soft); }
.task-records__row.is-selected { box-shadow: inset 3px 0 0 var(--text); }
.task-records__product { display: block; min-width: 0; font-weight: 650; }
.task-records__product-link { display: block; min-width: 0; overflow-wrap: anywhere; }
.task-records__subline, .task-records__account, .task-records__updated-at, .task-records__next-step { display: block; min-width: 0; overflow-wrap: anywhere; }
.task-records__updated-at--compact { display: none; }
.task-records__status { display: block; font-weight: 650; }
.task-records__status--queued, .task-records__status--running, .task-records__status--waiting { color: var(--warn-text); }
.task-records__status--failed { color: var(--bad-text); }
.task-records__status--completed { color: var(--good-text); }
.task-records__status--stopped, .task-records__status--unknown { color: var(--muted); }
.task-records__progress-line { display: flex; align-items: center; gap: 0.45rem; min-width: 0; margin-top: 0.25rem; }
.task-records__progress-track { display: block; width: 54px; height: 3px; flex: 0 0 54px; background: var(--line); }
.task-records__progress-fill { display: block; height: 100%; background: currentColor; }
.task-records__status--failed + .task-records__progress-line { color: var(--bad-text); }
.task-records__status--completed + .task-records__progress-line { color: var(--good-text); }
.task-records__timeline { position: relative; max-width: 100%; margin: 0 0 1rem; padding: 0.1rem 0 0 1.4rem; list-style: none; }
.task-records__timeline::before { content: ""; position: absolute; left: 0.7rem; top: 0.35rem; bottom: 0.45rem; width: 1px; background: var(--line-strong); }
.task-records__timeline-step { position: relative; min-width: 0; padding: 0 0 0.9rem 0.65rem; }
.task-records__timeline-step:last-child { padding-bottom: 0.2rem; }
.task-records__timeline-step::before { content: ""; position: absolute; left: -1.075rem; top: 0.32rem; width: 0.75rem; height: 0.75rem; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--line-strong); }
.task-records__timeline-step--success::before { background: var(--good-text); }
.task-records__timeline-step--failure::before { background: var(--bad-text); }
.task-records__timeline-step--pending::before { background: var(--warn-text); }
.task-records__timeline-step--running::before { background: var(--accent); }
.task-records__timeline-step--cancelled::before { background: var(--muted); }
.task-records__timeline-step time { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; line-height: 1.4; }
.task-records__timeline-step h4 { margin: 0.12rem 0 0; font-size: 0.8rem; line-height: 1.45; overflow-wrap: anywhere; }
.task-records__timeline-step p { margin: 0.12rem 0 0; color: var(--muted); font-size: 0.74rem; line-height: 1.5; overflow-wrap: anywhere; }
.task-records__detail-link { display: inline-flex; margin-top: 0.9rem; }
.task-records .record-panel { position: sticky; top: 84px; min-width: 0; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface); }
.task-records .record-panel-head { min-width: 0; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--line); }
.task-records .record-panel-head h3 { margin: 0.15rem 0 0; overflow-wrap: anywhere; font-size: 0.95rem; }
.task-records .record-panel-body { min-width: 0; max-height: calc(100vh - 104px); overflow-y: auto; padding: 0.9rem; }
.task-records .record-facts { margin: 0 0 0.9rem; }
.task-records .record-facts div { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.42rem 0; border-bottom: 1px solid var(--line); }
.task-records .record-facts dt { flex: 0 0 auto; color: var(--muted); }
.task-records .record-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; text-align: right; }
.task-records .record-summary { padding: 0.65rem 0.7rem; margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-left: 3px solid var(--line-strong); color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.task-records .record-summary.task-records__summary-panel--status { border-left-color: var(--accent); background: var(--surface-soft); }
.task-records .record-summary.task-records__summary-panel--result { border-left-color: var(--good-text); background: var(--good-bg); }
.task-records .record-summary.task-records__summary-panel--error { border-left-color: var(--bad-text); background: var(--bad-bg); }
.task-records .record-summary > strong { display: block; color: var(--text); font-size: 0.74rem; }
.task-records .record-summary p { margin: 0.18rem 0 0; overflow-wrap: anywhere; }
.task-records__summary--error { color: var(--bad-text); }
.task-records__summary--result { color: var(--good-text); }
.task-records__summary--status { color: var(--muted); }
.task-records__recovery { display: block; margin-top: 0.42rem; color: var(--text); font-size: 0.72rem; overflow-wrap: anywhere; }
.task-records__source-link { display: inline-flex; max-width: 100%; margin-top: 0.8rem; overflow-wrap: anywhere; }
.operation-table td { vertical-align: middle; }
.operation-table td:first-child { min-width: 230px; }
.table-note { max-width: 280px; margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; }
.technical-details { color: var(--muted); font-size: 0.72rem; }
.technical-details summary { cursor: pointer; font-weight: 650; }
.technical-details--inline { margin-top: 0.28rem; }
.technical-identifiers { display: grid; gap: 0.18rem 0.6rem; margin: 0.35rem 0 0; }
.technical-identifiers > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem; min-width: 0; }
.technical-identifiers dt { color: var(--muted); }
.technical-identifiers dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.technical-identifiers dd a { overflow-wrap: anywhere; }
.technical-details--block { padding: 0.85rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.technical-details--block > summary { margin-bottom: 0; color: var(--text); }
.technical-details--block[open] > summary { margin-bottom: 0.8rem; }
.live-status { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.72rem; }
.live-status > span { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); }
.status-banner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 0.35fr); gap: 1rem; padding: 1rem 1.1rem; margin-bottom: 1rem; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); background: var(--surface); }
.status-banner--retryable_failed, .status-banner--terminal_failed { border-left-color: var(--bad-text); }
.status-banner--confirmed { border-left-color: var(--good-text); }
.status-banner h2 { margin: 0.08rem 0; font-size: 1.2rem; }
.status-banner p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.status-banner__label, .next-step > span { color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.next-step { display: flex; flex-direction: column; justify-content: center; padding-left: 1rem; border-left: 1px solid var(--line); }
.next-step strong { margin: 0.15rem 0 0.35rem; font-size: 0.88rem; }
.inline-alert { padding: 0.8rem 1rem; margin-bottom: 1rem; border-left: 3px solid var(--warn-text); background: var(--warn-bg); }
.inline-alert--danger { border-left-color: var(--bad-text); background: var(--bad-bg); }
.inline-alert p { margin: 0.25rem 0 0; font-size: 0.8rem; }
.task-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 0.32fr); border: 1px solid var(--line); background: var(--surface); margin-bottom: 1.2rem; }
.primary-action { padding: 1rem; border-left: 3px solid var(--accent); background: var(--surface); }
.primary-action h2 { margin: 0.1rem 0 0.25rem; font-size: 1.05rem; }
.primary-action header > p:last-child { margin: 0; color: var(--muted); font-size: 0.8rem; }
.primary-action--horizontal { display: grid; grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr); gap: 1.2rem; margin-bottom: 1rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.task-actions { padding: 1rem; border-left: 1px solid var(--line); }
.task-actions h2 { margin: 0 0 0.6rem; font-size: 0.85rem; }
.submission-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.6rem; margin-top: 0.8rem; }
.submission-form .field { margin: 0; }
.submission-form--compact { margin: 0; }
.manual-preparation { margin-bottom: 1rem; }
.manual-preparation__form { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(130px, 0.6fr) minmax(180px, 1fr) auto; gap: 0.6rem; align-items: end; width: 100%; }
.manual-preparation__form .field { min-width: 0; margin: 0; }
.manual-preparation__form input, .manual-preparation__form select { width: 100%; }
.cancel-details { margin-top: 0.9rem; padding-top: 0.7rem; border-top: 1px solid var(--line); font-size: 0.75rem; }
.cancel-details summary { cursor: pointer; color: var(--bad-text); }
.cancel-details form { margin-top: 0.65rem; }
.plain-section { padding: 1rem 0; margin-bottom: 1rem; border-top: 1px solid var(--line-strong); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.65rem; }
.section-header h2 { margin: 0.1rem 0 0; font-size: 0.98rem; }
.attempt-list { border-top: 1px solid var(--line); }
.attempt-row { display: grid; grid-template-columns: 100px 110px minmax(190px, 1fr) minmax(150px, 1fr); gap: 0.7rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.76rem; }
.attempt-row--link { color: inherit; text-decoration: none; }
.attempt-row--link:hover { color: var(--accent-dark); background: var(--surface-soft); }
.source-summary { display: flex; align-items: center; gap: 0.65rem; }
.source-summary > span:last-child { color: var(--muted); font-size: 0.76rem; }
.definition-list--wide { grid-template-columns: minmax(110px, 0.2fr) minmax(0, 1fr); max-width: 900px; }
.secondary-action { padding: 0.8rem 0; margin-bottom: 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.secondary-action > summary { cursor: pointer; font-weight: 700; font-size: 0.8rem; }
.secondary-action[open] > summary { margin-bottom: 0.75rem; }

@media (max-width: 820px) {
  .task-records .records-layout { grid-template-columns: 1fr; }
  .task-records .record-panel { position: static; }
  .task-records .record-panel-body { max-height: none; overflow: visible; }
}

@media (min-width: 821px) and (max-width: 1100px) {
  .task-records__updated-at--wide { display: none; }
  .task-records__updated-at--compact { display: block; }
}

@media (max-width: 860px) {
  .site-header__inner { flex-wrap: wrap; gap: 0 1rem; padding-top: 0.45rem; }
  .main-nav { order: 3; width: 100%; flex-basis: 100%; border-top: 1px solid oklch(1 0 0 / 0.09); }
  .main-nav a { flex: 1; justify-content: center; }
  .account-controls { margin-left: auto; }
  .grid--2, .grid--3, .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .page-heading { flex-direction: column; }
  .page-heading--compact { flex-direction: row; }
  .task-entry { align-items: flex-start; flex-direction: column; }
  .page-heading__actions { justify-content: flex-start; }
  .definition-list { grid-template-columns: 1fr; }
  .definition-list dt { margin-top: 0.35rem; }
  .queue-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-column { min-height: 15.5rem; }
  .queue-column:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .queue-column:nth-child(2n) { border-right: 0; }
  .operations-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profit-totals, .profit-totals dl { flex-direction: column; }
  .profit-totals dl { gap: 0.7rem; }
  .profit-totals p { text-align: left; }
  .operation-block { padding: 0.85rem; }
  .task-workspace, .primary-action--horizontal { grid-template-columns: 1fr; }
  .task-actions { border-left: 0; border-top: 1px solid var(--line); }
  .attempt-row { grid-template-columns: 90px 100px minmax(0, 1fr); }
  .attempt-row > *:last-child { grid-column: 3; }
}

@media (max-width: 680px) {
  .operations-strip { grid-template-columns: 1fr; }
  .operation-block { border-right: 0; border-bottom: 1px solid var(--line); }
  .operation-block:last-child { border-bottom: 0; }
}

@media (max-width: 520px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-rail { position: absolute; width: 64px; height: 64px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-brand { width: 36px; height: 36px; margin-top: 14px; font-size: 16px; }
  .login-workspace { grid-column: 1; }
  .login-topbar { padding: 0 16px 0 64px; }
  .login-topbar__title span, .login-topbar__status { display: none; }
  .login-content { align-items: start; padding: 32px 16px; }
  .login-panel { padding: 22px 20px; box-shadow: none; }
  .site-header__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; padding: 0.65rem 1rem 0; }
  .brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .brand strong { white-space: nowrap; }
  .brand small { display: none; }
  .main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-column: 1 / -1; grid-row: 2; width: 100%; margin-top: 0.55rem; }
  .main-nav a { min-width: 0; min-height: 42px; padding: 0 0.35rem; font-size: 0.78rem; }
  .account-controls { grid-column: 2; grid-row: 1; margin-left: 0; justify-self: end; }
  .account-controls > * { min-height: 44px; padding: 0 0.5rem; }
  .page-shell { padding: 1rem; }
  .page-heading--compact { align-items: center; gap: 0.75rem; }
  .page-heading h1 { font-size: 1.4rem; }
  .page-heading__actions { flex: 0 0 auto; }
  .queue-board { grid-template-columns: 1fr; }
  .queue-column { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .queue-column:nth-child(n) { border-right: 0; }
  .queue-column:last-child { border-bottom: 0; }
  .queue-list { min-height: 4.75rem; }
  .queue-column__instruction { min-height: 0; }
  .background-status { align-items: flex-start; flex-direction: column; justify-content: center; gap: 0.15rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .status-banner { grid-template-columns: 1fr; }
  .next-step { padding: 0.7rem 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .submission-form { grid-template-columns: 1fr; }
  .submission-form .button { width: 100%; }
  .manual-preparation__form { grid-template-columns: 1fr; }
  .manual-preparation__form .button { width: 100%; }
  .attempt-row { grid-template-columns: minmax(0, 1fr) auto; }
  .attempt-row > *:nth-child(n+3) { grid-column: 1 / -1; }
  .source-summary { align-items: flex-start; flex-wrap: wrap; }
  .operation-table td:first-child { min-width: 190px; }
  .product-table, .product-table tbody, .product-table tr, .product-table td { display: block; width: 100%; }
  .product-table thead { display: none; }
  .product-table tr { position: relative; padding: 0.75rem 5.5rem 0.75rem 0.75rem; border-bottom: 1px solid var(--line); }
  .product-table tr:last-child { border-bottom: 0; }
  .product-table td { padding: 0.18rem 0; border-bottom: 0; overflow-wrap: anywhere; }
  .product-table .table-actions { position: absolute; top: 0.75rem; right: 0.75rem; width: auto; padding: 0; }
}
