/* ============================================================
   BUDS2 许可证生成中枢 · 设计系统
   主题：深空科技 / 玻璃拟态 / 极光动态 / 辉光交互
   ============================================================ */

:root {
  /* 色彩令牌 */
  --bg-0: #04060d;
  --bg-1: #070b16;
  --surface: rgba(16, 22, 38, 0.55);
  --surface-2: rgba(22, 30, 50, 0.7);
  --border: rgba(120, 165, 230, 0.16);
  --border-glow: rgba(80, 200, 255, 0.55);

  --primary: #22d3ee;
  --primary-2: #3b82f6;
  --violet: #a855f7;
  --primary-grad: linear-gradient(135deg, #22d3ee 0%, #3b82f6 55%, #6366f1 100%);
  --violet-grad: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);

  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;

  --text: #e8eefb;
  --text-dim: #93a1bd;
  --text-mute: #5e6e8c;

  /* 字体 */
  --font-sans: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Consolas", "Courier New", monospace;

  /* 阴影 / 辉光 */
  --glow-primary: 0 0 0 1px rgba(34, 211, 238, 0.35), 0 8px 30px -8px rgba(34, 211, 238, 0.45);
  --glow-soft: 0 10px 40px -12px rgba(0, 0, 0, 0.7);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text);
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 动态背景 ---------- */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
}
.aurora {
  position: fixed; inset: -20%; z-index: 0;
  background:
    radial-gradient(40% 50% at 20% 25%, rgba(34, 211, 238, 0.22), transparent 60%),
    radial-gradient(45% 55% at 82% 18%, rgba(99, 102, 241, 0.20), transparent 60%),
    radial-gradient(50% 60% at 65% 85%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(45% 50% at 12% 80%, rgba(59, 130, 246, 0.18), transparent 60%);
  filter: blur(20px);
  animation: auroraMove 18s ease-in-out infinite alternate;
}
@keyframes auroraMove {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.05) rotate(0deg); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.12) rotate(4deg); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.05) rotate(-3deg); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 165, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 165, 230, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
}

/* ---------- 玻璃通用 ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--glow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ---------- 屏幕切换 ---------- */
.screen {
  position: fixed; inset: 0; z-index: 2;
  display: none;
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.screen.active { display: block; opacity: 1; }
#main-screen.active {
  display: flex; flex-direction: column;
  overflow-y: auto;
}

/* ============================================================
   登录屏
   ============================================================ */
#login-screen {
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
}
#login-screen.active { display: flex; }

