/* ==========================================================================
   SingClan SCADA — 登录 / 后台 专用样式 (auth.css)
   暗蓝网格背景 + 玻璃拟态卡片，独立于主题 theme.css
   ========================================================================== */
:root {
  --a-bg-0: #060c18;
  --a-bg-1: #0a1426;
  --a-bg-2: #0c1830;
  --a-panel: rgba(14, 24, 44, 0.72);
  --a-panel-solid: #0e1a30;
  --a-line: rgba(120, 160, 220, 0.18);
  --a-line-strong: rgba(120, 160, 220, 0.32);
  --a-tx-1: #eaf2ff;
  --a-tx-2: #aebfdc;
  --a-tx-3: #6f83a6;
  --a-cyan: #22d3ee;
  --a-blue: #60a5fa;
  --a-brand: #ff7a35;
  --a-brand-d: #e55f1c;
  --a-green: #34d399;
  --a-red: #f43f5e;
  --a-amber: #fbbf24;
  --a-r-sm: 8px;
  --a-r-md: 12px;
  --a-r-lg: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.auth-page {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--a-tx-1);
  background-color: var(--a-bg-0);
  background-image:
    radial-gradient(900px 600px at 18% 12%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(820px 560px at 84% 88%, rgba(96, 165, 250, 0.12), transparent 60%),
    linear-gradient(180deg, var(--a-bg-0) 0%, var(--a-bg-1) 55%, var(--a-bg-2) 100%);
  position: relative;
  overflow-x: hidden;
}
/* 网格叠加层 */
body.auth-page::before {
  content: "";
  position: fixed;
  inset: -2px;
  background-image:
    linear-gradient(rgba(90, 140, 220, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 140, 220, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
          mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

/* ============ 登录页布局 ============ */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 38px 34px 30px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 26px;
}
.auth-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: transparent;
  object-fit: contain;
  display: block;
  box-shadow: 0 8px 22px rgba(34, 211, 238, 0.25);
  flex: none;
}
.auth-brand-text h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.02em;
  font-weight: 800;
}
.auth-brand-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--a-tx-3);
  letter-spacing: 0.06em;
}
.auth-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
}
.auth-sub {
  font-size: 13px;
  color: var(--a-tx-2);
  margin: 0 0 22px;
  line-height: 1.6;
}

/* 表单 */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--a-tx-2);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}
.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--a-tx-1);
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-md);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.field input::placeholder { color: var(--a-tx-3); }
.field input:focus,
.field select:focus {
  border-color: var(--a-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
  background: rgba(6, 12, 24, 0.85);
}
.field select { appearance: none; cursor: pointer; }

.btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--a-r-md);
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
}
.btn-primary {
  color: #06121f;
  background: linear-gradient(135deg, var(--a-cyan), var(--a-blue));
  box-shadow: 0 12px 30px rgba(34, 211, 238, 0.32);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 38px rgba(34, 211, 238, 0.42); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost {
  color: var(--a-tx-2);
  background: rgba(120, 160, 220, 0.10);
  border: 1px solid var(--a-line);
}
.btn-ghost:hover { color: var(--a-tx-1); border-color: var(--a-line-strong); }
.btn-danger {
  color: #fff;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.45);
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.26); }
.btn-sm { height: 34px; font-size: 13px; width: auto; padding: 0 14px; border-radius: 9px; }

.auth-error {
  display: none;
  margin: 4px 0 16px;
  padding: 11px 14px;
  font-size: 13px;
  color: #ffd9df;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--a-r-sm);
}
.auth-error.show { display: block; }
.auth-hint {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--a-tx-3);
  line-height: 1.7;
}
.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--a-tx-3);
  letter-spacing: 0.04em;
}

/* ============ 后台布局 ============ */
.admin-shell { position: relative; z-index: 1; min-height: 100vh; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  background: rgba(8, 14, 28, 0.82);
  border-bottom: 1px solid var(--a-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.admin-topbar .brand { display: flex; align-items: center; gap: 12px; }
.admin-topbar .brand .auth-logo { width: 38px; height: 38px; font-size: 17px; border-radius: 10px; }
.admin-topbar .brand b { font-size: 16px; font-weight: 800; }
.admin-topbar .brand span { font-size: 12px; color: var(--a-tx-3); display: block; }
.admin-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--a-tx-2); }
.admin-user .uname { color: var(--a-tx-1); font-weight: 700; }

