:root {
  --navy: #223a5e;
  --navy-deep: #14263e;
  --navy-ink: #0e1c30;
  --gold: #b6935a;
  --gold-deep: #8f6f3b;
  --bg: #d6dfe8;
  --panel: #e8eff5;
  --white: #fbfdfe;
  --ink: #1b2e47;
  --ink-2: #40546b;
  --ink-3: #7d8fa2;
  --line: #c8d5df;
  --serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); font-family: var(--sans); background: var(--bg); }
button, input { font-family: inherit; }
button { border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

.shell { width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg); }

/* ---------------- 顶部无边框标题栏 ---------------- */
.titlebar {
  position: relative;
  z-index: 20;
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: stretch;
  color: #edf3f8;
  background: linear-gradient(180deg, #243e63 0%, #1b304f 100%);
  border-bottom: 2px solid rgba(182, 147, 90, .72);
  box-shadow: 0 8px 22px rgba(14, 28, 48, .18);
  -webkit-app-region: drag;
}
.titlebar button, .titlebar .user-chip { -webkit-app-region: no-drag; }
.brand { width: 160px; flex: 0 0 160px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-right: 1px solid rgba(255,255,255,.11); }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #f1d8a9; border: 1px solid rgba(182,147,90,.58); border-radius: 7px; background: rgba(255,255,255,.04); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.brand-copy small { margin-top: 4px; color: rgba(237,243,248,.58); font-size: 7px; letter-spacing: 1.7px; }
.topnav { display: flex; align-items: stretch; gap: 2px; padding-left: 16px; }
.topnav button { position: relative; padding: 0 14px; color: rgba(237,243,248,.68); font-size: 12px; letter-spacing: .3px; }
.topnav button::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: transparent; }
.topnav button:hover { color: #fff; }
.topnav button.is-active { color: #f4dfb7; }
.topnav button.is-active::after { background: var(--gold); }
.titlebar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; padding-right: 0; }
.connection { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; color: rgba(237,243,248,.7); font-size: 9.5px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; }
.connection i { width: 5px; height: 5px; border-radius: 50%; background: #8fb89a; box-shadow: 0 0 0 3px rgba(143,184,154,.12); }
.connection.is-offline i { background: #d68c8c; box-shadow: 0 0 0 3px rgba(214,140,140,.12); }
.content-meta .connection { padding: 2px 7px; color: var(--ink-3); font-size: 9px; background: rgba(255,255,255,.35); border-color: #c8d5df; }
.content-meta .connection i { width: 4px; height: 4px; box-shadow: none; }
.top-icon { position: relative; width: 30px; height: 30px; display: grid; place-items: center; color: rgba(237,243,248,.7); border-radius: 5px; }
.top-icon svg { width: 16px; height: 16px; }
.top-icon:hover { color: #fff; background: rgba(255,255,255,.08); }
.bell-badge { position: absolute; top: 3px; right: 3px; min-width: 13px; height: 13px; padding: 0 3px; color: #fff; font-size: 8px; font-weight: 600; line-height: 13px; text-align: center; background: #b54141; border: 1px solid #1b304f; border-radius: 999px; }
.me { display: flex; align-items: center; gap: 8px; padding: 0 3px; }
.me-avatar { width: 30px; height: 30px; flex: 0 0 30px; overflow: hidden; background: #22303c; border: 1px solid rgba(255,255,255,.16); border-radius: 4px; }
.me-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; }
.me-name { display: flex; flex-direction: column; line-height: 1.15; }
.me-name b { color: #edf3f8; font-size: 11px; font-weight: 500; letter-spacing: .2px; }
.me-name span { margin-top: 2px; color: rgba(237,243,248,.52); font-size: 8.5px; letter-spacing: .3px; }
.vline { width: 1px; height: 20px; margin: 0 1px; background: rgba(255,255,255,.12); }
.logout { padding: 4px 2px; color: rgba(237,243,248,.72); font-size: 11px; letter-spacing: 1px; }
.logout:hover { color: var(--gold); }
.window-controls { height: 100%; display: flex; align-items: stretch; margin-left: 2px; }
.window-controls button { width: 28px; display: inline-flex; align-items: center; justify-content: center; color: rgba(237,243,248,.62); }
.window-controls button svg { width: 10px; height: 10px; }
.window-controls button:hover { color: #fff; background: rgba(255,255,255,.1); }
.window-controls button.close:hover { background: #b54141; }

/* ---------------- 侧栏与内容 ---------------- */
.shell-body { flex: 1 1 auto; min-height: 0; display: flex; }
.sidebar { width: 160px; flex: 0 0 160px; display: flex; flex-direction: column; background: linear-gradient(180deg, #1b304f 0%, #16283f 55%, #132338 100%); border-right: 1px solid rgba(15,32,52,.55); }
.workspace { display: flex; align-items: center; gap: 9px; margin: 14px 12px 8px; padding: 10px 9px; color: #edf3f8; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.07); border-radius: 7px; }
.workspace-icon { width: 27px; height: 27px; display: grid; place-items: center; color: #1b304f; font-family: var(--serif); font-size: 14px; background: linear-gradient(145deg, #e1c690, #b6935a); border-radius: 5px; }
.workspace b { display: block; font-size: 11.5px; font-weight: 500; }
.workspace small { display: block; margin-top: 3px; color: rgba(237,243,248,.45); font-size: 7px; letter-spacing: 1.2px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 9px 7px; }
.side-nav button { position: relative; display: flex; align-items: center; gap: 10px; height: 35px; padding: 0 11px; color: rgba(237,243,248,.64); font-size: 12px; text-align: left; border-radius: 5px; }
.side-nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-nav button.is-active { color: #f4dfb7; background: rgba(182,147,90,.14); }
.side-nav button.is-active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--gold); border-radius: 2px; }
.nav-ico { width: 17px; color: currentColor; font-size: 14px; text-align: center; opacity: .82; }
.sidebar-foot { margin-top: auto; padding: 12px 12px 16px; }
.credit { padding: 11px 10px; background: rgba(0,0,0,.13); border: 1px solid rgba(255,255,255,.07); border-radius: 7px; }
.credit > span { display: block; color: rgba(237,243,248,.48); font-size: 9px; }
.credit b { display: block; margin-top: 5px; color: #f4dfb7; font-family: var(--serif); font-size: 17px; font-weight: 500; }
.credit b small { font-family: var(--sans); font-size: 9px; font-weight: 400; }
.credit-btn { width: 100%; height: 27px; margin-top: 8px; color: #1b304f; font-size: 10px; font-weight: 600; background: linear-gradient(145deg, #e1c690, #b6935a); border-radius: 4px; }
.credit-btn:hover { background: #f0d8ab; }

.content { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; padding: 0 16px 16px; background: var(--bg); }
.content-head { height: 48px; flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.content-head { display: none; }
.breadcrumb { color: var(--ink-2); font-size: 11px; }
.breadcrumb i { margin: 0 7px; color: #9aabb9; font-style: normal; }
.content-meta { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 10px; }
.head-action { padding: 3px 0; color: var(--ink-3); font-size: 10px; border-bottom: 1px solid transparent; }
.head-action:hover { color: var(--gold-deep); border-color: rgba(182,147,90,.5); }
.frame-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--white); border: 1px solid #c4d2dd; border-radius: 8px; box-shadow: 0 12px 30px rgba(17,46,64,.1); }
#appFrame { display: block; width: 100%; height: 100%; border: 0; background: var(--white); }

/* ---------------- 登录器 ---------------- */
.login-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; background: radial-gradient(800px 520px at 50% 15%, rgba(60,91,130,.55), transparent 65%), linear-gradient(135deg, #101f33 0%, #1a2f4b 48%, #0d1929 100%); }
.login-layer::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 54px 54px; mask-image: radial-gradient(ellipse at center, #000, transparent 75%); }
.login-orbit { position: absolute; border: 1px solid rgba(182,147,90,.16); border-radius: 50%; pointer-events: none; }
.orbit-a { width: 760px; height: 760px; }
.orbit-b { width: 1080px; height: 1080px; border-color: rgba(255,255,255,.055); }
.login-card { position: relative; z-index: 2; width: min(438px, calc(100vw - 34px)); padding: 28px 40px 20px; background: var(--white); border: 1px solid rgba(214,224,233,.9); border-radius: 9px; box-shadow: 0 32px 90px rgba(0,0,0,.42); }
.login-close { position: absolute; top: 10px; right: 12px; width: 27px; height: 27px; color: #9aa9b7; font-size: 18px; line-height: 1; }
.login-close:hover { color: var(--ink); background: var(--panel); border-radius: 4px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 9px; }
.login-logo { width: 32px; height: 32px; display: grid; place-items: center; color: var(--gold-deep); border: 1px solid rgba(182,147,90,.45); border-radius: 7px; background: #f7f2e6; }
.login-logo svg { width: 23px; height: 23px; }
.login-brand strong { display: block; color: var(--ink); font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .6px; }
.login-brand span { display: block; margin-top: 3px; color: var(--ink-3); font-size: 7px; letter-spacing: 1.5px; }
.login-tabs { display: flex; justify-content: center; gap: 34px; margin: 7px 0 23px; border-bottom: 1px solid #e3ebf0; }
.login-tabs button { position: relative; padding: 0 3px 11px; color: var(--ink-3); font-size: 13px; }
.login-tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.login-tabs button.is-active { color: var(--ink); font-weight: 600; }
.login-tabs button.is-active::after { background: var(--gold); }
.login-panel { min-height: 286px; }
.login-panel[data-login-panel="qr"] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.qr-shell { width: 192px; height: 192px; display: grid; place-items: center; margin-top: 5px; padding: 8px; background: #fff; border: 1px solid #d4e0e8; border-radius: 5px; }
.qr-shell img { width: 100%; height: 100%; display: block; }
.qr-caption { margin: 14px 0 0; color: var(--ink); font-size: 11.5px; }
.qr-hint { margin: 6px 0 0; color: var(--ink-3); font-size: 9.5px; }
.switch-link { margin-top: 19px; color: var(--gold-deep); font-size: 10.5px; border-bottom: 1px solid rgba(182,147,90,.45); }
.switch-link:hover { color: var(--navy); }
.login-field { display: block; margin-top: 13px; }
.login-field span { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 10.5px; }
.login-field input { width: 100%; height: 38px; padding: 0 11px; color: var(--ink); font-size: 12px; background: #fbfdfe; border: 1px solid #c8d5df; border-radius: 4px; outline: none; }
.login-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(182,147,90,.12); }
.login-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.remember { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 10px; }
.remember input { width: 12px; height: 12px; accent-color: var(--gold-deep); }
.link-btn { padding: 0; color: var(--ink-3); font-size: 10px; }
.link-btn:hover { color: var(--gold-deep); }
.login-error { margin: 10px 0 0; color: #b54141; font-size: 10px; line-height: 1.5; }
.login-submit { width: 100%; height: 40px; margin-top: 17px; color: #fffaf0; font-size: 12px; font-weight: 600; letter-spacing: 1px; background: linear-gradient(145deg, var(--navy), var(--navy-deep)); border-radius: 4px; }
.login-submit:hover { background: linear-gradient(145deg, var(--gold), var(--gold-deep)); }
.login-submit:disabled { opacity: .65; cursor: wait; }
.login-foot { margin-top: 18px; padding-top: 13px; border-top: 1px solid #e3ebf0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.login-foot > div { display: flex; justify-content: center; gap: 12px; }
.login-foot > span { color: #a4b1bd; font-size: 8px; letter-spacing: .3px; text-align: center; }
.login-copyright { position: absolute; bottom: 18px; left: 0; right: 0; color: rgba(237,243,248,.34); font-size: 9px; text-align: center; letter-spacing: .5px; }

/* ---------------- toast ---------------- */
.toast { position: fixed; z-index: 200; left: 50%; bottom: 26px; transform: translateX(-50%); padding: 8px 14px; color: #f7f1e4; font-size: 11px; background: rgba(20,38,62,.94); border: 1px solid rgba(182,147,90,.4); border-radius: 5px; box-shadow: 0 10px 26px rgba(0,0,0,.2); }
.login-dock { position: fixed; z-index: 150; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 8px 13px 8px 8px; color: #edf3f8; background: rgba(20,38,62,.92); border: 1px solid rgba(182,147,90,.35); border-radius: 8px; box-shadow: 0 14px 30px rgba(0,0,0,.25); }
.login-dock:hover { background: #1b304f; border-color: var(--gold); }
.dock-mark { width: 28px; height: 28px; display: grid; place-items: center; color: #1b304f; font-family: var(--serif); font-size: 13px; background: linear-gradient(145deg, #e1c690, #b6935a); border-radius: 5px; }
.login-dock b { display: block; font-size: 10.5px; font-weight: 500; text-align: left; }
.login-dock small { display: block; margin-top: 3px; color: rgba(237,243,248,.55); font-size: 8.5px; text-align: left; }

@media (max-width: 900px) {
  .brand { width: 160px; flex-basis: 160px; }
  .sidebar { width: 160px; flex-basis: 160px; }
  .topnav button { padding: 0 8px; }
  .connection, .content-meta > span { display: none; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .brand { width: 170px; flex-basis: 170px; }
  .topnav { display: none; }
  .content { padding: 0 8px 8px; }
  .login-card { padding: 25px 23px 17px; }
}
