/* ═══════════════════════════════════════════════════════════════
   FarmHub – ipari IoT / sötét grafit, visszafogott neon-zöld LED akcent
═══════════════════════════════════════════════════════════════ */

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

:root {
  /* Sötét UI – a natív görgetősávok, űrlapelemek is sötét módban renderelődnek */
  color-scheme: dark;
  /* Háttér: grafit / fekete */
  --bg-base:         #080B0A;
  --bg-graphite:     #0D1110;
  --bg-panel:        #111715;
  --bg-base-mid:     #0D1110;
  /* Felületek: sötét zöld-szürke */
  --bg-card:         #151C19;
  --bg-card-hover:   #1a2320;
  --bg-elev:         #1B2420;
  --border-muted:    #26312C;
  --border:          #26312C;
  --border-light:    rgba(38, 49, 44, 0.65);
  /* Szöveg */
  --text-primary:    #F4F7F5;
  --text-secondary:  #A7B3AD;
  --text-muted:      #66736C;
  /* FarmHub neon zöld – csak akcent, LED, egészséges állapot */
  --accent:          #22C55E;
  --accent-neon:     #39FF88;
  --accent-deep:     #16A34A;
  --accent-mid:      #16A34A;
  --accent-bright:   #39FF88;
  --accent-glow:     rgba(57, 255, 136, 0.22);
  --link:            #5BA3C7;
  --link-hover:      #38BDF8;
  --green:           #22C55E;
  --blue:            #38BDF8;
  --yellow:          #FACC15;
  --orange:          #FACC15;
  --red:             #EF4444;
  --purple:          #a855f7;
  --radius-sm:       8px;
  --radius-md:       10px;
  --radius-lg:       12px;
  --radius-xl:       14px;
  --shadow-sm:       0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-card:     0 4px 20px rgba(0, 0, 0, 0.45),
                       0 0 0 1px rgba(38, 49, 44, 0.9),
                       inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-pop:      0 8px 28px rgba(0, 0, 0, 0.5),
                       0 0 0 1px rgba(38, 49, 44, 0.95),
                       inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-glow-accent: 0 0 18px rgba(57, 255, 136, 0.12);
  --ease-out:        cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(34, 197, 94, 0.04), transparent 55%);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── Modern, témába illő görgetősáv (globális) ─────────────────
   Vékony, lekerekített, sötét track (soha nem világos), halvány thumb,
   hoverre erősödik. Firefox + WebKit/Chromium. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 138, 130, 0.45) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(120, 138, 130, 0.38);
  border-radius: 999px;
  /* átlátszó border → "lebegő" vékony thumb, sötét háttér látszik körülötte */
  border: 3px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s var(--ease-out);
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(160, 180, 170, 0.6);
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
/* Sidebar menü: a thumb-ra húzva accent zöld */
.nav-menu::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
  background-clip: padding-box;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.18s var(--ease-out), opacity 0.18s var(--ease-out);
}
a:hover {
  color: var(--link-hover);
  text-decoration: none;
  opacity: 1;
}

/* Billentyűzet: látható fókusz (WCAG), egérrel nem zavaró */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
.nav-item:focus-visible,
.btn:focus-visible {
  outline-offset: 3px;
}

code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 4px;
}

.muted { color: var(--text-muted); }

/* ─── APP LAYOUT ────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ─── SIDEBAR ───────────────────────────────────── */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-muted);
  box-shadow: none;
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

.brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}
a.brand-link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  margin: 0 4px;
  padding: 6px 4px 24px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
a.brand-link:hover {
  background: rgba(255, 255, 255, 0.04);
}
a.brand-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.brand-icon,
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.brand-mark-svg {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 0 8px rgba(57, 255, 136, 0.28));
  transition: filter 0.2s ease, transform 0.2s ease;
}
a.brand-link:hover .brand-mark-svg {
  filter: drop-shadow(0 0 14px rgba(57, 255, 136, 0.5));
  transform: translateY(-1px);
}
.brand-logo-img,
.brand-logo-svg {
  width: 24px;
  height: 24px;
  display: block;
}
.brand-text { line-height: 1.2; }
.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  text-shadow: none;
  filter: none;
}
.brand-name span {
  color: var(--accent-neon);
  text-shadow: 0 0 18px rgba(57, 255, 136, 0.22);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.nav-menu {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
  margin-right: -4px;
}

/* Menü blokkok: áttekintés vs. üzemeltetés vs. admin */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-group + .nav-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.nav-group-label {
  padding: 0 12px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-group--admin {
  border-top-color: var(--border-light);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-elev);
  color: var(--text-primary);
}
.nav-item.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent);
  box-shadow: none;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.35);
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 19px;
  height: 19px;
  display: block;
  color: var(--text-muted);
  transition: color 0.15s ease, filter 0.15s ease, transform 0.15s ease;
}
.nav-item:hover .nav-icon svg {
  color: var(--text-primary);
}
.nav-item.active .nav-icon svg {
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(57, 255, 136, 0.45));
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
}

.sidebar-bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: 12px;
}
.system-card {
  background: var(--bg-elev);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-pop);
}
.system-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.system-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: none;
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.system-info {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}
.system-guide-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.system-guide-btn:hover {
  background: rgba(57, 255, 136, 0.06);
  border-color: rgba(57, 255, 136, 0.25);
  color: var(--accent-neon);
}

