/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[v-cloak] { display: none; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f0f2f5;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ── Layout ── */
#app { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}
.sidebar-brand { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar-sub { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 20px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s;
  text-decoration: none;
  font-size: 13.5px;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active { color: #fff; background: #c90304; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.logout-btn {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ── Main Content ── */
.main { flex: 1; overflow-y: auto; height: 100vh; display: flex; flex-direction: column; }

/* ── Page Header ── */
.page-header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 16px; font-weight: 700; color: #1a1a1a; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Page Body ── */
.page-body { padding: 24px 28px; flex: 1; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.stat-label { font-size: 12px; color: #999; margin-bottom: 8px; }
.stat-num { font-size: 32px; font-weight: 700; color: #1a1a1a; line-height: 1; }
.stat-card.red .stat-num { color: #c90304; }
.stat-card.orange .stat-num { color: #fa8c16; }
.stat-card.blue .stat-num { color: #1677ff; }
.stat-card.green .stat-num { color: #52c41a; }
.stat-card.purple .stat-num { color: #722ed1; }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
table { width: 100%; border-collapse: collapse; background: #fff; }
thead { background: #fafafa; }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: #666; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid #f5f5f5; font-size: 13px; color: #333; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.td-actions { display: flex; gap: 8px; white-space: nowrap; }

/* ── Filters Bar ── */
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-input, .filter-select {
  height: 34px;
  border: 1.5px solid #e8e8e8;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13px;
  color: #333;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
.filter-input:focus, .filter-select:focus { border-color: #c90304; }
.filter-input { width: 200px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: #c90304; color: #fff; }
.btn-primary:hover { background: #a00002; }
.btn-default { background: #fff; color: #555; border: 1.5px solid #e8e8e8; }
.btn-default:hover { border-color: #c90304; color: #c90304; }
.btn-danger { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }
.btn-danger:hover { background: #fff0ef; }
.btn-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-link { background: none; border: none; color: #c90304; padding: 0; height: auto; font-size: 13px; cursor: pointer; }
.btn-link:hover { color: #a00002; text-decoration: underline; }

/* ── Badge / Tag ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-pending    { background: #fff7e6; color: #d46b08; }
.badge-contacted  { background: #e6f4ff; color: #0958d9; }
.badge-visited    { background: #f0f5ff; color: #2f54eb; }
.badge-quoting    { background: #fff0f6; color: #c41d7f; }
.badge-tentative  { background: #fffbe6; color: #7c5800; }
.badge-signed     { background: #f6ffed; color: #389e0d; }
.badge-constructing { background: #e6fffb; color: #08979c; }
.badge-pending_acceptance { background: #fffbe6; color: #d4a017; }
.badge-accepted   { background: #f6ffed; color: #52c41a; }
.badge-settling   { background: #f9f0ff; color: #722ed1; }
.badge-completed  { background: #f5f5f5; color: #595959; }
.badge-cancelled  { background: #fff1f0; color: #cf1322; }
.badge-active     { background: #f6ffed; color: #389e0d; }
.badge-info       { background: #e6f7ff; color: #096dd9; }
.badge-inactive   { background: #f5f5f5; color: #8c8c8c; }
.badge-pending-s  { background: #fff7e6; color: #d46b08; }
.badge-approved   { background: #f6ffed; color: #389e0d; }
.badge-paid       { background: #f5f5f5; color: #595959; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: #666; }
.page-btn { width: 32px; height: 32px; border: 1.5px solid #e8e8e8; background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.page-btn:hover { border-color: #c90304; color: #c90304; }
.page-btn.active { background: #c90304; border-color: #c90304; color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Modal ── */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 540px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-lg { width: 740px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; line-height: 1; padding: 0; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500; display: block; }
.required { color: #c90304; }
.form-control {
  width: 100%;
  height: 36px;
  border: 1.5px solid #e8e8e8;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13px;
  color: #333;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}
.form-control:focus { border-color: #c90304; }
textarea.form-control { height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
select.form-control { cursor: pointer; }

/* ── Detail View ── */
.detail-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.info-section { margin-bottom: 20px; }
.info-section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.info-row { display: flex; padding: 10px 0; border-bottom: 1px solid #fafafa; }
.info-row:last-child { border-bottom: none; }
.info-key { width: 90px; flex-shrink: 0; font-size: 13px; color: #999; }
.info-val { flex: 1; font-size: 13px; color: #333; }
.info-val.price { color: #c90304; font-weight: 700; font-size: 15px; }

/* Status Header */
.status-banner {
  border-radius: 10px;
  padding: 20px 24px;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-banner-text { font-size: 22px; font-weight: 700; }
.status-banner-no { font-size: 13px; opacity: 0.75; margin-top: 4px; font-family: monospace; }
.bg-pending    { background: linear-gradient(135deg, #fa8c16, #ffc53d); }
.bg-contacted  { background: linear-gradient(135deg, #1677ff, #69b1ff); }
.bg-visited    { background: linear-gradient(135deg, #2f54eb, #85a5ff); }
.bg-quoting    { background: linear-gradient(135deg, #c41d7f, #f759ab); }
.bg-tentative  { background: linear-gradient(135deg, #7c5800, #d4b106); }
.bg-signed     { background: linear-gradient(135deg, #389e0d, #73d13d); }
.bg-constructing { background: linear-gradient(135deg, #08979c, #36cfc9); }
.bg-pending_acceptance { background: linear-gradient(135deg, #d4a017, #ffc53d); }
.bg-accepted   { background: linear-gradient(135deg, #389e0d, #95de64); }
.bg-settling   { background: linear-gradient(135deg, #722ed1, #b37feb); }
.bg-completed  { background: linear-gradient(135deg, #595959, #8c8c8c); }
.bg-cancelled  { background: linear-gradient(135deg, #cf1322, #ff4d4f); }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content:''; position:absolute; left:9px; top:6px; bottom:0; width:1.5px; background:#f0f0f0; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content:''; position:absolute; left:-22px; top:4px;
  width:10px; height:10px; border-radius:50%;
  background:#c90304; border:2px solid #fff;
  box-shadow: 0 0 0 2px #c90304;
}
.timeline-item.system::before { background: #d9d9d9; box-shadow: 0 0 0 2px #d9d9d9; }
.timeline-meta { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.timeline-author { font-size:13px; font-weight:600; color:#c90304; }
.timeline-author.system { color:#999; }
.timeline-time { font-size:12px; color:#bbb; }
.timeline-content { font-size:13px; color:#555; line-height:1.6; }

/* Photo Grid */
.photo-grid { display:flex; flex-wrap:wrap; gap:8px; }
.photo-thumb { width:80px; height:80px; border-radius:6px; object-fit:cover; cursor:pointer; border:1px solid #f0f0f0; }

/* Operations Panel */
.ops-card { position: sticky; top: 76px; }
.ops-section { margin-bottom: 20px; }
.ops-title { font-size:13px; font-weight:600; color:#555; margin-bottom:10px; }
.ops-btns { display:flex; flex-direction:column; gap:8px; }

/* Empty State */
.empty { text-align:center; padding: 60px 20px; color: #bbb; font-size: 14px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* Loading */
.loading { display:flex; align-items:center; justify-content:center; padding:60px; color:#bbb; font-size:14px; gap:10px; }
.spinner {
  width:20px; height:20px;
  border:2.5px solid #f0f0f0;
  border-top-color:#c90304;
  border-radius:50%;
  animation:spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container { position:fixed; bottom:28px; right:28px; z-index:9999; display:flex; flex-direction:column; gap:8px; }
.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: fadeIn 0.2s ease;
}
.toast-success { background:#fff; border-left: 4px solid #52c41a; color:#1a1a1a; }
.toast-error   { background:#fff; border-left: 4px solid #c90304; color:#1a1a1a; }
.toast-info    { background:#fff; border-left: 4px solid #1677ff; color:#1a1a1a; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* Dropdown search */
.search-dropdown {
  position:absolute; background:#fff; border:1.5px solid #e8e8e8; border-radius:6px;
  box-shadow:0 8px 24px rgba(0,0,0,0.1); z-index:100; width:100%; max-height:200px; overflow-y:auto;
}
.dropdown-item { padding:10px 14px; cursor:pointer; font-size:13px; border-bottom:1px solid #f5f5f5; }
.dropdown-item:hover { background:#fafafa; }
.dropdown-item:last-child { border-bottom:none; }
.relative { position:relative; }

/* Tabs */
.tabs { display:flex; gap:0; border-bottom:2px solid #f0f0f0; margin-bottom:20px; }
.tab { padding:10px 20px; font-size:13px; cursor:pointer; color:#999; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all 0.15s; }
.tab.active { color:#c90304; border-bottom-color:#c90304; font-weight:600; }

/* Breadcrumb */
.breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; color:#999; margin-bottom:16px; }
.breadcrumb a { color:#999; cursor:pointer; }
.breadcrumb a:hover { color:#c90304; }
.breadcrumb-sep { color:#ddd; }
.breadcrumb-current { color:#1a1a1a; font-weight:600; }
