:root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  color: #162735;
  background: #fff;
  font-size: 15px;
  --blue: #1179bb;
  --primary: #167fc0;
  --line: #dce5ea;
  --muted: #607481;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden], .symbols { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible { outline: 3px solid #55aee7; outline-offset: 3px; }
button { touch-action: manipulation; }
h1, h2, p { margin: 0; }
h1, h2, strong, b { font-weight: 650; }
h1 { font-size: clamp(1.72rem, 3vw, 2.15rem); letter-spacing: -.045em; }
h2 { font-size: 1.32rem; letter-spacing: -.025em; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.wordmark, .text-button, .primary, .secondary, .danger, .icon-button, .nav-current, .nav-link { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.wordmark { justify-content: flex-start; font-weight: 650; font-size: 1.03rem; gap: 11px; white-space: nowrap; letter-spacing: -.035em; }
.primary, .secondary, .danger { min-height: 42px; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: .92rem; }
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: #106ca8; }
.secondary { background: #f0f4f6; color: #425766; }
.secondary:hover { background: #e6ecef; }
.danger { background: #c03e43; color: #fff; }
.danger:hover { background: #a53237; }
.icon-button { flex-shrink: 0; width: 38px; height: 38px; border: 0; padding: 0; color: #677b88; border-radius: 50%; background: transparent; }
.icon-button:hover { background: #eaf1f5; color: #344a58; }
.text-button, .link-button { background: transparent; border: 0; color: var(--blue); padding: 6px 4px; font-size: .92rem; font-weight: 600; }
.text-button, .link-button:hover { color: #265774; }
.text-button:hover { color: var(--blue); }
.text-button .icon { width: 17px; height: 17px; }
.loading { color: var(--muted); text-align: center; padding: 30vh 16px; }
.description { color: var(--muted); line-height: 1.7; font-size: .98rem; }
.auth-page { --navy: #183d58; --gold: #c39d62; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #eef1f1; border-top: 4px solid var(--navy); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 12px max(6vw, calc((100vw - 1140px) / 2)); background: #fff; border-bottom: 1px solid #d8dedd; }
.topbar .wordmark { font-family: Georgia, "Songti SC", SimSun, serif; font-size: 1.3rem; font-weight: bold; letter-spacing: .08em; color: var(--navy); }
.portal-mark { width: 29px; height: 33px; display: inline-block; position: relative; flex: none; background: #21485f; clip-path: polygon(0 14%, 100% 0, 100% 85%, 0 100%); }
.portal-mark::before { content: ""; position: absolute; inset: 7px 5px 6px; border-top: 2px solid #d8b57d; border-bottom: 2px solid #d8b57d; transform: skewY(-11deg); background: repeating-linear-gradient(90deg, #d8b57d 0 2px, transparent 2px 6px); }
.topbar .text-button { color: #49616e; font-weight: 500; }
.topbar .text-button:hover { color: var(--navy); }
.auth-layout { width: min(1040px, 88vw); margin: auto; padding: clamp(42px, 8vh, 92px) 0; display: grid; grid-template-columns: 1.08fr 1fr; align-items: stretch; }
.auth-intro, .auth-main { min-height: 480px; }
.auth-intro { background: linear-gradient(146deg, #123149, #224e65); color: #fff; position: relative; isolation: isolate; overflow: hidden; padding: clamp(38px, 6vw, 75px) clamp(30px, 5.5vw, 66px); border-radius: 8px 0 0 8px; }
.entry-mark { display: block; margin-bottom: 28px; }
.platform-name { font: 650 clamp(2.6rem, 4.8vw, 4.1rem)/1.22 "Songti SC", "STSong", SimSun, serif; letter-spacing: .08em; }
.platform-caption { margin-top: 8px; font: 600 clamp(1.55rem, 2.9vw, 2.2rem)/1.45 "Songti SC", "STSong", SimSun, serif; letter-spacing: .1em; }
.portal-note { color: #d2e0e6; max-width: 21em; line-height: 1.85; font-size: .94rem; margin-top: 22px; }
.portal-art { position: absolute; z-index: -1; right: -5%; bottom: -2px; left: 9%; height: 40%; opacity: .65; transform: skewY(-14deg); transform-origin: 100% 100%; }
.portal-art span, .portal-art i, .portal-art b { position: absolute; bottom: 0; display: block; border: 1px solid #90acb453; border-top: 3px double #b29d78c4; background: repeating-linear-gradient(90deg, transparent 0 13px, #97b3bf45 14px, transparent 15px 19px); }
.portal-art span { left: 0; width: 76%; height: 40%; opacity: .48; }
.portal-art i { left: 25%; width: 68%; height: 66%; opacity: .7; }
.portal-art b { left: 55%; width: 55%; height: 100%; }
.auth-main { display: flex; flex-direction: column; justify-content: center; background: white; border: 1px solid #d9dfdf; border-left: 0; border-radius: 0 8px 8px 0; padding: clamp(34px, 5.6vw, 80px); }
.auth-main h2 { font: 700 1.8rem/1.5 "Songti SC", "STSong", SimSun, serif; letter-spacing: .06em; color: var(--navy); }
.auth-form { margin-top: 26px; }
.auth-form input { border-radius: 5px; border-color: #bcc9cf; min-height: 46px; }
.auth-form input:focus { border-color: #285d79; box-shadow: 0 0 0 2px #204d681a; }
label { display: block; font-size: .87rem; font-weight: 600; color: #3c505d; margin-bottom: 8px; }
input { width: 100%; min-height: 49px; padding: 11px 14px; border: 1px solid #c7d4dc; border-radius: 10px; outline: none; background: #fff; color: #1e303e; transition: border-color .12s; }
input:focus { border-color: #1789cb; box-shadow: 0 0 0 2px #1687c924; }
input::placeholder { color: #82929b; }
.auth-form label:not(:first-child) { margin-top: 18px; }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-field .icon-button { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 34px; height: 34px; }
.auth-submit { margin-top: 24px; width: 100%; min-height: 46px; font-size: 1rem; letter-spacing: .12em; background: var(--navy); border-radius: 5px; }
.auth-submit:hover { background: #102f47; }
.error { color: #9c2d34; background: #fff1f1; border: 1px solid #f2d4d5; border-radius: 8px; padding: 9px 12px; margin-top: 14px; font-size: .87rem; line-height: 1.6; overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: 239px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: #f7f9fa; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 29px 15px 15px; display: flex; flex-direction: column; gap: 35px; }
.sidebar .wordmark { margin-left: 12px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-current, .nav-link { justify-content: flex-start; border: 0; border-radius: 10px; min-height: 43px; padding: 10px 14px; font-weight: 550; font-size: .94rem; gap: 12px; }
.nav-current { color: #1172b4; background: #e9f4fb; }
.nav-link { color: #657784; background: transparent; }
.nav-link:hover { background: #f2f5f7; }
.user-area { display: flex; align-items: center; gap: 9px; margin-top: auto; border-top: 1px solid #e9edef; padding: 16px 3px 0 7px; }
.mini-avatar, .slot-avatar { display: grid; place-items: center; font-weight: 650; flex-shrink: 0; user-select: none; }
.mini-avatar { width: 35px; height: 35px; border-radius: 50%; background: #e6eff6; color: #487089; }
.user-detail { display: grid; min-width: 0; gap: 2px; flex: 1; }
.user-detail b { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-detail small { font-size: .74rem; color: var(--muted); }
.content { padding: clamp(32px, 5.4vw, 74px) clamp(25px, 5.2vw, 77px); width: 100%; max-width: 1400px; margin: 0 auto; }
.content-heading { display: flex; align-items: center; gap: 18px; justify-content: space-between; }
.content-heading .description { margin-top: 8px; }
.content-heading .primary { flex-shrink: 0; }
.config-note { margin-top: 27px; display: flex; align-items: flex-start; gap: 10px; background: #eaf4fb; border: 1px solid #cbe4f5; padding: 14px 15px; border-radius: 12px; color: #325a74; }
.config-note > .icon { margin-top: 2px; color: var(--blue); }
.config-note strong { font-size: .92rem; }
.config-note p { font-size: .85rem; margin-top: 4px; line-height: 1.65; }
.config-note .icon-button { margin: -3px -5px 0 auto; width: 30px; height: 30px; color: #4d7690; }
code { font-family: "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.empty-state { min-height: 345px; margin-top: 27px; padding: 45px 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 17px; text-align: center; }
.empty-art { position: relative; width: 90px; height: 77px; margin-bottom: 19px; }
.mock-front, .mock-back { position: absolute; width: 68px; height: 57px; border: 1px solid #c6dfe9; border-radius: 11px; }
.mock-back { transform: rotate(-15deg); left: 3px; top: 5px; background: #e0f3fc; }
.mock-front { transform: rotate(8deg); top: 13px; left: 17px; display: grid; grid-template-columns: 24px 1fr; padding: 11px 8px; align-content: center; gap: 4px; background: #fff; box-shadow: 0 4px 8px #2d607413; }
.mock-front img { width: 23px; height: 23px; grid-row: span 2; }
.mock-front span, .mock-front i { height: 4px; width: 17px; align-self: end; background: #a5cbde; border-radius: 3px; }
.mock-front i { align-self: start; width: 12px; background: #dae9f0; }
.empty-state p { margin: 9px 0 23px; color: var(--muted); line-height: 1.6; font-size: .93rem; }
.empty-state .add-slot { margin-top: 21px; }
.slot-list { margin-top: 26px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(242px, 100%), 1fr)); gap: 15px; }
.slot-list:empty { display: none; }
.slot-card { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 15px; padding: 20px; min-width: 0; }
.slot-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; }
.slot-avatar { width: 46px; height: 46px; border-radius: 50%; background: #dceefb; color: #2677ae; font-size: 1.14rem; }
.slot-avatar[data-tone="1"] { color: #55783e; background: #e6f1dd; }
.slot-avatar[data-tone="2"] { color: #896427; background: #f9eed8; }
.slot-avatar[data-tone="3"] { color: #7c5da2; background: #eee7f8; }
.slot-avatar[data-tone="4"] { color: #35857b; background: #dbf2ec; }
.slot-top .icon-button { margin: -6px -7px 0 0; }
.slot-card h2 { font-size: 1.1rem; overflow-wrap: anywhere; }
.slot-status { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: .82rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #8496a2; flex-shrink: 0; }
.slot-status[data-status="authorized"] { color: #39745d; }
.slot-status[data-status="authorized"] .status-dot { background: #43a277; }
.slot-status[data-status="needs_login"] .status-dot { background: #c59147; }
.account-name { margin-top: 5px; overflow-wrap: anywhere; color: #475f6c; font-size: .87rem; }
.slot-date { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.open-slot { margin-top: 21px; width: 100%; border: 0; background: #eff7fc; color: #116da7; border-radius: 8px; padding: 10px; display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; font-size: .89rem; }
.open-slot:hover { background: #dfeff9; }
.open-slot .icon { width: 16px; height: 16px; }
.legacy-note { margin: 12px 0 0; font-size: .8rem; line-height: 1.55; color: var(--muted); }
.legacy-slot { display: inline-block; margin-top: 7px; padding: 3px 0; font-size: .82rem; color: var(--blue); text-underline-offset: 3px; }
#config-open { margin-top: 5px; padding-left: 0; }
.slot-menu { position: absolute; z-index: 1; right: 14px; top: 48px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 4px; min-width: 114px; box-shadow: 0 5px 18px #18374c1a; }
.slot-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px; border: 0; border-radius: 5px; background: transparent; color: #415361; text-align: left; font-size: .88rem; }
.slot-menu button:hover { background: #f2f6f8; }
.slot-menu .remove { color: #af373c; }
.slot-menu .icon { width: 16px; height: 16px; }
.device-note { color: var(--muted); font-size: .83rem; margin-top: 20px; line-height: 1.7; }
#device-setup-line + .device-note { margin-top: 8px; }
#device-setup-open { padding: 3px 0; font-size: .85rem; }
.device-api-help { color: var(--muted); font-size: .87rem; line-height: 1.7; margin: -8px 0 17px; }
.device-api-help a { color: var(--blue); }
#device-setup-form input + label { margin-top: 14px; }
dialog { width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 17px; padding: 24px; color: #1c2f3e; box-shadow: 0 18px 80px #122d4a2b; }
dialog::backdrop { background: #122a3f63; }
.settings-form { margin-top: 19px; }
.settings-form label:not(:first-child), #admin-password-field { margin-top: 16px; }
.settings-form label small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.settings-form select { width: 100%; min-height: 48px; border: 1px solid #c7d4dc; border-radius: 9px; padding: 8px 12px; background: #fff; font: inherit; color: #1e303e; }
.admin-dialog { width: min(610px, calc(100% - 32px)); }
.admin-actions, .admin-row-head, .admin-identity { display: flex; align-items: center; gap: 7px; }
.admin-actions .secondary { min-height: 33px; font-size: .83rem; padding: 5px 10px; }
.admin-actions .secondary .icon { width: 15px; height: 15px; }
.admin-list { margin-top: 16px; }
.admin-list[aria-busy="true"]:empty::before { content: "正在读取…"; color: var(--muted); }
.admin-row { padding: 12px 0; border-top: 1px solid var(--line); }
.admin-row-head { justify-content: space-between; gap: 10px; min-height: 29px; }
.admin-row-head .icon-button { width: 30px; height: 30px; }
.admin-row-head .icon-button .icon { width: 16px; }
.admin-identity { min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; }
.role-label { font-size: .75rem; font-weight: 500; color: #456274; background: #edf3f5; border-radius: 4px; padding: 2px 7px; }
.admin-entries, .admin-count { color: #536974; font-size: .85rem; margin-top: 4px; }
.admin-entries summary { cursor: pointer; padding: 3px 0; }
.admin-entries ul { list-style: none; padding: 3px 0; margin: 4px 0 0; }
.admin-entries li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; background: #f5f8f9; overflow-wrap: anywhere; }
.admin-entries li + li { margin-top: 2px; }
.admin-entries small { flex: none; color: var(--muted); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-header .icon-button { margin-right: -6px; }
.dialog-description { color: var(--muted); line-height: 1.75; font-size: .9rem; margin: 10px 0 22px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.help-list { padding-left: 21px; margin: 17px 0; }
.help-list li { padding-left: 4px; margin-top: 15px; }
.help-list li::marker { color: var(--blue); font-weight: 600; }
.help-list strong { font-size: .94rem; }
.help-list p { font-size: .87rem; color: var(--muted); line-height: 1.7; margin-top: 4px; }
.toast { position: fixed; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 10px; background: #213846; color: white; max-width: calc(100% - 30px); text-align: center; font-size: .88rem; z-index: 10; }
@media (max-width: 780px) {
  .auth-layout { width: 94vw; grid-template-columns: 1fr 1fr; }
  .auth-intro, .auth-main { padding: 36px 28px; min-height: 410px; }
  .workspace { display: block; }
  .sidebar { flex-direction: row; align-items: center; gap: 15px; padding: 13px 19px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .wordmark { margin: 0; }
  .sidebar nav { display: flex; margin-left: auto; }
  .nav-current, .mini-avatar, .user-detail small { display: none; }
  .user-detail { flex: 0 1 auto; max-width: 8em; }
  .nav-link { padding: 8px; font-size: .86rem; gap: 5px; }
  .nav-link .icon { width: 16px; }
  .user-area { border: 0; border-left: 1px solid var(--line); padding: 0 0 0 10px; margin: 0; }
  .content { padding: 35px 23px; }
}
@media (max-width: 620px) {
  .auth-layout { width: min(100% - 32px, 440px); grid-template-columns: minmax(0, 1fr); margin: auto; padding: 22px 0; }
  .auth-intro { padding: 22px 25px; min-height: auto; border-radius: 6px 6px 0 0; }
  .entry-mark { width: 29px; height: 32px; margin-bottom: 12px; }
  .platform-name { font-size: 2.3rem; }
  .platform-caption { font-size: 1.25rem; margin-top: 2px; }
  .portal-note { font-size: .8rem; line-height: 1.65; margin-top: 13px; max-width: 23em; }
  .portal-art { left: 65%; height: 85%; opacity: .36; }
  .auth-main { min-height: auto; border-left: 1px solid #d9dfdf; border-top: 0; border-radius: 0 0 6px 6px; padding: 25px; }
  .auth-main h2 { font-size: 1.5rem; }
  .auth-form { margin-top: 18px; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; margin-left: 0; flex-wrap: wrap; }
  .user-area { justify-content: flex-end; border: 0; }
}
@media (max-width: 480px) {
  .topbar { min-height: 57px; }
  .content { padding: 29px 17px; }
  .content-heading { align-items: flex-start; gap: 8px; }
  .content-heading .description { font-size: .85rem; max-width: 230px; }
  .content-heading .primary { padding: 9px 11px; font-size: .85rem; gap: 3px; min-height: 37px; }
  .content-heading .icon { width: 16px; height: 16px; }
  .sidebar { padding: 10px 15px; gap: 5px; }
  .user-area { gap: 1px; padding-left: 7px; }
  .user-detail { max-width: 4em; }
  .user-detail b { font-size: .81rem; }
  .sidebar .wordmark { gap: 7px; }
  .sidebar .wordmark img { width: 28px; height: 28px; }
  .slot-list { grid-template-columns: 1fr; }
  .config-note { padding: 12px 10px; gap: 6px; }
  .empty-state { min-height: 300px; }
}
