:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --paper: #ffffff;
  --ink: #14213b;
  --muted: #4a5b75;
  --line: #d9e1ed;
  --nav: #101d33;
  --accent: #2447ba;
  --accent-dark: #19348d;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-underline-offset: 0.23em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #557aff; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.7rem); line-height: 1.25; letter-spacing: -0.04em; }
h2 { font-size: 1.18rem; line-height: 1.4; }
p, small { color: var(--muted); }
p { line-height: 1.65; }
small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.id { overflow-wrap: anywhere; font-size: 0.875em; }
time { font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 2.25rem; padding: 2rem 1.15rem 1.4rem; background: var(--nav); color: #f5f8ff; }
.brand { display: flex; align-items: center; gap: 0.72rem; font-weight: 700; color: inherit; text-decoration: none; }
.sidebar .brand { padding-inline: 0.45rem; }
.brand-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 9px; background: #c6d5ff; color: #172e83; font: 700 1.05rem var(--mono); letter-spacing: -0.08em; }
.sidebar nav { display: grid; gap: 0.3rem; }
.sidebar nav a { color: #c0cee5; text-decoration: none; padding: 0.72rem 0.85rem; border-radius: 7px; font-size: 0.96rem; }
.sidebar nav a:hover, .sidebar nav [aria-current] { background: #253658; color: white; }
.sidebar nav [aria-current] { box-shadow: inset 3px 0 #a4b8ff; font-weight: 650; }
.profile { margin-top: auto; border-top: 1px solid #3b4a64; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 1.05rem 0.35rem 0; }
.profile strong { overflow-wrap: anywhere; }
.profile small { display: block; margin-top: 0.18rem; color: #c0cee5; }
.quiet { white-space: nowrap; padding: 0.35rem; color: #e1e9fc; background: none; border: 0; border-radius: 4px; font-size: 0.875rem; }
.quiet:hover { background: #253658; }

.workspace { width: 100%; max-width: 1440px; margin-inline: auto; padding: clamp(1.35rem, 5vw, 4rem); }
.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.page-heading p { margin-top: 0.55rem; }
.back { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 650; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 12px #172e8310; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 1rem 1.15rem; }
th { background: #f8faff; color: #425472; font-size: 0.875rem; font-weight: 650; white-space: nowrap; }
td { border-top: 1px solid var(--line); }
tbody tr:hover { background: #f9fbff; }
.record-id { display: block; margin-top: 0.25rem; font: 0.875rem var(--mono); }
.task-link { font-weight: 700; white-space: nowrap; }
.empty { padding: 3.25rem 1rem; text-align: center; color: var(--muted); }
.empty-value { color: var(--muted); }
.state { display: inline-flex; align-items: center; padding: 0.26rem 0.65rem; border-radius: 999px; white-space: nowrap; font-size: 0.875rem; font-weight: 650; color: #43516b; background: #e9edf5; }
.pending { color: #764012; background: #ffedd8; }
.ready { color: #193e99; background: #e3ecff; }
.used { color: #14583d; background: #dcf4e8; }
.expired_link, .expired_code { color: #8a2436; background: #fce8ee; }
.paging { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.task-groups { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; }
.task-groups a { padding: 0.55rem 0.85rem; border-radius: 7px; color: var(--muted); font-weight: 650; text-decoration: none; }
.task-groups a:hover { background: #edf2ff; }
.task-groups a[aria-current] { background: #e3ecff; color: var(--accent-dark); }
.page-heading .refresh-status { flex-basis: 100%; margin: -0.3rem 0 0; font-size: 0.9rem; }

.button { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 42px; padding: 0.55rem 0.95rem; border: 1px solid #bdccdf; border-radius: 7px; color: var(--ink); background: var(--paper); text-decoration: none; font-size: 0.925rem; font-weight: 650; white-space: nowrap; }
.button:hover { background: #edf2ff; }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:disabled { cursor: not-allowed; opacity: 0.6; }
.link-validation { margin-top: -0.5rem; font-size: 0.9rem; overflow-wrap: anywhere; }
.link-validation[data-state="valid"] { color: #14583d; }
.link-validation[data-state="invalid"] { color: #83243c; }
.button.compact { min-height: 36px; padding: 0.3rem 0.65rem; }
.field-pair, .detail-grid { display: grid; gap: 1rem; }
.field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.form-panel { max-width: 45rem; }
.form-panel, .content-panel { padding: clamp(1.15rem, 2.7vw, 1.75rem); }
.content-panel h2 { margin-bottom: 1.1rem; }
.content-panel p + .button, .content-panel p + button { margin-top: 0.75rem; }
.fields { display: grid; gap: 1rem; }
.fields label { display: grid; gap: 0.43rem; font-size: 0.925rem; font-weight: 650; min-width: 0; }
.fields small { margin-top: -0.5rem; }
input:not([type=hidden]), textarea, select { display: block; width: 100%; min-height: 44px; padding: 0.6rem 0.7rem; border: 1px solid #bac9dd; border-radius: 7px; color: var(--ink); background: white; font-size: 1rem; font-weight: 400; }
select { appearance: none; padding-right: 2rem; background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 1.02rem center / 6px 6px no-repeat, linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 0.65rem center / 6px 6px no-repeat, white; }
textarea { resize: vertical; }
[readonly] { background: #f2f5fc !important; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.actions [role=status] { color: var(--muted); font-size: 0.875rem; }
.divided { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.timeline { margin: 0; }
.timeline div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.8rem; justify-content: space-between; padding: 0.65rem 0; border-top: 1px solid var(--line); }
.timeline dt { font-size: 0.9rem; color: var(--muted); }
.timeline dd { margin: 0; overflow-wrap: anywhere; }
.alert { padding: 0.7rem 0.9rem; margin-bottom: 1rem; border: 1px solid #e8bcc7; border-radius: 7px; background: #fff1f4; color: #83243c; }

.access { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr); }
.access-brand { min-height: 100%; display: flex; flex-direction: column; padding: clamp(1.5rem, 5vw, 4rem); color: #f5f8ff; background: radial-gradient(ellipse at bottom right, #293f78, transparent 72%), var(--nav); }
.access-intro { margin-block: auto; padding-block: 3rem; }
.access-intro h2 { max-width: 20rem; font-size: clamp(2.2rem, 6vw, 4.5rem); letter-spacing: -0.06em; }
.access-intro p { color: #cbd7ed; max-width: 21rem; margin-top: 0.8rem; }
.access-form { width: min(100%, 31rem); padding: clamp(1.5rem, 4vw, 3rem); margin: auto; }
.access-form h1 { margin-bottom: 1.75rem; }
.account-switch { margin-top: 1rem; font-size: 0.925rem; }

@media (max-width: 1020px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell, .access { grid-template-columns: 1fr; }
  .sidebar { gap: 0.9rem; padding: 1rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .profile { padding: 0.65rem 0 0; }
  .profile small { display: inline; margin-left: 0.35rem; }
  .access-intro { padding-block: 1.5rem 0; }
  .access-intro h2 { font-size: 2rem; }
  .access-form { margin-block: 0 auto; }
}
@media (max-width: 440px) {
  .field-pair { grid-template-columns: 1fr; }
}

.port-badge { display: inline-flex; gap: 0.35em; align-items: center; padding: 0.24em 0.6em; border-left: 3px solid var(--port-ink, #43516b); border-radius: 0.4em; color: var(--port-ink, #43516b); background: var(--port-bg, #e9edf5); font-size: 0.9rem; white-space: nowrap; }
.page-heading h1 .port-badge { vertical-align: middle; margin-inline-start: 0.25rem; }
.port-tone-0 { --port-ink: #134e9b; --port-bg: #e1efff; }
.port-tone-1 { --port-ink: #a13717; --port-bg: #ffecd9; }
.port-tone-2 { --port-ink: #125648; --port-bg: #dff5ec; }
.port-tone-3 { --port-ink: #663498; --port-bg: #f2e7ff; }
.port-tone-4 { --port-ink: #8f2450; --port-bg: #ffe8f2; }
.port-tone-5 { --port-ink: #4e5913; --port-bg: #eef5d9; }
.port-tone-6 { --port-ink: #185764; --port-bg: #dbf5f8; }
.port-tone-7 { --port-ink: #8e1c27; --port-bg: #ffe9e9; }
.port-tone-8 { --port-ink: #3a3c97; --port-bg: #e9ebff; }
.port-tone-9 { --port-ink: #745217; --port-bg: #fff3cc; }
.port-tone-10 { --port-ink: #1f5b22; --port-bg: #e3f4dd; }
.port-tone-11 { --port-ink: #295268; --port-bg: #e2eff4; }
.button.danger { color: #9a253b; }
.button.danger-filled { background: #9a253b; color: white; border-color: #9a253b; }
.button.danger-filled:hover { background: #7d1d30; }

.network-ip { font-size: 0.9rem; overflow-wrap: anywhere; }
.network-region { display: block; margin-top: 0.15rem; }
.geo-credit { margin-top: 0.7rem; font-size: 0.875rem; }
.date-filter { align-items: flex-end; }
.date-filter label { display: grid; gap: 0.25rem; font-size: 0.875rem; font-weight: 650; }
.stats-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.stats-summary div { padding: 0.9rem 1rem; }
.stats-summary dt { color: var(--muted); font-size: 0.875rem; }
.stats-summary dd { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-section { margin-top: 1.35rem; }
.stats-section h2 { margin-bottom: 0.6rem; }

.state.failed { color: #8a2436; background: #fce8ee; }
.deadline-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.65rem 1rem; margin-bottom: 1rem; padding: 0.85rem 1rem; border-left: 4px solid #2447ba; background: #eff4ff; }
.deadline-panel p { color: var(--ink); font-weight: 700; }
.deadline-panel strong { color: #2447ba; font: 750 clamp(1.55rem, 4vw, 2.35rem) var(--mono); }
.countdown-chip { display: inline-flex; align-items: baseline; gap: 0.45rem; border-radius: 6px; padding: 0.3rem 0.55rem; background: #e8f0ff; white-space: nowrap; }
.countdown-chip strong { color: #2447ba; font-family: var(--mono); }
[data-urgency="urgent"] { border-color: #b04825; background: #fff0e4; }
[data-urgency="urgent"] strong { color: #982f1b; }
[data-urgency="expired"] { border-color: #ab263e; background: #fce8ee; }
[data-urgency="expired"] strong { color: #9a253b; }
.failure-form summary { cursor: pointer; font-weight: 650; color: #9a253b; }
.failure-form[open] summary { margin-bottom: 0.75rem; }
.failure-reason { margin-top: 0.45rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.guide-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 0.9fr); gap: 1rem; align-items: start; }
.guide-stack { display: grid; gap: 1rem; min-width: 0; }
.guide-steps { display: grid; gap: 0.75rem; margin: 0; padding-inline-start: 1.5rem; line-height: 1.7; }
.guide-steps li { padding-inline-start: 0.25rem; }
.guide-steps li::marker { color: var(--accent); font-weight: 700; }
.guide-steps + .actions { margin-top: 1rem; }
.guide-reference dl { display: grid; gap: 0.75rem; margin: 0; }
.guide-reference dt { font-weight: 650; }
.guide-reference dd { margin: 0.2rem 0 0; color: var(--muted); line-height: 1.6; }
.guide-reference p + a { display: inline-block; margin-top: 0.65rem; }
.admin-feedback { margin-bottom: 1rem; padding: 0.65rem 0.85rem; border-radius: 7px; background: #dcf4e8; color: #14583d; }
@media (max-width: 900px) {
  .guide-grid { grid-template-columns: 1fr; }
}
