/* ========================================
   全屋定制自动报价 V5 — 暖色渐变风格
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #faf6f1;
  --bg-card: #ffffff;
  --bg-sidebar: #2d2018;
  --accent: #e07c4f;
  --accent-hover: #c96a3d;
  --accent-light: #fef0e8;
  --gold: #d4a853;
  --gold-light: #fdf3e0;
  --gradient: linear-gradient(135deg, #e07c4f 0%, #d4a853 100%);
  --gradient-soft: linear-gradient(135deg, #fef0e8 0%, #fdf3e0 100%);
  --text: #2d2018;
  --text-secondary: #8b7355;
  --text-light: #b8a590;
  --border: #ede4d8;
  --border-light: #f5efe8;
  --success: #4caf50;
  --success-light: #e8f5e9;
  --warning: #ff9800;
  --warning-light: #fff3e0;
  --danger: #ef5350;
  --danger-light: #ffebee;
  --info: #42a5f5;
  --info-light: #e3f2fd;
  --shadow-sm: 0 1px 3px rgba(45,32,24,0.06);
  --shadow: 0 2px 12px rgba(45,32,24,0.08);
  --shadow-lg: 0 8px 32px rgba(45,32,24,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: #fff;
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  font-size: 18px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .logo { font-size: 24px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-item.active {
  color: #fff; background: rgba(224,124,79,0.15);
  border-left-color: var(--accent);
}
.sidebar-item .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; color: rgba(255,255,255,0.3);
}

/* ---- Main Layout ---- */
.main-area {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
}
.search-box input {
  border: none; background: transparent; outline: none;
  font-size: 13px; width: 160px; color: var(--text);
}
.notification-bell {
  position: relative; cursor: pointer; font-size: 20px;
  color: var(--text-secondary);
}
.notification-bell .badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.user-area { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 500; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 180px; padding: 6px 0;
  display: none; z-index: 200;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13px; color: var(--text);
  cursor: pointer; transition: background .15s;
}
.dropdown-item:hover { background: var(--accent-light); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

.content { padding: 28px; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: #fdfcfa;
}

/* ---- Stat Cards ---- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { font-size: 28px; margin-bottom: 12px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ---- Quick Actions ---- */
.actions-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.action-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.action-icon { font-size: 32px; }
.action-text h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.action-text p { font-size: 12px; color: var(--text-secondary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--accent-light); color: var(--accent); }
.btn-secondary:hover { background: #fde0d0; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font);
  background: var(--bg-card); color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,124,79,0.12);
}
.form-control::placeholder { color: var(--text-light); }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .form-control { flex: 1; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b7355' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
  background: #fdfcfa; padding: 10px 12px;
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
}
table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
table tr:hover td { background: #fdfcfa; }
table input, table select {
  padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; font-family: var(--font);
  background: #fff;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: #2e7d32; }
.badge-warning { background: var(--warning-light); color: #e65100; }
.badge-danger { background: var(--danger-light); color: #c62828; }
.badge-info { background: var(--info-light); color: #1565c0; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-light); margin-bottom: 16px; flex-wrap: wrap; }
.tab-item {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .2s;
}
.tab-item:hover { color: var(--text); }
.tab-item.active {
  color: var(--accent); border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Collapsible (details) ---- */
details.card summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
  padding: 16px 20px;
  font-size: 15px; font-weight: 600;
  user-select: none;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::before {
  content: '▶'; font-size: 11px; color: var(--text-light);
  transition: transform .2s;
}
details.card[open] summary::before { transform: rotate(90deg); }
details.card summary .fold-hint {
  font-size: 12px; color: var(--text-light); font-weight: 400; margin-left: auto;
}
details.card[open] .card-body { border-top: 1px solid var(--border-light); }

/* ---- Upload Area ---- */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px; text-align: center;
  background: var(--gradient-soft);
  transition: all .2s; cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent); background: var(--accent-light);
}
.upload-area .icon { font-size: 40px; margin-bottom: 12px; }
.upload-area h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.upload-area p { font-size: 13px; color: var(--text-secondary); }

/* ---- Step Indicator ---- */
.steps { display: flex; align-items: center; justify-content: center; gap: 0; margin: 32px 0; }
.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-light);
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 2px solid var(--border); color: var(--text-light);
  transition: all .3s;
}
.step.active .step-num { background: var(--gradient); color: #fff; border-color: transparent; }
.step.completed .step-num { background: var(--success); color: #fff; border-color: transparent; }
.step.active { color: var(--text); font-weight: 600; }
.step.completed { color: var(--success); }
.step-line {
  width: 60px; height: 2px; background: var(--border);
  margin: 0 8px; transition: background .3s;
}
.step-line.completed { background: var(--success); }

/* ---- Log Area ---- */
.log-area {
  background: #1e1510; color: #e8d5c0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px; line-height: 1.7;
  padding: 16px; border-radius: var(--radius-sm);
  min-height: 160px; max-height: 400px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.log-area .log-time { color: #8b7355; }
.log-area .log-success { color: #81c784; }
.log-area .log-error { color: #ef5350; }
.log-area .log-warn { color: #ffb74d; }

/* ---- Toast ---- */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
  min-width: 280px; max-width: 420px;
}
.toast-success { background: #2e7d32; color: #fff; }
.toast-error { background: #c62828; color: #fff; }
.toast-warning { background: #e65100; color: #fff; }
.toast-info { background: #1565c0; color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(45,32,24,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px;
  max-width: 520px; width: 90%;
  animation: slideIn .3s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }

/* ---- Welcome Section ---- */
.welcome { margin-bottom: 24px; }
.welcome h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.welcome p { font-size: 14px; color: var(--text-secondary); }

/* ---- Section Title ---- */
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.section-hint { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ---- Action Bar ---- */
.action-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 0; border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

/* ---- Info Card ---- */
.info-card {
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.info-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }

/* ---- Auth Card ---- */
.auth-status-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 13px;
}
.auth-status-bar.ok { background: var(--success-light); color: #2e7d32; }
.auth-status-bar.warn { background: var(--warning-light); color: #e65100; }
.auth-status-bar.err { background: var(--danger-light); color: #c62828; }

/* ---- File Info ---- */
.file-info {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: #fdfcfa;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-top: 8px;
}
.file-info .icon { font-size: 24px; }
.file-info .name { font-weight: 600; font-size: 13px; }
.file-info .meta { font-size: 12px; color: var(--text-secondary); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .stats-row, .actions-row { grid-template-columns: repeat(2, 1fr); }
  .form-row-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .stats-row, .actions-row { grid-template-columns: 1fr; }
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .steps { flex-wrap: wrap; gap: 8px; }
  .step-line { display: none; }
}

/* ---- Misc ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.pointer { cursor: pointer; }