.login-card {
  width: min(420px, 92vw);
  padding: 38px 34px 30px;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  animation: cardIn .7s var(--ease) both;
}
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--primary-grad);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.8);
}
@keyframes cardIn {
  from { transform: translateY(24px) scale(.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.brand { text-align: center; margin-bottom: 26px; }
.logo-mark {
  font-size: 38px; line-height: 1;
  background: var(--primary-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.6));
  display: inline-block; margin-bottom: 10px;
}
.logo-mark.sm { font-size: 20px; margin: 0 8px 0 0; vertical-align: -2px; }
.brand h1 {
  font-size: 22px; font-weight: 700; letter-spacing: .5px;
}
.brand h1 span {
  background: var(--primary-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  margin-top: 8px; font-size: 11px; letter-spacing: 3px;
  color: var(--text-mute); font-family: var(--font-mono);
}

/* 角色切换 */
.role-toggle {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(8, 12, 22, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; margin-bottom: 6px;
}
.role-btn {
  position: relative; z-index: 2;
  border: none; background: transparent; cursor: pointer;
  padding: 10px 0; font-size: 14px; font-weight: 600;
  color: var(--text-dim); transition: color .35s var(--ease);
  font-family: var(--font-sans);
}
.role-btn.active { color: #04101a; }
.role-glider {
  position: absolute; z-index: 1; top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  border-radius: 9px; background: var(--primary-grad);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.5);
  transition: transform .4s var(--ease);
}
.role-glider.right { transform: translateX(100%); }
.role-hint {
  font-size: 11.5px; color: var(--text-mute);
  text-align: center; min-height: 16px; margin-bottom: 18px;
}

/* 表单字段 */
.field { margin-bottom: 16px; }
.field.span-2 { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 11px; letter-spacing: 1px;
  color: var(--text-dim); margin-bottom: 7px; text-transform: uppercase;
  font-family: var(--font-mono);
}
.field label i { color: var(--err); font-style: normal; margin-left: 2px; }

.input-wrap {
  display: flex; align-items: center;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), background .3s;
}
.input-wrap:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 22px -6px rgba(34, 211, 238, 0.5);
  background: rgba(10, 16, 30, 0.7);
}
.input-wrap .ico {
  font-size: 14px; opacity: .7; margin-right: 9px; user-select: none;
}
.input-wrap input,
.input-wrap select {
  flex: 1; width: 100%;
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14px; padding: 12px 0;
  font-family: var(--font-sans);
}
.input-wrap input.mono { font-family: var(--font-mono); font-size: 13px; }
.input-wrap input::placeholder { color: var(--text-mute); }
.input-wrap.grow { flex: 1; }

.eye {
  background: none; border: none; cursor: pointer; font-size: 14px;
  opacity: .6; padding: 0 2px;
}
.eye:hover { opacity: 1; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 22px;
}
.select-wrap select option { background: #0a0f1c; color: var(--text); }
.caret {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--text-dim); font-size: 12px;
}

.err {
  color: var(--err); font-size: 12.5px; min-height: 18px;
  margin-bottom: 10px; opacity: 0; transition: opacity .3s;
}
.err.show { opacity: 1; }

/* 记住密码 */
.remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft); margin: -4px 0 14px;
  cursor: pointer; user-select: none;
}
.remember input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1px solid rgba(120, 220, 255, 0.4);
  background: rgba(10, 16, 28, 0.6);
  display: grid; place-content: center; cursor: pointer;
  transition: all .2s;
}
.remember input[type="checkbox"]::before {
  content: "✓"; font-size: 11px; color: #04121f;
  transform: scale(0); transition: transform .15s;
}
.remember input[type="checkbox"]:checked {
  background: var(--primary-grad); border-color: transparent;
}
.remember input[type="checkbox"]:checked::before { transform: scale(1); }

/* 按钮 */
.btn-primary {
  position: relative;
  width: 100%; border: none; cursor: pointer;
  padding: 13px 0; border-radius: var(--radius-sm);
  background: var(--primary-grad);
  color: #04101a; font-size: 15px; font-weight: 700; letter-spacing: 2px;
  overflow: hidden;
  box-shadow: 0 8px 26px -8px rgba(34, 211, 238, 0.6);
  transition: transform .2s var(--ease), box-shadow .3s var(--ease), filter .2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px -8px rgba(34, 211, 238, 0.8);
  filter: brightness(1.06);
}
.btn-primary:active { transform: translateY(0) scale(.99); }
.btn-primary .btn-spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(4, 16, 26, 0.4); border-top-color: #04101a;
  border-radius: 50%; animation: spin .7s linear infinite;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.btn-primary.loading .btn-label { visibility: hidden; }
.btn-primary.loading .btn-spinner { display: block; }

.btn-ghost {
  border: 1px solid var(--border-glow);
  background: rgba(34, 211, 238, 0.06);
  color: var(--primary); cursor: pointer;
  padding: 13px 22px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  transition: background .25s, transform .2s, box-shadow .25s, opacity .25s;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(34, 211, 238, 0.14);
  box-shadow: 0 0 22px -6px rgba(34, 211, 238, 0.6);
}
.btn-ghost:disabled { opacity: .35; cursor: not-allowed; }

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.login-foot {
  position: fixed; bottom: 18px; z-index: 2;
  font-size: 11px; letter-spacing: 2px; color: var(--text-mute);
  font-family: var(--font-mono);
}

