/* ============================================================================
   cat-iot 基础样式：设计变量 + 重置 + 通用组件
   蓝白简约风 · 浅色主题 · 无任何外部 CDN 依赖（内网离线可用）
   ========================================================================== */

:root {
  /* --- 蓝色主色阶 --- */
  --blue-50: #f2f8ff;
  --blue-100: #e3efff;
  --blue-200: #c3ddff;
  --blue-300: #94c2fb;
  --blue-400: #4f97ff;
  --blue-500: #1677ff; /* 主色 */
  --blue-600: #0b5ed7;
  --blue-700: #084a9e;

  /* --- 中性文字 --- */
  --ink-1: #10233f; /* 标题 */
  --ink-2: #4a5a75; /* 正文 */
  --ink-3: #6b7a94; /* 次要 */
  --ink-4: #9aa7bb; /* 占位/禁用 */

  /* --- 背景与描边 --- */
  --bg: #f3f8ff;
  --bg-soft: #f8fbff;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --line: #e6ecf7;
  --line-2: #d7e3f4;

  /* --- 语义色 --- */
  --green: #12b76a;
  --green-soft: #e7f8ef;
  --amber: #f79009;
  --amber-soft: #fef5e7;
  --red: #f04438;
  --red-soft: #fef1f0;

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

  /* --- 圆角 --- */
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* --- 阴影：轻、干净，不带重色 --- */
  --shadow-xs: 0 1px 2px rgba(16, 35, 63, 0.05);
  --shadow-sm: 0 2px 8px -2px rgba(16, 35, 63, 0.08);
  --shadow-md: 0 6px 20px -8px rgba(16, 35, 63, 0.14);
  --shadow-lg: 0 18px 48px -20px rgba(22, 119, 255, 0.28), 0 2px 10px rgba(16, 35, 63, 0.05);
  --shadow-focus: 0 0 0 4px rgba(22, 119, 255, 0.13);

  --ease-out: cubic-bezier(0.22, 0.85, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: var(--blue-500);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--blue-600);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: rgba(22, 119, 255, 0.16);
  color: var(--ink-1);
}

/* --- 滚动条 --- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cdd9ea;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #b3c3dc;
  background-clip: content-box;
}

/* ---------------------------------------------------------- 通用工具类 */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.blue-text {
  color: var(--blue-500);
}

/* --- 状态点 --- */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--ink-4);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.dot.is-up {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.5);
  animation: dotPulse 2.6s ease-out infinite;
}

.dot.is-down {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.14);
}

.dot.is-unknown {
  background: var(--ink-4);
  animation: dotBlink 1.6s ease-in-out infinite;
}

@keyframes dotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(18, 183, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0);
  }
}

@keyframes dotBlink {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* --- 入场动画 --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================================
   提示条（.alert）
   ----------------------------------------------------------------------------
   这个组件原来只写在 login.css 里，而登录/注册页不引 base.css、内页不引
   login.css —— 结果是**内页弹窗里的报错提示完全没有样式**：没有底色边框，
   里面的 SVG 图标还会按原生尺寸撑成一大块。所以在这里补一份公共的。
   login.css 里那份保持不动（那两个页面要自带全套样式）。
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #fbd0cc;
  border-radius: var(--radius-md);
  background: var(--red-soft);
  color: #b42318;
  font-size: 13px;
  line-height: 1.55;
  animation: alertIn 0.26s var(--ease-out) both;
}

.alert[hidden] {
  display: none;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
}

.alert[data-tone="warn"] {
  border-color: #fadfb0;
  background: var(--amber-soft);
  color: #b25e09;
}

.alert[data-tone="info"] {
  border-color: var(--blue-200);
  background: var(--blue-50);
  color: var(--blue-700);
}

.alert[data-tone="success"] {
  border-color: #b3e9cd;
  background: var(--green-soft);
  color: #067647;
}

/* 页面里常驻的说明条（不是弹窗里的临时报错），左右留白对齐面板 */
.alert--inline {
  margin: 0 0 18px;
}

.alert a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
