/* ================================================================
   WP Manager V4 — Design System (inspiré ManageWP)
   Thème : clair, professionnel, sidebar double, cards sites
   ================================================================ */

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

:root {
  /* Couleurs */
  --bg:          #f0f2f5;
  --bg-card:     #ffffff;
  --bg-sidebar:  #1e2533;
  --bg-nav:      #161c29;
  --bg-header:   #1e2533;
  --border:      #e1e5eb;
  --border-dark: #2d3548;

  /* Texte */
  --text:        #2c3e50;
  --text-2:      #6b7a99;
  --text-light:  #a0aec0;
  --text-white:  #ffffff;
  --text-nav:    #8899bb;

  /* Accents */
  --primary:     #0085ba;
  --primary-h:   #006a96;
  --green:       #27ae60;
  --green-light: #e8f8f0;
  --red:         #e74c3c;
  --red-light:   #fdf0ef;
  --orange:      #e67e22;
  --orange-light:#fef5ec;
  --yellow:      #f39c12;
  --blue:        #3498db;
  --blue-light:  #eaf4fd;
  --purple:      #9b59b6;

  /* UI */
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-lg:   0 4px 20px rgba(0,0,0,.12);
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition:  .18s ease;

  /* Layout */
  --nav-w:       56px;
  --sidebar-w:   220px;
  --header-h:    52px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

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

/* ── Layout principal ─────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--nav-w) var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  grid-template-areas:
    "header header header"
    "nav    sidebar  main";
}

/* ── Header ───────────────────────────────────────────────────── */
#header {
  grid-area: header;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--border-dark);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-find {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  min-width: 180px;
  transition: background var(--transition);
}
.header-find:hover { background: rgba(255,255,255,.12); }
.header-find input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  width: 100%;
}
.header-find input::placeholder { color: rgba(255,255,255,.5); }

.header-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.3px;
  pointer-events: none;
}
.header-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 18px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.header-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.header-user:hover { background: rgba(255,255,255,.1); }

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Nav verticale (icônes) ───────────────────────────────────── */
#nav {
  grid-area: nav;
  background: var(--bg-nav);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 2px;
  border-right: 1px solid var(--border-dark);
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  width: 44px; height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-nav);
  font-size: 10px;
  gap: 3px;
  transition: color var(--transition), background var(--transition);
  position: relative;
  border: none;
  background: none;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-item .nav-icon { font-size: 18px; line-height: 1; }
.nav-item .nav-label { font-size: 9px; line-height: 1; }

.nav-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.nav-divider {
  width: 28px;
  height: 1px;
  background: var(--border-dark);
  margin: 4px 0;
}

/* ── Sidebar filtres ──────────────────────────────────────────── */
#sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-dark);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-section {
  border-bottom: 1px solid var(--border-dark);
  padding: 0;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  cursor: pointer;
  color: rgba(255,255,255,.5);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  user-select: none;
}
.sidebar-section-header:hover { color: rgba(255,255,255,.8); }
.sidebar-section-header .toggle-icon { font-size: 10px; transition: transform .2s; }
.sidebar-section-header.collapsed .toggle-icon { transform: rotate(-90deg); }

