:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2630;
  --muted: #7a8699;
  --line: #e6eaf2;
  --brand: #2f6bff;
  --brand-dark: #1f4fd6;
  --pending: #f0a020;
  --repairing: #2f6bff;
  --done: #2bb673;
  --danger: #e5484d;
  --shadow: 0 6px 24px rgba(31, 38, 48, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6bff 0%, #5b8bff 100%);
  padding: 20px;
}
.login-card {
  background: var(--card); width: 100%; max-width: 380px; border-radius: 18px;
  padding: 40px 32px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card p.sub { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; outline: none; transition: border .15s;
}
.field input:focus { border-color: var(--brand); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  background: var(--brand); color: #fff; transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-ghost { background: #eef2fb; color: var(--brand); }
.btn-ghost:hover { background: #e2e9fa; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93a3f; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 4px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #141b2d; color: #c7d0e0; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 22px 0;
}
.sidebar .brand { padding: 0 24px 24px; font-size: 18px; font-weight: 700; color: #fff; }
.sidebar .brand small { display: block; font-size: 12px; color: #6b7892; font-weight: 400; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 24px; font-size: 14px;
  color: #c7d0e0; border: none; background: none; width: 100%; text-align: left; transition: background .12s;
}
.nav-item:hover { background: rgba(255,255,255,.05); }
.nav-item.active { background: rgba(47,107,255,.18); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar .spacer { flex: 1; }
.sidebar .logout { margin: 0 16px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.topbar h2 { font-size: 18px; margin: 0; }
.topbar .who { color: var(--muted); font-size: 13px; }
.content { padding: 24px 28px; flex: 1; }

/* ---------- 工单 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab .count {
  background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; font-size: 12px; min-width: 18px; text-align: center;
}
.tab.active .count { background: rgba(255,255,255,.25); }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input {
  flex: 1; max-width: 280px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; outline: none;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ticket {
  background: var(--card); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.ticket:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(31,38,48,.12); }
.ticket .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ticket .no { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: #fff; }
.badge.pending { background: var(--pending); }
.badge.repairing { background: var(--repairing); }
.badge.done { background: var(--done); }
.ticket .loc { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.ticket .desc {
  font-size: 13px; color: #56616f; line-height: 1.5; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ticket .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- 维修员 ---------- */
.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; margin-top: 18px; }
.worker {
  background: var(--card); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center;
}
.worker .name { font-weight: 600; font-size: 15px; }
.worker .phone { font-size: 12px; color: var(--muted); margin-top: 3px; }
.worker .tag { font-size: 11px; color: var(--repairing); margin-top: 6px; }
.panel { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; outline: none; }

/* ---------- 弹窗 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,27,45,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .x { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px 22px; }
.info-row { display: flex; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.info-row .k { width: 90px; color: var(--muted); flex-shrink: 0; }
.info-row .v { flex: 1; word-break: break-all; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.section-title { font-size: 13px; color: var(--muted); margin: 18px 0 10px; font-weight: 600; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.action-row select { flex: 1; min-width: 140px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }

/* ---------- 小程序入口 ---------- */
.mp-card { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.mp-qr { width: 180px; height: 180px; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; background: #fff; }
.mp-fallback { width: 180px; height: 180px; border-radius: 12px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }
.mp-text h3 { margin: 0 0 8px; }
.mp-text p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 4px 0; }

.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #141b2d; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); }
.loading { text-align: center; color: var(--muted); padding: 50px 0; }

@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .sidebar .brand, .nav-item span, .sidebar .logout span { display: none; }
  .nav-item { justify-content: center; padding: 14px 0; }
}
