/* 养老院 Agent 工作台 · 移动优先样式 */
:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --primary: #b4532a;
  --primary-dark: #8f3f1e;
  --primary-soft: #f7e8e0;
  --accent: #2f6b4f;
  --accent-soft: #e5f0ea;
  --text: #2b2620;
  --muted: #8a8078;
  --line: #e8e1d7;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(43, 38, 32, 0.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
button { font-family: inherit; }

/* 布局 */
.app { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: 76px; }
.header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 243, 238, 0.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.header .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }
.header .title { font-weight: 700; font-size: 16px; }
.header .sub { color: var(--muted); font-size: 12px; }
.header .spacer { flex: 1; }
.main { padding: 14px 14px 0; }

/* 底部导航：悬浮胶囊，收窄不铺满 */
.tabbar {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 30; width: min(480px, calc(100% - 24px));
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 4px 18px rgba(43, 38, 32, 0.14);
  display: flex; justify-content: space-around;
  padding: 6px 8px;
}
.tabbar button {
  flex: 1; background: none; border: none; color: var(--muted);
  font-size: 11px; padding: 5px 0 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  border-radius: 999px;
}
.tabbar button.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
.tabbar button .ico { font-size: 20px; line-height: 1; display: flex; }
.tabbar button.active .ico { color: var(--primary); }

/* 卡片内紧凑操作行（代替一排按钮） */
.act-row { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.act-link { background: none; border: none; color: var(--primary); font-size: 13px; cursor: pointer; padding: 2px 0; }
.act-link:hover { text-decoration: underline; }
.act-link.danger { color: var(--danger); }

/* 桌面端适配：更宽的内容区、卡片留白、表单两列 */
@media (min-width: 900px) {
  .app { max-width: 860px; }
  .main { padding: 20px 24px 0; }
  .card { padding: 20px 22px; }
  .header { padding: 14px 24px; }
  .tabbar { bottom: 18px; }
  .row { gap: 16px; }
  .grid4 { gap: 12px; }
  .stat b { font-size: 24px; }
  body { font-size: 15.5px; }
}

/* 卡片与组件 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card h3 .tag { float: right; font-weight: 400; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

label.field { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; color: var(--text); background: #fcfbf9;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
textarea { resize: vertical; min-height: 72px; }
input[type='checkbox'] { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.85; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn.green { background: var(--accent); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.chip {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; margin: 0 6px 6px 0;
}
.chip.warm { background: var(--primary-soft); color: var(--primary-dark); }
.chip.gray { background: #f0ece5; color: var(--muted); }
.chip.red { background: #fdecea; color: var(--danger); }

.stat { text-align: center; padding: 10px 4px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; color: var(--primary); }
.stat span { font-size: 12px; color: var(--muted); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: none; }
.table .num { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }

/* 进度条 */
.progress { height: 8px; background: #efe9e0; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #d8814f); border-radius: 999px; transition: width 0.3s; }

/* 步骤条 */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 10px; margin-bottom: 12px; }
.steps .no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 13px; }

/* 照片墙 */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #efe9e0; }

/* 合规命中 */
.compliance-hit { background: #fff8e6; border: 1px solid #f2dfa8; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; }
.compliance-hit b { color: var(--danger); }
mark.hit { background: #ffd7d0; color: var(--danger); border-radius: 3px; padding: 0 2px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .logo-big { width: 64px; height: 64px; border-radius: 18px; background: var(--primary); color: #fff; font-size: 26px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(43, 38, 32, 0.92); color: #fff; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; z-index: 99; display: none; max-width: 86vw;
}

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 82vh; overflow: auto; padding: 18px; }

/* 列表项 */
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { font-size: 15px; }
.list-item .meta { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-all; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.badge-dot { position: absolute; top: -2px; right: -6px; width: 9px; height: 9px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; display: inline-block; }
.rec-dot { display: inline-block; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.hint { color: var(--muted); font-size: 12px; }
.divider { border: none; border-top: 1px dashed var(--line); margin: 14px 0; }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.mt10 { margin-top: 10px; }

/* 打印：只留报告主体 */
@media print {
  .header, .tabbar, #toast, .btn, button { display: none !important; }
  body { background: #fff; }
  .app { padding-bottom: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  textarea { border: none; resize: none; background: #fff; }
}
html, body { overflow-x: hidden; }