.sidebar-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  cursor: pointer;
  color: var(--text-nav);
  font-size: 12px;
  transition: color var(--transition), background var(--transition);
  border-radius: 0;
}
.sidebar-filter:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-filter.active { color: #fff; background: rgba(0,133,186,.25); }

.sidebar-filter input[type=checkbox] {
  accent-color: var(--primary);
  width: 13px; height: 13px;
  flex-shrink: 0;
}

.sidebar-filter .filter-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sidebar-filter .filter-count {
  margin-left: auto;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}
.sidebar-filter.active .filter-count { background: var(--primary); color: #fff; }

/* ── Zone principale ──────────────────────────────────────────── */
#main {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
#main::-webkit-scrollbar { width: 6px; }
#main::-webkit-scrollbar-track { background: var(--bg); }
#main::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── Action bar (barre contextuelle en haut du main) ──────────── */
.action-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.action-bar-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.action-tab {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  transition: all var(--transition);
}
.action-tab:hover { color: var(--primary); border-color: var(--primary); }
.action-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.action-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  padding: 5px 9px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  transition: all var(--transition);
}
.view-btn:hover { background: var(--bg); }
.view-btn.active { background: var(--primary); color: #fff; }

.count-label {
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

/* ── Page content ─────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 16px;
}

/* ── Cards sites (grille) ─────────────────────────────────────── */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.site-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.site-card-checkbox {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition);
}
.site-card:hover .site-card-checkbox,
.site-card-checkbox:checked { opacity: 1; }

.site-thumb {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #e8ecf0 0%, #d0d7e3 100%);
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.site-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.site-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #b0bec5;
}

.site-card-status {
  position: absolute;
  bottom: 6px; left: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid #fff;
}
.site-card-status.online  { background: var(--green); }
.site-card-status.offline { background: var(--red); }
.site-card-status.unknown { background: #aaa; }

.site-card-body {
  padding: 10px 12px;
}

.site-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.site-card-url {
  font-size: 11px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-card-url::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.site-card-url.offline { color: var(--red); }
.site-card-url.offline::before { background: var(--red); }

.site-card-badges {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--blue-light);
  color: var(--primary);
}
.update-badge.zero { background: #f0f2f5; color: var(--text-light); }
.update-badge.warn { background: var(--orange-light); color: var(--orange); }

/* ── Vue liste sites ──────────────────────────────────────────── */
.sites-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.site-row {
  display: grid;
  grid-template-columns: 32px 32px 1fr 80px 80px 80px 60px 100px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.site-row:last-child { border-bottom: none; }
.site-row:hover { background: #f7f9fb; }
.site-row.header-row {
  background: #f7f9fb;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: default;
  padding: 8px 14px;
}
.site-row.header-row:hover { background: #f7f9fb; }

.site-mini-thumb {
  width: 32px; height: 32px;
  border-radius: 4px;
  object-fit: cover;
  background: #e0e5ea;
  flex-shrink: 0;
}

.site-row-name {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.site-row-name strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-row-name span {
  font-size: 11px;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-row-name span.offline { color: var(--red); }

.site-row-stat {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.site-row-stat.zero { color: var(--text-light); font-weight: 400; }
.site-row-stat.warn { color: var(--orange); }

/* ── Dashboard ────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-col-right { display: none; }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.panel-tabs {
  display: flex;
  gap: 2px;
}
.panel-tab {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--transition);
}
.panel-tab.active { background: var(--text); color: #fff; border-color: var(--text); }
.panel-tab.has-count { border-color: var(--primary); color: var(--primary); }

.panel-body { padding: 16px; }

/* Compteurs updates */
.update-counters {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px;
  gap: 4px;
}
.update-counter {
  text-align: center;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  position: relative;
}
.update-counter:hover { background: var(--bg); }
.update-counter.active::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary);
}
.update-counter .num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-2);
  margin-bottom: 4px;
}
.update-counter.has-updates .num { color: var(--primary); }
.update-counter.active .num { color: var(--primary); }
.update-counter .lbl {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}

.update-counter-sep {
  width: 1px;
  height: 48px;
  background: var(--border);
}

.update-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: none;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.update-action-btn .icon { font-size: 20px; }
.update-action-btn:hover { background: var(--primary); color: #fff; }

/* Update item dans panel */
.update-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.update-item:last-child { border-bottom: none; }
.update-item input[type=checkbox] { accent-color: var(--primary); }
.update-item-name { flex: 1; font-weight: 500; }
.update-ver {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 11px;
}
.update-ver-new { color: var(--primary); font-weight: 600; }
.ver-arrow { color: var(--text-light); }

.update-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.select-info { font-size: 12px; color: var(--text-2); }

/* Services list (colonne droite) */
.service-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.service-item:last-child { border-bottom: none; }
.service-item:hover { background: #f7f9fb; }

.service-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.service-info { flex: 1; }
.service-info strong { display: block; font-size: 13px; font-weight: 600; }
.service-info small { font-size: 11px; color: var(--text-2); line-height: 1.4; }
.service-info .ok { color: var(--green); }
.service-info .warn { color: var(--orange); }
.service-info .err { color: var(--red); }
.service-chevron { color: var(--text-light); font-size: 12px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-2);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty-state small { font-size: 12px; }

/* ── Monitoring / Uptime ──────────────────────────────────────── */
.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.mon-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.mon-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.mon-card-header strong { font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.mon-status.online  { background: var(--green-light); color: var(--green); }
.mon-status.offline { background: var(--red-light);   color: var(--red); }
.mon-meta { font-size: 11px; color: var(--text-2); display: flex; gap: 12px; margin-top: 8px; }
.mon-uptime-bar {
  display: flex;
  gap: 2px;
  height: 24px;
  margin-top: 10px;
}
.mon-bar-day {
  flex: 1;
  border-radius: 2px;
  min-width: 3px;
}

/* ── Stats (dashboard global) ─────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-light); }
.stat-icon.blue   { background: var(--blue-light); }
.stat-icon.orange { background: var(--orange-light); }
.stat-icon.red    { background: var(--red-light); }
.stat-info strong { display: block; font-size: 22px; font-weight: 800; line-height: 1; }
.stat-info span   { font-size: 11px; color: var(--text-2); }

/* ── Tableau générique (updates, listes) ─────────────────────── */
.update-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 90px 120px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.update-row:last-child { border-bottom: none; }
.update-row.header {
  background: #f7f9fb;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-blue   { background: var(--blue-light);   color: var(--primary); }
.badge-gray   { background: #f0f2f5; color: var(--text-2); }

/* ── Boutons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-green   { background: var(--green);   color: #fff; }
.btn-red     { background: var(--red);     color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); opacity: 1; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-icon { padding: 6px; border-radius: var(--radius); }

/* ── Formulaires ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,133,186,.12);
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  font-size: 20px; color: var(--text-2);
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Toast notifications ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 500;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  max-width: 340px;
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #1a3a27; color: #56d364; border: 1px solid #2ea04340; }
.toast-error   { background: #3a1a1a; color: #ff7b72; border: 1px solid #f8514940; }
.toast-info    { background: #1a2a3a; color: #79c0ff; border: 1px solid #388bfd40; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ── Auth pages ───────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 36px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
  color: #fff;
}
.auth-logo h1 { font-size: 20px; font-weight: 800; }
.auth-logo p  { color: var(--text-2); font-size: 13px; }

/* ── Settings ─────────────────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}
.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-2);
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.settings-nav-item:hover { color: var(--text); background: var(--bg); }
.settings-nav-item.active { color: var(--primary); border-left-color: var(--primary); background: var(--blue-light); font-weight: 600; }

.toggle {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Tags sidebar ─────────────────────────────────────────────── */
.tag-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Activity log ─────────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-body { flex: 1; }
.activity-body p { font-size: 13px; margin-bottom: 2px; }
.activity-body small { font-size: 11px; color: var(--text-2); }

/* ── Users page ───────────────────────────────────────────────── */
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table th, .users-table td {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.users-table th {
  background: #f7f9fb;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .4px;
  font-size: 11px;
}
.users-table tr:hover td { background: #f7f9fb; }

/* ── Notes textarea ───────────────────────────────────────────── */
.notes-panel {
  padding: 12px 16px;
}
.notes-panel textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  outline: none;
}
.notes-panel textarea:focus { border-color: var(--primary); }

/* ── Scrollbar globale ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d7e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0bec5; }

/* ── Chart container ──────────────────────────────────────────── */
.chart-wrap { position: relative; height: 180px; }

/* ── Search overlay ───────────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(4px);
}
.search-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: none;
}
.search-results { max-height: 360px; overflow-y: auto; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg); }
.search-result-item:last-child { border-bottom: none; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  #app { grid-template-columns: var(--nav-w) 1fr; }
  #sidebar { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .sites-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
