:root {
  --blue-950: #082d45;
  --blue-900: #0a3d5b;
  --blue-800: #075577;
  --blue-700: #087aa5;
  --blue-600: #1596c4;
  --blue-500: #2f9ac5;
  --blue-100: #dff3fa;
  --blue-50: #eff9fc;
  --ink: #102532;
  --muted: #657782;
  --line: #dce7ec;
  --paper: #ffffff;
  --bg: #f4f8fa;
  --green: #168a64;
  --red: #c94747;
  --shadow: 0 22px 60px rgba(9, 53, 74, .14);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--ink); font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff;
  padding: 13px 14px; outline: none; transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(47, 154, 197, .12); }
label { display: block; margin: 17px 0 8px; font-size: 13px; font-weight: 700; color: #40535e; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; letter-spacing: .025em; }
.muted { color: var(--muted); line-height: 1.75; }
.eyebrow { margin: 0 0 18px; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: #bcefff; }
.eyebrow.dark { color: var(--blue-700); }
.primary-button, .ghost-button, .small-button {
  border: 0; border-radius: 12px; font-weight: 700; transition: transform .15s, background-color .15s, box-shadow .15s;
}
.primary-button { padding: 13px 20px; color: #fff; background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); box-shadow: 0 9px 24px rgba(8, 122, 165, .24); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(8, 122, 165, .3); }
.primary-button.full { width: 100%; margin-top: 6px; }
.ghost-button { padding: 10px 16px; color: var(--blue-800); background: var(--blue-50); border: 1px solid #cfe5ed; }
.ghost-button:hover { background: var(--blue-100); }
.link-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.form-message { min-height: 20px; margin: 10px 0; font-size: 13px; line-height: 1.5; }
.form-message.error { color: var(--red); }
.form-message.success { color: var(--green); }

/* 登录页 */
.login-page { min-height: 100vh; background: #e9f3f7; display: grid; place-items: center; padding: 28px; }
.login-shell { width: min(1080px, 100%); min-height: 650px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); }
.brand-panel {
  position: relative; overflow: hidden; padding: 64px; color: white;
  background: radial-gradient(circle at 80% 15%, rgba(117, 222, 249, .28), transparent 30%), linear-gradient(155deg, var(--blue-950), var(--blue-700));
}
.brand-panel::after { content: ""; position: absolute; width: 480px; height: 480px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; left: -210px; bottom: -310px; box-shadow: 0 0 0 80px rgba(255,255,255,.035), 0 0 0 160px rgba(255,255,255,.025); }
.brand-mark { width: 88px; height: 88px; margin-bottom: 52px; overflow: hidden; border-radius: 22px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-panel h1 { margin: 0; max-width: 520px; font-size: clamp(40px, 5vw, 62px); line-height: 1.14; letter-spacing: -.035em; }
.brand-copy { max-width: 520px; margin: 28px 0 36px; color: #d4edf6; font-size: 16px; line-height: 1.9; }
.brand-points { display: flex; flex-wrap: wrap; gap: 9px; }
.brand-points span { padding: 9px 13px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; }
.login-card { align-self: center; padding: 58px 66px; }
.login-card h2 { margin: 0; font-size: 34px; letter-spacing: -.03em; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 66px; }
.text-button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 7px 9px; color: var(--blue-700); background: transparent; border: 0; font-size: 13px; font-weight: 700; }
.security-note { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.security-note span { color: var(--green); margin-right: 7px; }
.mobile-brand { display: none; }

/* 工作台 */
.dashboard-page { min-height: 100vh; background: var(--bg); }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.topbar-brand img { width: 44px; height: 44px; border-radius: 11px; }
.topbar-brand span { display: grid; gap: 2px; }
.topbar-brand strong { font-size: 15px; }
.topbar-brand small { color: var(--blue-700); font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-badge { color: var(--muted); font-size: 13px; }
.dashboard-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 70px; }
.welcome-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.welcome-row h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; }
.welcome-row .muted { margin: 10px 0 0; }
.status-pill { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 10px 14px; color: var(--green); background: #e8f8f2; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(22, 138, 100, .12); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 30px 0 22px; }
.stat-card { min-height: 144px; display: grid; align-content: center; gap: 8px; padding: 26px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 28px; letter-spacing: -.025em; }
.stat-card small { color: #82919a; }
.stat-card.accent { color: #fff; border: 0; background: linear-gradient(135deg, var(--blue-900), var(--blue-600)); box-shadow: 0 15px 35px rgba(8, 85, 119, .2); }
.stat-card.accent span, .stat-card.accent small { color: #cfeef7; }
.content-grid { display: grid; grid-template-columns: 1.42fr .58fr; gap: 22px; }
.panel { padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 21px; letter-spacing: -.02em; }
.step-label { margin: 0; color: var(--blue-700); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.tag { padding: 7px 10px; border-radius: 999px; color: var(--blue-800); background: var(--blue-100); font-size: 11px; font-weight: 800; }
.tag.neutral { color: #55666f; background: #edf2f4; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.result-box { margin-top: 24px; padding: 18px; border: 1px solid #bfe3ef; border-radius: 16px; background: var(--blue-50); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.result-box textarea { min-height: 112px; resize: vertical; font-size: 12px; line-height: 1.65; background: #fff; }
.result-box p { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.small-button { padding: 8px 10px; color: #fff; background: var(--blue-700); font-size: 12px; }
.guide-list { padding: 0; margin: 0; list-style: none; }
.guide-list li { display: grid; grid-template-columns: 34px 1fr; gap: 13px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.guide-list li > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--blue-800); background: var(--blue-100); font-size: 12px; font-weight: 800; }
.guide-list strong { font-size: 14px; }
.guide-list p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.safe-box { margin-top: 22px; padding: 17px; border-radius: 14px; background: #fff8e8; }
.safe-box strong { color: #8b641b; font-size: 13px; }
.safe-box p { margin: 5px 0 0; color: #816e49; font-size: 12px; line-height: 1.6; }
.records-panel, .admin-panel { margin-top: 22px; }
.records-heading { align-items: end; }
.record-tools { display: flex; gap: 9px; }
.record-tools input { width: 270px; padding: 10px 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 13px; color: #71818a; background: #f5f8f9; text-align: left; white-space: nowrap; font-size: 11px; letter-spacing: .04em; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
td { padding: 15px 13px; border-bottom: 1px solid #edf2f4; white-space: nowrap; }
td.compact { max-width: 235px; overflow: hidden; text-overflow: ellipsis; }
.empty-cell { padding: 35px; color: var(--muted); text-align: center; }
.table-status { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.table-status.active { color: var(--green); background: #e6f7f1; }
.table-status.expired { color: var(--red); background: #fbecec; }
.table-action { padding: 5px 8px; color: var(--blue-700); border: 0; border-radius: 7px; background: transparent; font-weight: 700; font-size: 12px; }
.table-action:hover { background: var(--blue-50); }
.row-actions { display: flex; gap: 3px; }
.table-footnote { margin: 13px 0 0; color: #87959d; font-size: 11px; }
.admin-create-form { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; align-items: end; gap: 12px; padding: 18px; margin-bottom: 8px; border-radius: 15px; background: #f6f9fa; }
.admin-create-form label { margin-top: 0; }
.admin-create-form .primary-button { margin-bottom: 1px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translate(-50%, 25px); padding: 12px 18px; color: #fff; background: var(--blue-950); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.password-dialog { width: min(440px, calc(100% - 32px)); padding: 27px; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.password-dialog::backdrop { background: rgba(5, 36, 53, .48); backdrop-filter: blur(3px); }
.password-dialog h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .brand-panel { display: none; }
  .login-card { padding: 48px; }
  .mobile-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 42px; font-weight: 800; }
  .mobile-brand img { width: 46px; height: 46px; border-radius: 12px; }
  .content-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card.accent { grid-column: 1 / -1; }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .login-page { padding: 0; background: #fff; }
  .login-shell { min-height: 100vh; border-radius: 0; box-shadow: none; }
  .login-card { padding: 34px 24px; }
  .login-card h2 { font-size: 30px; }
  .topbar { height: auto; padding: 13px 16px; }
  .topbar-brand strong { font-size: 13px; }
  .topbar-brand small, .user-badge { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar .ghost-button { padding: 9px 11px; }
  .dashboard-shell { width: min(100% - 24px, 1240px); padding: 28px 0 50px; }
  .welcome-row { align-items: start; }
  .welcome-row h1 { font-size: 30px; }
  .welcome-row .muted { font-size: 13px; }
  .status-pill { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
  .stat-card { min-height: 115px; padding: 20px; border-radius: 17px; }
  .stat-card strong { font-size: 22px; }
  .stat-card small { font-size: 10px; }
  .panel { padding: 20px; border-radius: 17px; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .records-heading { align-items: stretch; flex-direction: column; }
  .record-tools { width: 100%; }
  .record-tools input { min-width: 0; width: 100%; }
  .admin-create-form { grid-template-columns: 1fr; padding: 14px; }
  .admin-create-form .primary-button { width: 100%; }
  td, th { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
