/**
 * [INPUT]: 依赖 lore-ui.css 的基础令牌与 status.ts 输出的顶部导航、命令栏和页面分区语义
 * [OUTPUT]: 提供 A7 淡蓝总览画布、紧凑命令栏、失效/异常状态区分、缓存状态、批量操作与分区标题布局
 * [POS]: public 状态页的壳层视觉，约束全页层级和响应式编排；账号卡与日志细节由 status.css 承接
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

html,
body {
  background: #f0f2ff;
}

body {
  color: #20222b;
}

.container {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 22px 64px;
  display: grid;
  gap: 12px;
}

.topbar {
  width: 100%;
  border-bottom-color: rgba(106, 116, 155, 0.16);
  background: rgba(240, 242, 255, 0.94);
}

.brand-mark {
  background: #526d9e;
}

.brand-copy strong {
  letter-spacing: 0;
}

.topbar-link-primary {
  background: #2f5283;
}

.command-bar {
  min-height: 82px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid #b7d4ed;
  border-radius: 9px;
  background: rgba(248, 250, 255, 0.96);
  box-shadow: 0 1px 2px rgba(70, 92, 130, 0.04);
}

.next-run-inline {
  min-width: 156px;
  padding-right: 16px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: start;
  gap: 3px 8px;
  border-right: 1px solid rgba(106, 116, 155, 0.18);
}

.next-run-inline > span,
.next-run-inline > small {
  color: #73798a;
  font-size: 11px;
}

.next-run-inline > small {
  grid-column: 1 / -1;
}

.countdown {
  color: #20222b;
  font-size: 24px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
}

.summary-status {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.stat-row,
.cache-row,
.summary-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-item,
.cache-pill,
.account-count {
  min-height: 25px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(106, 116, 155, 0.14);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.stat-item.error { color: var(--danger); background: var(--danger-soft); }
.stat-item.warning { color: var(--warning); background: var(--warning-soft); }
.stat-item.doing { color: var(--info); background: var(--info-soft); }
.stat-item.waiting { color: var(--warning); background: var(--warning-soft); }
.stat-item.done { color: var(--success); background: var(--success-soft); }

.cache-pill {
  gap: 6px;
  color: #4d566b;
  background: #f1f4fa;
}

.cache-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.cache-pill.fresh { color: var(--success); }
.cache-pill.refreshing { color: var(--info); }
.cache-pill.stale { color: var(--warning); }
.cache-pill.error { color: var(--danger); }

.cache-time {
  color: #73798a;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.summary-actions {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.summary-actions .btn {
  min-height: 42px;
  padding: 0 13px;
}

.summary-actions .btn-primary {
  background: #2f5283;
}

.summary-actions .btn-secondary {
  border-color: #aebbd0;
  background: #f9fbff;
}

.accounts-section,
.logs-section {
  display: grid;
  gap: 8px;
}

.section-heading-row {
  min-height: 42px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-row h1,
.section-heading-row h2 {
  margin: 0;
  color: #20222b;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
}

.section-heading-row h1 {
  font-size: 22px;
}

.section-heading-row h2 {
  font-size: 19px;
}

.account-count {
  color: #73798a;
  border-color: transparent;
  background: transparent;
}

.section-hint {
  color: #73798a;
  font-size: 11px;
}

@media (hover: hover) and (pointer: fine) {
  .topbar-link-primary:hover,
  .summary-actions .btn-primary:hover:not(:disabled) {
    background: #284873;
  }
}

@media (max-width: 900px) {
  .container {
    max-width: 700px;
  }

  .command-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .summary-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .summary-actions .btn {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .container {
    padding: 0 10px 44px;
    gap: 8px;
  }

  .topbar {
    min-height: 56px;
    padding: 4px 1px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-copy small {
    display: block;
  }

  .topbar-nav {
    gap: 3px;
  }

  .topbar-link {
    min-height: 42px;
    padding: 0 10px;
    font-size: 12px;
  }

  .command-bar {
    min-height: 0;
    padding: 9px 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .next-run-inline {
    min-width: 0;
    padding-right: 8px;
  }

  .next-run-inline > small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-status {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 7px;
    border-top: 1px solid rgba(106, 116, 155, 0.14);
  }

  .summary-actions {
    grid-column: 2;
    grid-row: 1;
    flex-wrap: nowrap;
  }

  .summary-actions .btn {
    min-height: 40px;
    padding: 0 10px;
    font-size: 11px;
  }

  .stat-row,
  .cache-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .stat-row::-webkit-scrollbar,
  .cache-row::-webkit-scrollbar {
    display: none;
  }

  .section-heading-row {
    min-height: 38px;
  }

  .section-heading-row h1 {
    font-size: 20px;
  }

  .section-hint {
    display: none;
  }
}

@media (max-width: 370px) {
  .brand-copy small {
    display: none;
  }

  .topbar-link {
    padding: 0 8px;
  }

  .summary-actions .btn {
    padding: 0 8px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .command-bar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #f9fbff;
  }
}

@media (prefers-contrast: more) {
  .command-bar {
    border-color: #6b7690;
  }
}
