/* 单位报修 · 移动端样式
   设计语言沿用小程序版：主色 #1B6AC9，状态色一一对应。
   小程序里用 rpx（750 基准），这里按 1rpx ≈ 0.5px 换算成 px。 */

:root {
  --brand: #1B6AC9;
  --brand-soft: #e8f1fc;
  --danger: #e6432d;
  --bg: #f5f6f8;
  --card: #fff;
  --line: #f0f0f0;
  --text: #333;
  --text-2: #666;
  --text-3: #999;
  --text-4: #bbb;
  --radius: 8px;
  --radius-lg: 12px;

  --st-sign: #ff9900;
  --st-rejected: #bbbbbb;
  --st-doing: #1B6AC9;
  --st-check: #7b61ff;
  --st-done: #19be6b;
  --st-cancel: #cccccc;

  --bar-h: 48px;
  --tab-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: contain; }

/* ---------- 顶部提醒横幅 ---------- */
.banner {
  position: fixed; left: 0; right: 0; top: var(--safe-t);
  z-index: 45;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  animation: banner-in .22s ease-out;
  max-width: 560px;
}
@media (min-width: 640px) {
  .banner { left: 50%; transform: translateX(-50%); }
}
/* display 被设成 flex 后，浏览器的 [hidden] 默认隐藏会失效，必须显式写 */
.banner[hidden] { display: none; }
.banner.warn { background: #ff9900; }
.banner-text { flex: 1; min-width: 0; }
.banner-title {
  font-size: 14px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-desc {
  font-size: 12px; opacity: .92; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-action {
  flex: 0 0 auto; border: 0; cursor: pointer;
  background: rgba(255,255,255,.24); color: #fff;
  border-radius: 15px; padding: 7px 13px; font-size: 13px;
  font-family: inherit;
}
.banner-action:active { opacity: .8; }
.banner-close {
  flex: 0 0 auto; border: 0; cursor: pointer; background: transparent;
  color: rgba(255,255,255,.85); font-size: 18px; line-height: 1;
  padding: 4px 2px; font-family: inherit;
}
@keyframes banner-in {
  from { transform: translateY(-110%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 640px) {
  @keyframes banner-in {
    from { transform: translateX(-50%) translateY(-110%); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
  }
}

/* ---------- 开关 ---------- */
.switch { position: relative; display: block; width: 46px; height: 26px; flex: 0 0 46px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 13px;
  background: #d0d3d8; transition: background .18s ease;
}
.switch .slider::before {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.22);
  transition: transform .18s ease;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- 顶栏 ---------- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--bar-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 4px;
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.appbar-title {
  flex: 1; margin: 0; font-size: 16px; font-weight: 500;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 必须显式写：.appbar 设了 display:flex，会覆盖浏览器对 hidden 属性的默认隐藏 */
.appbar[hidden] { display: none; }
.appbar-back, .appbar-action {
  width: 44px; height: 44px; flex: 0 0 44px;
  border: 0; background: transparent; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.appbar-back { font-size: 30px; }
.appbar-action { font-size: 19px; }
.appbar-back[hidden], .appbar-action[hidden] { display: none; }
.appbar-title + .appbar-action:last-child { }

/* ---------- 内容区 ---------- */
.view {
  min-height: 100vh;
  padding-top: calc(var(--bar-h) + var(--safe-t));
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}
.view.no-tab { padding-bottom: calc(var(--safe-b) + 16px); }
.view.notop { padding-top: var(--safe-t); }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: #fff;
  border-top: 1px solid var(--line);
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 11px; position: relative;
  padding: 0; font-family: inherit;
}
.tab-icon { font-size: 20px; line-height: 1; }
.tab.active { color: var(--brand); font-weight: 500; }
.tab-badge {
  position: absolute; top: 6px;
  left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 500;
}
.tab-badge[hidden] { display: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  margin: 10px 12px; padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card.tight { padding: 0 12px; }
.title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.muted { color: var(--text-3); font-size: 12px; }
.price { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px; border: 0; cursor: pointer;
  border-radius: 22px; font-size: 15px; font-family: inherit;
  background: var(--brand); color: #fff; transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-plain { background: #f2f3f5; color: var(--text-2); }
.btn-sm { height: 32px; font-size: 13px; padding: 0 14px; border-radius: 16px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- 状态标签 ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; color: #fff; line-height: 16px;
}
.st-sign { background: var(--st-sign); }
.st-rejected { background: var(--st-rejected); }
.st-doing { background: var(--st-doing); }
.st-check { background: var(--st-check); }
.st-done { background: var(--st-done); }
.st-cancel { background: var(--st-cancel); }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 12px; }
.form-item .label { font-size: 13px; color: var(--text-2); margin-bottom: 6px; display: block; }
.input, .textarea, .select {
  width: 100%; background: #f7f8fa; border: 1px solid transparent;
  border-radius: 6px; padding: 10px; font-size: 14px;
  font-family: inherit; color: var(--text); outline: none;
}
.input:focus, .textarea:focus, .select:focus { background: #fff; border-color: var(--brand); }
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ---------- 图片墙 ---------- */
.img-wall { display: flex; flex-wrap: wrap; gap: 8px; }
.img-cell, .add {
  width: 80px; height: 80px; border-radius: 6px; position: relative;
  overflow: hidden; background: #f0f1f3; flex: 0 0 auto;
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
  position: absolute; top: 0; right: 0; width: 20px; height: 20px;
  background: rgba(0,0,0,.5); color: #fff; font-size: 14px; line-height: 20px;
  text-align: center; border: 0; cursor: pointer; padding: 0; border-bottom-left-radius: 6px;
}
.add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1.1; color: var(--text-4);
  border: 0; cursor: pointer; font-family: inherit;
}
.add-txt { font-size: 11px; margin-top: 3px; color: var(--text-3); }
.add.cam { background: var(--brand-soft); color: var(--brand); }
.add.cam .add-txt { color: var(--brand); }

/* ---------- 行 / 列表 ---------- */
.row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.row:last-child { border-bottom: 0; }
.row-label { color: var(--text-3); flex: 0 0 auto; }
.row-value { text-align: right; word-break: break-all; }
.row-value.left { text-align: left; }

.list-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 0; border-bottom: 1px solid var(--line);
  padding: 14px 12px; font-family: inherit; font-size: 15px; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
}
.list-item:active { background: #fafafa; }
.list-item .arrow { color: var(--text-4); font-size: 16px; }
.list-group { background: var(--card); border-radius: var(--radius); margin: 10px 12px; overflow: hidden; }
.list-group .list-item:last-child { border-bottom: 0; }

/* 工单列表项 */
.order-item { background: var(--card); border-radius: var(--radius); margin: 10px 12px; padding: 12px; cursor: pointer; }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.order-no { font-size: 12px; color: var(--text-3); }
/* 列表第一行现在是「谁在修」（维护公司），要一眼看到，所以比 .order-no 明显 */
.order-company {
  font-size: 14px; color: var(--text); font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-head > .tag { flex: 0 0 auto; }
/* 第三行：问题描述。14px 保证看得清，但比「类型 · 位置」略淡一档，形成层次。
   描述为空时换成提示语（如「（语音描述）」），再用最浅的颜色。

   ⚠️ 下面三条一起用，是为了「保证只占一行」：
     nowrap + overflow hidden + text-overflow ellipsis
   只靠 JS 限字数是不够的 —— 一行能放多少字取决于屏幕宽度
   （320px 的老机型只放得下约 19 个汉字，26 字必然折行）。所以：
     JS 负责「少显示一点」，CSS 负责「不管什么屏幕都只有一行」。 */
.order-problem {
  font-size: 14px; margin-bottom: 6px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.order-problem.is-empty { color: var(--text-3); }
.order-desc { font-size: 14px; margin-bottom: 6px; word-break: break-all; }
.order-meta { font-size: 12px; color: var(--text-3); }

.empty { text-align: center; color: var(--text-4); padding: 60px 0; font-size: 14px; }

/* 提醒条 */
.alert-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff7e6; border: 1px solid #ffe0a3; color: #b26a00;
  border-radius: var(--radius); margin: 10px 12px; padding: 10px 12px;
  font-size: 13px; cursor: pointer;
}
.alert-bar[hidden] { display: none; }

/* 页签 */
.segmented {
  display: flex; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: calc(var(--bar-h) + var(--safe-t)); z-index: 20;
}
.seg {
  flex: 1; border: 0; background: transparent; cursor: pointer; position: relative;
  padding: 12px 4px; font-size: 14px; color: var(--text-2); font-family: inherit;
}
.seg.active { color: var(--brand); font-weight: 500; }
.seg.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 32px; height: 2px; background: var(--brand); border-radius: 1px;
}

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.stat-cell { background: #fafbfc; border-radius: 6px; padding: 10px; text-align: center; }
.stat-num { font-size: 20px; font-weight: 600; color: var(--brand); line-height: 1.2; }
.stat-num.warn { color: var(--st-sign); }
.stat-num.ok { color: var(--st-done); }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- 弹层 ---------- */
/* #overlay 只是容器：真正带压暗背景、负责排版的是里面的 .overlay-layer。
   拆开是为了支持叠层（弹层里再开弹层）—— 每层各有一块压暗背景，
   关掉内层时外层的背景还在，视觉上不会闪。 */
.overlay {
  position: fixed; inset: 0; z-index: 50;
}
.overlay[hidden] { display: none; }
.overlay-layer {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay-layer.center { align-items: center; }
.sheet {
  background: #fff; width: 100%; max-width: 520px;
  border-radius: 14px 14px 0 0; padding: 16px;
  padding-bottom: calc(16px + var(--safe-b));
  max-height: 86vh; overflow-y: auto;
}
.overlay-layer.center > .sheet { border-radius: 14px; margin: 0 24px; max-height: 80vh; }
.sheet-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; text-align: center; }
/* 弹层里的分组小标题（如「最近使用」「其他方式」） */
.picker-group {
  font-size: 12px; color: var(--text-3);
  padding: 12px 4px 4px;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions > .btn { flex: 1; }
.sheet-close { position: absolute; }

/* 图片查看 */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000;
  display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px;
  width: 40px; height: 40px; border-radius: 20px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.2); color: #fff; font-size: 20px; }

/* ---------- 轻提示 / 加载 ---------- */
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%);
  z-index: 70; background: rgba(0,0,0,.78); color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 14px;
  max-width: 76vw; text-align: center; word-break: break-all;
}
.toast[hidden] { display: none; }

.loading {
  position: fixed; inset: 0; z-index: 65;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.5);
}
.loading[hidden] { display: none; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 进度条（更新下载用） ---------- */
.progress {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--brand-soft); margin: 6px 0 8px;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: var(--brand); transition: width .25s ease;
}
/* 总大小未知时用条纹滚动表示「在进行中」，而不是假装有个百分比 */
.progress.indeterminate .progress-fill {
  background: repeating-linear-gradient(90deg,
    var(--brand) 0 14px, var(--brand-soft) 14px 28px);
  animation: stripes .9s linear infinite;
}
@keyframes stripes { to { background-position: 28px 0; } }
.progress-text {
  font-size: 13px; color: var(--text-3); text-align: center; line-height: 1.6;
}

/* ---------- 时间轴 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1px; background: #e6e8eb;
}
.tl-item { position: relative; padding-bottom: 12px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 2px #fff;
}
.tl-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.tl-note { font-size: 12px; color: var(--text-3); margin-top: 2px; word-break: break-all; }

/* ---------- 语音条 ---------- */
.voice-item {
  display: flex; align-items: center; gap: 8px;
  background: #f7f8fa; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px;
  font-size: 13px; color: var(--text-2);
}
.voice-item audio { flex: 1; height: 32px; min-width: 0; }

/* ---------- 登录页 ---------- */
.auth-wrap { padding: 32px 24px 24px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .glyph { font-size: 44px; line-height: 1; }
.auth-logo .brand-logo {
  width: 76px; height: 76px; display: block; margin: 0 auto;
  object-fit: contain; border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.10);
}
.auth-logo h1 { font-size: 20px; font-weight: 600; margin: 12px 0 4px; }
.auth-tabs { display: flex; background: #eef0f3; border-radius: 8px; padding: 3px; margin-bottom: 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px;
  font-size: 14px; color: var(--text-2); cursor: pointer; font-family: inherit; }
.auth-tab.active { background: #fff; color: var(--brand); font-weight: 500; }
.auth-hint { font-size: 12px; color: var(--text-3); margin-top: 12px; line-height: 1.6; }

/* 桌面端收敛宽度，避免被拉得很宽 */
@media (min-width: 640px) {
  .view { max-width: 560px; margin: 0 auto; }
  .appbar { max-width: 560px; left: 50%; transform: translateX(-50%); }
  .tabbar { max-width: 560px; left: 50%; transform: translateX(-50%); }
}
