/* 由舊 index.html 內嵌樣式搬出（登入、標題列、使用說明、共用 modal/表單）。Bot 卡片舊樣式已移除。 */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #0f1117;
      --surface: #1a1d27;
      --surface2: #22263a;
      --border: #2e3250;
      --text: #e2e8f0;
      --text2: #8892b0;
      --dim: #8892b0;
      --green: #4ade80;
      --yellow: #facc15;
      --red: #f87171;
      --blue: #60a5fa;
      --accent: #6366f1;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      min-height: 100vh;
    }

    /* ── 登入畫面 ── */
    #login-screen {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
    }

    .login-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 40px;
      width: 360px;
    }

    .login-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
    .login-card p { color: var(--text2); font-size: 14px; margin-bottom: 28px; }

    .field { margin-bottom: 16px; }
    .field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
    .field input {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 14px;
      color: var(--text);
      font-size: 14px;
      outline: none;
    }
    .field input:focus { border-color: var(--accent); }
    /* 欄位下方的白話說明，常駐顯示，避免日後看不懂各參數用途 */
    .field-hint { font-size: 12px; color: var(--text2); line-height: 1.5; margin-top: 5px; opacity: 0.85; }

    .btn {
      display: block;
      width: 100%;
      padding: 11px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
      transition: opacity .15s;
      text-decoration: none;
      text-align: center;
    }
    .btn:hover { opacity: .85; }
    .btn:disabled { opacity: .5; cursor: not-allowed; }

    .btn-secondary {
      background: var(--surface2);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .error-msg { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 20px; }
    .warn-msg { color: var(--yellow); font-size: 12px; line-height: 1.5; margin-bottom: 18px; }

    /* ── 主畫面 ── */
    #main-screen { display: none; }

    header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 32px;
      border-bottom: 1px solid var(--border);
    }
    header h1 { font-size: 18px; font-weight: 600; }

    .header-right { display: flex; align-items: center; gap: 16px; }
    .refresh-btn {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 7px 14px;
      font-size: 13px;
      cursor: pointer;
      transition: border-color .15s;
    }
    .refresh-btn:hover { border-color: var(--accent); }

    .logout-btn {
      background: transparent;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text2);
      padding: 7px 14px;
      font-size: 13px;
      cursor: pointer;
      transition: color .15s;
    }
    .logout-btn:hover { color: var(--text); }

    main { padding: 24px 32px; max-width: 1480px; margin: 0 auto; }

    .section-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text2);
      text-transform: uppercase;
      letter-spacing: .08em;
      margin-bottom: 16px;
    }

    /* ── 發文規則說明面板（可收合） ── */
    .guide {
      background: var(--surface);
      border: 1px solid var(--border);
      border-left: 3px solid var(--accent);
      border-radius: 12px;
      margin-bottom: 24px;
      overflow: hidden;
    }
    .guide summary {
      cursor: pointer;
      list-style: none;
      padding: 14px 20px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      user-select: none;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .guide summary::-webkit-details-marker { display: none; }
    .guide summary::after { content: '▾'; margin-left: auto; color: var(--text2); transition: transform .15s; }
    .guide[open] summary::after { transform: rotate(180deg); }
    .guide summary:hover { color: var(--blue); }
    .guide-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
    .guide-rule { margin-top: 16px; }
    .guide-rule h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
    .guide-rule p { font-size: 13px; line-height: 1.7; color: var(--text2); }
    .guide-rule code {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 1px 6px;
      font-size: 12.5px;
      color: var(--blue);
      font-family: 'SF Mono', 'Consolas', monospace;
    }
    .guide-eg {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 14px;
      margin-top: 8px;
      font-size: 12.5px;
      line-height: 1.7;
      color: var(--text2);
      white-space: pre-wrap;
    }
    .guide-eg b { color: var(--green); }
    .guide-warn { color: var(--yellow); }

    /* ── 顏色標註（對應左側圖片） ── */
    .mark-red {
      color: #ff5555;
      font-weight: 600;
    }
    .mark-lightblue {
      color: #60a5fa;
      font-weight: 600;
    }
    .mark-yellow {
      color: #ffd866;
      font-weight: 600;
    }

    /* ── 圖文對照佈局 ── */
    .guide-split {
      display: flex;
      gap: 32px;
      margin-top: 12px;
      align-items: flex-start;
    }
    .guide-split-img {
      flex: 0 0 70%;
      max-width: 70%;
      position: sticky;
      top: 20px;
    }
    .guide-split-img img {
      width: 100%;
      max-width: none;
      height: auto;
      border-radius: 8px;
      box-shadow: 0 2px 12px rgba(0,0,0,0.4);
      cursor: pointer;
      transition: transform 0.2s;
    }
    .guide-split-img img:hover {
      transform: scale(1.02);
    }
    .guide-split-text {
      flex: 1;
      min-width: 0;
    }
    .guide-split-text ol,
    .guide-split-text ul {
      margin: 8px 0;
      padding-left: 20px;
      line-height: 1.8;
    }
    .guide-split-text li {
      font-size: 13px;
      color: var(--text2);
      margin-bottom: 10px;
    }
    @media (max-width: 768px) {
      .guide-split { flex-direction: column; }
      .guide-split-img { flex: 1; max-width: 100%; position: static; }
    }

    /* 載入 / 空狀態 */
    .loading { color: var(--text2); font-size: 14px; padding: 40px 0; text-align: center; }
    .empty { color: var(--text2); font-size: 14px; padding: 60px 0; text-align: center; }

    #last-refresh { font-size: 12px; color: var(--text2); }

    /* Modal 共用 */
    .modal {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.6); z-index: 100;
      align-items: flex-start; justify-content: center;
      overflow-y: auto; padding: 40px 16px;
    }
    .modal-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 16px; padding: 32px; width: 520px; max-width: 100%;
    }
    .modal-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
    .modal-sub { color: var(--text2); font-size: 13px; margin-bottom: 24px; }