/* ─── Kezdő útmutató ─────────────────────────────── */
.onboarding-panel {
  margin-bottom: 20px;
}
.onboarding-panel--hidden,
.onboarding-panel[hidden] {
  display: none !important;
}
.onboarding-panel-inner {
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.08) 0%, var(--bg-card) 42%, var(--bg-card) 100%);
  border: 1px solid rgba(57, 255, 136, 0.22);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-pop);
}
.onboarding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.onboarding-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-neon);
  margin-bottom: 6px;
}
.onboarding-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.onboarding-lead {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  max-width: 52rem;
}
.onboarding-dismiss {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.onboarding-dismiss:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}
.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.onboarding-step:hover {
  border-color: rgba(57, 255, 136, 0.3);
  background: rgba(57, 255, 136, 0.05);
  transform: translateY(-1px);
}
.onboarding-step--current {
  border-color: rgba(57, 255, 136, 0.45);
  background: rgba(57, 255, 136, 0.08);
}
.onboarding-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(57, 255, 136, 0.15);
  color: var(--accent-neon);
}
.onboarding-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.onboarding-step-body strong {
  font-size: 13px;
}
.onboarding-step-body span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}
.onboarding-tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.onboarding-tip {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.onboarding-tip strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 4px;
}
.onboarding-tip--warn {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.06);
}
.onboarding-tip a {
  color: var(--accent-neon);
}
.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ─── MAIN ──────────────────────────────────────── */
.main {
  padding: 24px 32px;
  overflow-x: hidden;
  position: relative;
  background: var(--bg-graphite);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-title p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  max-width: 52rem;
  margin-top: 2px;
}
.page-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Aktív telep – mindig látható kontextus */
.site-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: -8px 0 20px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: none;
}

.site-context-bar--warn {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.35);
}

.site-context-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.site-context-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}
.site-context-icon svg {
  width: 18px;
  height: 18px;
}

.site-context-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-context-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.site-context-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.site-context-switch select {
  min-width: 180px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.site-context-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.4;
}

.site-context-hint a {
  color: var(--link);
  font-weight: 600;
}
.site-context-hint a:hover {
  color: var(--link-hover);
}

.sidebar-site {
  flex-shrink: 0;
  margin: 0 12px 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

.sidebar-site-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sidebar-site-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.sidebar-site-count {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── STATUS PILL ───────────────────────────────── */
.status-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
}
.status-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: none;
}
.status-pill-text {
  line-height: 1.2;
}
.status-pill-main { font-weight: 600; }
.status-pill-sub { color: var(--text-muted); font-size: 11px; }

.notif-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  color: var(--text-secondary);
  box-shadow: var(--shadow-pop);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notif-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #fbbf24;
}
.notif-btn-icon svg {
  width: 100%;
  height: 100%;
}
.notif-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.notif-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-base);
}

.user-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 16px 6px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border: 1px solid rgba(167, 139, 250, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 6px rgba(91, 33, 182, 0.35);
}
.user-avatar svg {
  width: 18px;
  height: 18px;
}
.user-info { line-height: 1.2; }
.user-name { font-weight: 600; }
.user-role { color: var(--text-muted); font-size: 11px; }

.header-logout-form {
  display: inline-flex;
  margin: 0;
}
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 42px;
  font-size: 13px;
  font-weight: 600;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.15);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.btn-logout svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fff;
  transform: translateY(-1px);
}
.btn-logout:focus-visible {
  outline: 2px solid rgba(248, 113, 113, 0.8);
  outline-offset: 2px;
}

/* ─── STAT CARDS ────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
/* A szöveg felülről igazodik: cím → érték → pill minden kártyán egy vonalban,
   így nem "csúszik szét", ha valahol nincs alsó leíró sor. */
.stat-card-text {
  flex: 1 1 auto;
  min-width: 0;
}
.stat-card-icon {
  align-self: center;
  flex-shrink: 0;
}
.stat-card-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.15;
}
.stat-card-value .unit {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.stat-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
/* Időszak-jelölő pill: melyik időtartam adata látszik a kártyán */
.stat-card-period {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.stat-card-period::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  background: currentColor;
}
.stat-card-period.period-live { background: rgba(34, 197, 94, 0.12);  color: var(--accent); border-color: rgba(34, 197, 94, 0.25); }
.stat-card-period.period-24h  { background: rgba(56, 189, 248, 0.12); color: var(--blue);   border-color: rgba(56, 189, 248, 0.25); }
.stat-card-period.period-day  { background: rgba(250, 204, 21, 0.12); color: var(--orange); border-color: rgba(250, 204, 21, 0.28); }
.stat-card-period.period-na   { background: rgba(244, 247, 245, 0.06); color: var(--text-muted); border-color: var(--border-light); }
.stat-card-period.period-na::before { display: none; }
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent);
}
.stat-card-icon.blue   { background: rgba(56, 189, 248, 0.1); color: var(--blue); }
.stat-card-icon.orange { background: rgba(250, 204, 21, 0.12); color: var(--orange); }
.stat-card-icon.red    { background: rgba(239, 68, 68, 0.1);  color: var(--red); }
.stat-card-icon.lux {
  font-size: 13px;
  font-weight: 700;
  background: rgba(244, 247, 245, 0.06);
  color: var(--text-secondary);
}
.stat-card-icon.purple { background: rgba(168, 85, 247, 0.1); color: var(--purple); }

