/* CheckMyCat 网页版 — teal 主题(主色 #00695C,沿用小程序设计语言:rpx→px 等比) */

[hidden] { display: none !important; }

:root {
  --teal: #00695C;
  --teal-dark: #004D40;
  --teal-light: #E0F2F1;
  --orange: #E65100;
  --bg: #f5f5f5;
  --text: #333;
  --muted: #999;
  --border: #eee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 登录页 ==================== */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.login-title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 22px;
  color: var(--teal);
}

.login-mode {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px; /* ≥16px 避免 iOS 聚焦自动放大 */
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ccc;
  font-size: 12px;
  margin: 20px 0;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #eee;
}

/* ==================== 按钮 ==================== */

button { font-family: inherit; }

.btn-primary,
.btn-outline {
  width: 100%;
  margin-top: 14px;
  padding: 11px 16px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:active { background: var(--teal-dark); }

.btn-outline {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}

.btn-outline:active { background: var(--teal-light); }

.btn-primary:disabled,
.btn-outline:disabled { opacity: 0.55; cursor: default; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

/* ==================== 模式头(标题 / Tab 栏 / 登出) ==================== */

#app-header {
  background: var(--teal);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

.tabbar {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.tab {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.tab.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

main#tab-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

.foot {
  text-align: center;
  color: #bbb;
  font-size: 12px;
  padding: 28px 0;
}

/* ==================== 卡片(沿用小程序 .card 系) ==================== */

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-title { font-size: 13px; color: var(--muted); }

.room-name {
  font-size: 34px;
  font-weight: bold;
  color: var(--text);
  margin: 12px 0;
  word-break: break-all;
}

.room-name.away { color: var(--orange); }

.updated { font-size: 13px; color: var(--muted); }

.warn { color: var(--orange); font-size: 14px; }

.center-card { text-align: center; }

.center-card .btn-primary { margin-top: 16px; }

.section-title {
  font-size: 15px;
  font-weight: bold;
  margin: 24px 2px 10px;
}

.list-item {
  background: #fff;
  padding: 13px 16px;
  margin-bottom: 8px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.list-item .title { font-size: 15px; color: var(--text); }

.list-item .sub { font-size: 12px; color: var(--muted); }

a.list-item { text-decoration: none; }

a.list-item:hover { background: var(--teal-light); }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 48px 16px;
}

.muted { color: var(--muted); }

/* ==================== 多猫 ==================== */

.pet-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
}

.pet-tab {
  border: 1px solid var(--teal);
  background: #fff;
  color: var(--teal);
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.pet-tab.active {
  background: var(--teal);
  color: #fff;
}

.pet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .pet-grid { grid-template-columns: 1fr 1fr; }
}

/* ==================== 表格 / 徽标 ==================== */

.table-wrap {
  background: #fff;
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}

.table th {
  text-align: left;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 13px;
  padding: 10px 12px;
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: #fafafa; }

.mono { font-family: Menlo, Consolas, monospace; font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.on { background: #E8F5E9; color: #2E7D32; }

.badge.off { background: #f0f0f0; color: var(--muted); }

.badge.warn { background: #FFF3E0; color: var(--orange); }

/* ==================== Toast ==================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 99;
  max-width: 86vw;
  text-align: center;
}

/* ==================== 管理员模式(Task 5) ==================== */

/* 搜索 / 工具条 */

.search-bar,
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  background: #fff;
}

.search-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

.danger-bar { align-items: center; }

.select {
  flex: 1;
  min-width: 0;
  max-width: 260px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  outline: none;
}

/* 小按钮(表格内操作) */

.btn-sm {
  border: 1px solid var(--teal);
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm:active { background: var(--teal-light); }

.btn-sm.danger {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-sm.danger:active { background: #FFF3E0; }

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pet-link {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}

.pet-link:hover { text-decoration: underline; }

/* 总览统计卡片 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-num {
  font-size: 28px;
  font-weight: bold;
  color: var(--teal);
  line-height: 1.2;
}

.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.muted-note {
  font-size: 12px;
  color: #bbb;
  margin: 4px 2px 0;
}

/* 家庭可展开列表 */

details.family-item {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

details.family-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

details.family-item summary::-webkit-details-marker { display: none; }

details.family-item summary::before { content: "▸"; color: var(--muted); }

details[open].family-item summary::before { content: "▾"; }

.fam-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fam-name { font-size: 15px; font-weight: 600; }

.fam-meta { font-size: 12px; color: var(--muted); }

.family-detail {
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.k { font-size: 13px; color: var(--muted); white-space: nowrap; }

.family-detail code,
.chip {
  font-size: 13px;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 3px 10px;
  border-radius: 6px;
}

.chip { border-radius: 999px; }

.chip.mono { font-family: Menlo, Consolas, monospace; }

.chips-row { display: flex; align-items: baseline; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