/* ============================================================
   主界面
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; margin: 14px 18px 0;
  border-radius: 16px;
}
.brand-mini {
  display: flex; align-items: center;
  font-weight: 700; font-size: 15px; letter-spacing: .5px;
}
.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.btn-ghost.sm {
  padding: 7px 14px; font-size: 12.5px; border-radius: 999px;
}
.identity {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 22, 0.5);
}
.identity .dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}
.identity.admin { color: var(--primary); }
.identity.admin .dot { background: var(--primary); }
.identity.engineer { color: var(--violet); }
.identity.engineer .dot { background: var(--violet); }

.dashboard {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 18px;
  max-width: 1180px; width: 100%; margin: 0 auto 24px;
}
.span-2 { grid-column: 1 / -1; }

.card {
  padding: 22px 24px;
  position: relative;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
  animation: cardUp .6s var(--ease) both;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: var(--glow-soft), 0 0 30px -10px rgba(34, 211, 238, 0.35);
}
@keyframes cardUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.card:nth-child(1) { animation-delay: .05s; }
.card:nth-child(2) { animation-delay: .12s; }
.card:nth-child(3) { animation-delay: .19s; }
.card:nth-child(4) { animation-delay: .26s; }

.card-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.card-head .idx {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--primary);
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--border-glow); border-radius: 9px;
  background: rgba(34, 211, 238, 0.07);
}
.card-head h2 { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.card-head .tag {
  margin-left: auto; font-size: 10px; letter-spacing: 2px;
  color: var(--text-mute); font-family: var(--font-mono);
}

.row { display: flex; gap: 12px; align-items: stretch; }
.hint {
  margin-top: 12px; font-size: 12px; line-height: 1.6;
  color: var(--text-mute);
}

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px;
}
.form-grid .field { margin-bottom: 0; }

.action-row { display: flex; gap: 14px; margin-bottom: 14px; }
.action-row .btn-primary { width: auto; flex: 1; letter-spacing: 2px; }
.status {
  font-size: 13px; color: var(--text-dim);
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(8, 12, 22, 0.45); border: 1px solid var(--border);
  font-family: var(--font-mono); line-height: 1.5;
}
.status.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }
.status.err { color: var(--err); border-color: rgba(251, 113, 133, 0.35); }

/* ============================================================
   Toast
   ============================================================ */
#toast-container {
  position: fixed; top: 22px; right: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 12px;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--glow-soft);
  display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn .4s var(--ease) both;
  border-left: 3px solid var(--primary);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-ico { font-size: 16px; line-height: 1.3; }
