/* ============================================================
   浙好家政 · 网页端管理后台 —— 全局样式
   视觉口径与小程序后台一致：主色 #FF8C42，白底圆角卡片，浅灰分隔线
   ============================================================ */
:root {
  --primary: #FF8C42;
  --primary-dark: #F07B2E;
  --primary-light: #FFF1E6;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --border: #EEEEEE;
  --divider: #F0F0F0;
  --text: #333333;
  --text-sub: #666666;
  --text-mut: #999999;
  --danger: #F44336;
  --success: #4CAF50;
  --warning: #FF9800;
  --info: #2196F3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ============ 布局骨架 ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px;
  flex: none;
  background: #2B2B33;
  color: #fff;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .brand .dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); margin-right: 8px;
}
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #C8C8D0; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar nav a.active {
  color: #fff; background: linear-gradient(90deg, rgba(255, 140, 66, 0.25), transparent);
  border-left: 3px solid var(--primary);
}
.sidebar .side-foot { padding: 14px 20px; font-size: 12px; color: #6A6A76; border-top: 1px solid rgba(255,255,255,0.08); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  flex: none;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }

/* 模式开关：演示数据 / 连云端 */
.mode-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-sub);
}
.mode-toggle .mode-label { white-space: nowrap; }
.mode-toggle .mode-label.on { color: var(--primary); font-weight: 600; }
.switch {
  position: relative; width: 46px; height: 24px; background: #D8D8DE;
  border-radius: 12px; cursor: pointer; transition: background .2s; border: none;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(22px); }

.topbar .user-chip { font-size: 13px; color: var(--text-sub); }
.topbar .btn-logout {
  background: none; border: 1px solid var(--border); color: var(--text-sub);
  padding: 5px 12px; border-radius: 6px; font-size: 13px;
}
.topbar .btn-logout:hover { color: var(--danger); border-color: var(--danger); }

.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ============ 卡片 ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.card-title .sub { font-weight: 400; font-size: 12px; color: var(--text-mut); margin-left: 8px; }

/* ============ KPI 指标卡 ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.kpi {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.kpi .kpi-label { font-size: 13px; color: var(--text-sub); }
.kpi .kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--text); }
.kpi .kpi-value.primary { color: var(--primary); }
.kpi .kpi-extra { font-size: 12px; color: var(--text-mut); margin-top: 4px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--divider); white-space: nowrap; }
th { font-size: 12px; color: var(--text-mut); font-weight: 500; background: #FAFAFC; }
tbody tr:hover { background: #FBFBFD; }
td.num { font-variant-numeric: tabular-nums; }
.money { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ 徽标 / 状态 ============ */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; line-height: 18px; color: #fff;
}
.badge.gray { background: #9E9E9E; }
.badge.green { background: var(--success); }
.badge.orange { background: var(--warning); }
.badge.blue { background: var(--info); }
.badge.red { background: var(--danger); }
.badge.muted { background: #E0E0E0; color: #666; }

.dot-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 14px;
  background: var(--primary); color: #fff; transition: opacity .15s;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text-sub); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn.plain { background: none; color: var(--primary); padding: 4px 6px; font-size: 13px; }
.btn.plain.danger { color: var(--danger); }

/* ============ 表单 ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; outline: none; background: #fff; transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.7; }
.input[readonly] { background: #F5F5F7; color: var(--text-mut); }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }

/* 筛选条 */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; }

/* ============ 分页 ============ */
.pagination { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text-sub); }
.pagination button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 12px; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ 空态 / 加载 ============ */
.empty { text-align: center; color: var(--text-mut); padding: 48px 0; }
.loading { text-align: center; color: var(--text-mut); padding: 24px 0; }

/* ============ 抽屉（详情） ============ */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 92vw;
  background: #fff; z-index: 100; box-shadow: -4px 0 20px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.drawer-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { font-size: 16px; }
.drawer-head .close { background: none; border: none; font-size: 22px; color: var(--text-mut); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-grid .d-item { border-bottom: 1px dashed var(--divider); padding-bottom: 8px; }
.detail-grid .d-item.full { grid-column: 1 / -1; }
.d-item .k { font-size: 12px; color: var(--text-mut); }
.d-item .v { font-size: 14px; margin-top: 2px; word-break: break-all; }

/* ============ 弹窗 ============ */
.dialog-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: center; justify-content: center; }
.dialog { background: #fff; border-radius: 12px; width: 400px; max-width: 90vw; padding: 22px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.dialog h4 { font-size: 15px; margin-bottom: 10px; }
.dialog .dialog-msg { color: var(--text-sub); margin-bottom: 18px; white-space: pre-wrap; }
.dialog .dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============ 登录页 ============ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #FFF1E6 0%, #FFE3CE 100%); }
.login-card { width: 400px; max-width: 92vw; background: #fff; border-radius: 16px; padding: 36px; box-shadow: 0 10px 40px rgba(255,140,66,.18); }
.login-card .logo { text-align: center; margin-bottom: 8px; font-size: 22px; font-weight: 700; }
.login-card .slogan { text-align: center; color: var(--text-mut); font-size: 13px; margin-bottom: 28px; }
.login-card .divider { text-align: center; color: var(--text-mut); margin: 18px 0; position: relative; }
.login-card .divider::before, .login-card .divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--divider); }
.login-card .divider::before { left: 0; }
.login-card .divider::after { right: 0; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ============ 编辑器（服务图文大屏） ============ */
.editor-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.editor-tabs button {
  border: none; background: none; padding: 9px 16px; font-size: 14px;
  color: var(--text-sub); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.editor-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.media-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.media-item .thumb {
  height: 100px; background: #F5F5F7 center/contain no-repeat; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: var(--text-mut); font-size: 12px; overflow: hidden;
}
.media-item .thumb img { max-width: 100%; max-height: 100%; }
.media-item .meta { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.media-item .row { display: flex; gap: 6px; align-items: center; }
.media-item .row .input, .media-item .row .select { padding: 4px 6px; font-size: 12px; }
.media-item .actions { display: flex; gap: 4px; margin-top: 8px; }

.list-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.list-item .grow { flex: 1; }
.list-item .idx { color: var(--text-mut); font-size: 12px; width: 28px; text-align: center; }

.faq-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }

.hint { font-size: 12px; color: var(--text-mut); margin-top: 4px; }

/* 素材库缩略图网格 */
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.material-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.material-card .thumb { height: 110px; background: #F5F5F7 center/contain no-repeat; display: flex; align-items: center; justify-content: center; color: var(--text-mut); font-size: 20px; }
.material-card .thumb img { max-width: 100%; max-height: 100%; }
.material-card .info { padding: 10px; }
.material-card .info .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-card .info .meta { font-size: 12px; color: var(--text-mut); margin-top: 4px; }

/* 工作台待办 */
.workbench-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.workbench-item .w-count { font-size: 22px; font-weight: 700; min-width: 44px; text-align: center; }
.workbench-item .w-count.high { color: var(--danger); }
.workbench-item .w-count.normal { color: var(--info); }
.workbench-item .w-title { font-weight: 600; }
.workbench-item .w-hint { font-size: 12px; color: var(--text-mut); }

.muted { color: var(--text-mut); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.hidden { display: none !important; }