.stat-card--health .stat-card-value {
  color: var(--accent);
  text-shadow: 0 0 28px rgba(57, 255, 136, 0.18);
}

/* ─── Dashboard: telep állapot vs. szenzor (külön blokkok) ───────── */
.dash-ops-bar {
  margin-bottom: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
}
.dash-ops-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dash-ops-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.dash-ops-live-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.dash-ops-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.dash-ops-metric {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-light);
  min-width: 0;
}
a.dash-ops-metric--link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
a.dash-ops-metric--link:hover {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}
.dash-ops-metric-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent);
}
.dash-ops-metric-icon--alert {
  background: rgba(250, 204, 21, 0.12);
}
.dash-ops-metric-icon--warn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}
.dash-ops-metric-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.dash-ops-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}
.dash-ops-metric-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.dash-ops-metric-value .unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.dash-ops-metric--health .dash-ops-metric-value {
  color: var(--accent-neon);
}
.dash-ops-metric-sub {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 2px;
}

.dash-sensor-bar {
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.04) 0%, var(--bg-card) 100%);
  border: 1px solid rgba(56, 189, 248, 0.18);
}
.dash-sensor-bar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.dash-sensor-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.dash-sensor-bar-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.dash-sensor-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.dash-sensor-metric {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--border-muted);
}
.dash-sensor-metric--temp { border-left-color: #22c55e; }
.dash-sensor-metric--hum  { border-left-color: #38bdf8; }
.dash-sensor-metric--co2  { border-left-color: #a855f7; }
.dash-sensor-metric--nh3  { border-left-color: #facc15; }
.dash-sensor-metric--pressure { border-left-color: #94a3b8; }
.dash-sensor-metric--na   { border-left-color: var(--border-muted); opacity: 0.75; }
.dash-sensor-metric-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.dash-sensor-metric-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.dash-sensor-metric-value .unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.dash-sensor-metric-hint {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── ÚJ dashboard stat-kártya dizájn ──────────────────────────────
   Függőleges elrendezés: az ikon a jobb felső sarokba kerül (abszolút),
   így soha nem versengnek a hellyel és nem lógnak össze. Az érték és a
   pill teljes szélességben, alatta. A cím fix 2-soros helyet kap, így az
   értékek minden kártyán egy vonalban kezdődnek. */
.stat-cards--dashboard {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.stat-cards--dashboard .stat-card {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 16px;
}
.stat-cards--dashboard .stat-card-text {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
.stat-cards--dashboard .stat-card-label {
  font-size: 12px;
  line-height: 1.3;
  padding-right: 42px;   /* hely az ikonnak, ne fusson alá */
  min-height: 2.6em;     /* 2 sornyi fix hely → értékek egy vonalban */
  margin-bottom: 4px;
}
.stat-cards--dashboard .stat-card-value {
  font-size: 24px;
}
.stat-cards--dashboard .stat-card-value .unit {
  font-size: 13px;
}
.stat-cards--dashboard .stat-card-period {
  align-self: flex-start;
  margin-top: 10px;
}
.stat-cards--dashboard .stat-card-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  font-size: 14px;
  border-radius: 9px;
}

/* ─── Ólak oldal: kártya az összes szenzor buborékkal ───────────── */
.building-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.building-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-pop);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.building-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.building-card.warning { border-color: rgba(250, 204, 21, 0.4); }
.building-card.danger { border-color: rgba(239, 68, 68, 0.45); }
.building-card.offline { opacity: 0.72; }
.building-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.building-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.building-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.building-card-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(34, 197, 94, 0.1);
  flex-shrink: 0;
}
.building-card.warning .building-card-badge { background: rgba(250, 204, 21, 0.12); }
.building-card.danger .building-card-badge { background: rgba(239, 68, 68, 0.12); }
.building-card.offline .building-card-badge { background: rgba(120, 138, 130, 0.12); }
.bc-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}
.bc-metric {
  background: var(--bg-elev);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--text-muted);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}
.bc-metric.temp  { border-left-color: var(--green); }
.bc-metric.hum   { border-left-color: var(--blue); }
.bc-metric.co2   { border-left-color: var(--purple); }
.bc-metric.nh3   { border-left-color: var(--orange); }
.bc-metric.press { border-left-color: #94a3b8; }
.bc-metric.lux   { border-left-color: #cbd5e1; }
.bc-metric.mort  { border-left-color: var(--red); }
.bc-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-metric-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  margin-top: 2px;
}
.bc-metric-value .u {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}
.bc-period {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.bc-period-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(57, 255, 136, 0.5);
  flex-shrink: 0;
}
.dash-live-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  font-size: 13px;
  color: var(--text-secondary);
}
.dash-live-banner .dash-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(57, 255, 136, 0.55);
  flex-shrink: 0;
  animation: pulse 2.5s infinite;
}
.dash-reports-panel {
  margin-bottom: 20px;
}
.dash-reports-panel .dash-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.dash-report-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 16px;
}
.dash-report-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.dash-report-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

/* ─── GRID LAYOUT ───────────────────────────────── */
.grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-link {
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.panel-link:hover { color: var(--accent); }

.chart-wrap { height: 280px; }

/* ─── Szenzor chip szűrők (chart legend helyett) ─ */
.sensor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.sensor-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(55, 65, 85, 0.9);
  background: rgba(12, 16, 26, 0.85);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: border-color 0.18s, color 0.18s, background 0.18s, opacity 0.18s;
  user-select: none;
}
.sensor-chip:hover {
  border-color: rgba(34, 197, 94, 0.45);
  color: #94a3b8;
}
.sensor-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
/* Kiválasztva: vékony zöld keret, világos felirat (mint a mockup) */
.sensor-chip.on {
  border-color: var(--accent);
  background: var(--bg-elev);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(57, 255, 136, 0.1);
}
.sensor-chip.on .sensor-chip-label {
  font-weight: 500;
}
.sensor-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity 0.18s;
}
.sensor-chip:not(.on) .sensor-chip-dot {
  opacity: 0.5;
}
.sensor-chip.on .sensor-chip-dot {
  opacity: 1;
}
.sensor-chart-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ─── ALERTS ────────────────────────────────────── */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-elev);
  border-radius: 10px;
  border-left: 3px solid var(--red);
}
.alert-row.warning { border-left-color: var(--orange); }
.alert-row.info    { border-left-color: var(--blue); }

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  font-size: 16px;
  flex-shrink: 0;
}
.alert-row.warning .alert-icon { background: rgba(250, 204, 21, 0.12); color: var(--orange); }
.alert-row.info    .alert-icon { background: rgba(56, 189, 248, 0.12); color: var(--blue); }

