/* =====================================================================
   工作台样式 —— 淡绿色主题
   想换配色：只改下面 :root 的变量；也可在 config.json 的 theme 里覆盖。
   ===================================================================== */

:root {
  /* 主色（淡绿） */
  --brand:        #2fa36b;
  --brand-weak:   #e9f7f0;   /* 主色浅底 */
  --brand-line:   #cfeadd;   /* 主色浅描边 */

  /* 背景与文字 */
  --bg:           #f3faf6;   /* 页面背景（极淡绿） */
  --card-bg:      #ffffff;
  --text:         #1e2a24;
  --text-sub:     #5d6f66;
  --text-weak:    #8a9c93;

  /* 图标：素色（低饱和灰绿），降低视觉噪声 */
  --icon:         #6f8b7d;
  --icon-bg:      #eef6f1;
  --icon-hover:   #2fa36b;

  /* 描边与阴影 */
  --border:       #e3efe9;
  --shadow:       0 1px 2px rgba(30, 42, 36, .04), 0 4px 12px rgba(30, 42, 36, .035);
  --shadow-hover: 0 6px 18px rgba(47, 163, 107, .14), 0 2px 6px rgba(30, 42, 36, .05);

  /* 状态色 */
  --ok:      #2fa36b;
  --down:    #e5534b;
  --pending: #dd9526;
  --maint:   #4a8fd4;

  --radius:    12px;
  --gap:       14px;
  --max-width: 1100px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* 隐藏的 SVG 图标库 */
.sprite { display: none; }

/* 通用图标尺寸 */
.ico { width: 22px; height: 22px; display: block; fill: none;
       stroke: currentColor; stroke-width: 1.7;
       stroke-linecap: round; stroke-linejoin: round; }

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
}

/* 配置加载失败提示 */
.config-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fdf3f2;
  border: 1px solid #f6d9d6;
  color: #b3402e;
  font-size: 13px;
}
.config-error code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 0, 0, .05);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ================= 顶部欢迎区 ================= */
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.hero-main { min-width: 220px; }

.greeting { font-size: 22px; font-weight: 600; letter-spacing: .2px; }

.hero-sub { margin-top: 4px; font-size: 13px; color: var(--text-sub); }

.hero-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 时钟 */
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock-time {
  font-size: 24px; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.clock-date { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* 天气胶囊 */
.weather {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: var(--shadow);
  font-size: 13px; color: var(--text-sub);
  white-space: nowrap;
}
.weather .w-icon { font-size: 16px; line-height: 1; filter: saturate(.75); }
.weather .w-temp { font-weight: 600; color: var(--text); font-size: 15px; }
.weather .w-city { color: var(--text-weak); }

/* ================= 公告栏 ================= */
.announce {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand-weak);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 13px; color: var(--text);
}
.announce .a-tag {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  color: var(--brand); font-weight: 600; font-size: 12px;
}
.announce .a-tag .ico { width: 15px; height: 15px; stroke-width: 1.9; }
.announce .a-body { flex: 1; overflow: hidden; }
.announce .a-item { display: block; }
.announce .a-item + .a-item { margin-top: 2px; }
.announce .a-time { color: var(--text-weak); margin-left: 8px; font-size: 12px; }

/* ================= 分组与卡片 ================= */
.group { margin-bottom: 24px; }

.group-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; }
.group-title { font-size: 14px; font-weight: 600; color: var(--text); }
.group-title::before {
  content: ""; display: inline-block;
  width: 3px; height: 14px;
  background: var(--brand); border-radius: 2px;
  margin-right: 8px; vertical-align: -2px;
}
.group-desc { font-size: 12px; color: var(--text-weak); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--gap);
}

.card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  cursor: pointer;
  min-height: 72px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand-line);
}
.card:active { transform: translateY(0) scale(.995); }

/* 卡片图标：素色底 + 素色线性图标 */
.card-icon {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--icon-bg);
  color: var(--icon);
  overflow: hidden;
  transition: color .16s ease, background .16s ease;
}
.card:hover .card-icon { color: var(--icon-hover); background: var(--brand-weak); }
.card-icon img { width: 24px; height: 24px; object-fit: contain; }
.card-icon .ico-text { font-size: 17px; font-weight: 600; line-height: 1; }

.card-text { min-width: 0; flex: 1; }
.card-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-desc {
  font-size: 12px; color: var(--text-weak);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}

/* 卡片右上角状态点：手机 App 角标样式——贴角、压住边框、实心不描边 */
.status-dot {
  position: absolute; top: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  transform: translate(45%, -45%);
  background: var(--text-weak);
  transition: background .2s ease;
  cursor: default;
}
.status-dot.up      { background: var(--ok); }
.status-dot.down    { background: var(--down); animation: pulse 1.6s infinite; }
.status-dot.pending { background: var(--pending); }
.status-dot.maint   { background: var(--maint); }
.status-dot.unknown { background: #c9cdd4; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 83, 75, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(229, 83, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 83, 75, 0); }
}

/* 悬浮卡片时的文字状态气泡：右对齐贴在卡片上沿外侧，宽度受卡片约束防溢出 */
.status-tip {
  position: absolute;
  bottom: calc(100% + 8px); right: 0;
  max-width: 100%;
  white-space: normal;
  background: rgba(30, 42, 36, .92);
  color: #fff;
  font-size: 12px; line-height: 1.35;
  padding: 6px 9px; border-radius: 6px;
  opacity: 0; visibility: hidden;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
  z-index: 6;
}
.card:hover .status-tip { opacity: 1; visibility: visible; transform: translateY(0); }

/* 占位 / 未配置链接的卡片 */
.card.disabled { opacity: .62; cursor: default; }
.card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
}
.card.disabled:hover .card-icon { color: var(--icon); background: var(--icon-bg); }

/* ================= 页脚 ================= */
.footer { margin-top: 8px; text-align: center; font-size: 12px; color: var(--text-weak); }

/* ================= 小屏适配 ================= */
@media (max-width: 560px) {
  .page { padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }
  .greeting { font-size: 19px; }
  .clock-time { font-size: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card { padding: 12px; gap: 10px; min-height: 66px; }
  .card-icon { width: 36px; height: 36px; }
  .card-icon .ico { width: 20px; height: 20px; }
}
