/* ============================================================
   MyCAFM — Webes admin felület
   Dizájn: az Android-kliens márkájához igazítva
   (mély teal #006A6B + meleg borostyán #A1591E akcentus)
   ============================================================ */

:root {
  /* Márka */
  --primary: #006a6b;          /* mély teal — fő márkaszín */
  --primary-dark: #00504f;     /* sötétebb teal — hover/aktív */
  --primary-50: #e9f5f4;       /* halvány teal — finom háttér */
  --primary-100: #cfe9e7;      /* teal pötty — badge/chip háttér */
  --primary-border: #a6dbd8;   /* teal keret */
  --accent: #a1591e;           /* borostyán akcentus */
  --accent-50: #fbeee2;        /* borostyán háttér */

  /* Felület / szöveg */
  --bg: #f4fbfa;               /* teal-árnyalatú világos háttér */
  --surface: #ffffff;
  --surface-2: #f3f8f7;        /* finom kiemelt felület (hover/zebra) */
  --border: #dde7e5;           /* teal-árnyalatú keret */
  --border-strong: #c5d4d2;
  --text: #131c1c;
  --text-soft: #34403f;
  --muted: #62716f;

  /* Funkcionális */
  --danger: #c2271f;
  --danger-50: #fdeceb;
  --ok: #15803d;

  /* Forma / árnyék (Android: lekerekített 12–28dp) */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 35, 34, .06), 0 1px 3px rgba(15, 35, 34, .04);
  --shadow: 0 2px 6px rgba(15, 35, 34, .06), 0 8px 24px -12px rgba(15, 35, 34, .14);
  --shadow-lg: 0 18px 50px -18px rgba(15, 35, 34, .35);
  --brand-grad: linear-gradient(135deg, #006a6b 0%, #0a7d72 55%, #2f7d5e 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }

/* --- Login --- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(0, 106, 107, .16), transparent 60%),
    radial-gradient(900px 560px at 108% 110%, rgba(161, 89, 30, .12), transparent 55%),
    var(--bg);
}
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 30px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--brand-grad);
}
.brand { margin: 4px 0 0; font-size: 30px; letter-spacing: -.5px; font-weight: 800; }
.brand span { color: var(--primary); }
.login-sub { margin: -10px 0 10px; color: var(--muted); font-weight: 500; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--text-soft); }
.login-card input { padding: 11px 13px; }
.login-card .btn-primary { margin-top: 4px; padding: 12px 14px; font-size: 15px; }

/* --- Kétfaktoros (push) jóváhagyás: várakozó pörgő --- */
.ketfaktor-spinner {
  width: 44px; height: 44px; margin: 8px auto 4px;
  border: 4px solid var(--primary-100);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ketfaktor-spin 0.9s linear infinite;
}
@keyframes ketfaktor-spin { to { transform: rotate(360deg); } }

/* --- Inputs / buttons --- */
input, select, textarea {
  font: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
input::placeholder, textarea::placeholder { color: #9aa6a4; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 106, 107, .16);
}
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .04s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 106, 107, .25); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(0, 80, 79, .25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--primary-border); color: var(--primary-dark); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-50); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }

.error { color: var(--danger); margin: 0; font-size: 13px; font-weight: 500; }
.ok { color: var(--ok); font-weight: 500; }

/* --- App layout --- */
.topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-brand { font-weight: 800; letter-spacing: -.3px; font-size: 17px; cursor: pointer; user-select: none; }
.topbar-brand span { color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user #user-nev { font-weight: 600; color: var(--text-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-soft); cursor: pointer; transition: background .14s;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary-dark); }
.icon-btn svg { width: 20px; height: 20px; }
.badge {
  background: var(--primary-100);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
}
/* minmax(0, 1fr): a tartalom-oszlop ne tudjon a széles táblázat miatt a képernyőn túl kitágulni */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 58px); transition: grid-template-columns .15s ease; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 12px; overflow-x: hidden; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; background: none; border: none; cursor: pointer; font: inherit;
  font-size: 11px; text-transform: uppercase; letter-spacing: .7px; font-weight: 700;
  color: var(--muted); padding: 14px 10px 5px; white-space: nowrap; text-align: left;
}
.nav-group-title:hover { color: var(--primary-dark); }
.nav-group-nyil { font-size: 9px; flex: none; transition: color .14s; }
.nav-group-box { display: flex; flex-direction: column; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  cursor: pointer;
  color: var(--text-soft);
  font: inherit;
  font-weight: 500;
  position: relative;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface-2); color: var(--primary-dark); }
