*, *::before, *::after { box-sizing: border-box; }
:root {
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #112448;
  background: #f4f7fb;
  --ink: #112448;
  --muted: #536582;
  --line: #dbe4f2;
  --surface: #fff;
  --navy: #102449;
  --blue: #2459eb;
  --blue-dark: #1745c5;
  --soft-blue: #eef4ff;
  --green: #14634b;
  --amber: #88520d;
  --red: #a2273e;
}
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
h1,h2,h3,p { margin-block: 0; }
h1,h2,h3 { color: var(--ink); line-height: 1.3; }
h1 { font-size: clamp(1.55rem, 4vw, 2rem); letter-spacing: -.03em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { line-height: 1.65; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button,input,select,textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .64; cursor: not-allowed; }
:focus-visible { outline: 3px solid #789cff; outline-offset: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 34px rgba(21,40,78,.05); }
.button, .icon-button {
  display: inline-flex; justify-content: center; align-items: center; text-align: center; gap: 7px;
  min-height: 40px; padding: 7px 14px; border: 1px solid transparent; border-radius: 8px; white-space: nowrap;
  font-size: .89rem; line-height: 1.35; font-weight: 650; text-decoration: none;
}
.button:hover { text-decoration: none; }
.button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary, .icon-button { background: #fff; color: var(--ink); border-color: var(--line); }
.button.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--soft-blue); border-color: #a8bcf2; }
.button.subtle { background: transparent; color: var(--muted); }
.button.subtle:hover:not(:disabled) { color: var(--blue-dark); background: var(--soft-blue); }
.button.danger { background: var(--red); color: #fff; }
.button.full { width: 100%; }
.button.link { min-height: 35px; padding: 5px 6px; color: var(--blue-dark); background: transparent; }
.button.link:hover:not(:disabled) { background: var(--soft-blue); }
.button.link.negative { color: var(--red); }
.icon-button { min-width: 40px; padding-inline: 8px; }
.field { display: grid; gap: 7px; font-size: .9rem; font-weight: 650; }
.field + .field, .field-action + .field { margin-top: 15px; }
input:not([type="radio"], [type="checkbox"]), select, textarea {
  min-height: 44px; width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid #cdd8ea;
  border-radius: 8px; background: #fff; font-weight: 400;
}
input[readonly] { background: #f6f8fc; }
input:disabled,select:disabled { background: #f5f7fb; }
textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
input::placeholder { color: #63738a; }
.field-action { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 7px; }
.field-action > input { min-width: 0; }
.form-message { margin-top: 13px; color: var(--blue-dark); font-size: .9rem; overflow-wrap: anywhere; }
.form-message.error { color: var(--red); }
.form-submit { margin-top: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 740; font-size: 1rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--blue); color: white; font-size: 1.05rem; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .95fr) minmax(435px, 1.05fr); }
.login-brand { position: relative; isolation: isolate; padding: clamp(28px,6vw,88px); background: radial-gradient(ellipse at 86% 84%, #225ee7 0%, #123c9b 39%, #102449 86%); color: #eef4ff; overflow: hidden; display: flex; flex-direction: column; }
.login-brand > .brand, .login-brand h1 { color: #fff; }
.login-brand-copy { margin: auto 0; padding-block: 48px 100px; }
.login-brand h1 { font-size: clamp(2.4rem,6vw,5.65rem); letter-spacing: -.05em; }
.login-brand p { margin-top: 13px; font-size: clamp(.95rem,2vw,1.21rem); color: #d8e7ff; }
.orbit { z-index: -1; position: absolute; width: 74%; aspect-ratio: 1; bottom: -22%; right: -13%; transform: rotate(-28deg); border: 1px solid rgba(197,227,255,.44); border-radius: 50%; }
.orbit i { position: absolute; inset: 9%; border: 1px solid rgba(197,227,255,.36); border-radius: 50%; }
.orbit i:nth-child(2) { inset: 19%; }
.orbit i:nth-child(3) { inset: 30%; }
.orbit i:nth-child(4) { inset: 41%; }
.orbit i:nth-child(5) { inset: 7% auto auto 67%; width: 12px; aspect-ratio: 1; background: #a1d5ff; box-shadow: 0 0 25px #b9ddff; }
.login-content { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(100%, 420px); padding: clamp(23px,4vw,38px); }
.login-card h2 { font-size: 1.55rem; margin-bottom: 22px; }
.role-group { border: none; margin: 0 0 20px; padding: 0; display: grid; gap: 7px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.role-group legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 650; }
.role-group label { position: relative; cursor: pointer; }
.role-group input { opacity: 0; position: absolute; }
.role-group span { text-align: center; display: block; border: 1px solid var(--line); padding: 8px 5px; border-radius: 8px; font-size: .9rem; color: var(--muted); }
.role-group input:checked + span { background: var(--soft-blue); color: var(--blue-dark); border-color: #9bb7ff; font-weight: 700; }
.role-group input:focus-visible + span { outline: 2px solid #789cff; }
.invite-layout { width: min(100%, 520px); margin: 0 auto; padding: clamp(16px,5vw,44px); }
.invite-layout > .brand { margin: 0 0 19px 2px; }
.invite-card { padding: clamp(19px,6vw,32px); }
.invite-card h1 { overflow-wrap: anywhere; margin-bottom: 22px; }
#invite-login { margin-top: 16px; }
.workspace-layout { min-height: 100vh; display: grid; grid-template-columns: 225px minmax(0,1fr); }
.sidebar { background: var(--navy); padding: 24px 15px; color: #f5f9ff; min-height: 100vh; }
.sidebar .brand { color: #fff; margin: 0 8px 24px; }
.side-role { padding: 0 10px 12px; color: #acbedc; font-size: .78rem; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { color: #dce8ff; padding: 12px 11px; font-size: .93rem; border-radius: 8px; }
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] { text-decoration: none; background: #233f71; color: #fff; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 61px; padding: 8px clamp(14px,3.6vw,46px); background: #fff; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.header-user { display: flex; align-items: center; gap: 8px; }
.content { max-width: 1540px; margin: 0 auto; padding: clamp(14px,3.6vw,46px); }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 22px; }
.page-header p { color: var(--muted); margin-top: 5px; max-width: 760px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.table-card { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .88rem; }
th,td { padding: 11px 14px; vertical-align: middle; border-bottom: 1px solid #e8edf6; }
th { background: #f8faff; color: #415777; white-space: nowrap; font-size: .83rem; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td time, .nowrap { white-space: nowrap; }
.empty { padding: 24px; color: var(--muted); }
.notice { padding: 13px 15px; border: 1px solid #cddcfc; background: var(--soft-blue); color: #244982; border-radius: 8px; margin-bottom: 14px; overflow-wrap: anywhere; }
.notice.error { color: var(--red); background: #fff1f2; border-color: #ffd4db; }
.notice.warning { color: var(--amber); background: #fff7e8; border-color: #f3ddad; }
.badge { display: inline-flex; color: #3c5273; background: #ecf1f8; padding: 3px 8px; border-radius: 20px; white-space: nowrap; line-height: 1.25; font-size: .79rem; }
.badge.active, .badge.approved { color: var(--green); background: #ddf4e8; }
.badge.pending, .badge.suspended, .badge.scheduled { color: var(--amber); background: #fff0cf; }
.badge.rejected, .badge.stopped, .badge.expired { color: var(--red); background: #fce9ed; }
.block { padding: clamp(16px,3vw,26px); margin-bottom: 18px; }
.block > h2, .block > h3 { margin-bottom: 10px; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 11px; margin-bottom: 16px; padding: 13px; }
.filters .field { margin: 0; min-width: 126px; }
.filters input, .filters select { min-height: 40px; }
.checks { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; min-height: 40px; font-size: .88rem; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { padding: 14px 16px; color: var(--muted); }
.metric strong { display: block; font-size: 1.7rem; color: var(--ink); margin-top: 6px; }
.key-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.key-value { flex: 1; min-width: 180px; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8faff; font-family: Consolas, ui-monospace, monospace; white-space: nowrap; }
.help { color: var(--muted); font-size: .88rem; }
.details { margin: 0; display: grid; grid-template-columns: minmax(88px,.65fr) minmax(0,1fr); gap: 9px 14px; font-size: .91rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.dialog { border: 1px solid var(--line); border-radius: 13px; padding: 0; width: min(calc(100vw - 24px), 650px); max-height: min(85vh,850px); color: var(--ink); background: #fff; box-shadow: 0 24px 80px #1124483d; }
.dialog::backdrop { background: #101d39a0; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.dialog-header .icon-button { min-height: 34px; min-width: 34px; }
.dialog-body { padding: 17px 19px; }
.dialog-actions { padding: 0 19px 17px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
#dialog-message { padding: 0 19px 12px; margin-top: 0; }
.toast { position: fixed; z-index: 3; bottom: 17px; right: 17px; color: white; background: #193766; padding: 10px 16px; border-radius: 9px; max-width: min(430px,calc(100vw - 34px)); }
@media (max-width: 800px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 205px; }
  .login-brand-copy { padding: 24px 0 14px; }
  .login-content { align-items: start; }
  .workspace-layout { grid-template-columns: minmax(0,1fr); }
  .sidebar { min-height: 0; padding: 11px; }
  .sidebar .brand { margin: 0 5px 10px; }
  .side-role { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { padding: 7px 8px; }
  .workspace-header { min-height: 52px; }
  .page-header { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .login-content { padding: 15px; }
  .header-user { gap: 2px; }
  .header-user button { padding-inline: 5px; }
  .metric { padding: 8px; font-size: .83rem; }
}

.spaced, .invite-actions { margin-top: 16px; }
.section-heading { margin-bottom: 10px; }
.prompt-editor textarea { min-height: 250px; }

.key-eye, .key-copy { position: relative; width: 41px; }
.key-eye::before { content: ""; width: 14px; height: 14px; border: 1.7px solid currentColor; border-radius: 11px 2px; transform: rotate(45deg); }
.key-eye::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.key-eye[aria-pressed="true"] { color: var(--blue-dark); background: var(--soft-blue); }
.key-copy::before, .key-copy::after { content: ""; width: 11px; height: 13px; position: absolute; border: 1.6px solid currentColor; border-radius: 2px; }
.key-copy::before { transform: translate(-2px,2px); }
.key-copy::after { transform: translate(2px,-2px); background: white; }
