:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg2: #f2f5f7;
  --card: #ffffff;
  --card-hover: #f2f5f7;
  --line: #c9d3dc;
  --text: #1e2a33;
  --muted: #64748b;
  --lime: #ffb347;
  --lime-soft: rgba(255, 179, 71, 0.18);
  --lime-ink: #26160a;
  --orange: #b45f0a;
  --orange-soft: rgba(255, 179, 71, 0.20);
  --cyan: #0b6fb8;
  --cyan-soft: rgba(11, 111, 184, 0.10);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.10);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.10);
  --radius: 12px;
  --shadow: 0 8px 24px rgba(30, 42, 51, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #f2f5f7 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
::selection { background: var(--lime-soft); }

/* Boot loader */
.boot-loader { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.boot-spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .logo-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.login-brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.3px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.btn-biometric { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 10px; border: none; background: linear-gradient(135deg, var(--lime), #a3d900); color: var(--lime-ink); font-weight: 700; font-size: 15px; cursor: pointer; }
.btn-biometric:active { transform: translateY(1px); }
.login-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 20px 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { margin-bottom: 14px; min-width: 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; max-width: 100%; min-width: 0; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font-size: 14px;
}
.field input[type="date"] { font-size: 13px; padding-right: 6px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--lime); }
.field textarea { resize: vertical; min-height: 70px; }
.btn { padding: 11px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-hover); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 600; transition: border-color 0.15s, transform 0.1s; }
.btn:hover { border-color: var(--lime); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: var(--red-soft); color: #ffb4b4; border-color: rgba(239,68,68,0.4); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.error-text { color: var(--red); font-size: 13px; margin: 8px 0 0; }
.login-link { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; }

/* App shell - sidebar layout */
.app-shell { min-height: 100vh; display: flex; }
.badge-role { padding: 2px 8px; border-radius: 6px; background: var(--cyan-soft); color: var(--cyan); font-size: 11px; font-weight: 700; }

.sidebar {
  width: 252px; flex-shrink: 0; height: 100vh; position: sticky; top: 0; overflow-y: auto;
  background: linear-gradient(180deg, #ffffff, var(--bg2)); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15.5px; padding: 4px 10px 24px; letter-spacing: 0.2px; }
.sidebar-brand .logo-dot { width: 11px; height: 11px; border-radius: 3px; background: var(--lime); box-shadow: 0 0 10px var(--lime); flex-shrink: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; border: none;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer;
  width: 100%; text-align: left; transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(30,42,51,0.055); color: var(--text); }
.nav-item.active { background: var(--lime-soft); color: var(--lime); }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-user { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px 12px 10px; }
.sidebar-user-name { font-size: 13px; color: var(--text); font-weight: 600; }

.sidebar-backdrop { display: none; }
.menu-toggle { display: none; }
.mobile-title { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 22px 26px 60px; max-width: 1280px; margin: 0 auto; width: 100%; }
.app-footer { text-align: center; font-size: 11.5px; color: var(--muted); padding: 14px 20px 22px; opacity: 0.7; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(3,8,16,0.6); z-index: 39; }
  .menu-toggle {
    display: flex; align-items: center; justify-content: center; position: fixed; top: 9px; left: 12px; z-index: 41;
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer;
  }
  .menu-toggle svg { width: 20px; height: 20px; }
  .menu-toggle.hidden { display: none; }
  .mobile-title { display: flex; align-items: center; height: 56px; position: sticky; top: 0; z-index: 20; padding: 0 16px 0 58px; font-weight: 700; font-size: 15px; background: var(--bg2); border-bottom: 1px solid var(--line); }
  .content { padding-top: 16px; }
  .kanban { flex-direction: column; overflow-x: visible; }
  .kanban-col { min-width: 0; width: 100%; }
}

/* Dashboard cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; transition: transform 0.15s, border-color 0.15s; }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(255,179,71,0.55); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; }
.stat-card .stat-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat-card.warn .stat-value { color: var(--orange); }
.stat-card.danger .stat-value { color: var(--red); }
.stat-card.ok .stat-value { color: var(--lime); }

/* Időjárás kártya és 7 napos előrejelzés (Open-Meteo) */
.weather-card { position: relative; overflow: hidden; display: flex; align-items: flex-end; min-height: 132px; cursor: pointer; padding: 0; }
.weather-scene { position: absolute; inset: 0; overflow: hidden; }
.weather-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%); }
.weather-content { position: relative; z-index: 2; padding: 14px 16px; }
.weather-card .stat-label, .weather-card .stat-value { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }

.weather-card.scene-clear, .forecast-day.scene-clear { background: linear-gradient(180deg, #3d8fd6 0%, #8fd3f4 100%); }
.weather-card.scene-partly, .forecast-day.scene-partly { background: linear-gradient(180deg, #5c92c4 0%, #a9c9de 100%); }
.weather-card.scene-cloudy, .weather-card.scene-loading, .forecast-day.scene-cloudy { background: linear-gradient(180deg, #64717f 0%, #8f9aa8 100%); }
.weather-card.scene-fog, .forecast-day.scene-fog { background: linear-gradient(180deg, #8b97a2 0%, #b9c2cb 100%); }
.weather-card.scene-rain, .forecast-day.scene-rain { background: linear-gradient(180deg, #354456 0%, #57687c 100%); }
.weather-card.scene-snow, .forecast-day.scene-snow { background: linear-gradient(180deg, #7c93a6 0%, #cfd9e1 100%); }
.weather-card.scene-storm, .forecast-day.scene-storm { background: linear-gradient(180deg, #1e2530 0%, #3a4655 100%); }

.wx-sun { position: absolute; top: 14px; right: 18px; width: 46px; height: 46px; border-radius: 999px; background: radial-gradient(circle, #fff6c9 0%, #ffd75e 60%, rgba(255,215,94,0) 72%); box-shadow: 0 0 26px 6px rgba(255,215,94,0.55); animation: wx-sun-pulse 4s ease-in-out infinite; }
.wx-sun.small { width: 30px; height: 30px; top: 12px; right: 44px; }
@keyframes wx-sun-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.9; } }

.wx-cloud { position: absolute; width: 70px; height: 24px; border-radius: 999px; background: rgba(255,255,255,0.85); box-shadow: 16px -10px 0 -2px rgba(255,255,255,0.85), -14px -4px 0 -4px rgba(255,255,255,0.7); animation: wx-drift 22s linear infinite; }
.wx-cloud.dark { background: rgba(120,130,145,0.85); box-shadow: 16px -10px 0 -2px rgba(120,130,145,0.85), -14px -4px 0 -4px rgba(120,130,145,0.7); }
.wx-cloud.c1 { top: 18px; left: -20%; animation-duration: 22s; }
.wx-cloud.c2 { top: 46px; left: -40%; animation-duration: 28s; animation-delay: -8s; opacity: 0.8; }
.wx-cloud.c3 { top: 8px; left: -60%; animation-duration: 34s; animation-delay: -4s; opacity: 0.6; }
@keyframes wx-drift { from { transform: translateX(0); } to { transform: translateX(340px); } }

.wx-rain { position: absolute; inset: -20px -20px -20px 0; opacity: 0.55; background-image: repeating-linear-gradient(115deg, rgba(210,230,255,0.8) 0 2px, transparent 2px 14px); animation: wx-rain-fall 0.6s linear infinite; }
@keyframes wx-rain-fall { from { background-position: 0 0; } to { background-position: -20px 24px; } }

.wx-snow { position: absolute; inset: 0; opacity: 0.85; background-image: radial-gradient(circle, #fff 1.5px, transparent 1.5px); background-size: 22px 22px; animation: wx-snow-fall 6s linear infinite; }
@keyframes wx-snow-fall { from { background-position: 0 0; } to { background-position: 20px 120px; } }

.wx-fog { position: absolute; left: -10%; width: 120%; height: 18px; background: rgba(255,255,255,0.35); filter: blur(3px); border-radius: 999px; animation: wx-fog-drift 12s ease-in-out infinite; }
.wx-fog.f1 { top: 20px; animation-duration: 12s; }
.wx-fog.f2 { top: 42px; animation-duration: 16s; animation-delay: -4s; opacity: 0.7; }
.wx-fog.f3 { top: 62px; animation-duration: 14s; animation-delay: -8s; opacity: 0.5; }
@keyframes wx-fog-drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(24px); } }

.wx-bolt { position: absolute; top: 30px; right: 40px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 20px solid #ffe873; animation: wx-flash 3s ease-in-out infinite; }
@keyframes wx-flash { 0%, 92%, 100% { opacity: 0; } 94%, 97% { opacity: 1; } }

.forecast-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.forecast-day { position: relative; overflow: hidden; border-radius: 10px; min-height: 150px; display: flex; align-items: flex-end; color: #fff; }
.forecast-day-scene { position: absolute; inset: 0; overflow: hidden; transform: scale(0.6); transform-origin: top right; }
.forecast-day-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.6) 100%); }
.forecast-day-content { position: relative; z-index: 2; padding: 10px; width: 100%; }
.forecast-day-label { font-weight: 800; font-size: 13px; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }
.forecast-day-desc { font-size: 11.5px; opacity: 0.9; margin-top: 2px; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }
.forecast-day-temps { margin-top: 6px; font-weight: 800; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }
.forecast-day-temps .max { font-size: 17px; }
.forecast-day-temps .min { font-size: 13px; opacity: 0.75; margin-left: 6px; }
.forecast-day-precip { margin-top: 6px; font-size: 11.5px; color: #d7ecff; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }

.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; margin: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tables and lists */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: rgba(255,255,255,0.02); }
.table-wrap { overflow-x: auto; }

.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.item-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.item-card:hover { border-color: var(--lime); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
.item-card h3 { margin: 0 0 6px; font-size: 14.5px; }
.item-card .meta { color: var(--muted); font-size: 12px; margin: 2px 0; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--orange-soft); color: var(--orange); }
.badge-danger { background: var(--red-soft); color: #ff9d9d; }
.badge-info { background: var(--cyan-soft); color: var(--cyan); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--muted); }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { min-width: 240px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; flex-shrink: 0; }
.kanban-col-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 8px; padding: 0 4px; }
.kanban-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.kanban-card:hover { border-color: var(--lime); }
.kanban-card .kc-title { font-weight: 700; margin-bottom: 4px; }
.kanban-card .kc-meta { color: var(--muted); font-size: 11.5px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,8,16,0.7); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 24px 14px; overflow-y: auto; z-index: 50; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 640px; padding: 22px; box-shadow: var(--shadow); margin: auto; animation: modal-in 0.15s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .field-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-del { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 6px; width: 20px; height: 20px; font-size: 12px; cursor: pointer; }
.photo-add-btn { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 8px; border: 1px dashed var(--line); color: var(--muted); cursor: pointer; font-size: 22px; background: var(--bg2); }
.photo-add-btn input { display: none; }

/* Floor plan overlay */
.floorplan-wrap { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.floorplan-wrap img { display: block; max-width: 100%; }
.floorplan-pin { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; }
.floorplan-pin.sev-ALACSONY { background: var(--cyan); }
.floorplan-pin.sev-KOZEPES { background: var(--orange); }
.floorplan-pin.sev-MAGAS { background: #ff5a1f; }
.floorplan-pin.sev-KRITIKUS { background: var(--red); }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }

.summary-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; max-height: 260px; overflow: auto; }

.toast-wrap { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--lime); border-radius: 8px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow); min-width: 220px; }
.toast.error { border-left-color: var(--red); }

@media (max-width: 720px) {
  .content { padding: 14px 12px 90px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
