/* admin.css —— 后台统一设计语言（安居运营管理平台）
   去 AI 味：墨绿主色替代微信绿，侧栏近黑沉稳，表格/表单克制。 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #0d9488;
  --primary-dark: #0a7d72;
  --primary-soft: #e6f7f4;
  --primary-line: #bfe6e0;
  --accent: #b8763e;
  --danger: #b6443a;
  --warning: #9a6a16;
  --text: #23292e;
  --text-2: #5b646b;
  --text-weak: #97a0a6;
  --bg: #f4f3ef;
  --card: #ffffff;
  --line: #e8e6e0;
  --line-strong: #dcd9d2;
  --sidebar-bg: #20262b;
  --sidebar-text: #b9c0c4;
  --sidebar-active: #1f3a35;
}

body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }

/* 框架 */
.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; height: 100vh; position: fixed; left: 0; top: 0; }
.logo { padding: 20px 18px; font-size: 16px; font-weight: 700; color: #e8edea; border-bottom: 1px solid #2c3338; letter-spacing: .5px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 0; scrollbar-width: thin; scrollbar-color: #4a545c var(--sidebar-bg); scrollbar-gutter: stable; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.nav::-webkit-scrollbar-thumb { background: #4a545c; border-radius: 3px; }
.nav-group { }
.nav-group-title { padding: 10px 18px 6px; font-size: 11px; color: #6f797e; letter-spacing: 1px; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; }
.nav-group-title::after { content: "▾"; font-size: 10px; color: #6f797e; transition: transform .15s; }
.nav-group.collapsed .nav-group-title::after { transform: rotate(-90deg); }
.nav-group.collapsed .nav-item { display: none; }
/* 分组折叠时二级父菜单必须一起收起：否则父菜单标题孤立露出，点开也看不到子项（表现为「点了没反应」） */
.nav-group.collapsed .nav-parent { display: none; }
.nav-item { padding: 7px 18px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px; color: var(--sidebar-text); transition: background .15s; border-left: 3px solid transparent; }
.nav-item:hover { background: #2a3136; }
.nav-item.active { background: var(--sidebar-active); color: #fff; border-left-color: var(--primary); }
/* 二级父菜单（健康任务中心 / 体检服务） */
.nav-parent { }
/* user-select:none 防连点选中文字；预留 3px 透明左边框，active 只换颜色，避免文字左右位移抖动 */
.nav-parent-title { padding: 7px 18px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: space-between; color: var(--sidebar-text); transition: background .15s, color .15s; user-select: none; -webkit-user-select: none; border-left: 3px solid transparent; }
.nav-parent-title:hover { background: #2a3136; }
.nav-parent-title::after { content: "▾"; font-size: 10px; color: #6f797e; transition: transform .15s; }
.nav-parent.collapsed .nav-parent-title::after { transform: rotate(-90deg); }
.nav-parent.collapsed .nav-sub { display: none; }
.nav-sub .nav-item { padding-left: 34px; font-size: 12.5px; }
.nav-parent.active > .nav-parent-title { color: #fff; border-left-color: var(--primary); }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid #2c3338; font-size: 12px; color: #8b949a; line-height: 1.7; }
.sidebar .foot a { color: #a9b4ba; cursor: pointer; text-decoration: none; }

.main { margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }
#iframe#content, iframe#content { flex: 1; border: none; background: #fff; width: 100%; min-height: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 5; flex-shrink: 0; }
.topbar .title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar .right { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 14px; }
.topbar .right a { color: var(--primary); cursor: pointer; }
.content-area { padding: 22px; flex: 1; }

/* 按钮 */
.btn { background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; transition: background .15s; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary-line); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #9c3a31; }
.btn.line { background: #fff; color: var(--text-2); border: 1px solid var(--line-strong); }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 5px; }
.btn.xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* 工具栏 */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.search input { height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 12px; width: 220px; font-size: 13px; outline: none; }
.search input:focus { border-color: var(--primary); }
.filter { font-size: 13px; color: var(--text-2); }
.filter select { height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 10px; margin-left: 6px; outline: none; }
.filter select:focus { border-color: var(--primary); }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 11px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); }
th { background: #f7f6f3; color: var(--text-2); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfa; }
td .btn { margin-right: 8px; white-space: nowrap; }
td .btn:last-child { margin-right: 0; }
/* 操作列：禁止换行，避免列宽被压缩后按钮被裁切/挤在一起（各列表页共用） */
td:last-child, th:last-child { white-space: nowrap; }
/* 操作按钮统一紧凑尺寸，两个按钮并排更从容 */
td:last-child .btn { padding: 4px 10px; font-size: 12px; border-radius: 5px; line-height: 1.6; vertical-align: middle; }

/* 标签 */
.tag { background: #f3f2ee; color: var(--text-2); border-radius: 4px; padding: 1px 7px; font-size: 12px; border: 1px solid var(--line); }
.tag-warn { color: var(--warning); background: #f6efe2; border-color: #e6d8bf; }
.status-on { color: var(--primary); font-weight: 600; }
.status-off { color: var(--text-weak); }
.uncat { color: var(--danger); font-size: 12px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 20; }
.modal-mask.show { display: flex; }
.modal { background: #fff; width: 480px; border-radius: 10px; padding: 24px; max-height: 88vh; overflow-y: auto; border: 1px solid var(--line); }
.modal h3 { font-size: 16px; margin-bottom: 16px; color: var(--text); }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 12px; font-size: 13px; outline: none; font-family: inherit; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { height: 60px; resize: vertical; }
.row2 { display: flex; gap: 12px; }
.row2 > div { flex: 1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

/* 通用 */
.empty { text-align: center; color: var(--text-weak); padding: 40px; }
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: rgba(35,41,46,.92); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }
.thumb { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #f6f6f6; }
.thumb-emoji { width: 46px; height: 46px; border-radius: 6px; background: #f3f3f3; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; }
.thumb-ph { width: 46px; height: 46px; border-radius: 6px; background: #f0f0f0; display: inline-flex; align-items: center; justify-content: center; color: #bbb; font-size: 12px; }
.img-prev { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #f6f6f6; }
.img-prev-ph { width: 64px; height: 64px; border-radius: 6px; background: #f3f3f3; display: inline-flex; align-items: center; justify-content: center; color: #bbb; font-size: 12px; }
.img-row { display: flex; align-items: center; gap: 12px; }
.img-row input[type="file"] { font-size: 12px; }

/* 图文块编辑器 */
.blk-editor { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fafaf8; }
.blk-add { display: flex; gap: 8px; margin-bottom: 10px; }
.blk-add button { background: #fff; color: var(--primary); border: 1px solid var(--primary-line); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 12px; }
.blk-add button:hover { background: var(--primary-soft); }
.blk-item { display: flex; gap: 8px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.blk-ops { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.blk-ops button { border: 1px solid var(--line-strong); background: #fff; border-radius: 4px; width: 28px; height: 26px; cursor: pointer; font-size: 12px; line-height: 1; }
.blk-ops button:hover { background: #f2f2f2; }
.blk-item textarea { flex: 1; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px; font-size: 13px; resize: vertical; min-height: 56px; font-family: inherit; outline: none; }
.blk-item textarea:focus { border-color: var(--primary); }
.blk-img-wrap { flex: 1; }
.blk-img-wrap img { max-width: 100%; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.blk-img-wrap .blk-img-tip { font-size: 12px; color: #999; margin-top: 4px; }
.blk-img-wrap input[type="file"] { font-size: 12px; margin-top: 4px; }
.blk-hint { font-size: 12px; color: #999; margin-top: 6px; line-height: 1.5; }

/* 数据概览卡片 */
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.card-stat { flex: 1; min-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; border-left: 4px solid var(--primary); }
.card-stat .num { font-size: 30px; font-weight: 700; color: var(--primary); }
.card-stat .lbl { font-size: 13px; color: var(--text-weak); margin-top: 6px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); }
.tip { color: #999; font-size: 13px; line-height: 1.7; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
/* 缺 Key 等危险告警（模型配置信息条） */
.alert-danger { margin: 6px 0; padding: 7px 10px; border-radius: 6px; background: #3a1416; color: #ff6b6b; border: 1px solid #6b2b2e; font-size: 12.5px; line-height: 1.5; }
.warn { color: #e0a458; font-weight: 600; }