.toast .t-body { flex: 1; }
.toast .t-title { font-size: 13.5px; font-weight: 700; margin-bottom: 3px; }
.toast .t-msg { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes toastOut {
  to { transform: translateX(40px); opacity: 0; }
}

/* ============================================================
   加载遮罩
   ============================================================ */
#loading-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  background: rgba(4, 6, 13, 0.72);
  backdrop-filter: blur(6px);
}
#loading-overlay.show { display: flex; }
.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid rgba(34, 211, 238, 0.18);
  border-top-color: var(--primary);
  border-right-color: var(--violet);
  animation: spin1 1s linear infinite;
  box-shadow: 0 0 30px -6px rgba(34, 211, 238, 0.6);
}
@keyframes spin1 { to { transform: rotate(360deg); } }
#loading-overlay p {
  margin-top: 18px; font-size: 13px; letter-spacing: 1px;
  color: var(--text-dim); font-family: var(--font-mono);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 860px) {
  .dashboard { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .action-row { flex-direction: column; }
}
@media (max-width: 520px) {
  .login-card { padding: 30px 22px 24px; }
  .topbar { margin: 10px; padding: 12px 16px; }
}

/* ============================================================
   登录链接 / 多面板
   ============================================================ */
.login-links {
  display: flex; justify-content: space-between;
  margin-top: 16px; font-size: 12.5px;
}
.login-links a {
  color: var(--primary); text-decoration: none; cursor: pointer;
  opacity: .85; transition: opacity .2s;
}
.login-links a:hover { opacity: 1; text-decoration: underline; }

/* 侧边标签导航 */
.tabnav {
  display: flex; gap: 8px; padding: 14px 18px 0;
  max-width: 1180px; width: 100%; margin: 0 auto;
}
.tab {
  border: 1px solid var(--border); background: rgba(8, 12, 22, 0.5);
  color: var(--text-dim); cursor: pointer;
  padding: 10px 18px; border-radius: 12px 12px 0 0; font-size: 13.5px; font-weight: 600;
  transition: all .25s var(--ease); font-family: var(--font-sans);
}
.tab:hover { color: var(--text); border-color: var(--border-glow); }
.tab.active {
  color: #04101a; background: var(--primary-grad);
  border-color: transparent; box-shadow: 0 0 22px -6px rgba(34, 211, 238, 0.6);
}
.panel { display: none; }
.panel.active {
  display: contents;
}

/* 汇总 KPI */
.summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kpi {
  background: rgba(8, 12, 22, 0.45); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; text-align: center;
}
.kpi-val {
  font-size: 30px; font-weight: 800; font-family: var(--font-mono);
  background: var(--primary-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.kpi-lbl { font-size: 11.5px; color: var(--text-mute); margin-top: 4px; letter-spacing: 1px; }

/* 筛选网格 */
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.filter-grid .field { margin-bottom: 0; }
.filter-grid input[type="date"] { color-scheme: dark; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.rec-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px;
}
.rec-table th {
  text-align: left; padding: 10px 12px; color: var(--text-mute);
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid var(--border); font-family: var(--font-mono); white-space: nowrap;
}
.rec-table td {
  padding: 11px 12px; border-bottom: 1px solid rgba(120, 165, 230, 0.07);
  color: var(--text); white-space: nowrap;
}
.rec-table td.mono, .rec-table .mono { font-family: var(--font-mono); font-size: 12px; }
.rec-table tr:hover td { background: rgba(34, 211, 238, 0.04); }
.rec-table .empty { text-align: center; color: var(--text-mute); padding: 22px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.badge.ok { color: var(--ok); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge.rev { color: var(--err); background: rgba(251, 113, 133, 0.12); border: 1px solid rgba(251, 113, 133, 0.3); }

.pager { margin-top: 14px; font-size: 12.5px; color: var(--text-dim); display: flex; gap: 10px; align-items: center; }
.pg {
  border: 1px solid var(--border-glow); background: rgba(34, 211, 238, 0.06);
  color: var(--primary); cursor: pointer; padding: 6px 14px; border-radius: 8px; font-size: 12.5px;
  transition: background .2s;
}
.pg:hover { background: rgba(34, 211, 238, 0.14); }

.mini {
  border: 1px solid var(--border); background: rgba(8, 12, 22, 0.5);
  color: var(--text-dim); cursor: pointer; padding: 5px 10px; border-radius: 7px;
  font-size: 12px; margin-right: 6px; transition: all .2s;
}
.mini:hover { color: var(--primary); border-color: var(--border-glow); }

/* 修改密码弹层 */
.modal {
  position: fixed; inset: 0; z-index: 70; display: none;
  align-items: center; justify-content: center; background: rgba(4, 6, 13, 0.7);
  backdrop-filter: blur(6px);
}
.modal.show { display: flex; }
.modal-card { width: min(380px, 92vw); padding: 28px 26px; border-radius: 18px; }
.modal-card h3 { font-size: 17px; margin-bottom: 18px; }
.modal-card .action-row { margin-top: 14px; }

/* 主界面为可滚动容器 */
#main-screen.active { display: block; overflow-y: auto; }