.alert-body { flex: 1; min-width: 0; }
.alert-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.alert-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.alert-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.alert-time {
  font-size: 11px;
  color: var(--text-muted);
}
.alert-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.alert-row.warning .alert-tag { background: rgba(250, 204, 21, 0.15); color: var(--orange); }
.alert-row.info    .alert-tag { background: rgba(56, 189, 248, 0.15); color: var(--blue); }

/* ─── ENV STATS ─────────────────────────────────── */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.env-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.env-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.env-icon.temp { background: rgba(34, 197, 94, 0.12); color: var(--accent); }
.env-icon.hum  { background: rgba(56, 189, 248, 0.12); color: var(--blue); }
.env-icon.co2  { background: rgba(168, 85, 247, 0.1); color: var(--purple); }
.env-icon.air  { background: rgba(167, 179, 173, 0.08); color: var(--text-secondary); }
.env-icon.nh3  { background: rgba(250, 204, 21, 0.12); color: var(--orange); }
.env-icon.lux  { background: rgba(244, 247, 245, 0.06); color: var(--text-secondary); }

.env-text { line-height: 1.2; min-width: 0; }
.env-value { font-size: 17px; font-weight: 700; }
.env-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── DEVICE TABLE ──────────────────────────────── */
.device-table {
  width: 100%;
  border-collapse: collapse;
}
.device-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.device-table td {
  padding: 12px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.device-table tr:last-child td { border-bottom: none; }
.device-table .name { font-weight: 600; }

.dev-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dev-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dev-status.online .dot { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.dev-status.offline .dot { background: var(--red); }
.dev-status.weak .dot { background: var(--orange); }
.dev-status.online { color: var(--accent); }
.dev-status.offline { color: var(--red); }
.dev-status.weak { color: var(--orange); }

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.signal-bars span {
  width: 3px;
  background: var(--border);
  border-radius: 1px;
}
.signal-bars span:nth-child(1) { height: 4px; }
.signal-bars span:nth-child(2) { height: 7px; }
.signal-bars span:nth-child(3) { height: 10px; }
.signal-bars span:nth-child(4) { height: 13px; }
.signal-bars.s1 span:nth-child(-n+1),
.signal-bars.s2 span:nth-child(-n+2),
.signal-bars.s3 span:nth-child(-n+3),
.signal-bars.s4 span:nth-child(-n+4) { background: var(--accent); }
.signal-bars.weak.s1 span:nth-child(-n+1),
.signal-bars.weak.s2 span:nth-child(-n+2) { background: var(--orange); }

/* ─── BUILDINGS GRID ────────────────────────────── */
.buildings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* Grafikonok / választó rács */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.building-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border-muted);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}
.building-tile:not(.warning):not(.danger):not(.offline) {
  border-color: rgba(34, 197, 94, 0.35);
}
.building-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.08);
}
.building-tile.warning { border-color: var(--orange); }
.building-tile.danger { border-color: var(--red); }
.building-tile.offline { border-color: var(--text-muted); opacity: 0.6; }

