/* ===== XTREME 售后管理后台 ===== */
:root {
  --primary: #79B4D6;
  --primary-dark: #4F94BD;
  --primary-soft: #E5F0F7;
  --bg: #F4F7FA;
  --panel: #ffffff;
  --line: #E1E8EE;
  --text: #2A3F4F;
  --text-sub: #5C6975;
  --text-muted: #97A4B0;
  --danger: #E74C3C;
  --success: #2ECC71;
  --warning: #F39C12;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }

/* 全局取消圆角 */
*, *::before, *::after {
  border-radius: 0 !important;
}

/* ===== 登录页 ===== */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #79B4D6 0%, #4F94BD 100%);
}
.login-card {
  width: 420px;
  background: #ffffff;
  padding: 48px 40px 40px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}
.login-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 4px;
  text-align: center;
  color: var(--primary-dark);
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 13px;
  letter-spacing: 1px;
}
.login-form { margin-top: 36px; }
.login-form .field { margin-bottom: 18px; }
.login-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-sub);
  font-size: 13px;
}
.login-form input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fafcfe;
  color: var(--text);
}
.login-form input:focus { border-color: var(--primary); }
.login-btn {
  width: 100%;
  height: 46px;
  background: var(--primary);
  color: #fff;
  border: none;
  letter-spacing: 4px;
  cursor: pointer;
  margin-top: 8px;
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.login-tip {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== 主框架 ===== */
.layout {
  display: flex;
  min-height: 100vh;
}
.aside {
  width: 220px;
  background: #243042;
  color: #cbd6e2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c2535;
  color: #fff;
  font-weight: 600;
  letter-spacing: 4px;
  font-size: 18px;
}
.menu { flex: 1; padding: 16px 0; overflow-y: auto; }
.menu-item {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 24px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 1px;
  border-left: 3px solid transparent;
  color: #cbd6e2;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.menu-item.active {
  background: rgba(121, 180, 214, 0.2);
  border-left-color: var(--primary);
  color: #fff;
}
.menu-icon {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  display: inline-block;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0.85;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.topbar-title { font-weight: 600; font-size: 16px; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 16px; color: var(--text-sub); }
.topbar-link { color: var(--primary-dark); cursor: pointer; }
.topbar-link:hover { text-decoration: underline; }

.content {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* ===== 通用卡片 / 工具条 ===== */
.panel {
  background: #fff;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-sub { color: var(--text-muted); font-size: 12px; font-weight: normal; }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 200px;
}
.toolbar .grow { flex: 1; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  letter-spacing: 1px;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ===== 表格 ===== */
.table-wrap { overflow: auto; border: 1px solid var(--line); }
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}
.table th {
  background: #f7fafc;
  color: var(--text-sub);
  font-weight: 600;
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafcfe; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

/* 状态徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  border: 1px solid;
  letter-spacing: 1px;
}
.tag-pending { color: var(--warning); border-color: var(--warning); background: rgba(243, 156, 18, 0.08); }
.tag-passed { color: var(--success); border-color: var(--success); background: rgba(46, 204, 113, 0.08); }
.tag-rejected { color: var(--danger); border-color: var(--danger); background: rgba(231, 76, 60, 0.08); }

/* ===== 分页 ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-sub);
  font-size: 13px;
}
.pager-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--text-sub);
}
.pager-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.pager-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pager-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.pager-info { margin-right: auto; }

/* ===== 表单 ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}
.form-row { display: flex; flex-direction: column; }
.form-row.full { grid-column: span 2; }
.form-row label {
  margin-bottom: 6px;
  color: var(--text-sub);
  font-size: 13px;
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus { border-color: var(--primary); }
.form-row textarea { min-height: 100px; resize: vertical; }
.form-help { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

/* ===== 弹层 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 30, 50, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  width: 640px;
  max-width: 92vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-large { width: 880px; }
.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  letter-spacing: 1px;
}
.modal-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
}
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== 上传 ===== */
.uploader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-box {
  width: 100%;
  height: 220px;
  background: #f5f8fb;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); }
.upload-box img { width: 100%; height: 100%; object-fit: cover; }
.upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}
.upload-plus { font-size: 32px; color: var(--primary); margin-bottom: 4px; }
.upload-actions { display: flex; gap: 12px; }

/* ===== 协议节配置（动态行） ===== */
.policy-row {
  border: 1px solid var(--line);
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fafcfe;
}
.policy-row .row-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.policy-row input,
.policy-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: #fff;
}
.policy-row textarea { min-height: 70px; margin-top: 8px; }

/* ===== 详情看板 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 14px;
  font-size: 13px;
}
.detail-grid dt { color: var(--text-muted); }
.detail-grid dd { margin: 0; color: var(--text); word-break: break-all; }
.detail-imgs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.detail-img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--line);
}

/* ===== 通用辅助 ===== */
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }

.hint-banner {
  background: #FFF8E5;
  border: 1px solid #F5D788;
  color: #8C6D00;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  background: rgba(36, 48, 66, 0.92);
  color: #fff;
  padding: 10px 22px;
  z-index: 9999;
  font-size: 13px;
  letter-spacing: 1px;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd8e0; }
::-webkit-scrollbar-track { background: transparent; }

/* 未查看订单标记 */
.row-unviewed {
  background-color: #FFF5F5 !important;
  position: relative;
}

.row-unviewed:hover {
  background-color: #FFEBEB !important;
}

.row-unviewed td:first-child {
  position: relative;
  border-left: 3px solid #E74C3C;
}

.badge-new {
  display: inline-block;
  background: #E74C3C;
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  font-weight: 600;
  vertical-align: middle;
}

/* 菜单徽章 */
.menu-item {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}

.menu-badge {
  background: #E74C3C;
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  line-height: 16px;
}

/* 状态标签 - 审核中（蓝色） */
.tag-pending-blue {
  background: #E8F4FD;
  color: #4F94BD;
  border: 1px solid #B5D9F0;
}

/* 状态标签 - 正在质保中（黄色） */
.tag-warranty {
  background: #FFF8E1;
  color: #F39C12;
  border: 1px solid #FFE082;
}

/* 状态标签 - 未通过（红色） */
.tag-rejected {
  background: #FFEBEE;
  color: #E74C3C;
  border: 1px solid #FFCDD2;
}

/* 售后完成 */
.status-completed {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #27AE60;
  font-weight: 600;
}

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #27AE60;
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* 超时提醒条 */
.timeout-bar {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.timeout-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: #F39C12;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.timeout-content {
  flex: 1;
}

.timeout-title {
  font-weight: 600;
  color: #C0871D;
  margin-bottom: 8px;
  font-size: 14px;
}

.timeout-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeout-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #FFE082;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #5C6975;
  cursor: pointer;
  transition: all 0.2s;
}

.timeout-item:hover {
  background: #FFF8E1;
  transform: translateY(-1px);
}

.timeout-item-no {
  font-weight: 600;
  color: #E74C3C;
}

.timeout-item-name {
  color: #97A4B0;
}

.timeout-delay-btn {
  background: #4F94BD;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* 已完成 - 绿色标签 */
.tag-completed {
  background: #27AE60;
  color: #ffffff;
  border: 1px solid #27AE60;
}
