:root {
  --bg: #132238;
  --surface: rgba(30, 46, 74, 0.66);
  --surface-solid: #1e2e4a;
  --border: rgba(96, 165, 250, 0.22);
  --border-strong: rgba(96, 165, 250, 0.55);
  --text: #e6eaf0;
  --text-2: #a5b2c4;
  --accent: #38bdf8;
  --accent-deep: #0ea5e9;
  --ok: #34d399;
  --err: #f87171;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(14, 165, 233, 0.22), transparent 62%),
    var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 科技网格底纹（顶部淡入，向下渐隐） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.07) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, #000 30%, transparent 100%);
}

.home {
  background:
    linear-gradient(rgba(11, 20, 38, 0.42), rgba(11, 20, 38, 0.42)),
    url("/static/images/bg.jpg") center / cover no-repeat fixed;
}
.home::before { display: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ 品牌元素 ============ */
.brand-mark {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.sm { width: 32px; height: 32px; border-radius: 8px; }
.brand-mark.sm svg { width: 18px; height: 18px; }

/* ============ 登录页 ============ */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }

.login-card {
  width: min(384px, 100%);
  padding: 44px 40px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 64px rgba(2, 8, 20, 0.45);
}

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-title { font-size: 27px; font-weight: 650; letter-spacing: 1px; text-align: center; line-height: 1.5; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 21px; color: var(--text-2); margin-bottom: 8px; }
.field input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(13, 24, 44, 0.9); color: var(--text);
  font-size: 22px; outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); }

.login-error {
  display: none; align-items: center; gap: 6px;
  margin-bottom: 16px; padding: 9px 12px;
  border: 1px solid rgba(248, 113, 113, 0.25); border-radius: 8px;
  font-size: 21px; color: var(--err); background: rgba(248, 113, 113, 0.08);
}
.login-error.show { display: flex; }

.login-btn {
  width: 100%; height: 46px; margin-top: 6px;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 23px; font-weight: 650; letter-spacing: 6px; text-indent: 6px;
  color: #06121f; background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  transition: filter 0.18s var(--ease), transform 0.18s var(--ease);
}
.login-btn:hover { filter: brightness(1.12); }
.login-btn:active { transform: scale(0.985); }
.login-btn:disabled { opacity: 0.55; cursor: default; filter: none; transform: none; }

/* ============ 首页 ============ */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 68px; padding: 0 32px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 34, 60, 0.85);
  backdrop-filter: blur(12px);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title {
  font-size: 28px; font-weight: 650; letter-spacing: 0.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.logout-btn {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-2);
  font-size: 21px; cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { color: var(--accent); border-color: var(--border-strong); }

.card-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  align-content: center;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: calc((100vh - 136px) * 0.1) 10%;
}

.sys-card {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 4 / 7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
a.sys-card { cursor: pointer; }
a.sys-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 44px rgba(4, 14, 32, 0.5);
}
.sys-card.disabled { opacity: 0.5; cursor: not-allowed; }

/* 卡片照片背景（bg01-bg04 依次对应四张卡片；底部渐深保证文字可读） */
.card-grid > .sys-card {
  background-size: cover;
  background-position: center;
}
.card-grid > .sys-card:nth-child(1) {
  background-image:
    linear-gradient(180deg, rgba(8, 14, 28, 0.10) 0%, rgba(8, 14, 28, 0.55) 52%, rgba(8, 14, 28, 0.88) 100%),
    url("/static/images/bg01.png");
}
.card-grid > .sys-card:nth-child(2) {
  background-image:
    linear-gradient(180deg, rgba(8, 14, 28, 0.10) 0%, rgba(8, 14, 28, 0.55) 52%, rgba(8, 14, 28, 0.88) 100%),
    url("/static/images/bg02.png");
}
.card-grid > .sys-card:nth-child(3) {
  background-image:
    linear-gradient(180deg, rgba(8, 14, 28, 0.10) 0%, rgba(8, 14, 28, 0.55) 52%, rgba(8, 14, 28, 0.88) 100%),
    url("/static/images/bg03.png");
}
.card-grid > .sys-card:nth-child(4) {
  background-image:
    linear-gradient(180deg, rgba(8, 14, 28, 0.10) 0%, rgba(8, 14, 28, 0.55) 52%, rgba(8, 14, 28, 0.88) 100%),
    url("/static/images/bg04.png");
}

.card-title {
  position: absolute;
  top: 26px;
  left: 22px;
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 6px;
  color: #f2f6fb;
  text-shadow: 0 2px 12px rgba(4, 10, 22, 0.85);
}

.card-more {
  position: absolute;
  bottom: 26px;
  right: 22px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(4, 10, 22, 0.8);
}
.card-more-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 18, 34, 0.55);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card-more-icon svg { width: 18px; height: 18px; }
a.sys-card:hover .card-more-icon {
  transform: translate(2px, -2px);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}
.sys-card.disabled .card-more { color: var(--text-2); }

.grid-empty { grid-column: 1 / -1; text-align: center; color: var(--text-2); font-size: 21px; }

/* ============ 研发单位 footer ============ */
.org-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 52px; padding: 0 32px;
  border-top: 1px solid var(--border);
  background: rgba(10, 18, 34, 0.55);
  backdrop-filter: blur(10px);
}
.org-label {
  flex-shrink: 0;
  font-size: 19px; font-weight: 400;
  color: var(--text-2);
  letter-spacing: 2px;
  writing-mode: horizontal-tb;
}
.org-icon {
  display: flex;
  align-items: center;
  color: var(--accent);
}
.org-icon svg { width: 19px; height: 19px; display: block; }
.org-sep { color: var(--text-2); opacity: 0.5; font-size: 19px; }
.org-names {
  font-size: 19px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ ICP 备案 footer ============ */
.icp-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px; padding: 0 32px;
  background: rgba(10, 18, 34, 0.55);
  backdrop-filter: blur(10px);
  font-size: 13px;
  color: var(--text-2);
}
.icp-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.icp-footer a:hover { color: var(--accent); text-decoration: underline; }

/* 首页：备案号内嵌于 org-footer 行尾 */
.icp-link {
  flex-shrink: 0;
  font-size: 19px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.icp-link:hover { color: var(--accent); text-decoration: underline; }

/* ============ 响应式 & 动效偏好 ============ */
@media (max-width: 1200px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .org-footer { flex-wrap: wrap; height: auto; min-height: 52px; padding: 12px 16px; }
  .org-names { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
  a.sys-card:hover { transform: none; }
}
