/* ─── Estilo Oficial Ministerio / Portal BOE (PHP Version) ───────────────── */
:root {
  --bg-deep:    #f1f5f9;
  --bg-base:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-hover:   #f8fafc;
  --sidebar-w:  260px;
  --accent:     #1e40af;       /* Azul Institucional */
  --accent-dark:#1e3a8a;
  --accent2:    #4338ca;
  --gob-red:    #ad1519;       /* Rojo Oficial España */
  --gob-yellow: #fabd00;       /* Amarillo Oficial España */
  --gold:       #b45309;
  --success:    #047857;
  --warning:    #d97706;
  --danger:     #b91c1c;
  --info:       #0284c7;
  --secondary:  #475569;
  --text:       #0f172a;       /* Texto primario oscuro */
  --text-muted: #64748b;
  --text-dim:   #334155;
  --border:     #cbd5e1;       /* Borde suave limpio */
  --border-accent: #94a3b8;
  --radius:     8px;
  --radius-sm:  4px;
  --shadow:     0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg:  0 8px 24px rgba(15, 23, 42, 0.12);
  --transition: 0.2s ease;
}

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; font-weight: 500; transition: color var(--transition); }
a:hover { color: var(--accent-dark); text-decoration: underline; }

button { cursor: pointer; font-family: inherit; }

/* ─── Layout Structure ───────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ─── Sidebar Oficial ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;         /* Azul Noche Ministerio */
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 120;
  box-shadow: 4px 0 16px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 110;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.open {
  display: block;
  opacity: 1;
}

/* Banda de la bandera española en la cabecera oficial */
.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 3px solid var(--gob-red);
  background: #090d16;
  position: relative;
}

.sidebar-brand::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gob-red) 0%, var(--gob-red) 35%, var(--gob-yellow) 35%, var(--gob-yellow) 65%, var(--gob-red) 65%, var(--gob-red) 100%);
}

.brand-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.brand-text {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 10px 4px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  text-decoration: none !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.4);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e293b;
  background: #090d16;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ollama-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.ollama-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--secondary);
}

.ollama-dot.ok { background: #10b981; box-shadow: 0 0 6px #10b981; }
.ollama-dot.err { background: #ef4444; }

.btn-sync {
  width: 100%;
  padding: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.btn-sync:hover {
  background: #334155;
  border-color: #475569;
}

.btn-sync.syncing .sync-icon { display: none; }
.btn-sync.syncing .spin { display: inline-block !important; }
.spin { display: none; animation: spin 1s linear infinite; }

@keyframes spin { 100% { transform: rotate(360deg); } }

.sync-status-text {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  min-height: 14px;
}

/* ─── Main Content Layout ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--sidebar-w));
}

.topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 20px;
  color: #0f172a;
  margin-right: 12px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
}

.page-body {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ─── KPI Cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.kpi-card.blue   { border-top-color: #1e40af; }
.kpi-card.green  { border-top-color: #047857; }
.kpi-card.gold   { border-top-color: #d97706; }
.kpi-card.purple { border-top-color: #6d28d9; }

.kpi-icon {
  font-size: 24px;
  position: absolute;
  top: 16px; right: 16px;
  opacity: 0.6;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Charts ─────────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

/* ─── Filter Bar Layout ──────────────────────────────────────── */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 150px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #0f172a;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
  transition: all var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

select.form-control { cursor: pointer; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-primary {
  background: var(--accent);
  color: #ffffff !important;
}
.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155 !important;
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a !important;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}
.btn-ghost:hover { background: #eff6ff; }

/* ─── Cards Grid Layout ──────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.subasta-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.subasta-card:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-id {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-emerald { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-indigo { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-purple { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-cyan { background: #cff4fc; color: #055160; border: 1px solid #9eeaf9; }

.card-desc {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-price {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.card-price-label {
  font-size: 11px;
  color: var(--text-muted);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.card-footer {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

/* ─── Badges Oficiales ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.badge-tipo-Inmueble { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-tipo-Vehículo { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-tipo-Otro     { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-purple  { background: #f3e8ff; color: #6b21a8; }

/* ─── Detalle Layout ─────────────────────────────────────────── */
.detail-hero {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--accent);
}

.detail-id {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.detail-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-url { font-size: 13px; }

.price-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.price-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.price-card.valor    { border-top: 4px solid var(--accent); }
.price-card.tasacion { border-top: 4px solid var(--info); }
.price-card.deposito { border-top: 4px solid var(--warning); }

.price-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.price-card-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.ai-card {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-title {
  font-size: 14px;
  font-weight: 800;
  color: #581c87;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-model-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: #e9d5ff;
  color: #6b21a8;
  border-radius: 4px;
  font-weight: 700;
}

.ai-summary-text {
  font-size: 14px;
  line-height: 1.6;
  color: #3b0764;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.detail-section-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.detail-section-body { padding: 16px 20px; }

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

.field-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #f1f5f9;
}

.field-row:last-child { border-bottom: none; padding-bottom: 0; }

.field-key { color: var(--text-muted); font-weight: 500; }
.field-val { color: #0f172a; font-weight: 600; text-align: right; word-break: break-word; }

/* ─── Table ──────────────────────────────────────────────────── */
.table-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ─── Map View ───────────────────────────────────────────────── */
.map-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 450px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#map { width: 100%; height: 100%; }

.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid var(--border);
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
}

.leaflet-popup-content { margin: 0 !important; line-height: 1.4 !important; min-width: 260px; }

.map-mini-card { padding: 16px; }
.map-mini-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.map-mini-id { font-size: 11px; font-family: monospace; color: #1e40af; background: #eff6ff; padding: 2px 6px; border-radius: 4px; }
.map-mini-title { font-size: 13px; font-weight: 600; color: #0f172a; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.map-mini-price { font-size: 16px; font-weight: 800; color: #0f172a; margin-bottom: 10px; }
.map-mini-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid #f1f5f9; }

.map-marker-pin {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.25); border: 2px solid white;
}

.marker-inmueble { background: #059669; }
.marker-vehiculo { background: #2563eb; }
.marker-otro     { background: #7c3aed; }

/* ─── Star / Favorite Button ──────────────────────────────────── */
.btn-star {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 2px 6px;
  transition: transform 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.btn-star:hover { transform: scale(1.25); color: #d97706; }
.btn-star.active { color: #d97706; }

/* ─── ROI Calculator Widget ──────────────────────────────────── */
.calc-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.calc-res-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  text-align: center;
}

.calc-res-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--success);
  margin-top: 4px;
}

/* ─── AI Chat Widget ─────────────────────────────────────────── */
.chat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
}

.chat-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
}

.chat-pill:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent);
}

.chat-messages {
  max-height: 380px;
  min-height: 180px;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }

.chat-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-msg.assistant .chat-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* ─── Docs Card ──────────────────────────────────────────────── */
.docs-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.docs-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.doc-item:hover { background: #f8fafc; }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }

/* ─── Responsive Media Queries ───────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .page-body {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-badge {
    display: none;
  }

  .filter-bar {
    padding: 14px;
    gap: 10px;
  }

  .filter-group {
    flex: 1 1 calc(50% - 10px);
    min-width: 130px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .filter-group {
    flex: 1 1 100%;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .price-cards {
    grid-template-columns: 1fr;
  }

  .calc-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    font-size: 15px;
  }
}
