:root {
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #17223b;
  background: #f1f4f9;
  font-synthesis: none;
  --paper: #f1f4f9;
  --surface: #fff;
  --ink: #17223b;
  --muted: #53637e;
  --border: #dfe6f1;
  --accent: #3749dc;
  --accent-dark: #2b3cbf;
  --navy: #131c34;
  --danger: #ae3547;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-underline-offset: .25em; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
:focus-visible { outline: 3px solid #5364ec; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.3rem); font-weight: 750; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 720; line-height: 1.35; }
.muted { color: var(--muted); font-size: .87rem; line-height: 1.6; }
code, .mono { font-family: "IBM Plex Mono", Consolas, monospace; font-size: .89em; font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: 1rem; top: -6rem; z-index: 5; background: white; padding: .65rem 1rem; border-radius: 6px; }
.skip:focus { top: .6rem; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { width: min(1160px, calc(100% - 64px)); min-height: 64px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: .98rem; font-weight: 740; }
.brand-icon { display: inline-grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: white; font: 780 1.04rem/1 "Inter", system-ui, sans-serif; }
.quiet { min-height: 36px; padding: 6px 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: .83rem; font-weight: 620; white-space: nowrap; }
.quiet:hover:not(:disabled) { background: #edf1f9; color: var(--ink); }

.layout { width: min(1160px, calc(100% - 64px)); margin: 0 auto; padding: 34px 0 56px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 2px 0 25px; }
.page-head .muted { margin-top: 7px; overflow-wrap: anywhere; }
.card-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
.card-identity > span:first-child { min-width: 0; }
.feed { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 6px 11px; border: 1px solid #dce5f0; border-radius: 100px; background: #fff; color: #50617b; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.status-dot { display: inline-block; background: currentColor; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.feed[data-state="live"] .status-dot { color: #188267; }
.feed[data-state="stale"] { color: #865817; border-color: #eddfbd; background: #fff8e7; }
.banner { padding: 11px 15px; margin-bottom: 16px; background: #e9f5ee; color: #23604a; border: 1px solid #c5e6d7; border-radius: 10px; font-size: .88rem; line-height: 1.55; overflow-wrap: anywhere; }
.banner[data-kind="error"] { background: #fff0f2; color: var(--danger); border-color: #f1ced6; }
#loading { background: #edf1fe; color: #364997; border-color: #d6def7; }
#notice { position: sticky; top: 10px; z-index: 2; }

.login-grid { width: min(918px, 100%); display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); margin: clamp(24px, 9vh, 94px) auto 0; border: 1px solid #e0e6f1; border-radius: 20px; box-shadow: 0 18px 45px #17223b0c; background: white; overflow: hidden; }
.login-intro, .login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 4.1vw, 54px); min-width: 0; }
.login-intro { min-height: 362px; position: relative; isolation: isolate; background: linear-gradient(145deg, #131c34, #1d2b58); color: #fff; overflow: hidden; }
.login-intro::after, .task-panel::after { content: ""; position: absolute; inline-size: 310px; block-size: 310px; border: 1px solid #bac9ff32; border-radius: 50%; box-shadow: 0 0 0 27px #bac9ff12, 0 0 0 56px #bac9ff0b; right: -160px; top: -170px; z-index: -1; pointer-events: none; }
.login-intro h1 { font-size: clamp(2rem, 5vw, 3rem); }
.login-intro p { max-width: 25rem; margin-top: 14px; color: #d0daef; line-height: 1.7; }
.intro-steps { display: flex; flex-wrap: wrap; gap: 9px 15px; list-style: none; padding: 0; margin: 29px 0 0; color: #e1e8ff; font-size: .78rem; }
.intro-steps li { display: inline-flex; align-items: center; gap: 7px; }
.intro-steps li::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: #98a7ff; }
.login-card h2 { font-size: 1.38rem; }
.login-card > .muted { margin-top: 7px; }
.login-card .stack { margin-top: 22px; }

.panel { min-width: 0; padding: clamp(16px, 2.2vw, 23px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 3px 11px #17223b04; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head .muted { margin-top: 4px; }
.panel-head button { flex-shrink: 0; }
.customer-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 20px; }
.customer-side { display: grid; grid-template-rows: auto 1fr; gap: 16px; min-width: 0; }
.quota-panel { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.quota-panel .muted { margin-top: 5px; }
.quota-count { color: var(--accent-dark); font-size: clamp(1.45rem, 3vw, 2.02rem); font-variant-numeric: tabular-nums; }
.profile-panel .panel-head { margin-bottom: 6px; }
.profile-panel .stack, .profile-panel > button { margin-top: 14px; }
.profile-panel > button { width: 100%; }
.profile-panel .stack button { width: 100%; }
.history { margin-top: 22px; }

.task-panel { min-width: 0; min-height: 330px; isolation: isolate; position: relative; padding: clamp(19px, 3vw, 32px); display: flex; flex-direction: column; gap: 19px; background: linear-gradient(135deg, #141d3a 0%, #1c2c59 100%); color: #fff; border: 1px solid #18274f; border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 24px #17223b1a; }
.task-panel-head, .task-panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 13px; }
.task-panel-head h2 { color: #e1e8fd; }
.task-panel .badge[data-status="queued"] { background: #344575; color: #edf0ff; }
.task-panel .badge[data-status="running"] { background: #3a4da2; color: #f1f3ff; }
.task-panel .badge[data-status="succeeded"] { background: #204e49; color: #caf7e4; }
.task-panel .badge[data-status="attention"] { background: #584529; color: #ffe4a5; }
.task-panel .badge[data-status="failed"] { background: #622e43; color: #ffe1e6; }
.task-panel .badge[data-status="cancelled"] { background: #3b486b; color: #e0e6f5; }
.task-muted { color: #c0cce5; font-size: .83rem; line-height: 1.55; }
.job-focus { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 147px; }
.job-focus:empty::before { content: '正在读取任务…'; color: #c0cce5; font-size: .85rem; }
.task-metric { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.task-figure { font-size: clamp(2.15rem, 5vw, 3.65rem); line-height: 1.15; font-weight: 790; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.task-stage { color: #d9e3fd; font-size: .9rem; overflow-wrap: anywhere; }
.task-panel progress { display: block; width: 100%; margin: 15px 0 11px; height: 7px; border: 0; border-radius: 100px; overflow: hidden; appearance: none; background: #ffffff33; accent-color: #9aabff; }
.task-panel progress::-webkit-progress-bar { background: #ffffff33; border-radius: 100px; }
.task-panel progress::-webkit-progress-value { background: #a3b1ff; border-radius: 100px; }
.task-panel progress::-moz-progress-bar { background: #a3b1ff; border-radius: 100px; }
.task-detail { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 34px; }
.task-detail .small.danger { background: transparent; border-color: #8e799d; color: #ffdfeb; }
.task-detail .small.danger:hover:not(:disabled) { background: #713955; color: #fff; }
.task-panel-footer { border-top: 1px solid #aabef444; padding-top: 17px; }
.task-panel-footer .primary { background: #e7ebff; border-color: #e7ebff; color: #202e72; min-width: 118px; }
.task-panel-footer .primary:not(:disabled):hover { background: #f5f6ff; border-color: #f5f6ff; }
.task-panel :focus-visible { outline-color: #cbd4ff; }
.task-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; color: #edf2ff; font-size: 1.22rem; }
.task-empty-mark { position: relative; display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #a0b1e783; border-radius: 9px; background: #a2b6ff22; }
.task-empty-mark::before { content: ""; width: 15px; height: 8px; border: solid #cad5ff; border-width: 2px 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 8px; background: #edf1f8; color: #53617a; border-radius: 999px; font-size: .74rem; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge[data-status="queued"] { background: #edf1fb; color: #45568a; }
.badge[data-status="running"] { background: #e9edff; color: #3446bb; }
.badge[data-status="succeeded"], .badge[data-status="enabled"] { background: #e7f6ee; color: #24634e; }
.badge[data-status="attention"] { background: #fff2d9; color: #825912; }
.badge[data-status="failed"], .badge[data-status="expired"] { background: #fcecf0; color: #9e354c; }
.plan-badge {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #cad7fa;
  border-radius: 6px;
  color: #2c4898;
  background: #ecf2ff;
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.plan-badge[data-plan="max"] { border-color: #e2d4f8; color: #683c94; background: #f5eeff; }
.plan-note {
  padding: 10px 12px;
  border: 1px solid #e2d4f8;
  border-radius: 8px;
  color: #57367e;
  background: #f7f2ff;
  font-size: .83rem;
  line-height: 1.55;
}
.customer-plan-note { margin-bottom: 16px; }
.empty { padding: 24px 6px; text-align: center; color: var(--muted); font-size: .87rem; line-height: 1.55; }

.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; min-width: 0; color: var(--ink); font-size: .83rem; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; background: #fff; color: var(--ink); border: 1px solid #cdd7e8; border-radius: 8px; }
input:hover, select:hover, textarea:hover { border-color: #a3b3d0; }
input::placeholder, textarea::placeholder { font-size: .91em; color: #66758e; opacity: 1; }
textarea { resize: vertical; overflow-wrap: anywhere; }
.primary, .secondary, .small { min-height: 42px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.primary:not(:disabled):hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary, .small { color: #3042b3; background: #f2f5ff; border-color: #d6dff8; }
.secondary:not(:disabled):hover, .small:not(:disabled):hover { background: #e6ecff; border-color: #bfcaf3; }
.small { min-height: 34px; padding: 5px 9px; font-size: .77rem; }
.small.danger { background: #fff7f8; color: var(--danger); border-color: #f1d5dc; }
.small.danger:hover:not(:disabled) { background: #fee7ec; border-color: #eac0cb; }

.filter { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.filter select { min-width: 100px; min-height: 36px; padding: 6px 9px; }
.creation { background: #f7f9fd; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.creation summary { color: #3446b0; font-size: .86rem; font-weight: 720; padding: 11px 13px; }
.admin-form { display: flex; flex-wrap: wrap; gap: 11px; align-items: end; padding: 3px 13px 14px; }
.admin-form label { flex: 1 1 130px; }
#workers-form label { max-width: 345px; }
.table-wrap { position: relative; max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap:focus-visible { outline-offset: 1px; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: .84rem; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e7ecf5; }
th { background: #f5f7fb; color: #51617f; font-size: .76rem; font-weight: 720; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faff; }
td code { color: #435271; }
.cell-progress { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.cell-percent { font-size: .86em; font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
td .toolbar { justify-content: flex-start; }
dialog { width: min(480px, calc(100% - 26px)); padding: 23px; color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 65px #0f173b50; }
dialog::backdrop { background: #101a35a8; }

@media (max-width: 900px) {
  .layout, .topbar-inner { width: calc(100% - 40px); }
  .customer-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 15px; }
  .customer-side { gap: 13px; }
}

@media (max-width: 700px) {
  .layout, .topbar-inner { width: calc(100% - 28px); }
  .layout { padding-top: 23px; }
  .topbar-inner { min-height: 55px; }
  .brand-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px; }
  .page-head { gap: 10px; margin-bottom: 17px; }
  .customer-grid { grid-template-columns: 1fr; }
  .task-panel { min-height: 278px; }
  .login-grid { grid-template-columns: 1fr; margin-top: 5px; }
  .login-intro { min-height: 175px; }
  .intro-steps { margin-top: 16px; }
  .history { margin-top: 15px; }
}

@media (max-width: 620px) {
  .table-wrap { overflow: visible; border: 0; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
  .table-wrap tr { display: grid; margin-bottom: 10px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 11px; }
  .table-wrap tr:last-child { margin-bottom: 0; }
  .table-wrap td { display: grid; grid-template-columns: minmax(62px, .33fr) minmax(0, 1fr); align-items: center; gap: 9px; padding: 7px 0; white-space: normal; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; }
  .table-wrap .cell-value { min-width: 0; overflow-wrap: anywhere; }
  .table-wrap tbody tr:last-child td { border-bottom: 1px solid #e7ecf5; }
  .table-wrap tbody tr td:last-child, .table-wrap tbody tr:last-child td:last-child { border-bottom: 0; }
}

@media (max-width: 385px) {
  .page-head { align-items: flex-start; }
  .feed { padding: 5px 8px; gap: 6px; }
  .task-detail { flex-wrap: wrap; }
}
