.modal { position: fixed; inset: 0; background: rgba(2,6,23,0.55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 10000; }
.modal.show { display: flex; }
.modal-card { width: min(640px, 90vw); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-list { max-height: 50vh; overflow: auto; margin-top: 8px; }
.modal-item { padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.modal-item:hover { background: rgba(148,163,184,0.12); }
.layout-graphs { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.sidebar { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.crems-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.crem-item { padding: 10px 12px 10px 16px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--card); transition: transform .08s ease, background .15s ease; position: relative; }
.crem-item:hover { background: #f8fafc; }
.crem-time { font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.crem-meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.crem-row { display: block; }
.crem-scr { color: #3b82f6; font-size: 11px; }
.crem-scr strong { color: #2563eb; font-weight: 700; }

/* Indicateur visuel à gauche pour chaque crémation */
.crem-item::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 4px; background: #ef4444; border-radius: 4px; opacity: .7; }
/* Variantes de couleur pour les listes latérales */
.crem-item--preheat::before { background: #f59e0b; }
.crem-item--daily::before { background: #22c55e; }

/* Améliorations mode sombre */
.theme-dark .sidebar { background: var(--card); border-color: #233142; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.theme-dark .crem-item { background: #0f172a; border-color: #1f2937; }
.theme-dark .crem-item:hover { background: #111827; }
.theme-dark .crem-time { color: #e5e7eb; }
.theme-dark .crem-meta { color: #94a3b8; }
.theme-dark .crem-scr { color: #60a5fa; }
.theme-dark .crem-scr strong { color: #93c5fd; }
.theme-dark .crem-item::before { background: #ef4444; opacity: .9; }
.theme-dark .crem-item--preheat::before { background: #f59e0b; }
.theme-dark .crem-item--daily::before { background: #22c55e; }

/* Temporary pulse highlight for selected list items */
.crem-item.hl { outline: 2px solid #22c55e; animation: pulseBox 1.6s ease-out 1; }
@keyframes pulseBox { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5);} 100% { box-shadow: 0 0 0 10px rgba(34,197,94,0);} }

@media (max-width: 960px) {
  .layout-graphs { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
}
:root {
  --fg: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
}

.theme-dark:root, .theme-dark {
  --fg: #e5e7eb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --bg: #0b1220;
  --card: #0f172a;
  --border: #1f2937;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--fg); background: var(--bg); }
.theme-dark body { color: var(--fg); background: var(--bg); }
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.container--wide { max-width: none; width: 100%; }
.header { position: sticky; top: 0; z-index: 30; background: linear-gradient(90deg, rgba(255,255,255,0.85), rgba(255,255,255,0.7)); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.theme-dark .header { background: linear-gradient(90deg, rgba(15,23,42,0.9), rgba(15,23,42,0.75)); border-bottom-color: #1f2937; }
.nav { display: flex; align-items: center; justify-content: space-between; height: 36px; }
.brand { font-weight: 300; font-style: italic; color: var(--fg); text-decoration: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 4px; font-family: "Myriad Pro","MyriadPro-LightIt","Myriad Pro Light","Myriad Pro Italic", Segoe UI, Roboto, system-ui, -apple-system, Arial, sans-serif; }
.brand-logo .ft { color: #f59e0b; }
.brand-logo .connect { position: relative; color: #3b82f6; background: linear-gradient(90deg, rgba(59,130,246,0.15), rgba(59,130,246,0.35), rgba(59,130,246,0.15)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 3s ease infinite; margin-left: 0; }
.chip--pro { background: rgba(59,130,246,0.18); color: #1d4ed8; border-color: rgba(59,130,246,0.35); }
@keyframes shimmer { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.links { display: inline-flex; align-items: center; gap: 6px; }
.links a { color: var(--fg); text-decoration: none; }
.live-badge { margin-left: 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #ef4444; }
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0.7); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); } 70% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.search-form { display: flex; gap: 8px; align-items: center; margin: 12px 0 20px; flex-wrap: wrap; }
.search-form input, .search-form button { padding: 8px 10px; }
.search-form .input { border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 10px; padding: 10px 12px; min-width: 260px; }
.search-form .btn, .btn-secondary { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; }
.btn-secondary:hover { background: #f1f5f9; }
.theme-dark .btn-secondary:hover { background: #111827; }
.date-input { border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 10px; padding: 8px 10px; }
.theme-dark .date-input { background: #0f172a; border-color: #1f2937; color: #e5e7eb; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: #f1f5f9; }
.theme-dark .table { border-color: #1f2937; }
.theme-dark .table th, .theme-dark .table td { border-bottom-color: #1f2937; }
.table--modern { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.table--modern thead th { position: sticky; top: 0; background: linear-gradient(0deg, rgba(241,245,249,1), rgba(241,245,249,0.8)); backdrop-filter: blur(6px); z-index: 1; }
.table--modern tbody tr:nth-child(odd) { background: rgba(148,163,184,0.05); }
.table--modern tbody tr:hover { background: rgba(148,163,184,0.12); }
.table--modern td .actions { display: inline-flex; gap: 6px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--border); background: #f1f5f9; color: #0f172a; }
.theme-dark .pill { background: #111827; color: #e5e7eb; border-color: #1f2937; }
/* Header sombre du tableau */
.theme-dark .table--modern { border-color: #1f2937; }
.theme-dark .table--modern thead th { background: linear-gradient(0deg, rgba(17,24,39,1), rgba(17,24,39,0.85)); color: #e5e7eb; border-bottom: 1px solid #1f2937; }
.theme-dark .table--modern tbody tr:hover { background: rgba(30,41,59,0.5); }
.hint { color: var(--muted); margin-left: 12px; }
.json { background: #0b1021; color: #d1e7ff; padding: 12px; border-radius: 6px; overflow: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.card .value { font-size: 22px; font-weight: 700; margin-top: 6px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; grid-auto-rows: minmax(140px, auto); grid-auto-flow: dense; }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.chart-card header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: move; }
.chart-title { margin: 0; font-size: 16px; }
.chart-actions { display: flex; gap: 6px; }
.chart-actions .icon-btn { border: 1px solid var(--border); background: transparent; color: var(--fg); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.chart-actions .icon-btn:hover { background: #f1f5f9; }
.chart-card.dragging { opacity: .8; outline: 2px dashed var(--border); }
.theme-dark .chart-actions .icon-btn:hover { background: #111827; }
.chart-actions .add-compare { border-color: #3b82f6; color: #3b82f6; }
.chart-card .card-body { padding: 12px; flex: 1; display: flex; min-height: 140px; }
.chart-card .card-body canvas { flex: 1; min-height: 120px; }
.chart-card.span-2 { grid-column: span 2; }

@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } }

/* Modern extras */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #f1f5f9; color: #0f172a; border: 1px solid var(--border); margin-right: 6px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0 16px; flex-wrap: wrap; }
.btn { padding: 6px 10px; border: 1px solid var(--border); background: var(--card); border-radius: 8px; cursor: pointer; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; line-height: 1; font-family: inherit; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.icon { padding: 6px 10px; }
.btn.success { background: #22c55e; color: #fff; border-color: #16a34a; }
.btn.success:hover { background: #16a34a; }

/* Compare panels */
.cmp-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin: 12px 0; }
.cmp-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.cmp-title { margin: 0; font-size: 14px; font-weight: 700; }
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cmp-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--card); }
.cmp-card h4 { margin: 0 0 6px 0; font-size: 13px; }
@media (max-width: 1100px) { .cmp-grid { grid-template-columns: 1fr; } }

/* Ghost compare card */
.chart-card--ghost { opacity: 0.7; border: 1px dashed var(--border); background: transparent; }
.chart-card--ghost .chart-title { color: var(--muted); }
.chart-card--ghost .card-body { display: flex; align-items: center; justify-content: center; min-height: 120px; }

/* Compare accents & header details */
.chart-card .chart-title .sub { font-weight: 400; font-size: 12px; opacity: 0.8; margin-left: 8px; }
.badge-accent { display: inline-block; padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-left: 8px; }
.links .btn, .links .btn-secondary { height: 32px; padding: 6px 10px; display: inline-flex; align-items: center; }
.links .btn-secondary { background: transparent; }
.theme-dark .btn:hover { background: #111827; }

/* Appbar icon buttons */
.nav-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--fg); text-decoration: none; height: 30px; font-weight: 600; }
.nav-btn:hover { background: #f1f5f9; }
.theme-dark .nav-btn:hover { background: #111827; }
.nav-btn .i { width: 14px; height: 14px; display: inline-block; }
.nav-btn .i svg { width: 14px; height: 14px; display: block; }
/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 8px 0 12px; }
.tab { padding: 8px 12px; cursor: pointer; border: 1px solid transparent; border-radius: 8px 8px 0 0; }
.tab.active { border-color: var(--border); border-bottom-color: transparent; background: var(--card); }
.tab:hover { background: rgba(148,163,184,0.12); }

/* Score energy tabs color-coding */
.tab-energy { position: relative; padding-left: 22px; }
.tab-energy::before { content: ''; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 999px; background: currentColor; opacity: 0.9; }
.tab-energy[data-energy="0"] { color: #2563eb; background: rgba(59,130,246,0.08); }
.tab-energy[data-energy="0"].active { background: rgba(59,130,246,0.18); border-color: #3b82f6; color: #1d4ed8; }
.tab-energy[data-energy="8"] { color: #16a34a; background: rgba(34,197,94,0.08); }
.tab-energy[data-energy="8"].active { background: rgba(34,197,94,0.18); border-color: #22c55e; color: #15803d; }
/* Gas now in red */
.tab-energy[data-energy="16"] { color: #dc2626; background: rgba(239,68,68,0.08); }
.tab-energy[data-energy="16"].active { background: rgba(239,68,68,0.18); border-color: #ef4444; color: #b91c1c; }

/* Dark theme: better contrast for tabs */
.theme-dark .tabs { border-bottom-color: #1f2937; }
.theme-dark .tab { color: var(--fg); background: transparent; border-color: transparent; }
.theme-dark .tab:hover { background: rgba(17,24,39,0.6); }
.theme-dark .tab.active { background: #0f172a; border-color: #1f2937; border-bottom-color: transparent; }
/* Dark theme variants for energy tabs */
.theme-dark .tab-energy[data-energy="0"] { background: rgba(59,130,246,0.15); }
.theme-dark .tab-energy[data-energy="8"] { background: rgba(34,197,94,0.15); }
.theme-dark .tab-energy[data-energy="16"] { background: rgba(239,68,68,0.15); }
.theme-dark .tab-energy[data-energy="0"].active { background: rgba(59,130,246,0.22); border-color: #1f2937; color: #93c5fd; }
.theme-dark .tab-energy[data-energy="8"].active { background: rgba(34,197,94,0.22); border-color: #1f2937; color: #86efac; }
.theme-dark .tab-energy[data-energy="16"].active { background: rgba(239,68,68,0.22); border-color: #1f2937; color: #fca5a5; }

/* Empty state */
.empty { padding: 12px; border: 1px dashed var(--border); background: var(--card); border-radius: 10px; color: var(--muted); margin: 8px 0; }

/* New polish */
.tag { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; margin-right: 6px; background: #eef2ff; color: #3730a3; }
.theme-dark .tag { background: #1e293b; color: #c7d2fe; border-color: #243447; }
.summary-row { display: flex; gap: 8px; align-items: center; margin: 6px 0 10px; flex-wrap: wrap; }
.editable { cursor: pointer; border-bottom: 1px dotted rgba(148,163,184,0.7); padding: 1px 2px; border-radius: 4px; }
.editable:hover { background: rgba(59,130,246,0.15); }
.editable.dirty { background: rgba(34,197,94,0.15); border-bottom-color: rgba(34,197,94,0.8); }
.input.small { padding: 6px 8px; height: 30px; }

/* Small inline icons */
.icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; font-size: 13px; margin-left: 6px; }
.icon--electric { background: rgba(251,191,36,0.18); }
.icon--hybrid { background: rgba(34,197,94,0.18); }
.icon--gas { background: rgba(239,68,68,0.18); }

/* Chips (compact badges with icon + label) */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; vertical-align: middle; }
.chip .chip-icon { font-size: 13px; line-height: 1; }
.chip--electric { background: rgba(251,191,36,0.18); }
.chip--hybrid { background: rgba(34,197,94,0.18); }
.chip--gas { background: rgba(239,68,68,0.18); }
.theme-dark .chip { border-color: #1f2937; }

/* Footer */
.footer { margin-top: 24px; padding: 16px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--border); }

details { border: 1px solid var(--border); border-radius: 10px; background: var(--card); margin: 8px 0; }
details > summary { list-style: none; cursor: pointer; padding: 10px 12px; border-bottom: 1px solid var(--border); user-select: none; display: flex; align-items: center; gap: 10px; }
details[open] > summary { border-bottom-color: var(--border); }
details > summary::before { content: '▸'; transition: transform .15s ease; color: var(--muted); }
details[open] > summary::before { transform: rotate(90deg); }

.section-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); margin: 12px 0; }
.section-title { margin: 0 0 8px; font-size: 18px; }

/* Preheat tab polish */
.ph-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.ph-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.ph-list .row { display: grid; grid-template-columns: 170px repeat(4, 1fr) 140px; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.ph-list .row:last-child { border-bottom: none; }
.ph-list .row .muted { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 12px 0 16px; align-items: stretch; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 20px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Login page */
.login { display: grid; place-items: center; min-height: calc(100vh - 120px); }
.login-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.login-card h1 { margin: 0 0 4px; }
.login-card .muted { color: var(--muted); margin: 0 0 16px; }
.login-form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field input { padding: 10px 12px; border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 10px; }
.error { color: #ef4444; margin-top: 8px; min-height: 20px; }

/* Animation de mise à jour live des KPIs */
.kpi .value.live-update {
  animation: kpiFlash 600ms ease;
  border-radius: 8px;
}

/* Toast */
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); opacity: 0; transform: translateY(10px); transition: all .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Global loading overlay */
.loading-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(2,6,23,0.65); backdrop-filter: blur(4px); transition: opacity .2s ease, visibility .2s ease; }
.loading-overlay.hidden { opacity: 0; visibility: hidden; }
.loading-box { display: grid; place-items: center; gap: 12px; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,0.35); }
.loading-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; }
.loading-spinner { width: 64px; height: 64px; border: 4px solid rgba(148,163,184,0.35); border-top-color: #22c55e; border-radius: 999px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes kpiFlash {
  0% { background: rgba(59,130,246,0.25); transform: scale(1.04); }
  60% { background: rgba(59,130,246,0.12); transform: scale(1.01); }
  100% { background: transparent; transform: scale(1); }
}
.theme-dark .kpi .value.live-update {
  animation: kpiFlashDark 600ms ease;
}
@keyframes kpiFlashDark {
  0% { background: rgba(59,130,246,0.35); transform: scale(1.04); }
  60% { background: rgba(59,130,246,0.18); transform: scale(1.01); }
  100% { background: transparent; transform: scale(1); }
}

/* Equipment Search in Header */
.search-equipment {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin: 0 20px;
}
.search-equipment input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}
.search-equipment input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.search-equipment input::placeholder {
  color: var(--muted);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.search-dropdown.show {
  display: block;
}
.search-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.search-item:last-child {
  border-bottom: none;
}
.search-item:hover {
  background: rgba(59, 130, 246, 0.08);
}
.search-item strong {
  color: var(--fg);
  font-weight: 600;
}
.search-item .muted {
  color: var(--muted);
  font-size: 13px;
}
.search-item.search-empty {
  color: var(--muted);
  cursor: default;
  text-align: center;
}
.search-item.search-empty:hover {
  background: transparent;
}

/* Dark theme adjustments */
.theme-dark .search-equipment input {
  background: #0f172a;
  border-color: #1f2937;
}
.theme-dark .search-equipment input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.theme-dark .search-dropdown {
  background: #0f172a;
  border-color: #1f2937;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.theme-dark .search-item {
  border-bottom-color: #1f2937;
}
.theme-dark .search-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

/* Responsive */
@media (max-width: 900px) {
  .search-equipment {
    display: none; /* Hide on mobile to save space */
  }
}

/* Pinned equipments */
.pinned-equipments {
  position: relative;
  margin-left: 8px;
}
.pinned-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}
.pinned-toggle:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent);
}
.pinned-count {
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.pinned-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.pinned-dropdown.show {
  display: block;
}
.pinned-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.pinned-item:last-child {
  border-bottom: none;
}
.pinned-item:hover {
  background: rgba(59, 130, 246, 0.05);
}
.pinned-link {
  flex: 1;
  color: var(--fg);
  text-decoration: none;
  display: block;
}
.pinned-link:hover {
  color: var(--accent);
}
.pinned-link strong {
  font-weight: 600;
}
.pinned-unpin {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 16px;
  transition: all 0.15s ease;
}
.pinned-unpin:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.pinned-item.pinned-empty {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* Pin button on graphs page */
.btn-pin {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
.btn-pin:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent);
}
.btn-pin.pinned {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Dark theme */
.theme-dark .pinned-toggle {
  background: #0f172a;
  border-color: #1f2937;
}
.theme-dark .pinned-toggle:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}
.theme-dark .pinned-dropdown {
  background: #0f172a;
  border-color: #1f2937;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.theme-dark .pinned-item {
  border-bottom-color: #1f2937;
}
.theme-dark .pinned-item:hover {
  background: rgba(59, 130, 246, 0.12);
}
.theme-dark .pinned-unpin:hover {
  background: rgba(239, 68, 68, 0.15);
}

@media (max-width: 900px) {
  .pinned-equipments {
    display: none;
  }
}