.building-tile .name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.building-tile .temp {
  font-size: 16px;
  font-weight: 700;
}
.building-tile .hum {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.central-gateway {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.central-gateway::before {
  content: '';
  display: inline-block;
  width: 60px;
  height: 1px;
  background: var(--border);
  vertical-align: middle;
  margin-right: 8px;
}
.central-gateway::after {
  content: '';
  display: inline-block;
  width: 60px;
  height: 1px;
  background: var(--border);
  vertical-align: middle;
  margin-left: 8px;
}

/* ─── CAMERAS ───────────────────────────────────── */
.camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.camera-tile {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--bg-elev);
}
.camera-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-tile .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
}
.camera-tile .label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.camera-tile .live {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
}

/* ─── BOTTOM GRID ───────────────────────────────── */
.grid-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ─── FORMS ─────────────────────────────────────── */
input, select, textarea {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  outline: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ─── BUTTONS ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-primary {
  background: var(--accent-deep);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--accent);
  box-shadow: var(--shadow-glow-accent);
}
.btn-primary:active {
  background: var(--accent-deep);
  box-shadow: none;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

select.compact {
  padding: 6px 12px;
  font-size: 12px;
  width: auto;
}

/* ─── MODAL ─────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }
.modal form { padding: 24px; }
.confirm-modal {
  max-width: 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.confirm-modal-header {
  padding: 18px 20px;
}
#confirm-dialog-title {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 600;
  margin: 0;
}
.confirm-modal .confirm-context {
  background: var(--bg-elev);
  border: none;
  border-radius: 0;
  padding: 16px 20px;
  margin: 0;
  flex: 1;
}
.confirm-context-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}
.confirm-label {
  flex: 0 0 72px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.confirm-value {
  flex: 1;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-word;
}
.confirm-highlight {
  margin: 14px 0 0;
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  color: var(--accent);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 10px;
}
.confirm-modal--danger .confirm-highlight {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}
.confirm-detail {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-secondary);
}
.confirm-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}
.confirm-modal-actions .btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ─── BADGES ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
}
.badge-admin { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge-viewer { background: rgba(34, 197, 94, 0.15); color: var(--accent-bright); }

/* ─── DATA TABLE (admin) ────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light);
}
.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.data-table tr:hover { background: var(--bg-elev); }

/* ─── TABS ──────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  color: var(--text-muted);
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── EMPTY STATE ───────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-pop);
  position: relative;
}
.empty-state .big {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ─── LOGIN ─────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 20px;
  background: var(--bg-base);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-pop);
}
.site-select-card {
  max-width: 480px;
}
.site-select-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.site-select-btn:hover {
  border-color: rgba(57, 255, 136, 0.35);
  background: rgba(57, 255, 136, 0.06);
  transform: translateY(-1px);
}
.site-select-btn-name {
  font-size: 15px;
  font-weight: 600;
}
.site-select-btn-hint {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-brand.brand-link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: -8px auto 24px;
  width: fit-content;
  transition: background 0.15s ease;
}
.login-brand.brand-link:hover {
  background: rgba(255, 255, 255, 0.04);
}
.login-brand .brand-mark-svg { width: 30px; height: 30px; }
.login-brand .brand-name { font-size: 24px; }
.login-title {
  text-align: center;
  margin-bottom: 24px;
}
.login-title h2 {
  font-size: 20px;
  margin-bottom: 6px;
}
.login-title p {
  color: var(--text-muted);
  font-size: 13px;
}
.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--red);
  color: #fca5a5;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}
.login-btn {
  width: 100%;
  background: var(--accent-deep);
  color: white;
  border: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.login-btn:hover {
  background: var(--accent);
  box-shadow: var(--shadow-glow-accent);
}
.login-btn:active {
  background: var(--accent-deep);
  box-shadow: none;
}

/* ─── DIARY PAGE LAYOUT ────────────────────────── */
.diary-page {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.diary-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 16px;
  padding: 14px 20px;
}

.diary-toolbar-building {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.diary-toolbar-building .diary-cal-building-select {
  min-width: 160px;
  max-width: 220px;
}

.diary-toolbar-date {
  text-align: right;
}

.diary-toolbar-date-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.diary-layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .diary-layout {
    grid-template-columns: 1fr;
  }
  .diary-sidebar {
    order: -1;
  }
  .diary-toolbar-date {
    text-align: left;
    width: 100%;
  }
}

.diary-sidebar {
  position: sticky;
  top: 16px;
}

.diary-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.diary-cal-hint {
  font-size: 11px;
  margin: 12px 0 0;
  line-height: 1.4;
}

.diary-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Turnus panel – elkülönítve a napi adatoktól */
.flock-panel {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, var(--bg-card) 45%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.flock-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light, rgba(255, 255, 255, 0.06));
}

.flock-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.flock-panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.flock-panel-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  min-height: 42px;
  white-space: nowrap;
}

.flock-panel-actions .btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.flock-panel-actions .btn-flock-edit {
  border: 1.5px solid rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.flock-panel-actions .btn-flock-edit:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.75);
  color: #bbf7d0;
}

.flock-panel-actions .btn-flock-new {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35), 0 4px 16px rgba(34, 197, 94, 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.flock-panel-actions .btn-flock-new:hover {
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.5), 0 6px 22px rgba(34, 197, 94, 0.38);
  transform: translateY(-1px);
}

.flock-panel-actions .btn-flock-new:active {
  transform: translateY(0);
}

.flock-panel-body {
  padding: 16px 20px 20px;
}

