/* ============================================================
 * 国唐汽车售后服务管理系统 - 样式 (浅色主题)
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7686;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #16a34a;
  --success-soft: #e7f6ec;
  --warning: #d97706;
  --warning-soft: #fdf0e1;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
}
a { color: var(--primary); text-decoration: none; }

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: #0f172a;
  color: #cbd5e1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar .brand {
  padding: 18px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg,#3b82f6,#2563eb);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; color: #cbd5e1; cursor: pointer;
  border-left: 3px solid transparent; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(37,99,235,.18); color: #fff; border-left-color: var(--primary); }
.sidebar .nav-icon { width: 18px; text-align: center; }

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; flex-shrink: 0;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .meta { color: var(--muted); font-size: 13px; }
.content { padding: 22px; overflow-y: auto; flex: 1; }

/* 卡片 */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 标签页切换 */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 18px; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none; }
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select {
  height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13px; min-width: 160px;
}

/* 按钮 */
.btn {
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.btn:hover { border-color: #cdd5e0; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr:hover { background: #f8fafc; }
td .row-actions { display: flex; gap: 6px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag-blue { background: var(--primary-soft); color: var(--primary-dark); }
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-orange { background: var(--warning-soft); color: var(--warning); }
.tag-red { background: var(--danger-soft); color: var(--danger); }
.tag-gray { background: #eef1f5; color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50;
  overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--panel); border-radius: 12px; width: 100%; max-width: 620px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: pop .15s ease;
}
@keyframes pop { from { transform: translateY(-8px); opacity: .7; } to { transform: none; opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { cursor: pointer; border: none; background: none; font-size: 20px; color: var(--muted); }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; color: var(--muted); }
.form-field input, .form-field select, .form-field textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13px; font-family: inherit;
}
.form-field textarea { height: 80px; padding: 10px 12px; resize: vertical; }

/* 详情 */
.detail-row { display: flex; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.detail-row .k { width: 120px; color: var(--muted); flex-shrink: 0; }
.detail-row .v { flex: 1; }

/* 提示 */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 100; opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 维修进度条 */
.progress { display: flex; align-items: center; gap: 8px; }
.progress .track { flex: 1; background: #eef1f5; border-radius: 6px; height: 14px; overflow: hidden; position: relative; min-width: 80px; }
.progress .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; transition: width .3s; }
.progress .txt { font-size: 12px; color: var(--muted); white-space: nowrap; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
.list-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list-line:last-child { border-bottom: none; }

/* ---------- 登录 / 权限 / 分组 ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 130px); padding: 20px; }
.login-card { width: 380px; max-width: 92vw; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card .brand { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.login-card .field { margin-bottom: 14px; }
.login-card .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-card .field input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.role-badge { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 600; }
.user-chip { font-size: 13px; color: #475569; }
.user-chip .role-badge { margin-right: 6px; }
.group-card { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; background: #fff; }
.group-card .group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.group-card table { margin: 0; }

/* ---------- 顶栏同步控件（多人实时同步） ---------- */
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.sync-box { display: flex; align-items: center; gap: 8px; }
.sync-badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.sync-badge.ok { background: #ecfdf5; color: #047857; }
.sync-badge.syncing { background: #eff6ff; color: #1d4ed8; }
.sync-badge.offline { background: #fef2f2; color: #b91c1c; }
.sync-badge.local { background: #f1f5f9; color: #64748b; }
.btn-mini { border: 1px solid var(--border); background: #fff; color: #334155; border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-mini:hover { background: #f8fafc; border-color: #cbd5e1; }

/* ---------- 钉钉 H5 / 移动端适配 ---------- */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar .brand { display: none; }
  .sidebar nav { display: flex; flex-direction: row; padding: 0; gap: 2px; }
  .sidebar nav a { border-left: none; border-bottom: 3px solid transparent; padding: 10px 12px; white-space: nowrap; }
  .sidebar nav a.active { border-left: none; border-bottom-color: var(--primary); background: rgba(37,99,235,.12); }
  .main { min-width: 0; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .content { padding: 14px; }
  .modal { width: 94vw; }
  .form-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .cards { grid-template-columns: 1fr; }
}
.group-card table th, .group-card table td { padding: 10px 16px; }

