/* ============================================================
   广电技术服务派单系统 - 现代风格 UI
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --warn: #f59e0b;
  --warn-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --dark: #334155;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .16);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.mt { margin-top: 16px; }

/* ---------- 头部 ---------- */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.app-header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; font-weight: 700; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .3);
}
.brand-logo-lg { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { color: var(--muted); font-size: 13px; }

/* ---------- 布局 ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.app-footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 20px; border-top: 1px solid var(--border);
}
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 22px; font-weight: 700; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title-row .card-title { margin-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

/* ---------- 统计卡片 ---------- */
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; text-align: left;
}
.stat-num { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-num.warn { color: #d97706; }
.stat-num.info { color: var(--primary); }
.stat-num.ok { color: var(--ok); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.stat-mini { padding: 16px 18px; }
.stat-mini-row { display: flex; justify-content: space-around; text-align: center; }
.stat-mini-item b { display: block; font-size: 24px; font-weight: 800; }
.stat-mini-item span { color: var(--muted); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s ease;
  background: var(--card); color: var(--text); text-decoration: none; line-height: 1.4;
}
.btn:hover { opacity: .92; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 26px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-lg { padding: 5px 14px; font-size: 13px; }
.badge-warn { background: var(--warn-bg); color: #b45309; }
.badge-info { background: var(--info-bg); color: var(--primary-dark); }
.badge-ok { background: var(--ok-bg); color: #15803d; }
.badge-muted { background: #f1f5f9; color: var(--muted); }
.badge-dark { background: #334155; color: #fff; }
.badge-p1 { background: #f1f5f9; color: var(--dark); }
.badge-p2 { background: #ffedd5; color: #c2410c; }
.badge-p3 { background: #fee2e2; color: #b91c1c; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); background: #f8fafc; white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table tr.row-urgent { background: #fff7ed; }
.table tr.row-urgent:hover { background: #ffedd5; }
.td-desc { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-actions { white-space: nowrap; }
.inline-form { display: inline-block; }
.link { color: var(--primary); font-weight: 500; }
.link:hover { text-decoration: underline; }
.queue-pos { margin-left: 6px; font-size: 12px; color: #d97706; }

/* ---------- 表单 ---------- */
.form-control {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: #fff; transition: border .15s, box-shadow .15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control-sm { padding: 5px 8px; font-size: 13px; border-radius: 8px; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--dark); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13px;
}
.radio-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar .form-control { width: auto; }

/* ---------- 登录页 ---------- */
.login-body { background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-panel {
  display: grid; grid-template-columns: 1.1fr 1fr; max-width: 900px; width: 100%;
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.login-brand {
  background: linear-gradient(150deg, #1e3a8a, #2563eb 55%, #3b82f6);
  color: #fff; padding: 48px 40px; display: flex; align-items: center;
}
.login-brand-inner h1 { font-size: 24px; margin: 18px 0 8px; }
.login-brand-inner p { opacity: .85; margin: 0 0 24px; font-size: 14px; }
.login-brand-inner ul { margin: 0; padding-left: 18px; opacity: .9; font-size: 13px; line-height: 2.1; }
.login-form-panel { padding: 48px 40px; display: flex; align-items: center; }
.login-form { width: 100%; }
.login-form h2 { margin: 0 0 4px; font-size: 22px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-tip { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }
@media (max-width: 760px) {
  .login-panel { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* ---------- 值班 ---------- */
.duty-card { min-height: 120px; }
.duty-person { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.duty-name { font-size: 16px; font-weight: 700; }
.duty-phone { color: var(--primary); font-weight: 600; font-size: 15px; }
.duty-empty { color: var(--muted); font-size: 13px; }
.duty-list { display: flex; flex-direction: column; gap: 10px; }
.duty-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
}
.duty-item-info { flex: 1; }
.duty-item-name { font-weight: 600; }
.duty-item-phone { color: var(--muted); font-size: 13px; }
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-label { font-weight: 600; }

/* ---------- 技术员状态卡 ---------- */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tech-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: #fff; transition: box-shadow .15s;
}
.tech-card:hover { box-shadow: var(--shadow); }
.tech-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tech-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #93c5fd, #3b82f6); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.tech-name { font-weight: 700; }
.tech-phone { margin-left: 8px; color: var(--muted); font-weight: 400; font-size: 12px; }
.tech-meta { color: var(--muted); font-size: 12px; }
.tech-task {
  background: var(--primary-soft); border: 1px solid #bfdbfe; border-radius: 10px; padding: 10px 12px;
}
.tech-task-label { font-size: 12px; color: var(--primary-dark); font-weight: 600; }
.tech-task-no { font-weight: 700; font-size: 13px; margin: 2px 0; }
.tech-task-desc { color: var(--dark); font-size: 12px; }
.tech-task-meta { margin-top: 8px; display: flex; gap: 6px; }
.tech-idle { color: var(--ok); font-weight: 600; text-align: center; padding: 18px 0; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab:hover { color: var(--primary); }
.tab-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.tab-spacer { flex: 1; }
.tech-badges { display: flex; gap: 8px; }

/* ---------- 工单详情 ---------- */
.detail-status { display: flex; gap: 8px; }
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th { text-align: left; width: 90px; color: var(--muted); font-weight: 600; padding: 7px 0; vertical-align: top; }
.kv td { padding: 7px 0; }
.timeline { padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 22px 28px; }
.tl-item::before {
  content: ""; position: absolute; left: 7px; top: 14px; bottom: 0;
  width: 2px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--border);
}
.tl-done .tl-dot { border-color: var(--ok); background: var(--ok-bg); }
.tl-active .tl-dot { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px rgba(37,99,235,.15); }
.tl-title { font-weight: 600; }
.tl-time { color: var(--muted); font-size: 12px; }
.tl-meta { color: var(--muted); font-size: 12px; }
.remark-box {
  margin-top: 14px; background: var(--ok-bg); border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 12px 14px;
}
.remark-title { font-weight: 700; color: #15803d; margin-bottom: 6px; font-size: 13px; }

/* ---------- 附件 ---------- */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.att-img img {
  width: 100%; height: 150px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); cursor: zoom-in; transition: transform .15s;
}
.att-img img:hover { transform: scale(1.02); }
.att-video video { width: 100%; max-height: 260px; border-radius: 10px; background: #000; }
.att-video-name { font-size: 12px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 上传 ---------- */
.upload-drop {
  border: 2px dashed var(--border); border-radius: 12px; padding: 26px;
  text-align: center; cursor: pointer; color: var(--muted); transition: all .15s;
  background: #f8fafc;
}
.upload-drop:hover, .upload-drop.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.upload-hint { font-size: 14px; }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.upload-item {
  position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #f8fafc; padding: 8px;
}
.upload-item img { width: 100%; height: 84px; object-fit: cover; border-radius: 6px; }
.upload-item .u-video-ic {
  height: 84px; display: flex; align-items: center; justify-content: center;
  background: #0f172a; color: #fff; font-size: 26px; border-radius: 6px;
}
.upload-item .u-name { font-size: 12px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .u-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(15,23,42,.65); color: #fff; border: 0; cursor: pointer; font-size: 13px; line-height: 1;
}

/* ---------- 弹窗 ---------- */
.modal-mask[hidden] { display: none !important; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200;
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; padding: 24px; max-height: 82vh; overflow-y: auto;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- 提示 ---------- */
.alert {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px;
  border: 1px solid transparent;
}
.alert-ok { background: var(--ok-bg); color: #15803d; border-color: #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #b91c1c; border-color: #fecaca; }

/* ---------- 图表 ---------- */
.chart-card { min-width: 0; }
.chart { width: 100%; height: 300px; }
.chart-wide { grid-column: 1 / -1; }

/* ---------- 快捷入口 ---------- */
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-link {
  display: flex; flex-direction: column; gap: 2px; padding: 16px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text);
  font-weight: 600; transition: all .15s; background: #fff;
}
.quick-link:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick-link .ql-ic { font-size: 22px; margin-bottom: 6px; }
.quick-link small { color: var(--muted); font-weight: 400; font-size: 12px; }