.flock-panel-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Létszám: induló − elhullás = maradék */
.flock-headcount-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 8px 10px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.flock-headcount-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 10px;
}

.flock-headcount-card--start {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.flock-headcount-card--loss {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.flock-headcount-card--remain {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.flock-headcount-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  line-height: 1.2;
}

.flock-headcount-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.flock-headcount-card--loss .flock-headcount-value {
  color: #f87171;
}

.flock-headcount-card--remain .flock-headcount-value {
  color: #60a5fa;
}

.flock-headcount-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.flock-headcount-pct {
  color: #f87171;
  font-weight: 600;
}

.flock-headcount-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 300;
  color: var(--text-muted);
  padding: 0 2px;
  align-self: center;
}

.flock-headcount-sep--eq {
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .flock-headcount-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }
  .flock-headcount-sep {
    font-size: 18px;
    padding: 0;
  }
  .flock-headcount-sep--eq::before {
    content: none;
  }
  .flock-headcount-value {
    font-size: 22px;
  }
}

/* Turnus meta (faj, indulás, cél) */
.flock-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 16px;
}

@media (max-width: 700px) {
  .flock-meta-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.flock-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.flock-meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.flock-meta-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.flock-meta-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Turnus: FCR / becslés sáv */
.flock-production-strip {
  padding: 0 20px 16px;
  border-top: 1px solid var(--border-light, rgba(255, 255, 255, 0.06));
}

.flock-production-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 900px) {
  .flock-production-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.flock-prod-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}

.flock-prod-card--accent {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.flock-prod-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.flock-prod-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.flock-prod-hint {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* Turnusok oldal – sidebar lista (ól napló layout mintájára) */
.flocks-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flocks-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  font: inherit;
  color: inherit;
}
.flocks-nav-item:hover {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(255, 255, 255, 0.02);
}
.flocks-nav-item.active {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12);
}
.flocks-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.flocks-nav-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}
.flocks-nav-badge--active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent);
}
.flocks-nav-badge--archived {
  background: rgba(56, 189, 248, 0.12);
  color: var(--blue);
}
.flocks-nav-loss {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.flocks-nav-period {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.flocks-nav-meta {
  font-size: 11px;
  line-height: 1.4;
}
.flocks-page .flock-production-grid {
  padding: 0;
}
.flocks-page #flock-summary-panel .flock-panel-body {
  padding: 0 20px 16px;
}
.flocks-page .gran-btn.active {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent);
}
.flocks-detail-stack {
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Takarmány / súly panelek */
.diary-panel-badge {
  font-size: 11px;
  margin-left: auto;
}

.diary-feed-total,
.diary-weight-today {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 12px;
}

.diary-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.diary-inline-form .field {
  margin: 0;
  min-width: 120px;
}

.diary-field-grow {
  flex: 1;
  min-width: 160px;
}

.diary-form-title {
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 10px;
}

.weight-metrics-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.weight-metric-pill {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.weight-metric-pill strong {
  color: var(--text-primary);
}
.weight-metric-pill--accent {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.08);
}
.weight-metric-pill--accent strong {
  color: #fbbf24;
}

.prod-chips {
  margin-bottom: 12px;
}

/* Opcionális (összecsukható) kézi rögzítő űrlap */
.diary-optional-form {
  margin-top: 14px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}
.diary-optional-form > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  list-style: none;
  padding: 6px 0;
  user-select: none;
}
.diary-optional-form > summary::-webkit-details-marker { display: none; }
.diary-optional-form > summary:hover { color: var(--text-primary); }
.diary-optional-form[open] > summary { color: var(--text-primary); margin-bottom: 8px; }
.diary-optional-hint {
  font-size: 12px;
  margin: 0 0 12px;
  line-height: 1.5;
}

.chart-wrap-weight {
  height: 260px;
  margin-bottom: 12px;
}

/* Élősúly napi lebontás tábla */
.weight-breakdown {
  margin-top: 14px;
}
.wb-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.wb-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wb-table th,
.wb-table td {
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
}
.wb-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elev);
  color: var(--text-secondary);
  font-weight: 600;
  z-index: 1;
}
.wb-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.wb-table td:nth-child(5) strong {
  color: #fbbf24;
}
.wb-src {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
}
.wb-auto {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
}
.wb-manual {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

/* Napi adatok blokk */
.diary-day-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 8px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  border: none;
  background: transparent;
  box-shadow: none;
}

.diary-day-heading {
  margin: 0;
  padding: 0 4px 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.diary-day-section .panel {
  margin-bottom: 0;
}

.diary-day-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.diary-mortality-block {
  margin-top: 0;
}

.diary-mortality-form-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.diary-mortality-form-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.diary-mortality-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.diary-mortality-form .field {
  margin: 0;
}

.diary-mortality-comment {
  flex: 1;
  min-width: 200px;
}

.diary-loading-panel {
  margin: 0;
}

/* ─── DIARY CALENDAR ───────────────────────────── */
.diary-calendar-panel {
  margin-bottom: 0;
  padding: 16px 18px 18px;
  max-width: none;
}

.diary-cal-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.diary-cal-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.diary-cal-selected-wrap {
  flex: 1;
  min-width: 0;
}

.diary-cal-building-form {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.diary-cal-building-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.diary-cal-building-select {
  min-width: 120px;
  max-width: 160px;
  padding: 8px 28px 8px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  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='%239aa3b5' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.diary-cal-building-select:hover {
  border-color: var(--text-muted);
}
.diary-cal-building-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.14);
}

.diary-cal-selected {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.diary-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.diary-cal-month {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  text-align: center;
}

.diary-cal-nav-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.diary-cal-nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.diary-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  user-select: none;
}

/* Egy közös grid: a fejléc és a napok oszlopai nem csúsznak el */
.diary-cal-weekdays,
.diary-cal-days {
  display: contents;
}

.diary-cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 0;
}

