:root {
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #161f34;
  background: #f3f5f9;
  font-synthesis: none;
  --navy: #111c36;
  --muted: #52617a;
  --line: #dce3ef;
  --indigo: #3d4bdc;
  --indigo-dark: #2e3bc1;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3.2vw, 2.55rem); line-height: 1.23; letter-spacing: -.035em; }
h2 { font-size: 1.24rem; line-height: 1.35; }
p { line-height: 1.6; }
.muted { color: var(--muted); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid #6c77ff; outline-offset: 3px; }
.system-message { margin: 1.5rem; color: var(--muted); }

.brand { display: flex; align-items: center; gap: .75rem; color: white; font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.brand-icon { position: relative; flex: 0 0 2rem; height: 2rem; background: #525fed; border-radius: .52rem; }
.brand-icon::before { content: ""; position: absolute; inset: 7px 7px 7px 8px; border: 1.5px solid white; border-radius: 2px; }
.brand-icon::after { content: ""; position: absolute; width: 7px; top: 13px; left: 11px; height: 5px; border-block: 1px solid white; }
.side-footer { display: flex; align-items: center; gap: .55rem; font-size: .875rem; color: #bdc9e4; }
.local-dot { background: #61d1ae; border-radius: 50%; width: .48rem; height: .48rem; }

.login-screen { min-height: 100svh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }
.login-side { min-height: 100%; padding: clamp(1.5rem, 4.75vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; color: white; background: radial-gradient(ellipse at 70% 60%, #28366d 0%, transparent 65%), var(--navy); }
.login-intro { align-self: center; width: min(100%, 25rem); }
.login-intro h1 { font-size: clamp(2rem, 4vw, 3.65rem); }
.login-intro p { margin-top: .65rem; color: #c5cee7; }
.login-graphic { position: relative; width: min(100%, 23rem); aspect-ratio: 1.5; display: grid; place-items: center; margin-top: 2rem; }
.graphic-ring { position: absolute; border: 1px solid #7889d54d; border-radius: 50%; aspect-ratio: 1.65; transform: rotate(-24deg); }
.ring-outer { width: 95%; }
.ring-inner { width: 69%; }
.graphic-card { z-index: 1; display: grid; place-items: center; width: 28%; aspect-ratio: 1; border: 1px solid #a5aeff99; border-radius: 27%; background: linear-gradient(145deg, #7281fb, #3b47c5); box-shadow: 0 25px 55px #080e3380; transform: rotate(-9deg); }
.graphic-dot { position: absolute; border-radius: 50%; background: #aeb8ff; box-shadow: 0 0 18px #aeb8ff9f; }
.dot-first { width: .6rem; height: .6rem; left: 13%; top: 53%; }
.dot-second { width: .43rem; height: .43rem; right: 16%; top: 27%; }
.lock-icon, .small-lock { position: relative; display: inline-block; border: 2px solid currentColor; border-radius: .25em; width: 1.15em; height: .82em; margin-top: .25em; }
.lock-icon::before, .small-lock::before { content: ""; position: absolute; border: 2px solid currentColor; border-bottom: 0; border-radius: 1em 1em 0 0; width: .63em; height: .52em; left: 50%; bottom: 100%; transform: translateX(-50%); }
.lock-icon { font-size: clamp(1.25rem, 3vw, 2.5rem); }
.login-main { min-height: 100%; display: grid; place-items: center; padding: clamp(1.2rem, 6vw, 5rem); }
.login-card { width: min(100%, 28rem); padding: clamp(1.45rem, 4vw, 2.9rem); border: 1px solid var(--line); background: white; border-radius: 1.3rem; box-shadow: 0 18px 60px #2637590d; }
.login-card h2 { font-size: 1.75rem; }
.login-card > p { margin-top: .45rem; }
.login-card form { margin-top: 1.6rem; }
.login-card .setup-help { margin-top: 1.3rem; color: var(--muted); font-size: .875rem; }
code { font-family: Consolas, monospace; color: #3745b6; }

.workspace { min-height: 100svh; display: grid; grid-template-columns: 14.75rem minmax(0, 1fr); }
.sidebar { min-height: 100%; background: var(--navy); color: white; display: flex; flex-direction: column; padding: 1.65rem 1.15rem; }
.sidebar .brand { padding-inline: .4rem; }
.site-nav { margin-top: 3rem; display: grid; gap: .45rem; }
.site-nav > p { color: #aebcdb; font-size: .875rem; font-weight: 600; padding: 0 .55rem .3rem; }
.site-button { display: grid; grid-template-columns: 2rem 1fr auto; gap: .7rem; align-items: center; text-align: left; width: 100%; padding: .58rem; border: 1px solid transparent; border-radius: .65rem; background: transparent; color: #e2e9ff; }
.site-button:hover { background: #1e2a4c; }
.site-button.selected { background: #26335c; border-color: #425385; color: white; }
.site-symbol { display: grid; place-items: center; width: 2rem; height: 2rem; font-size: .75rem; font-weight: 700; letter-spacing: .035em; color: #e1e8ff; background: #334268; border-radius: .4rem; }
.selected .site-symbol { background: #4957d0; color: white; }
.site-count { color: #cbd5f2; font-size: .875rem; font-variant-numeric: tabular-nums; max-width: 5ch; overflow: hidden; text-overflow: ellipsis; }
.sidebar .side-footer { margin-top: auto; padding: 2rem .6rem 0; }
.workspace-main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.65rem; padding: .8rem clamp(1.15rem, 3.5vw, 3rem); background: white; border-bottom: 1px solid var(--line); font-weight: 600; }
.profile { display: flex; align-items: center; gap: .7rem; font-size: .875rem; min-width: 0; }
#operator { overflow: hidden; text-overflow: ellipsis; max-width: 14ch; white-space: nowrap; }
.avatar { display: grid; place-items: center; flex: 0 0 1.9rem; height: 1.9rem; border-radius: 50%; color: #3341bd; background: #e9edff; }
.content { max-width: 100rem; margin: 0 auto; padding: 2.4rem clamp(1.15rem, 3.5vw, 3rem) 3rem; }
.overview { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.45rem; }
.overview p { margin-top: .4rem; }
.demo-notice { margin: 0 0 1rem; padding: .65rem .8rem; border: 1px solid #e6c481; border-radius: .55rem; background: #fff6df; color: #583d12; font-size: .875rem; }
.login-card .demo-notice { margin: .5rem 0 0; }
.workspace-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; justify-content: space-between; margin-bottom: 1rem; }
.workspace-navigation .filters { margin: 0; }
.section-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.section-links a { text-decoration: none; }
.mobile-label { display: none; }
.overview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.account-number { font-variant-numeric: tabular-nums; font-weight: 650; }
.report-group-select { max-width: 12rem; }
.vault-status { display: flex; align-items: center; gap: .55rem; color: #204d42; background: #e6f5ef; padding: .45rem .65rem; border: 1px solid #c8e7da; border-radius: .5rem; white-space: nowrap; font-size: .875rem; }
.small-lock { font-size: .72rem; }
.small-lock, .small-lock::before { border-width: 1px; }
.panels { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(19rem, 1fr); gap: 1.25rem; align-items: start; }
.panel { min-width: 0; padding: clamp(1.1rem, 2.15vw, 1.6rem); background: white; border: 1px solid var(--line); border-radius: .95rem; box-shadow: 0 3px 14px #18274808; }
.panel-heading p { margin-top: .4rem; font-size: .9rem; }
.hg-panel { margin-bottom: 1.25rem; }
.hg-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; }
.hg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hg-actions .primary { width: auto; text-decoration: none; font-size: .875rem; }
.hg-actions select { margin-bottom: 0; }
.hg-panel .message { margin: .85rem 0 0; }
.hg-panel details { margin-top: .85rem; color: var(--muted); font-size: .875rem; }
.hg-panel summary { width: fit-content; cursor: pointer; }
.hg-panel ul { margin: .6rem 0 0; padding: 0; list-style: none; }
.hg-panel li { display: flex; flex-wrap: wrap; gap: .35rem 1rem; padding: .3rem 0; }
.reports-panel, .report-batch, .report-results { margin-bottom: 1.25rem; }
.hg-work-area.with-browser { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 2.6fr); gap: 1rem; align-items: start; }
.with-browser .report-queue li { display: flex; flex-wrap: wrap; }
.with-browser .report-editor-heading { display: block; }
.browser-pane { min-width: 0; border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; background: #f7f9fd; }
.browser-pane header, .browser-pane .report-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem; flex-wrap: wrap; }
.browser-pane h3 { margin: 0; }
.browser-pane header { justify-content: flex-start; }
#hg-browser-host { margin-inline-start: auto; }
.browser-zoom { display: inline-flex; align-items: center; gap: .24rem; }
.browser-zoom .quiet { min-width: 2rem; padding: .15rem .45rem; font-size: 1rem; }
.browser-zoom output { min-width: 4ch; text-align: center; font-size: .85rem; font-variant-numeric: tabular-nums; }
#hg-browser-status { padding: 0 .7rem .6rem; color: var(--muted); }
#hg-screen { display: block; width: 100%; height: auto; background: white; }
#hg-screen:focus-visible { outline-offset: -3px; }
@media (max-width: 950px) { .hg-work-area.with-browser { grid-template-columns: minmax(0, 1fr); } .with-browser .browser-pane { grid-row: 1; } }
.report-account-results { display: grid; gap: .75rem; margin-top: .9rem; }
.report-account-result { min-width: 0; padding: .75rem; border: 1px solid var(--line); border-radius: .55rem; }
.report-account-result-header { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.report-account-result-header h3 { margin: 0; font-size: 1rem; }
.report-account-result > p { margin: .5rem 0 0; font-size: .875rem; }
.report-result-tools { display: flex; justify-content: flex-end; margin-block: .65rem; }
#report-result-loading { margin-top: .65rem; }
.report-result-scroll { overflow: auto; max-height: 32rem; border: 1px solid var(--line); border-radius: .55rem; }
.report-result-scroll th { position: sticky; top: 0; z-index: 1; background: #eef1fa; }
.report-result-scroll td { font-variant-numeric: tabular-nums; }
.report-result-scroll td:nth-child(3) { white-space: nowrap; }
.report-result-scroll .report-number { text-align: right; }
.report-result-scroll .report-total td { font-weight: 700; background: #f1f3ff; }
.report-result-pages { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-top: .75rem; }
#report-result-raw { max-height: 32rem; overflow: auto; padding: .8rem; border: 1px solid var(--line); border-radius: .55rem; white-space: pre-wrap; overflow-wrap: anywhere; }
#report-query { margin-top: 1rem; }
.report-query-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.report-options, .report-editor-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.report-options { margin-bottom: 1rem; font-size: .875rem; }
.queue-toolbar { align-items: flex-end; justify-content: flex-start; }
.queue-toolbar select { max-width: 100%; }
.report-presets, .report-actions, .queue-actions { display: flex; flex-wrap: wrap; gap: .42rem; }
.report-entry-link { text-decoration: none; }
.report-account-field { border: 1px solid var(--line); border-radius: .6rem; padding: .65rem .8rem .8rem; margin-bottom: .9rem; }
.report-account-field legend { font-size: .875rem; font-weight: 650; padding-inline: .3rem; }
.report-account-options { display: flex; flex-wrap: wrap; gap: .4rem .6rem; max-height: 12rem; overflow-y: auto; }
.report-account-options label { display: flex; align-items: center; gap: .4rem; padding: .3rem .55rem; margin: 0; border: 1px solid #dce2f2; background: #f4f6fd; border-radius: .45rem; cursor: pointer; }
.report-account-options input { width: 1rem; min-height: 1rem; margin: 0; padding: 0; accent-color: var(--indigo); }
.report-submit, .report-actions .primary { width: auto; }
.report-queue { display: grid; gap: .35rem; list-style: decimal inside; margin: .9rem 0; padding: 0; }
.report-queue li { display: grid; grid-template-columns: minmax(5rem, 1fr) auto minmax(0, 1fr); align-items: center; gap: .6rem; background: #f5f7fb; padding: .5rem .65rem; border: 1px solid transparent; border-radius: .48rem; font-size: .875rem; }
.report-queue li.queue-active { background: #eef1ff; border-color: #cdd5fa; }
.report-queue .queue-name { appearance: none; border: 0; background: transparent; color: var(--indigo); padding: .2rem 0; font-weight: 700; text-align: left; }
.report-queue .queue-name:hover { text-decoration: underline; }
.report-queue .queue-name:disabled { color: inherit; cursor: default; opacity: 1; text-decoration: none; }
.queue-identity { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.queue-code { font: 600 .85rem Consolas, monospace; letter-spacing: .08em; }
.queue-actions { justify-content: flex-end; }
.report-editor-heading h3 { margin: 0; font-size: 1rem; }
#report-editor { border-top: 1px solid var(--line); padding-top: .8rem; }
#report-editor .field-help { margin-top: .5rem; }
#report-text, #report-copy-text { display: block; width: 100%; min-height: 7rem; max-height: 70vh; resize: vertical; margin-bottom: .65rem; padding: .65rem; border: 1px solid #cbd5e6; border-radius: .5rem; color: inherit; font: .9rem/1.5 Consolas, monospace; tab-size: 4; white-space: pre; }
.report-actions { justify-content: flex-end; }
.sheet-caption { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; font-size: .875rem; }
#report-sheet { position: relative; height: 234px; width: 100%; overflow: auto; background: white; color: #192537; border: 1px solid #bec9d4; border-radius: .3rem; user-select: none; }
.sheet-surface { position: relative; font: .84rem/1.35 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.sheet-row { position: absolute; left: 0; width: 100%; height: var(--sheet-row); }
.sheet-row span { position: absolute; display: block; height: 100%; width: var(--sheet-col); padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: pre; border-right: 1px solid #ccd4dc; border-bottom: 1px solid #ccd4dc; cursor: cell; }
.sheet-heading, .sheet-index { z-index: 1; background: #eef2f5; color: #536278; text-align: center; }
.sheet-heading span, .sheet-row .sheet-index { cursor: default; }
.sheet-row .sheet-index { width: var(--sheet-gutter); }
.sheet-number { text-align: right; }
.sheet-emphasis [role=gridcell] { font-weight: 700; }
.sheet-row [aria-selected=true] { background: #deefe8; box-shadow: inset 0 0 0 1px #368568; }
#report-sheet-help { margin: .35rem 0 .65rem; }
.filters { display: flex; gap: .35rem; background: #edf0f8; border-radius: .6rem; padding: .25rem; margin-block: 1.2rem; width: fit-content; }
.filter { color: #43516c; border: 1px solid transparent; background: transparent; border-radius: .42rem; padding: .38rem .7rem; font-size: .9rem; }
.filter:hover { background: #f6f7fe; }
.filter.selected { background: white; color: #3341bd; border-color: #dce2f1; box-shadow: 0 1px 2px #202e4c0d; font-weight: 700; }
.filter span { margin-left: .25rem; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; text-align: left; }
th, td { padding: .62rem .45rem; white-space: nowrap; }
th { color: #495976; background: #f4f6fa; }
td { border-bottom: 1px solid #e9edf5; }
td:nth-child(3) { overflow-wrap: anywhere; white-space: normal; }
.tag { display: inline-block; color: #52617a; background: #edf0f5; padding: .24rem .4rem; border-radius: .35rem; }
.tag.configured { color: #225244; background: #e6f5ef; }
.empty { display: grid; place-items: center; align-content: center; text-align: center; min-height: 14rem; padding: 1.4rem .7rem; background: #fafbfe; border-radius: .65rem; border: 1px dashed #d8dfef; }
.empty-icon { display: grid; align-content: center; justify-items: center; gap: .23rem; background: #e9edff; color: #4654d2; border-radius: .75rem; width: 2.75rem; height: 2.75rem; margin-bottom: .7rem; }
.empty-icon span { width: .95rem; height: 1px; background: currentColor; }
.empty p:first-of-type { font-weight: 700; }
.empty p + p { margin-top: .35rem; font-size: .875rem; }

fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.create-panel form { margin-top: 1.15rem; }
.form-grid { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
label { display: block; font-size: .875rem; font-weight: 650; margin-bottom: .42rem; }
input, select { width: 100%; min-height: 2.7rem; color: #161f34; background: white; border: 1px solid #cbd5e6; border-radius: .45rem; padding: .56rem .7rem; margin-bottom: .95rem; }
input::placeholder { color: #67748a; }
select { appearance: none; padding-right: 1.75rem; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: .85rem; top: 1.05rem; width: .45rem; height: .45rem; border: solid #465674; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.optional { font-weight: 400; font-size: .82rem; color: var(--muted); margin-left: .25rem; }
#google-secret { margin-bottom: .35rem; }
.field-help { font-size: .875rem; color: var(--muted); margin-bottom: .95rem; }
.primary, .quiet { border-radius: .46rem; font-weight: 650; }
.primary { display: block; width: 100%; min-height: 2.7rem; background: var(--indigo); color: white; border: 1px solid transparent; padding: .55rem .85rem; }
.primary:hover { background: var(--indigo-dark); }
.quiet { color: #3745b6; background: #f4f6fd; border: 1px solid #dce2f2; padding: .4rem .66rem; font-size: .875rem; white-space: nowrap; }
.quiet:hover { background: #e9edff; }
.account-group-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; margin-bottom: .75rem; }
.account-group-tools select { min-width: 8rem; margin-bottom: 0; font-size: .875rem; }
.account-group-tools button { min-height: 2.7rem; }
.account-actions button + button { margin-left: .35rem; }
#groups-form { margin-top: .75rem; }
.view-button { padding: .27rem .55rem; }
.message { padding: .55rem .64rem; border-radius: .42rem; margin: 0 0 .75rem; font-size: .875rem; color: #8e262c; background: #fff0f0; }
.message[data-state="success"] { color: #1e5342; background: #e6f5ef; }
.message[data-state="info"] { color: #394887; background: #eef1ff; }
.list-message { margin-bottom: 0; }

dialog { width: min(28rem, calc(100% - 2rem)); padding: 1.5rem; border: 1px solid var(--line); border-radius: .95rem; color: #161f34; box-shadow: 0 18px 65px #111c364a; }
dialog::backdrop { background: #111c367a; }
dialog > p { margin: .4rem 0 1.1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.dialog-actions .primary { width: auto; }
.credentials { background: #f3f5fc; border-radius: .6rem; padding: .85rem; margin-block: 0 1rem; }
.credentials dt { color: var(--muted); font-size: .875rem; }
.credentials dd { margin: .22rem 0 .65rem; font-family: Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.credentials dd:last-child { margin-bottom: 0; }

@media (max-width: 1030px) {
  .workspace { grid-template-columns: 12rem minmax(0, 1fr); }
  .panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 690px) {
  .login-screen, .workspace { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: 1.15rem; }
  .login-side .login-intro, .login-side .side-footer, .sidebar .side-footer { display: none; }
  .login-screen { grid-template-rows: auto 1fr; }
  .sidebar { padding: 1rem; gap: .9rem; }
  .site-nav { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-nav > p { grid-column: 1 / -1; padding-bottom: .1rem; }
  .topbar { min-height: 3.7rem; flex-wrap: wrap; }
  .profile { flex-wrap: wrap; gap: .45rem; }
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-wrap tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .65rem; margin-bottom: .55rem; border: 1px solid var(--line); border-radius: .55rem; }
  .table-wrap td { min-width: 0; padding: .35rem; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .mobile-label { display: block; font-weight: 500; color: var(--muted); }
  .table-wrap .account-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-content: end; }
  .table-wrap .account-actions button + button { margin-left: 0; }
  .content { padding-top: 1.5rem; }
  .overview { align-items: flex-start; flex-direction: column; }
  .report-query-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .report-query-grid > :first-child { grid-column: 1 / -1; }
  .report-query-grid input[type="date"] { min-width: 0; }
  .report-queue li { grid-template-columns: minmax(0, 1fr) auto; }
  .queue-actions { grid-column: 1 / -1; }
  .queue-actions:empty { display: none; }
}