.nav-item.active { background: var(--primary-50); color: var(--primary-dark); font-weight: 700; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-ikon { display: inline-flex; flex: none; color: var(--muted); transition: color .14s; }
.nav-item:hover .nav-ikon, .nav-item.active .nav-ikon { color: var(--primary); }
.nav-ikon svg { width: 19px; height: 19px; }
.nav-label { white-space: nowrap; overflow: hidden; }
/* Nyitott jegyek darabszám-köre a menüponton */
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
/* Becsukott sávban kis kör az ikon jobb-felső sarkában */
.app.collapsed .nav-badge {
  position: absolute; top: 4px; right: 6px; margin: 0;
  min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px;
}
.content { padding: 26px 28px; min-width: 0; }

/* Becsukott sáv: csak ikonok */
.app.collapsed .layout { grid-template-columns: 60px minmax(0, 1fr); }
.app.collapsed .nav-label { display: none; }
.app.collapsed .nav-group-title { height: 1px; padding: 8px 0 0; margin: 0 6px; overflow: hidden; color: transparent; border-top: 1px solid var(--border); }
/* Ikon-only sávban a szekció-összecsukás nem értelmezhető (a fejléc rejtett) → minden ikon látszik */
.app.collapsed .nav-group-box.hidden { display: flex !important; }
.app.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.app.collapsed .nav-item.active::before { display: none; }

/* --- Content blocks --- */
.page-title { margin: 0 0 18px; font-size: 23px; font-weight: 800; letter-spacing: -.4px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Választott elemek „chip"-ként (pl. karbantartási terv berendezései) */
.chip-lista { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-100); color: var(--primary-dark); border: 1px solid var(--primary-border); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 500; }
.chip button { border: none; background: none; cursor: pointer; color: var(--primary-dark); font-weight: 700; line-height: 1; padding: 0; font-size: 14px; opacity: .7; }
.chip button:hover { opacity: 1; }
.chip-ures { color: var(--muted); font-size: 13px; }

/* Tab-fülek (pl. berendezés életútja: Karbantartás / Hibaelhárítás) */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--border); }
.tab-gomb {
  font: inherit; font-weight: 600; border: none; background: none; cursor: pointer;
  padding: 9px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .14s, border-color .14s;
}
.tab-gomb:hover { color: var(--text); }
.tab-gomb.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* Történések idővonal (munkalap-részlet) */
.idovonal { list-style: none; margin: 0; padding: 0; }
.idovonal li { display: flex; gap: 12px; padding: 8px 0 8px 16px; border-left: 2px solid var(--border); position: relative; }
.idovonal li::before { content: ''; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.iv-ido { flex: none; width: 120px; color: var(--muted); font-size: 13px; }
.iv-szoveg { flex: 1; }

/* Belső megjegyzések (komment-szál) */
.megj-lista { display: flex; flex-direction: column; gap: 8px; }
.megj-elem { padding: 8px 10px; background: var(--primary-50); border-left: 3px solid var(--primary); border-radius: 6px; }

/* Fotó-rács (munkalap-részlet, audit) */
.foto-racs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.foto { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); transition: box-shadow .14s, transform .08s; }
.foto:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.foto img { display: block; width: 100%; height: 120px; object-fit: cover; cursor: pointer; }
.foto .foto-betolt { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.foto figcaption { padding: 7px 9px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
/* Csatolt-fotó ikon a listában (kattintható, képnézegetőt nyit) */
.btn-foto-link { border: 0; background: transparent; cursor: pointer; padding: 0 2px; font-size: 1em; line-height: 1; border-radius: var(--radius-sm); vertical-align: baseline; }
.btn-foto-link:hover { filter: brightness(1.1); transform: scale(1.12); }

/* 3D modell: nézegető (bal) + lista/feltöltés (jobb) */
.modell-keret { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.modell-nezo { width: 100%; height: 400px; background: #0f172a; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.modell-nezo model-viewer { width: 100%; height: 100%; }
.modell-lista { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.modell-sor { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.modell-sor.kijelolt { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.modell-siker { color: #16a34a; font-size: 13px; font-weight: 600; }
.modell-alap-jel { font-size: 11px; font-weight: 700; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.modell-nev { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.modell-meret { font-size: 11px; white-space: nowrap; }
.modell-feltolt { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 860px) { .modell-keret { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }

/* Görgethető lista-keret: bordázott kártya, belül vízszintes görgetés, ha sok az oszlop */
.tabla-keret {
  padding: 0;                 /* a táblázat a keret széléig ér, a görgősáv a keret aljára kerül */
  overflow-x: auto;
}
.tabla-keret > table { margin: 0; }
.tabla-keret > p { padding: 18px; margin: 0; }   /* "Betöltés…" / "Nincs tétel" üzenet bélése */
/* A lista oszlopai ne törjenek több sorba — inkább legyen vízszintes görgetés */
.tabla-keret th, .tabla-keret td { white-space: nowrap; }
thead th { background: var(--surface-2); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; color: var(--muted); }
tbody tr { transition: background .1s; }
tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* Kattintható lista-sorok (a sorra kattintva nyílik a részlet/szerkesztő) */
.lista-kattinthato tbody tr { cursor: pointer; }
.lista-kattinthato tbody tr:hover td { background: var(--primary-50); }

/* Státusz-badge: lekerekített, színkódolt pill a munkalap státuszhoz
   (színek az Android MyCafmPalette-hez igazítva) */
.statusz-badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.st-uj          { background: #f1f5f4; color: #475569; border-color: #dde7e5; }
.st-kiosztva    { background: #eef4ff; color: #1d4ed8; border-color: #bfd6fe; }
.st-folyamatban { background: #fff6e6; color: #b45309; border-color: #fbd690; }
.st-kesz        { background: #e8f8ee; color: #15803d; border-color: #b3eac6; }
.st-lezarva     { background: #f2ecfe; color: #6d28d9; border-color: #ddd0fb; }
.st-archivalt   { background: #eef2f3; color: #546e7a; border-color: #dae2e3; }
.st-felfuggesztve { background: #fdecec; color: #be123c; border-color: #f6c8c4; }

/* Modal (overlay + doboz) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 28, 27, .55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 12px;
}
.modal-box {
  background: var(--surface, #fff); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: 96vh; display: flex; flex-direction: column; padding: 18px 22px;
  border: 1px solid var(--border);
}
.modal-xl { width: min(1800px, 98vw); }
.modal-fej { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-tartalom { overflow: auto; }

/* Heti generáló rács */
.mx-grid { border-collapse: collapse; }
.mx-grid th, .mx-grid td { border-bottom: 1px solid var(--border); padding: 4px 6px; }
.mx-grid th.mx-het, .mx-grid td.mx-cella { text-align: center; min-width: 24px; padding: 3px; font-size: 11px; }
.mx-grid td.mx-cella input { cursor: pointer; }
.mx-grid .mx-nev, .mx-grid .mx-pont { white-space: nowrap; }
/* Az első három oszlop balra ragad vízszintes görgetéskor */
.mx-grid th:nth-child(-n+3), .mx-grid td:nth-child(-n+3) {
  position: sticky; background: var(--surface, #fff); z-index: 1;
}
.mx-grid th:nth-child(1), .mx-grid td:nth-child(1) { left: 0; }
.mx-grid th:nth-child(2), .mx-grid td:nth-child(2) { left: 34px; }
.mx-grid th:nth-child(3), .mx-grid td:nth-child(3) { left: 200px; }
.mx-grid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.mx-grid thead th:nth-child(-n+3) { z-index: 3; }
/* A lista-szerű szűrő-sor a fő fejléc alá ragad (nem fedi) */
.mx-grid .szuro-sor th { top: 32px; z-index: 2; }
.mx-grid .szuro-sor th:nth-child(-n+3) { z-index: 3; }

/* Oszlop-szűrő sor a táblázat fejlécében */
.szuro-sor th { padding: 4px 8px 8px; background: var(--surface-2); position: sticky; top: 0; }
.szuro-input { width: 100%; padding: 6px 8px; font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: normal; }
.szuro-datum { display: flex; gap: 4px; }
.szuro-datum .szuro-input { padding: 5px; }
.rendezheto { cursor: pointer; user-select: none; }
.rendezheto:hover { color: var(--text); }
.sort-jel { color: var(--primary); font-size: 10px; }
.szuro-eszkoz { padding-bottom: 8px; }

/* Excel-szerű oszlopszűrő: gomb a fejlécben + lebegő, kereshető, többválasztós panel */
.szuro-gomb {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: normal;
  padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: #fff; color: var(--text); cursor: pointer; transition: border-color .14s, background .14s;
}
.szuro-gomb:hover { background: var(--surface-2); border-color: var(--primary-border); }
.szuro-gomb.aktiv { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-50); font-weight: 600; }
.szuro-gomb-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.szuro-gomb-nyil { flex: none; color: var(--muted); font-size: 10px; }

.szuro-panel {
  position: fixed; z-index: 1200; width: 240px; max-height: 320px;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px;
}
.szuro-panel-kereso { margin-bottom: 6px; font-size: 13px; }
.szuro-panel-lista { overflow-y: auto; }
.szuro-cb {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px;
  cursor: pointer; font-weight: 400; text-transform: none; letter-spacing: normal; font-size: 13px;
}
.szuro-cb:hover { background: var(--primary-50); }
.szuro-cb input { width: auto; flex: none; }
.szuro-cb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.szuro-cb-mind { font-weight: 600; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; padding-bottom: 6px; }

/* Checklist-sablon tételek */
.cs-tetel { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.cs-tetel-nev { flex: 1; font-weight: 500; }
.cs-tetel-tipus { color: var(--muted); font-size: 12px; }

/* Helyszín-fa (#9) */
.hf-tree { display: flex; flex-direction: column; }
.hf-sor {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px;
  cursor: pointer; transition: background .12s;
}
.hf-sor:hover { background: var(--primary-50); }
.hf-sor[data-has-child="0"] { cursor: default; }
.hf-sor[data-has-child="0"]:hover { background: transparent; }
.hf-toggle { flex: none; width: 16px; text-align: center; color: var(--muted); font-size: 12px; }
.hf-toggle.hf-leaf { color: var(--border-strong); }
.hf-ikon { flex: none; }
.hf-cimke { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-akciok { flex: none; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.hf-sor:hover .hf-akciok { opacity: 1; }
.hf-akciok .btn { padding: 3px 8px; }

/* Többválasztós hivatkozás-lista (pl. berendezés szülők/gyermekek) */
.multiref-kereso { width: 100%; font-size: 13px; }
.multiref-lista { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: var(--surface); }
.multiref-sor { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 7px; cursor: pointer; }
.multiref-sor:hover { background: var(--primary-50); }
.multiref-sor input { width: auto; flex: none; }

/* Checkbox / radio akcentus a márkaszínre */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* Scrollbar finomítás */
* { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   Dashboard (kezdőlap) — KPI-k + diagramok
   ============================================================ */
.dash-szurok { flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.dash-szurok label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }

/* KPI kártyák */
.kpi-racs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px 18px;
}
.kpi-ertek { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--primary-dark); letter-spacing: -.5px; }
.kpi-cimke { margin-top: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-drill { cursor: pointer; transition: box-shadow .12s, transform .12s, border-color .12s; }
.kpi-drill:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--primary); }

/* Diagram-rács */
.dash-racs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px; align-items: start;
}
.dash-card { padding: 16px 18px; }
.dash-card.dash-szeles { grid-column: 1 / -1; }
.dash-racs > .dash-teljes { grid-column: 1 / -1; }

/* Kereshető választó (combobox) lebegő találati listája — modal (z:1000) felett is. */
.combo-panel {
  position: absolute; z-index: 1300; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  max-height: 260px; overflow-y: auto; max-width: min(480px, 92vw);
}
.combo-tetel { padding: 7px 12px; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-tetel:hover, .combo-tetel.aktiv { background: #eef2f7; }
.combo-tetel.kivalasztva { font-weight: 700; }
.combo-tobb { padding: 7px 12px; color: var(--muted); font-size: 12px; }
.dash-cim { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--text-soft); }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { flex: none; }
.donut-kozep { font-size: 22px; font-weight: 800; fill: var(--text); }
.donut-kozep-cimke { font-size: 9px; font-weight: 600; fill: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; min-width: 130px; flex: 1; }
.dl-sor { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dl-pont { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.dl-cimke { flex: 1; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-ertek { font-weight: 700; color: var(--text); }

/* Vízszintes oszlopok (top listák) */
.barsh { display: flex; flex-direction: column; gap: 9px; }
.barh-sor { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; }
.barh-cimke { font-size: 12.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barh-sav { background: var(--surface-2); border-radius: 6px; height: 18px; overflow: hidden; }
.barh-kitolt { height: 100%; border-radius: 6px; min-width: 2px; transition: width .3s ease; }
.barh-ertek { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; }

/* Függőleges oszlopok (havi trend) */
.barsv { display: flex; align-items: flex-end; gap: 10px; height: 190px; overflow-x: auto; padding-top: 6px; }
.barv-oszlop { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 38px; height: 100%; }
.barv-sav { flex: 1; width: 26px; display: flex; align-items: flex-end; }
.barv-kitolt { width: 100%; border-radius: 6px 6px 0 0; min-height: 2px; transition: height .3s ease; }
.barv-ertek { font-size: 11px; font-weight: 700; color: var(--text-soft); }
.barv-cimke { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ============================================================
   Karbantartási naptár
   ============================================================ */
.np-keret { padding: 14px; }
.np-nezetvalto { display: inline-flex; gap: 4px; }

/* Közös: nap-szám gomb (drilldown) */
.np-napszam { display: inline-block; font-weight: 700; font-size: 12px; color: var(--text-soft);
  cursor: pointer; border-radius: 6px; padding: 1px 6px; }
.np-napszam:hover { background: var(--primary-50); color: var(--primary-dark); }

/* Munkalap-chip */
.np-chip { display: flex; gap: 5px; align-items: baseline; background: var(--surface-2);
  border-left: 3px solid #999; border-radius: 5px; padding: 2px 6px; margin-top: 3px;
  cursor: pointer; font-size: 11.5px; overflow: hidden; transition: background .12s; }
.np-chip:hover { background: var(--primary-50); }
.np-chip-szam { font-weight: 700; color: var(--text); white-space: nowrap; }
.np-chip-cim { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-tobb { font-size: 11px; color: var(--primary-dark); font-weight: 600; margin-top: 2px; cursor: default; }
/* Drag-and-drop (havi nézet) */
.np-huzhato { cursor: grab; }
.np-huzhato:active { cursor: grabbing; }
.np-huzas { opacity: .45; }
.np-celdrop { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-50); }
.np-tiltott { outline: 2px dashed var(--danger); outline-offset: -2px; background: var(--danger-50); cursor: not-allowed; }

/* Havi nézet */
.np-hint { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.np-fejsor, .np-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.np-fejsor { margin-bottom: 6px; }
.np-fejnap { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; }
.np-grid { gap: 6px; }
.np-cella { min-height: 92px; border: 1px solid var(--border); border-radius: 9px; padding: 5px;
  background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.np-cella.np-mas { background: var(--surface-2); opacity: .65; }
.np-cella.np-ma { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.np-cella.np-ma .np-napszam { background: var(--primary); color: #fff; }

/* Heti nézet — függőleges nap-lista (teljes szélességű sorok) */
.np-hetlista { display: flex; flex-direction: column; gap: 8px; }
.np-hetsor { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.np-hetsor.np-ma { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-50); }
.np-hetdatum { display: flex; flex-direction: column; gap: 1px; }
.np-hetnap { font-weight: 700; color: var(--text-soft); }
.np-hetnum { font-size: 12px; color: var(--muted); }
.np-hetjegyek { display: flex; flex-wrap: wrap; gap: 7px; min-height: 26px; align-items: flex-start; }
.np-hetjegyek .np-chip { margin-top: 0; font-size: 12.5px; padding: 4px 9px; max-width: 320px; }
.np-ures { color: var(--muted); font-size: 12.5px; padding-top: 4px; }

/* Éves nézet — 12 mini-hónap */
.np-ev { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.np-mini { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--surface); }
.np-minifej { font-weight: 700; color: var(--primary-dark); text-align: center; margin-bottom: 6px;
  cursor: pointer; border-radius: 7px; padding: 2px; text-transform: capitalize; }
.np-minifej:hover { background: var(--primary-50); }
.np-evfejsor, .np-evgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.np-evfejnap { text-align: center; font-size: 9px; font-weight: 700; color: var(--muted); }
.np-evcell { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--text-soft); border-radius: 5px; }
.np-evcell.np-mas { color: var(--border-strong); }
.np-evcell.np-ma { outline: 1px solid var(--primary); }
.np-evcell.np-van { background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; }
.np-evcell.np-van:hover { background: var(--primary-dark); }

@media (max-width: 720px) {
  .np-cella .np-chip-cim { display: none; }
  .np-cella { min-height: 70px; }
  .np-hetsor { grid-template-columns: 1fr; gap: 6px; }
}