.diary-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-height: 52px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 4px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.diary-cal-day:hover {
  background: var(--bg-elev);
}
.diary-cal-day--other {
  opacity: 0.35;
}
.diary-cal-day--other:hover {
  opacity: 0.55;
}
.diary-cal-day--today:not(.diary-cal-day--selected) .diary-cal-day-num {
  box-shadow: 0 0 0 1px var(--text-muted);
  border-radius: 50%;
}
.diary-cal-day--selected {
  background: var(--blue);
}
.diary-cal-day--selected:hover {
  background: #2563eb;
}
.diary-cal-day--selected .diary-cal-day-num,
.diary-cal-day--selected .diary-cal-mort {
  color: #fff;
}
.diary-cal-day--selected.diary-cal-day--has-mort .diary-cal-mort--active {
  color: rgba(255, 255, 255, 0.9);
}

.diary-cal-day-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.diary-cal-mort {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}
.diary-cal-mort--active {
  color: var(--orange);
  font-weight: 600;
}
.diary-cal-day--selected .diary-cal-mort {
  color: rgba(255, 255, 255, 0.75);
}

.diary-sensor-panel { margin-bottom: 20px; }
.diary-sensor-panel .chart-wrap-sensors { height: 320px; }
.diary-sensor-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.diary-sensor-stat strong { color: var(--text-primary); }

.diary-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.diary-chart-stat {
  font-size: 12px;
  color: var(--text-muted);
}

.diary-mortality-total {
  font-size: 18px;
  font-weight: 600;
  margin: 12px 0;
}

/* Elhullás heatmap (naptár) */
.diary-cal-day--heat-1:not(.diary-cal-day--selected) {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.diary-cal-day--heat-2:not(.diary-cal-day--selected) {
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.35);
}
.diary-cal-day--heat-2:not(.diary-cal-day--selected) .diary-cal-mort--active {
  color: #fde047;
}
.diary-cal-day--heat-3:not(.diary-cal-day--selected) {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
}
.diary-cal-day--heat-3:not(.diary-cal-day--selected) .diary-cal-mort--active {
  color: #fdba74;
}
.diary-cal-day--heat-4:not(.diary-cal-day--selected) {
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.diary-cal-day--heat-4:not(.diary-cal-day--selected) .diary-cal-mort--active {
  color: #fca5a5;
  font-weight: 700;
}

/* Fejléc állapot */
.status-pill.status-ok .dot {
  background: var(--green);
  box-shadow: 0 0 12px rgba(57, 255, 136, 0.45);
}
.status-pill.status-warn .dot {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}
.status-pill.status-warn .status-pill-sub {
  color: #fcd34d;
}
.status-pill.status-danger .dot {
  background: var(--red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.45);
}
.status-pill.status-danger .status-pill-sub {
  color: #fca5a5;
}

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
  max-width: 360px;
}
.toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.toast--success {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, #0f1f1a, var(--bg-elev));
}
.toast--error {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, #1f0f0f, var(--bg-elev));
}
.toast--info {
  border-color: rgba(59, 130, 246, 0.5);
}
.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.toast--success .toast-icon { color: var(--green); }
.toast--error .toast-icon { color: var(--red); }

/* Skeleton / élő frissítés */
.dash-live-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-live-meta.is-refreshing::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 0.8s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.skeleton-block {
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-card-hover) 50%, var(--bg-elev) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease infinite;
  border-radius: 10px;
  min-height: 80px;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.chart-wrap {
  position: relative;
}
.chart-skeleton {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-card-hover) 50%, var(--bg-elev) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease infinite;
  z-index: 1;
}
.chart-skeleton.is-hidden {
  display: none;
}