.admin-main { max-width: 980px; margin: 0 auto; padding: 30px 22px 60px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .admin-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg);
  padding: 22px 22px 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  margin-bottom: 18px;
}
.panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
}
.panel .desc { margin: 0 0 18px; font-size: 12.5px; color: var(--a-tx-3); line-height: 1.6; }
.panel.full { grid-column: 1 / -1; }

.msg {
  display: none;
  margin: 0 0 14px;
  padding: 10px 13px;
  font-size: 13px;
  border-radius: var(--a-r-sm);
}
.msg.show { display: block; }
.msg.ok { color: #c8ffe9; background: rgba(52, 211, 153, 0.14); border: 1px solid rgba(52, 211, 153, 0.4); }
.msg.err { color: #ffd9df; background: rgba(244, 63, 94, 0.14); border: 1px solid rgba(244, 63, 94, 0.4); }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--a-line); }
.tbl th { color: var(--a-tx-3); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.actions { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.admin { color: var(--a-amber); background: rgba(251, 191, 36, 0.14); }
.badge.user { color: var(--a-blue); background: rgba(96, 165, 250, 0.14); }

.row-actions { display: flex; gap: 8px; }

.admin-empty { padding: 22px; text-align: center; color: var(--a-tx-3); font-size: 13px; }
.admin-back {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 6px; color: var(--a-tx-2); text-decoration: none; font-size: 13px;
}
.admin-back:hover { color: var(--a-cyan); }

/* ============ 登录着陆页（双入口卡片模式） ============ */
.landing {
  width: 100%;
  max-width: 760px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.app-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 14px 30px rgba(34, 130, 240, 0.42));
  margin-bottom: 20px;
}
.app-icon svg { width: 100%; height: 100%; display: block; }
.app-icon img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-title {
  margin: 0;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #eaf6ff, #b6dcff);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #eaf6ff;
}
.brand-sub {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--a-tx-1);
  letter-spacing: 0.04em;
}
.brand-tag {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--a-tx-3);
  letter-spacing: 0.03em;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  margin: 34px 0 26px;
}
.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 26px 22px 22px;
  background: linear-gradient(180deg, rgba(20, 32, 56, 0.78), rgba(12, 22, 42, 0.72));
  border: 1px solid var(--a-line);
  border-radius: var(--a-r-lg);
  cursor: pointer;
  color: var(--a-tx-1);
  font-family: inherit;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.16s ease, border-color 0.18s, box-shadow 0.2s;
}
.role-card:hover {
  transform: translateY(-4px);
  border-color: var(--a-line-strong);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(34, 211, 238, 0.18);
}
.role-card:focus-visible { outline: 2px solid var(--a-cyan); outline-offset: 2px; }
.rc-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.rc-icon svg { width: 26px; height: 26px; display: block; }
.role-card[data-role="admin"] .rc-icon {
  background: rgba(251, 191, 36, 0.14);
  color: var(--a-amber);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3) inset;
}
.role-card[data-role="user"] .rc-icon {
  background: rgba(96, 165, 250, 0.14);
  color: var(--a-blue);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3) inset;
}
.rc-title { font-size: 18px; font-weight: 800; letter-spacing: 0.03em; }
.rc-desc {
  margin: 9px 0 18px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--a-tx-2);
}
.rc-btn {
  margin-top: auto;
  align-self: flex-start;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--a-cyan);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.role-card[data-role="admin"] .rc-btn { color: var(--a-amber); }
.role-card:hover .rc-btn { gap: 10px; }
.rc-btn .arrow { transition: transform 0.16s; }
.role-card:hover .rc-btn .arrow { transform: translateX(3px); }

@media (max-width: 560px) {
  .role-cards { grid-template-columns: 1fr; gap: 14px; }
  .brand-title { font-size: 23px; }
}

/* ============ 登录弹窗（modal） ============ */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-modal[hidden] { display: none; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--a-panel-solid);
  border: 1px solid var(--a-line-strong);
  border-radius: var(--a-r-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 30px 30px 26px;
  animation: modalIn 0.22s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.modal-head .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--a-cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: 0.02em; }
.modal-hint { margin: 0 0 18px; font-size: 12.5px; color: var(--a-tx-3); line-height: 1.6; }
.modal-card .auth-error { margin: 0 0 14px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-top: 8px; }
.modal-actions .btn { height: 46px; }
.forgot {
  display: inline-block;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--a-tx-3);
  text-decoration: none;
  cursor: pointer;
}
.forgot:hover { color: var(--a-cyan); }
