:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --line: rgba(60,60,67,0.12);
  --t1: #1D1D1F;
  --t2: #3C3C43;
  --t3: #6E6E73;
  --t4: #86868B;
  --brand: #0071E3;
  --brand-soft: #E8F1FF;
  --ok: #34C759;
  --ok-soft: #E8F9EE;
  --warn: #FF9F0A;
  --warn-soft: #FFF4E0;
  --danger: #FF3B30;
  --danger-soft: #FFECEB;
  --shadow: 0 1px 2px rgba(0,0,0,0.03), 0 10px 30px rgba(0,0,0,0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(0,113,227,0.12), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(52,199,89,0.10), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 24px;
  padding: 36px 34px 30px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04), 0 24px 60px rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.8);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-tile {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(140deg, #1D1D1F, #3A3A44);
  color: #fff; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 6px 16px rgba(0,0,0,0.18);
  flex-shrink: 0;
}
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--t4); }
.brand-sm { margin-bottom: 22px; padding: 0 4px; }
.brand-sm .brand-tile { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }

.login-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin: 0 0 6px; }
.login-desc { color: var(--t3); font-size: 13px; margin: 0 0 22px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--t2); margin-bottom: 7px; }
.hint { color: var(--t4); font-weight: 400; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; }

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #F5F5F7;
  font-size: 14px;
  font-family: inherit;
  color: var(--t1);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: rgba(0,113,227,0.55);
  box-shadow: 0 0 0 3.5px rgba(0,113,227,0.13);
}
textarea { min-height: 84px; resize: vertical; }
input:disabled { color: var(--t4); cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.32,0.72,0,1), background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(0,113,227,0.28); }
.btn-primary:hover { background: #0067d1; }
.btn-ghost { background: rgba(120,120,128,0.10); color: var(--t1); }
.btn-ghost:hover { background: rgba(120,120,128,0.16); }
.btn-quiet { background: transparent; color: var(--t3); border-color: var(--line); }
.btn-quiet:hover { background: rgba(120,120,128,0.08); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #ffdedb; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }

.alert { border-radius: 12px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: var(--danger-soft); color: #c0261c; }
.alert-info { background: var(--brand-soft); color: #0a58a8; }
.login-foot { color: var(--t4); font-size: 12px; text-align: center; margin: 18px 0 0; }

/* ============ 应用框架 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--t2);
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(120,120,128,0.08); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-glyph {
  width: 26px; height: 26px; border-radius: 8px;
  background: #1D1D1F; color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-blue { background: linear-gradient(140deg,#0A84FF,#0053B3); }
.nav-green { background: linear-gradient(140deg,#30D158,#1D9A40); }
.nav-orange { background: linear-gradient(140deg,#FF9F0A,#E07600); }
.nav-purple { background: linear-gradient(140deg,#BF5AF2,#7A2FC4); }
.nav-teal { background: linear-gradient(140deg,#40C8E0,#0E7C93); }
.nav-red { background: linear-gradient(140deg,#FF6B5E,#C2331F); }
.nav-amber { background: linear-gradient(140deg,#FFC24B,#C77A08); }

/* 分页切换（订单页的商城 / 租赁）。用分段控件而不是两个 tab 下划线：
   这两者是同一张表的两个数据源，不是页面层级。 */
.seg {
  display: inline-flex; gap: 2px; padding: 3px; flex: none;
  background: var(--bg, #F5F5F7); border: 1px solid var(--line); border-radius: 10px;
}
.seg-item {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 13px;
  padding: 6px 14px; border-radius: 8px; background: transparent; color: var(--t3);
}
.seg-item:hover { color: var(--t2); }
.seg-item.active { background: var(--card, #fff); color: var(--t1); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
.who { font-size: 13px; font-weight: 700; }
.who-uid {
  font-size: 11px; color: var(--t4); font-family: ui-monospace, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 10px; cursor: pointer;
}
.who-uid:hover { color: var(--brand); }

.main { flex: 1; min-width: 0; padding: 34px 38px 60px; }
.page-head { margin-bottom: 22px; }
.page-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; margin: 0 0 4px; }
.page-head p { color: var(--t3); font-size: 13.5px; margin: 0; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }

/* 概览统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.8);
}
.stat-num { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.stat-label { color: var(--t3); font-size: 13px; margin-top: 2px; }
.stat-sub { color: var(--t4); font-size: 12px; margin-top: 8px; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar-input { flex: 1; max-width: 320px; }
.toolbar-select { width: 160px; }

/* 表格 */
.table-wrap {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.8);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--t3);
  padding: 13px 16px; background: #FAFAFC; border-bottom: 1px solid var(--line);
  letter-spacing: .4px; white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #FCFCFD; }
.cell-name { font-weight: 700; font-size: 14px; }
.cell-sub { color: var(--t3); font-size: 12.5px; margin-top: 2px; }
.cell-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.cell-muted { color: var(--t4); font-size: 13px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-row { text-align: center; color: var(--t4); padding: 40px 16px !important; }
.acc-foot { color: var(--t4); font-size: 12.5px; margin: 12px 2px 0; line-height: 1.7; }
.group-row td {
  background: rgba(120,120,128,0.06); font-size: 12px; font-weight: 700;
  color: var(--t3); letter-spacing: 1px; padding: 8px 16px !important;
}

/* 状态徽标 */
.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; }
.badge-on { background: var(--ok-soft); color: #248A3D; }
.badge-off { background: rgba(120,120,128,0.12); color: var(--t3); }
.badge-warn { background: var(--warn-soft); color: #C77700; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-danger { background: rgba(255,59,48,0.12); color: #C2331F; }
.warn-text { color: #C77700; }

/* 工单详情：上半部分只读，下半部分（.action-zone）是维修人员的处理区 */
.detail-block { margin-bottom: 14px; }
.detail-block > .k { font-size: 12px; color: var(--t4); margin-bottom: 6px; }
.detail-block .desc {
  background: var(--bg, #F5F5F7); border-radius: var(--border-radius-md, 8px);
  padding: 10px 12px; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.kv { display: flex; gap: 10px; padding: 7px 0; border-bottom: 0.5px solid var(--line); font-size: 13.5px; }
.kv .k { color: var(--t4); width: 88px; flex: none; }
.kv .v { flex: 1; word-break: break-word; }
.img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.img-grid .img-cell { width: 92px; height: 92px; border-radius: 8px; overflow: hidden; background: #F5F5F7; }
.img-grid img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.img-grid .img-missing {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--t4);
}
.timeline { display: flex; flex-direction: column; gap: 4px; }
.tl-row { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.tl-seq {
  width: 18px; height: 18px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.tl-action { font-weight: 600; }
.tl-time { color: var(--t4); font-size: 12px; margin-left: auto; }
.tl-remark { color: var(--t3); font-size: 12.5px; padding-left: 26px; }

/* 处理结果（有内容才出现）—— 用左侧色条跟用户报障信息区分开 */
.fix-result { border-left: 3px solid var(--brand); padding-left: 12px; margin-left: -12px; }

/* 处理区：与上面的只读区之间拉一条分隔线，避免误以为还能改上面 */
.action-zone {
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px;
}
.action-zone .field { margin-bottom: 12px; }
.action-zone textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 13.5px; line-height: 1.6;
  padding: 10px 12px; border: 0.5px solid var(--line); border-radius: var(--border-radius-md, 8px);
  resize: vertical; background: #fff; color: inherit;
}
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.two-col { display: flex; gap: 12px; flex-wrap: wrap; }
.two-col > .field { flex: 1 1 160px; min-width: 0; }

/* 手机上的维修师傅：电话要能直接点着拨出去 */
.tel-link { color: var(--brand); font-weight: 600; text-decoration: none; }
.tel-link:active { opacity: .6; }

/* 开关 */
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(120,120,128,0.28);
  transition: background .2s;
  pointer-events: none;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform .22s cubic-bezier(0.32,0.72,0,1);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

/* 无权限 */
.no-perm {
  max-width: 520px; margin: 60px auto; background: var(--card);
  border-radius: 22px; padding: 40px 36px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.8);
}
.no-perm-icon {
  width: 62px; height: 62px; border-radius: 19px; margin: 0 auto 18px;
  background: linear-gradient(140deg,#FF9F0A,#E07600); color: #fff;
  font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(224,118,0,0.28);
}
.no-perm h2 { margin: 0 0 10px; font-size: 21px; }
.no-perm p { color: var(--t3); font-size: 13.5px; margin: 0 0 18px; }
.uid-box {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  background: #F5F5F7; border-radius: 12px; padding: 13px;
  word-break: break-all; margin-bottom: 12px; color: var(--t2);
}
.no-perm-or { color: var(--t4); font-size: 12.5px; margin: 22px 0 10px; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.32);
  backdrop-filter: saturate(160%) blur(6px);
  -webkit-backdrop-filter: saturate(160%) blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  width: 100%; max-width: 560px; max-height: 88vh;
  background: var(--card); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 14px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px; border-radius: 9px; border: none;
  background: rgba(120,120,128,0.10); color: var(--t3);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: rgba(120,120,128,0.18); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px 20px; border-top: 1px solid var(--line);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: rgba(29,29,31,0.94); color: #fff;
  padding: 11px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  z-index: 120; box-shadow: 0 12px 34px rgba(0,0,0,0.3);
  animation: toastIn .22s cubic-bezier(0.32,0.72,0,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (max-width: 900px) {
  .sidebar { width: 76px; padding: 18px 10px; }
  .sidebar .brand-title, .sidebar .brand-sub, .nav-item span:last-child,
  .who, .who-uid { display: none; }
  .nav-item { justify-content: center; }
  .main { padding: 24px 18px 50px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ===== 展示图片编辑 ===== */
.img-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.img-cell { position: relative; width: 92px; height: 92px; }
.img-thumb {
  width: 92px; height: 92px; border-radius: 14px;
  background: #F5F5F7; display: block; object-fit: cover;
}
.img-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--t4); font-size: 18px;
}
.img-del {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.62); color: #fff; border: none;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.img-del:hover { background: var(--danger); }
.img-cover {
  position: absolute; left: 5px; bottom: 5px;
  background: rgba(0,113,227,0.92); color: #fff;
  border-radius: 6px; padding: 1px 6px; font-size: 10.5px; font-weight: 700;
}
.img-add {
  width: 92px; height: 92px; border-radius: 14px;
  background: #F5F5F7; border: 1.5px dashed rgba(60,60,67,0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--t4); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.img-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ===== 演示模式横幅 ===== */
.demo-banner {
  background: linear-gradient(135deg, #FFF4E0, #FFF9F0);
  border: 1px solid rgba(255,159,10,0.28);
  color: #8a5300;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 13px;
  margin-bottom: 22px;
}
.demo-banner b { color: #b8720a; }