/* ─── RESPONSIVE (desktop / tablet) ─────────────── */
@media (max-width: 1200px) {
  .grid-main { grid-template-columns: 1fr; }
  .buildings-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .grid-bottom { grid-template-columns: 1fr; }
  .buildings-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobil: assets/mobile.css */

/* ─── PHONE (≤600px) ────────────────────────────── */
@media (max-width: 600px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .buildings-grid {
    grid-template-columns: 1fr;
  }
  .flock-production-grid {
    grid-template-columns: 1fr;
  }

  .page-actions .status-pill {
    order: 3;
    width: 100%;
  }
  .page-actions .btn-logout {
    margin-left: auto;
  }

  .diary-cal-day {
    min-height: 44px;
    padding: 8px 2px;
  }
  .diary-cal-nav-btn {
    width: 44px;
    height: 44px;
  }

  .flock-panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  .flock-panel-actions {
    width: 100%;
  }
  .flock-panel-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .device-table th:nth-child(5),
  .device-table td:nth-child(5) {
    display: none;
  }
}

/* ─── COMPARE (cards + table) ───────────────────── */
.compare-cards {
  display: none;
}
.compare-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.compare-card.compare-worst {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(220, 38, 38, 0.08);
}
.compare-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.compare-card-head h3 {
  margin: 0;
  font-size: 16px;
}
.compare-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  font-size: 13px;
}
.compare-card-grid dt {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 2px;
}
.compare-card-grid dd {
  margin: 0 0 8px;
  font-weight: 500;
}
.compare-card-flags {
  margin-top: 10px;
}
.compare-card-actions {
  margin-top: 14px;
}
.compare-card-actions .btn {
  width: 100%;
  justify-content: center;
}

.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th {
  text-align: left;
  padding: 10px 8px;
  background: var(--bg-elev);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.compare-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.compare-table tr.compare-worst { background: rgba(220, 38, 38, 0.08); }

/* ─── Ól összehasonlítás: metrika-választó + mátrix ───────────── */
.compare-metric-panel {
  margin-bottom: 16px;
}
.compare-metric-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.compare-metric-head .muted {
  font-size: 12px;
}
.compare-chips {
  flex-wrap: wrap;
}
.compare-matrix-wrap {
  padding: 0;
  overflow: hidden;
}
.compare-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.compare-matrix th,
.compare-matrix td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.compare-matrix thead th {
  background: var(--bg-elev);
  border-bottom: 2px solid var(--border);
  vertical-align: bottom;
}
.compare-matrix .cm-barn {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.compare-matrix .cm-barn-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.compare-matrix .cm-barn-link {
  font-size: 11px;
  color: var(--link);
}
.cm-metric-col {
  text-align: left !important;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  position: sticky;
  left: 0;
  z-index: 1;
}
.cm-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.compare-matrix tbody td {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.compare-matrix tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.compare-matrix td.cm-best {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.3);
}
.compare-matrix td.cm-worst {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.28);
}
.flag-pill {
  display: inline-block;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  margin: 2px 4px 2px 0;
}
.flag-pill.critical { background: rgba(220, 38, 38, 0.25); color: #fecaca; }
.flag-pill.warning { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
.flock-mini { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.loss-bad { color: #f87171; font-weight: 600; }
.loss-ok { color: var(--text-primary); }

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.report-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.report-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Login */
@media (max-width: 480px) {
  body.login-page {
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  }
  .login-card {
    padding: 24px 20px;
  }
}

/* ─── Security audit ─────────────────────────────── */
.audit-page { display: flex; flex-direction: column; gap: 20px; }
.audit-compliance-panel .panel-header { align-items: center; }
.audit-score-badge {
  font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 20px;
}
.audit-score-ok { background: rgba(34, 197, 94, 0.15); color: var(--accent-bright); }
.audit-score-warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.compliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.compliance-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: 10px; border: 1px solid var(--border-light);
  background: var(--bg-elev);
}
.compliance-pass { border-color: rgba(34, 197, 94, 0.35); }
.compliance-fail { border-color: rgba(239, 68, 68, 0.35); }
.compliance-icon { font-size: 18px; font-weight: 700; width: 24px; text-align: center; }
.compliance-pass .compliance-icon { color: var(--accent-bright); }
.compliance-fail .compliance-icon { color: #f87171; }
.compliance-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.compliance-detail { font-size: 12px; color: var(--text-muted); }
.compliance-ref {
  display: inline-block; margin-top: 6px; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
  opacity: 0.8;
}
.audit-hint { margin-top: 8px; font-size: 13px; }
.audit-kpi { margin: 0; }
.audit-filter-panel { margin: 0; }
.audit-filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
}
.audit-filter-bar label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.audit-filter-bar input, .audit-filter-bar select {
  min-width: 140px; padding: 8px 10px; font-size: 13px;
}
.audit-filter-bar .hidden { display: none; }
.audit-tabs { margin-bottom: 0; }
.audit-pager { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }
.audit-details-cell { max-width: 280px; word-break: break-word; }
.audit-json { font-size: 11px; white-space: pre-wrap; display: block; max-height: 80px; overflow: auto; }
.audit-action, .audit-reason { font-family: monospace; font-size: 11px; }
.badge-ok { background: rgba(34, 197, 94, 0.15); color: var(--accent-bright); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.devices-workflow-panel { margin-bottom: 16px; }
.devices-workflow-steps {
  margin: 0 0 12px 1.2rem;
  padding: 0;
  color: var(--text-secondary);
  line-height: 1.65;
}
.devices-workflow-steps li { margin-bottom: 8px; }
.devices-workflow-note { font-size: 12px; margin: 0; }
.devices-workflow-note code {
  font-size: 11px;
}
.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.data-table tr.row-unassigned td {
  background: rgba(245, 158, 11, 0.06);
}
.data-table tr.row-fail { background: rgba(239, 68, 68, 0.05); }
.data-table tr.row-ok { background: rgba(34, 197, 94, 0.03); }
