:root {
  color-scheme: light;
  --background: #f8f8fc;
  --foreground: #211e31;
  --card: #fff;
  --primary: #5a43cc;
  --muted: #f4f3f8;
  --muted-foreground: #655f75;
  --accent: #f0edfe;
  --accent-foreground: #4e36b8;
  --border: #e7e5ef;
  --input: #dfdce9;
  --sidebar-width: 222px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--foreground); background: var(--background); }
p, h1, h2 { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .49; cursor: default; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 16%, #eee6ff, transparent 65%); }
.login-card { width: min(100%, 390px); padding: clamp(20px, 6vw, 28px); }
.login-card .brand { margin: 0 0 20px; }
.login-card h1 { margin-bottom: 20px; font-size: 1.4rem; }
.login-card form { display: grid; gap: 14px; }
.login-card button { min-height: 40px; }
.login-error { color: #a32343; font-size: .875rem; }
.activation-message { margin: -8px 0 16px; overflow-wrap: anywhere; }
#activation-page .login-card > a { margin-top: 16px; }

.dashboard-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 21px 14px; overflow: auto; border-right: 1px solid var(--border); background: var(--card); }
.brand { display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; margin: 0 5px 32px; border-radius: 8px; font-size: 1.19rem; font-weight: 750; letter-spacing: -.045em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: white; background: linear-gradient(150deg, #765ce8, #543cce); box-shadow: 0 2px 4px #593fcb32, inset 0 1px 0 #ffffff3d; }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-accent { color: var(--primary); }
.navigation { display: grid; gap: 5px; }
.navigation a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; color: var(--muted-foreground); font-size: .875rem; font-weight: 550; white-space: nowrap; }
.navigation a:hover { background: var(--muted); color: var(--foreground); }
.navigation a[aria-current] { border-color: #e8e2fc; background: var(--accent); color: var(--accent-foreground); font-weight: 650; }
.sidebar-footer { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 13px 9px 0; border-top: 1px solid var(--border); }
.sidebar-account { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--muted-foreground); }
.sidebar-account .icon { width: 16px; height: 16px; }
.sidebar-footer .button { flex-shrink: 0; }
.account-name { min-width: 0; overflow: hidden; font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }

.workspace { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
.workspace-scroll { min-width: 0; overflow: auto; overscroll-behavior: contain; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 62px; padding: 0 clamp(18px, 3vw, 44px); border-bottom: 1px solid var(--border); background: var(--card); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted-foreground); font-size: .875rem; white-space: nowrap; }
.breadcrumb .icon { width: 13px; height: 13px; }
.breadcrumb strong { color: var(--foreground); font-weight: 650; }
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1480px; margin-inline: auto; padding: 26px clamp(18px, 3vw, 44px) 42px; }
.content[data-page="add-user"] { min-height: 100%; place-items: center; padding-block: clamp(15px, 3vw, 26px); }
.content[data-page="accounts"] { min-height: 100%; }
.content[data-page="history"] { height: 100%; min-height: 280px; grid-template-rows: minmax(0, 1fr); }
.workspace-scroll:has(> .content[data-page="history"]), #history-table { scrollbar-width: none; }
.workspace-scroll:has(> .content[data-page="history"])::-webkit-scrollbar, #history-table::-webkit-scrollbar { display: none; }

.hero { position: relative; isolation: isolate; display: flex; min-height: 145px; align-items: center; overflow: hidden; padding: 24px 30px; border: 1px solid #e6defc; border-radius: 16px; background: linear-gradient(105deg, #f3efff, #f0ebfe 52%, #e9e0ff); }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { color: #211739; font-size: clamp(1.65rem, 3vw, 2.125rem); font-weight: 750; line-height: 1.22; letter-spacing: -.045em; }
.hero p { max-width: 35rem; margin-top: 10px; color: #5e5277; line-height: 1.65; }
.hero-art { position: absolute; inset: 0 0 0 auto; width: 365px; pointer-events: none; }
.hero-art::before { position: absolute; inset: 0; content: ""; background-image: radial-gradient(#6e4dd438 1px, transparent 1px); background-size: 13px 13px; mask-image: linear-gradient(to right, transparent, #000 29%); }
.hero-orbit { position: absolute; top: 50%; right: 54px; width: 190px; aspect-ratio: 1; transform: translateY(-50%); border: 1px solid #a58be95c; border-radius: 50%; box-shadow: 0 0 0 25px #a28ae917, 0 0 0 51px #a28ae90f; }
.hero-main, .hero-tile { position: absolute; display: grid; place-items: center; border: 1px solid #c6b4f2; color: #6949ca; background: linear-gradient(155deg, #fefcff, #eee4ff); box-shadow: 0 7px 18px #5e41bd23, inset 0 1px 0 #fff; }
.hero-main { top: 24px; right: 103px; width: 91px; height: 91px; transform: rotate(-12deg); border-radius: 24px; }
.hero-main .icon { width: 62px; height: 62px; stroke-width: 1.3; }
.hero-tile { width: 37px; height: 37px; border-radius: 11px; }
.hero-target { right: 176px; bottom: 18px; transform: rotate(-13deg); }
.hero-cursor { top: 25px; right: 60px; transform: rotate(13deg); }
.hero-tile .icon { width: 21px; height: 21px; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: 0 1px 2px #211e3109; }
.metric { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 96px; padding: 13px 16px; }
.metric p { margin-bottom: 5px; color: var(--muted-foreground); font-size: .875rem; }
.metric strong { font-size: clamp(1.4rem, 2.1vw, 1.85rem); font-weight: 720; line-height: 1.15; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.metric .metric-state { font-size: clamp(1.13rem, 1.65vw, 1.5rem); letter-spacing: -.035em; }
.unit { color: var(--muted-foreground); font-size: .8125rem; }
.metric-icon { display: inline-grid; flex: none; place-items: center; width: 39px; height: 39px; border-radius: 10px; }
.metric-icon .icon { width: 20px; height: 20px; }
.violet { color: #6648ce; background: #efeafd; }
.amber { color: #925b13; background: #fff2df; }
.blue { color: #395dc0; background: #e9f0ff; }
.metric-icon.green { color: #147353; background: #e7f7ef; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 18px; }
.calibration-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.calibration-column > .panel { flex: 1; }
.panel { display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 73px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-heading h2, .task-summary h2 { color: var(--foreground); font-size: 1.0625rem; line-height: 1.35; font-weight: 700; letter-spacing: -.02em; }
.panel-heading p, .panel-note { margin-top: 4px; color: var(--muted-foreground); font-size: .875rem; line-height: 1.5; }
.panel-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--border); }
.calibration-footer { margin-top: auto; }
.calibration-footer .panel-note { margin: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.button .icon { width: 16px; height: 16px; }
.button-primary { color: white; background: var(--primary); }
.button-primary:not(:disabled):hover { background: #4d36bb; }
.button-outline { border-color: var(--input); color: var(--foreground); background: var(--card); }
.button-outline:not(:disabled):hover { border-color: #cfc3f3; color: var(--accent-foreground); background: var(--accent); }
.button-danger { color: #a32343; border-color: #ebc7d2; background: #fff5f7; }
.button-danger:not(:disabled):hover { background: #ffe7ee; }
.status-pill { display: inline-flex; flex: none; align-items: center; gap: 6px; width: fit-content; padding: 4px 9px; border-radius: 7px; font-size: .8125rem; font-weight: 620; line-height: 1.3; white-space: nowrap; }
.status-pill[data-tone="neutral"] { color: #5e576e; background: var(--muted); }
.status-pill[data-tone="green"] { color: #147353; background: #e7f7ef; }
.status-pill[data-tone="violet"] { color: #5534ad; background: var(--accent); }
.status-pill[data-tone="amber"] { color: #87520d; background: #fff3dc; }
.status-pill[data-tone="red"] { color: #9c3049; background: #fbeaf0; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

#run-form { display: flex; flex: 1; flex-direction: column; }
fieldset { display: grid; gap: 13px; min-width: 0; margin: 0; padding: 14px 18px; border: 0; }
.run-footer { justify-content: flex-end; gap: 8px; margin-top: auto; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.primary-fields, .advanced { max-width: 660px; }
.quota-note { margin-top: -6px; }
.three-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; font-size: .875rem; font-weight: 630; }
.field input, .field select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--input); border-radius: 7px; color: var(--foreground); background: #fff; font-size: 1rem; font-weight: 450; }
.field input::placeholder { color: #756d86; }
.field input:disabled, .field select:disabled { color: #746d83; background: #f8f7fb; }
.input-unit, .browser-select { position: relative; display: block; min-width: 0; }
.browser-select select { appearance: none; padding-right: 27px; }
.browser-select select:enabled { cursor: pointer; }
.browser-select .icon { position: absolute; inset: 0 8px 0 auto; width: 15px; height: 15px; margin-block: auto; color: var(--muted-foreground); pointer-events: none; }
.input-unit input { padding-right: 42px; }
.input-unit input { appearance: textfield; }
.input-unit input::-webkit-inner-spin-button, .input-unit input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.input-unit > span { position: absolute; inset: 0 10px 0 auto; display: grid; place-items: center; margin-block: auto; color: var(--muted-foreground); font-size: .8125rem; font-weight: 450; pointer-events: none; }
.checkbox { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .875rem; line-height: 1.4; }
.checkbox input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--accent-foreground); font-size: .8125rem; font-weight: 600; }
.flow span { padding: 4px 8px; border-radius: 6px; background: #f3effc; }
.flow .icon { width: 13px; height: 13px; color: #7f719d; }
.advanced { border: 1px solid var(--border); border-radius: 8px; background: #fbfafd; }
.advanced-heading { margin: 0; padding: 8px 10px; color: var(--muted-foreground); font-size: .875rem; font-weight: 600; }
.advanced-body { display: grid; gap: 12px; padding: 11px 10px; border-top: 1px solid var(--border); }
kbd { display: inline-block; padding: 0 4px; border: 1px solid #e1deea; border-radius: 4px; background: #f8f7fb; color: #5f5574; font-family: inherit; font-size: .8rem; line-height: 1.4; }

.point-list { margin: 0; padding: 0 18px; list-style: none; }
.point-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 49px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.point-list li[aria-current] .point-icon { color: #fff; background: var(--primary); }
.point-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.point-icon .icon { width: 16px; height: 16px; }
.point-list strong { display: block; font-size: .875rem; font-weight: 650; }
.point-list small { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: .75rem; }
.coordinate { color: var(--muted-foreground); font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calibration-note { margin: 0; padding: 10px 18px 12px; }

.task-result-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 14px; color: var(--foreground); background: var(--card); box-shadow: 0 18px 55px #211e3133; }
.task-result-dialog::backdrop { background: #211e3159; }
.task-result-content { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 21px 20px 18px; }
.task-result-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; color: #87520d; background: #fff3dc; }
.task-result-dialog[data-tone="success"] .task-result-icon { color: #176241; background: #e1f5e9; }
.task-result-dialog[data-tone="error"] .task-result-icon { color: #9c3049; background: #fbeaf0; }
.task-result-dialog h2 { font-size: 1.125rem; line-height: 1.4; }
.task-result-dialog p { margin-top: 6px; color: var(--muted-foreground); font-size: .9375rem; line-height: 1.55; overflow-wrap: anywhere; }
.task-result-dialog .task-result-progress { font-size: .875rem; }
.task-result-actions { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); }
.task-summary { display: grid; gap: 8px; padding: 12px 18px; color: var(--muted-foreground); font-size: .875rem; }
.task-summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.task-summary-heading h2 { flex: none; }
.task-summary-heading p { text-align: end; overflow-wrap: anywhere; }
.task-summary-heading p[data-tone="error"] { color: #a32343; }
.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 9px; background: #efecf7; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform: scaleX(var(--progress-ratio, 0)); transform-origin: left; transition: transform 650ms ease-out; }
.progress-track[aria-valuenow="0"] .progress-fill { transition: none; }
.progress-percentage { min-width: 4ch; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
@starting-style {
  .progress-fill { transform: scaleX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}
.table-scroll { overflow: auto; border-radius: 0 0 14px 14px; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#cloud-status { padding: 12px 18px; }
#cloud-screen { aspect-ratio: 16 / 9; min-height: 240px; overflow: hidden; background: #161922; border-radius: 0 0 14px 14px; }
table { width: 100%; min-width: 675px; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 12px; white-space: nowrap; font-size: .875rem; }
th:first-child, td:first-child { padding-left: 18px; }
th { color: var(--muted-foreground); background: #f8f7fb; font-weight: 620; }
tbody tr + tr { border-top: 1px solid var(--border); }
.history-empty { padding: 27px 18px; color: var(--muted-foreground); font-size: .875rem; text-align: center; }
[data-pages="history"] { min-height: 0; }
[data-pages="history"] > .panel-heading, [data-pages="history"] > .table-pagination { flex-shrink: 0; }
#history-table { flex: 1; min-height: 0; }
.create-account-panel { width: min(100%, 510px); }
.account-form-fields { display: grid; gap: 12px; padding: 18px; }
.account-filters { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 180px) auto; align-items: end; justify-content: start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.account-filters .button { min-height: 38px; }
.account-feedback { color: var(--muted-foreground); font-size: .875rem; overflow-wrap: anywhere; }
.account-feedback[data-tone="error"] { color: #a32343; }
.account-feedback[data-tone="success"] { color: #147353; }
.accounts-feedback { padding: 14px 18px; }
#accounts-table, #history-table { border-radius: 0; }
#accounts-rows > tr, #history-rows > tr { border-bottom: 1px solid var(--border); }
.account-row-actions { display: flex; gap: 8px; }
.table-pagination { margin-top: auto; }
.table-pagination .panel-note { margin: 0; }
.page-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.page-links .button { min-width: 36px; padding-inline: 9px; }
.page-links [aria-current="page"] { border-color: #e8e2fc; background: var(--accent); color: var(--accent-foreground); }
.page-gap { padding: 0 3px; color: var(--muted-foreground); }
.account-dialog .task-result-actions, .invitation-dialog .task-result-actions { gap: 8px; }
.account-dialog .account-form-fields > p, .invitation-dialog .account-form-fields > p { margin: 0; }
.account-dialog .account-feedback[data-tone="error"] { color: #a32343; }

@media (max-width: 1160px) {
  :root { --sidebar-width: 185px; }
  .hero-art { right: -23px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric { padding-inline: 12px; }
  .metric-icon { width: 33px; height: 33px; }
}

@media (max-width: 950px) {
  .hero-copy { max-width: 70%; }
  .panel-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 760px) {
  .dashboard-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { padding: 9px 12px; border-width: 0 0 1px; }
  .sidebar-footer { margin-top: 8px; padding: 8px 4px 0; }
  .brand { margin: 0 1px 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
  .navigation a { min-height: 34px; padding: 0 4px; gap: 4px; justify-content: center; font-size: .8125rem; }
  .navigation .icon { width: 14px; height: 14px; }
  .topbar { min-height: 52px; padding-inline: 13px; }
  .content { gap: 14px; padding: 15px 13px 30px; }
  .hero { min-height: 123px; padding: 16px 19px; }
  .hero p { font-size: .875rem; }
  .hero-art { right: -62px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { min-height: 74px; }
}

@media (max-width: 440px) {
  .hero-copy { max-width: 76%; }
  .hero-art { right: -122px; opacity: .7; }
  .hero h1 { font-size: 1.48rem; }
  .breadcrumb { gap: 5px; }
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { min-height: 62px; }
  .panel-heading, .panel-footer, fieldset, .task-summary, .point-list, .calibration-note { padding-inline: 12px; }
  .three-fields { grid-template-columns: minmax(0, 1fr); }
  .account-filters { grid-template-columns: minmax(0, 1fr); }
  .account-filters .button { justify-self: end; }
}