/* ═════════ 新版後台（計劃 12）═════════ */
:root { --card-w: 300px; --touch: 44px; }
button { font-family: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 燈號：形狀＋文字，不只靠顏色 */
.lamp { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1.3; }
.lamp-dot { font-size: 12px; }
.lamp-green .lamp-dot { color: var(--green); }
.lamp-yellow .lamp-dot { color: var(--yellow); }
.lamp-red .lamp-dot { color: var(--red); }
.lamp-gray .lamp-dot { color: var(--text2); }
.lamp-red .lamp-text { color: var(--red); }
.lamp-yellow .lamp-text { color: var(--yellow); }

/* 標題列 */
.app-header { flex-wrap: wrap; gap: 12px; }
.app-header .header-right { flex-wrap: wrap; gap: 8px; }
.hdr-btn {
  min-height: var(--touch); min-width: var(--touch); padding: 0 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; cursor: pointer;
}
.hdr-btn:hover { border-color: var(--accent); }
.hdr-btn:disabled { opacity: .5; cursor: not-allowed; }
.hdr-link { display: inline-flex; align-items: center; text-decoration: none; }

/* 頂端橫幅（刷新失敗／退回模式） */
.banner { margin: 0 32px; padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.banner[hidden] { display: none; }
.banner-warn { background: rgba(250,204,21,.12); border: 1px solid var(--yellow); color: var(--yellow); margin-top: 16px; }

/* 摘要列 */
.summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.sum-item {
  min-height: var(--touch); padding: 0 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.sum-item:hover { border-color: var(--accent); }
.sum-item strong { font-size: 16px; }
.sum-item.bad strong { color: var(--red); }
.sum-item .sub { color: var(--text2); font-size: 12px; }
.sum-spacer { flex: 1; }

/* 搜尋與篩選 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.filters input[type=search] {
  min-height: var(--touch); min-width: 220px; flex: 1 1 220px; max-width: 360px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px; color: var(--text); font-size: 14px; outline: none;
}
.filters input[type=search]:focus { border-color: var(--accent); }
.chip {
  min-height: var(--touch); padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text2); font-size: 13px; cursor: pointer;
}
.chip[aria-pressed=true] { border-color: var(--accent); color: var(--text); background: rgba(99,102,241,.18); }
.filter-count { color: var(--text2); font-size: 13px; }

/* 機器人區塊 */
.host-title { font-size: 13px; font-weight: 600; color: var(--text2); margin: 18px 0 8px; letter-spacing: .04em; }
.block { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px; }
.block[hidden] { display: none; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; }
.block-toggle {
  min-height: var(--touch); display: inline-flex; align-items: center; gap: 8px; background: transparent; border: none;
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; padding: 0 6px;
}
.block-name small { color: var(--text2); font-weight: 400; font-size: 12px; margin-left: 6px; }
.block-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text2); align-items: center; }
.block-stats .bad { color: var(--red); font-weight: 600; }
.block-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }
.capacity { display: inline-flex; align-items: center; gap: 6px; }
.progress { width: 70px; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); }
.capacity.over .progress > i { background: var(--yellow); }
.capacity.over { color: var(--yellow); }
.block-body { padding: 4px 14px 14px; }
.small-btn {
  min-height: var(--touch); min-width: var(--touch); padding: 0 12px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; cursor: pointer;
}
.small-btn:hover:not(:disabled) { border-color: var(--accent); }
.small-btn:disabled { opacity: .45; cursor: not-allowed; }
.small-btn.danger { border-color: var(--red); color: var(--red); }
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-switch button { min-height: var(--touch); padding: 0 12px; background: var(--surface2); border: none; color: var(--text2); font-size: 13px; cursor: pointer; }
.view-switch button[aria-pressed=true] { background: var(--accent); color: #fff; }
.narrow-only { display: none; }
@media (max-width: 640px) {
  .wide-only { display: none; }
  .narrow-only { display: block; }
  main { padding: 16px; }
  .banner { margin: 0 16px; }
  header { padding: 14px 16px; }
}

/* 卡片橫向單排 */
.cards { display: flex; flex-wrap: nowrap; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 10px; outline: none; }
.cards:focus-visible { outline: 2px solid var(--accent); }
.card {
  flex: 0 0 var(--card-w); width: var(--card-w); scroll-snap-align: start; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; position: relative;
}
.card.red { border-color: rgba(248,113,113,.6); }
.card.failed { border: 2px solid var(--red); }
.card .fail-tag { position: absolute; top: -1px; right: -1px; background: var(--red); color: #0f1117; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 0 10px 0 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-size: 15px; font-weight: 600; word-break: break-all; }
.card-sub { font-size: 12px; color: var(--text2); word-break: break-all; }
.card-lamps { display: flex; flex-direction: column; gap: 2px; }
.card-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.card-row .k { color: var(--text2); }
.card-warn { color: var(--yellow); font-size: 12px; }
.card-note { color: var(--text2); font-size: 12px; line-height: 1.5; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.card-actions .small-btn { flex: 1 1 auto; padding: 0 8px; }
.switch { position: relative; display: inline-flex; align-items: center; min-height: var(--touch); min-width: var(--touch); justify-content: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { width: 40px; height: 22px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); position: relative; transition: background .2s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }

/* 選單 */
.menu { position: relative; display: inline-block; }
.menu-popup {
  position: fixed; left: 0; top: 0; z-index: 50; min-width: 180px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.menu-popup[hidden] { display: none; }
.menu-item { display: block; width: 100%; min-height: var(--touch); text-align: left; padding: 0 12px; background: transparent; border: none; border-radius: 6px; color: var(--text); font-size: 14px; cursor: pointer; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--surface2); }
.menu-item.danger { color: var(--red); }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* 清單模式 */
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.list-tools input { min-height: var(--touch); background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; color: var(--text); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table.glist { width: 100%; border-collapse: collapse; font-size: 13px; }
table.glist th, table.glist td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.glist th button { background: transparent; border: none; color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; min-height: 32px; padding: 0; }
table.glist tr.failed td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--text2); flex-wrap: wrap; }

/* 視窗 */
#dialog-root:empty { display: none; }
.dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.dialog { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 520px; max-width: 100%; outline: none; }
.dialog-danger { border-color: var(--red); }
.dialog-title { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.dialog-body { font-size: 14px; line-height: 1.6; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.dlg-btn { width: auto; min-height: var(--touch); margin-top: 0; padding: 0 18px; }
.dlg-cancel { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.dlg-danger { background: var(--red); color: #0f1117; }
.dialog-discard { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--yellow); border-radius: 8px; color: var(--yellow); }

/* 提示列 */
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.toast-ok { border-color: var(--green); }
.toast-undo { border-color: var(--green); }
.toast-error { border-color: var(--red); color: var(--red); }
.toast-text { flex: 1; word-break: break-word; }
.toast-btn { min-height: var(--touch); min-width: var(--touch); padding: 0 12px; background: transparent; border: 1px solid currentColor; border-radius: 8px; color: inherit; cursor: pointer; font-size: 13px; }

/* 圖例 */
.legend-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.legend-row .lamp { min-width: 72px; }
.legend-sub { color: var(--text2); font-size: 13px; margin: 14px 0 6px; font-weight: 600; }
.block.planned { opacity: .6; }
.empty { color: var(--text2); font-size: 14px; padding: 24px 0; text-align: center; }

/* 群組視窗（計劃 13） */
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-row input[type=text] { width: 100%; min-height: var(--touch); padding: 0 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.form-row .readonly { min-height: var(--touch); display: flex; align-items: center; padding: 0 12px; background: var(--surface2); border-radius: 8px; color: var(--text2); }
.form-hint { font-size: 12px; color: var(--text2); margin-top: 6px; line-height: 1.5; }
.form-msg { font-size: 12px; line-height: 1.5; margin-top: 6px; padding: 6px 10px; border-radius: 6px; background: var(--bg2); color: var(--text2); }
.form-msg-error { color: var(--red); }
.form-msg-warn { color: var(--text2); }
.form-msg-ok { color: var(--green); }
.form-warnings:empty { display: none; }
.inline-row { display: flex; gap: 8px; align-items: stretch; }
.inline-row input { flex: 1; min-width: 0; }
.verify-result:empty { display: none; }
.email-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; word-break: break-all; }
.email-select { width: 100%; }
.restore-prompt { padding: 4px 0; }
.confirm-body ul { margin: 4px 0 12px 20px; }
.confirm-title { font-weight: 600; margin-top: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { min-height: var(--touch); padding: 0 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
.tab[aria-selected=true] { border-color: var(--accent); color: var(--accent); }
.post-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.post-item { padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text2); }
.post-count.bad, .post-warn.bad { color: var(--red); }
.post-content { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.post-reason { margin-top: 4px; font-size: 13px; color: var(--red); }
.audit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit-table th, .audit-table td { padding: 6px 8px; text-align: left; border-top: 1px solid var(--border); word-break: break-word; }
.dialog:has(.audit-body) { width: 860px; }
.trash { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 12px; }
.trash summary { min-height: var(--touch); display: flex; align-items: center; cursor: pointer; font-size: 14px; color: var(--text2); }
.trash-tools { margin: 8px 0; }
.trash-tools input { min-height: var(--touch); padding: 0 12px; width: min(320px, 100%); background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.trash-list { list-style: none; margin: 0; padding: 0; }
.trash-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.trash-name { font-size: 14px; }
.trash-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.card.flash { animation: flash 1.5s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .card.flash { animation: none; outline: 2px solid var(--accent); } }

/* ── 計劃 14：機器人改名、精靈、還原 ── */
.rename-form { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rename-input { min-height: var(--touch); min-width: 160px; padding: 0 10px; background: var(--surface2); border: 1px solid var(--accent); border-radius: 8px; color: var(--text); font-size: 14px; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.wizard-step { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--text2); }
.wizard-step.current { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.wizard-step.done { color: var(--green); border-color: var(--green); }
.wizard-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.field-note:empty, .form-hint:empty { display: none; }
.field-note { color: var(--red); }
.prep-list { list-style: none; margin: 8px 0 0; padding: 0; }
.prep-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.prep-item label { flex: 1 1 260px; min-height: var(--touch); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.prep-values { font-size: 13px; color: var(--text2); background: var(--surface2); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.check-items { list-style: none; margin: 10px 0 0; padding: 0; }
.check-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.check-pass .check-mark, .check-pass .check-state { color: var(--green); }
.check-fail .check-mark, .check-fail .check-state { color: var(--red); }
.check-skipped .check-mark, .check-skipped .check-state { color: var(--text2); }
.check-detail { flex-basis: 100%; font-size: 12px; color: var(--text2); }
.restore-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.restore-groups { list-style: none; margin: 4px 0 8px; padding: 0; max-height: 40vh; overflow-y: auto; }
.restore-item label { min-height: var(--touch); display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.block.planned { opacity: 0.8; }

/* ── 計劃 14：配額視窗 ── */
.dialog:has(.quota-body) { width: 720px; }
.quota-period { font-size: 14px; margin: 0 0 10px; }
.table-wrap { overflow-x: auto; }
.quota-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.quota-table th, .quota-table td { padding: 8px; text-align: left; border-top: 1px solid var(--border); }
.quota-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.quota-prepaid { font-size: 14px; margin: 0 0 6px; }
.quota-service { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.service-preview { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }
.service-preview.bad { border-color: #c0392b; }
.service-line { font-size: 14px; line-height: 1.7; }
.records-filter { margin-bottom: 8px; }
.qa-body .qa-current { font-size: 14px; margin-bottom: 8px; }
.qa-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qa-preview { font-size: 16px; font-weight: 600; margin: 10px 0; }
.qa-preview.bad { color: var(--red); }
.form-row select { width: 100%; min-height: var(--touch); padding: 0 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }

/* ── 計劃 15：檢查連線進度面板 ── */
.check-root { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.check-root[hidden] { display: none; }
.check-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.check-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.check-bar { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.check-bar i { display: block; height: 100%; background: var(--accent); }
.check-done .check-bar i { background: var(--green); }
.check-stopped .check-bar i { background: var(--yellow); }
.check-headline { margin-top: 8px; font-size: 14px; }
.check-counts { margin-top: 4px; font-size: 12px; color: var(--text2); }
.check-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.check-reason { font-size: 12px; color: var(--yellow); align-self: center; }
@media (max-width: 640px) { .check-root { right: 8px; left: 8px; bottom: 8px; width: auto; } }

/* ── 計劃 15：異常面板與鈴鐺 ── */
.anomaly-panel { position: fixed; top: 64px; right: 16px; z-index: 35; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 96px); overflow-y: auto; background: var(--surface); border: 1px solid var(--red); border-radius: 12px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.anomaly-panel[hidden] { display: none; }
.anomaly-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.anomaly-tools { display: inline-flex; gap: 6px; }
.anomaly-list { list-style: none; margin: 0; padding: 0; }
.anomaly-item { padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.anomaly-item.acked { opacity: 0.55; }
.anomaly-subject { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.anomaly-kind { font-size: 12px; padding: 1px 8px; border: 1px solid var(--red); border-radius: 999px; color: var(--red); }
.anomaly-name { font-weight: 600; word-break: break-word; }
.anomaly-reason { margin-top: 4px; color: var(--text2); word-break: break-word; }
.anomaly-since { margin-top: 2px; font-size: 12px; color: var(--text2); }
.anomaly-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bell-quiet { opacity: 0.6; }
@media (max-width: 640px) { .anomaly-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 55vh; border-radius: 12px 12px 0 0; } }

/* ── 計劃 15：異常總表 ── */
.back-link { color: var(--accent); text-decoration: none; font-size: 14px; }
#issue-count { font-size: 14px; color: var(--text2); }
.check-inline { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); font-size: 14px; }
.filters select { min-height: var(--touch); padding: 0 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.issues-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.issues-table th, .issues-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.issues-table th button { background: transparent; border: none; color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; min-height: 32px; padding: 0; }
.issues-table .sticky-col { position: sticky; background: var(--surface); z-index: 1; }
.issues-table .sticky-1 { left: 0; min-width: 64px; }
.issues-table .sticky-2 { left: 64px; min-width: 110px; }
.issues-table .sticky-3 { left: 174px; min-width: 130px; }
.issue-reasons { list-style: none; margin: 0; padding: 0; min-width: 220px; }
.issue-actions { white-space: nowrap; }
.issue-link { color: var(--accent); text-decoration: none; }
.sev-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; font-size: 12px; }
.sev-tag.sev-failed, .sev-tag.sev-red { color: var(--red); }
.sev-tag.sev-yellow { color: var(--yellow); }
.sev-tag.sev-gray { color: var(--text2); }
tr.flash td, .block.flash { animation: flash 1.5s ease-out; }
.settings-body .field-note { color: var(--red); }
.dialog:has(.settings-body) { width: 640px; }
.dialog:has(.settings-body) .dialog-body { max-height: 70vh; overflow-y: auto; }

/* 手機／觸控：表頭排序按鈕也要有 44px 的點擊範圍 */
@media (max-width: 640px), (pointer: coarse) { table.glist th button, .issues-table th button { min-height: 44px; min-width: 44px; padding: 0 6px; } }
