* {
  box-sizing: border-box;
}

:root {
  --blue: #1e7bf5;
  --blue-deep: #1667d8;
  --blue-soft: #eaf2ff;
  --bg: #f1f4f9;
  --card: #ffffff;
  --text: #1c2333;
  --sub: #8a91a3;
  --line: #edeff5;
  --orange: #ff7a2f;
  --red: #ff4d3f;
  --green: #12a76f;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 20% 0%, #3d95ff 0%, #1e7bf5 45%, #14509f 100%);
}

.login-card {
  width: 360px;
  padding: 36px 32px 28px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(8, 26, 60, 0.28);
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(140deg, #3d95ff, #1e7bf5);
  color: #fff;
  font-size: 32px;
  line-height: 64px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 1px;
}

.login-sub {
  margin: 8px 0 24px;
  color: var(--sub);
  font-size: 12px;
}

.login-field {
  text-align: left;
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--sub);
}

.login-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #e2e7f0;
  border-radius: 10px;
  outline: none;
  background: #fafbfe;
}

.login-field input:focus {
  border-color: var(--blue);
  background: #fff;
}

.login-tip {
  margin: 16px 0 0;
  font-size: 11px;
  color: #a8afbd;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3d95ff, #1b6fe8);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.9;
}

.btn.block {
  width: 100%;
  height: 44px;
  margin-top: 8px;
}

.btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid #dbe7fb;
}

.btn.danger {
  background: #fff1f0;
  color: var(--red);
  border: 1px solid #ffd9d5;
}

.btn.mini {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  color: #b3b9c6;
  cursor: pointer;
}

.link {
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, #3d95ff, #1e7bf5);
  color: #fff;
  text-align: center;
  line-height: 40px;
  font-size: 20px;
}

.brand-text b {
  display: block;
  font-size: 15px;
}

.brand-text small {
  color: var(--sub);
  font-size: 11px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #4a5468;
  cursor: pointer;
  margin-bottom: 2px;
  font-size: 13px;
}

.nav-item:hover {
  background: #f6f9ff;
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.nav-item .ni-icon {
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: #fff1f0;
  color: var(--red);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
}

.sidebar-foot {
  padding: 14px 16px 20px;
  border-top: 1px solid var(--line);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 30px 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.page-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--sub);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--sub);
}

.content {
  padding: 0 30px 40px;
}

/* ---------- 卡片 / 概览 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 22px;
  border: 1px solid #f0f2f7;
  box-shadow: 0 6px 20px rgba(24, 48, 92, 0.04);
}

.stat-label {
  color: var(--sub);
  font-size: 12px;
}

.stat-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-foot {
  margin-top: 6px;
  font-size: 11px;
  color: #a8afbd;
}

.stat-card.blue .stat-value { color: var(--blue); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }

.panel {
  margin-top: 20px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid #f0f2f7;
  box-shadow: 0 6px 20px rgba(24, 48, 92, 0.04);
  padding: 20px 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
}

.muted {
  color: var(--sub);
  font-size: 12px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-links a {
  padding: 8px 14px;
  background: #f6f9ff;
  color: var(--blue);
  border-radius: 8px;
  font-size: 12px;
  text-decoration: none;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search {
  height: 38px;
  width: 240px;
  padding: 0 12px;
  border: 1px solid #e2e7f0;
  border-radius: 10px;
  outline: none;
  background: #fff;
}

.search:focus {
  border-color: var(--blue);
}

.spacer {
  flex: 1;
}

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid #f0f2f7;
  box-shadow: 0 6px 20px rgba(24, 48, 92, 0.04);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #f4f6fa;
  vertical-align: middle;
  white-space: nowrap;
}

td:first-child,
th:first-child {
  min-width: 200px;
}

th {
  background: #fafbfe;
  color: #6b7386;
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  top: 0;
}

td.wrap {
  white-space: normal;
  word-break: break-all;
  min-width: 220px;
  max-width: 360px;
  color: #4a5468;
}

tr:last-child td {
  border-bottom: none;
}

.empty-row {
  padding: 40px 0;
  text-align: center;
  color: #a8afbd;
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 18px;
}

.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.orange { background: #fff2e4; color: var(--orange); }
.badge.green { background: #e8f8f0; color: var(--green); }
.badge.red { background: #fff1f0; color: var(--red); }
.badge.gray { background: #f2f4f8; color: #8a91a3; }

.thumb {
  width: 52px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: #f2f4f8;
  display: block;
}

.swatch {
  display: inline-block;
  width: 26px;
  height: 18px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid #e2e7f0;
}

.actions {
  display: flex;
  gap: 6px;
}

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  color: #6b7386;
}

.field input,
.field select,
.field textarea {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #e2e7f0;
  border-radius: 8px;
  outline: none;
  background: #fafbfe;
  width: 100%;
}

.field textarea {
  height: 110px;
  padding: 10px;
  line-height: 1.6;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  background: #fff;
}

.field .hint {
  font-size: 11px;
  color: #a8afbd;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}

.switch input {
  width: 40px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: #dfe5ef;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  padding: 0;
  border: none;
  transition: background 0.2s;
}

.switch input:checked {
  background: var(--blue);
}

.switch input::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}

.switch input:checked::after {
  left: 20px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  width: 720px;
  max-width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(8, 26, 60, 0.3);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head b {
  font-size: 16px;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfe;
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(28, 35, 51, 0.92);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ---------- 概览 & 设置页 ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 900px) {
  .sidebar {
    width: 64px;
  }
  .brand-text,
  .nav-item span.label,
  .sidebar-foot {
    display: none;
  }
  .brand {
    justify-content: center;
    padding: 16px 8px;
  }
  .nav-item {
    justify-content: center;
    padding: 12px 4px;
  }
  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* 维修服务起步价行 */
.repair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.repair-row .rp-name { flex: 1; min-width: 0; }
.repair-row .rp-price { width: 96px; }
.repair-row input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e2e6ef;
  border-radius: 8px;
  font-size: 13px;
  color: #1c2333;
  background: #fff;
}
.repair-row .icon-btn { width: 34px; height: 34px; flex-shrink: 0; }
