* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0e17; --card: #111827; --border: rgba(0,240,255,.14); --text: #e5e9f0; --muted: #8b93a7;
  --green: #39ff14; --amber: #ffb020; --red: #ff2d95; --accent: #00f0ff;
  --card-input: #0f172a; --shadow: rgba(0,0,0,.45);
}
@font-face {
  font-family: 'Orbitron';
  src: url('/fonts/Orbitron.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(60% 40% at 20% 0%, rgba(0,240,255,.06), transparent 60%),
    radial-gradient(40% 35% at 85% 100%, rgba(255,45,149,.05), transparent 60%),
    linear-gradient(rgba(0,240,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  min-height: 100vh;
}
/* 静态扫描线覆盖层（零动画成本） */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 3px);
}
.hidden { display: none !important; }
a { color: var(--accent); }
.mono { font-family: ui-monospace, Consolas, "JetBrains Mono", monospace; font-size: 13px; }

/* 登录页 */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: rgba(17,24,39,.88); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 300px; text-align: center;
  box-shadow: 0 0 30px rgba(0,240,255,.08), var(--shadow);
}
.login-card h1 { font-family: 'Orbitron', sans-serif; font-size: 22px; margin-bottom: 4px; color: var(--accent); text-shadow: 0 0 14px rgba(0,240,255,.5); letter-spacing: 2px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; letter-spacing: 1px; }
.login-card input {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px;
  background: var(--card-input); color: var(--text); outline: none;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(0,240,255,.25); }
.login-card button { width: 100%; padding: 10px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; }

/* 应用外壳 */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: rgba(15,23,42,.8);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px;
  backdrop-filter: blur(8px);
}
.brand { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 18px; padding: 4px 8px 16px; color: var(--accent); text-shadow: 0 0 10px rgba(0,240,255,.4); letter-spacing: 1px; }
.nav-label { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 12px 8px 4px; letter-spacing: 1px; }
.sidebar ul { list-style: none; }
.sidebar li { padding: 8px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; color: var(--text); transition: background .15s ease, color .15s ease; }
.sidebar li:hover { background: rgba(0,240,255,.08); }
.sidebar li.active {
  background: rgba(0,240,255,.12); color: var(--accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent), 0 0 12px rgba(0,240,255,.15);
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main { flex: 1; padding: 20px; min-width: 0; }
.banner {
  background: rgba(255,45,149,.12); border: 1px solid var(--red); color: #ffd7e6;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
  animation: banner-slide .35s cubic-bezier(.2,.7,.3,1) both;
}
.banner.ok { background: rgba(57,255,20,.1); border-color: var(--green); color: #d8ffce; }
.banner.warn { background: rgba(255,176,32,.12); border-color: var(--amber); color: #ffe9c2; }
.banner.pulse { animation: banner-slide .35s cubic-bezier(.2,.7,.3,1) both, banner-pulse 1s 3; }
@keyframes banner-slide { from { transform: translateY(-110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes banner-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,45,149,.5); } 50% { box-shadow: 0 0 0 8px rgba(255,45,149,0); } }

/* 状态点：绿呼吸 / 黄快闪 / 红涟漪+光晕 */
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; position: relative; }
.dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(57,255,20,.6); animation: dot-breathe 2s ease-in-out infinite; }
.dot.warn { background: var(--amber); animation: dot-blink 1s ease-in-out infinite; }
.dot.bad { background: var(--red); box-shadow: 0 0 8px 2px rgba(255,45,149,.7); }
.dot.bad::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--red); animation: dot-ring 1.6s ease-out infinite;
}
@keyframes dot-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(.82); } }
@keyframes dot-blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes dot-ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.2); opacity: 0; } }

/* 详情卡片 */
.detail-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: 720px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.detail-head h2 { font-size: 22px; color: var(--text); }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(0,240,255,.12); color: var(--accent); }
.tag.deployed { background: rgba(57,255,20,.12); color: var(--green); }
.tag.maintaining { background: rgba(255,176,32,.12); color: var(--amber); }
.tag.offline { background: rgba(139,147,167,.15); color: var(--muted); }
.progress-wrap { height: 8px; background: #1e293b; border-radius: 4px; overflow: hidden; margin: 8px 0; position: relative; }
.progress-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  box-shadow: 0 0 8px rgba(0,240,255,.4);
}
.progress-wrap::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 40%, rgba(255,255,255,.25) 50%, transparent 60%);
  animation: progress-shine 3s ease-in-out infinite;
}
@keyframes progress-shine { 60%, 100% { transform: translateX(120%); } }
.detail-row { display: flex; gap: 8px; padding: 6px 0; font-size: 14px; }
.detail-row .k { color: var(--muted); width: 90px; flex-shrink: 0; }
.detail-row a { color: var(--accent); text-decoration: none; }
.detail-actions { margin-top: 16px; display: flex; gap: 10px; }

/* 监控表 */
table.monitor-table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
table.monitor-table th, table.monitor-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
table.monitor-table th { background: #0f172a; color: var(--muted); font-weight: 600; }

/* 按钮 */
.btn { padding: 8px 14px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
.btn:hover { border-color: var(--accent); box-shadow: 0 0 8px rgba(0,240,255,.2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #04121a; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 0 14px rgba(0,240,255,.45); }
.btn-danger { color: var(--red); border-color: rgba(255,45,149,.5); }
.btn-danger:hover { border-color: var(--red); box-shadow: 0 0 8px rgba(255,45,149,.3); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(4,8,15,.7); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-card { background: #141b2d; border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-card h3 { margin-bottom: 16px; color: var(--accent); }
.modal-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.modal-card input, .modal-card select, .modal-card textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; font-size: 14px;
  background: var(--card-input); color: var(--text); outline: none;
}
.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 趋势图 */
.hours-toggle { display: flex; gap: 8px; margin: 12px 0; }
.chart-block { margin: 14px 0; }
.chart-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chart-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 顶栏（仅手机显示）与遮罩 */
.topbar { display: none; }
.sidebar-mask { display: none; }

/* 手机端（≤768px）：抽屉式导航 */
@media (max-width: 768px) {
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(10,14,23,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .btn-icon { font-size: 20px; line-height: 1; padding: 6px 12px; }
  .topbar-brand { font-family: 'Orbitron', sans-serif; color: var(--accent); letter-spacing: 1px; font-size: 16px; }

  .app-view { display: block; padding-top: 52px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: 240px; transform: translateX(-100%);
    transition: transform .25s ease;
    padding-top: calc(16px + env(safe-area-inset-top));
    backdrop-filter: none;
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  body.drawer-open .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(4,8,15,.6);
  }

  .main { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .detail-card { max-width: 100%; padding: 16px; }
  .modal-card { width: 90vw; max-height: 92vh; }
  .sidebar li { min-height: 44px; }
  .btn { min-height: 40px; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 平板（768-1024px）：侧栏收窄 + 间距微调 */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main { padding: 16px; }
  .detail-card { padding: 16px; }
}

/* hover 上浮仅在有 hover 能力的设备启用（触屏不 sticky） */
@media (hover: hover) {
  .detail-card:not(:has(.table-scroll)):hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px var(--shadow), 0 0 0 1px rgba(0,240,255,.25);
    border-color: rgba(0,240,255,.4);
  }
}

/* 无障碍：动效降级 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}
