:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --primary: #0e8f6f;
  --primary-dark: #067356;
  --border: #d8e0ea;
  --shadow: 0 12px 30px rgba(15, 23, 42, .12);
  --topbar-h: 74px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Segoe UI, Arial, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
button { border: 0; border-radius: 11px; padding: 10px 14px; background: var(--primary); color: #fff; cursor: pointer; font-weight: 700; }
button:hover { background: var(--primary-dark); }
button.secondary { background: #e8eef6; color: #172033; }
button.secondary:hover { background: #dce5f0; }
button:disabled { opacity: .6; cursor: wait; }

.topbar { height: var(--topbar-h); display: grid; grid-template-columns: minmax(280px, 1fr) auto minmax(240px, 1fr); align-items: center; gap: 18px; padding: 12px 18px; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--border); box-shadow: 0 3px 16px rgba(15,23,42,.08); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand__logo { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #0e8f6f, #38bdf8); color: #fff; font-weight: 800; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.1; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topnav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.navbtn { background: #e8eef6; color: #172033; min-width: 92px; }
.navbtn.active { background: var(--primary); color: #fff; }
.topbar__actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.appShell { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - var(--topbar-h)); min-height: 0; }
.sidebar { background: #101b29; color: #fff; padding: 18px; overflow-y: auto; box-shadow: var(--shadow); z-index: 20; }
.panel { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.hint { color: #a7b3c4; font-size: 13px; line-height: 1.35; margin: 0 0 10px; }
label { display: block; margin: 12px 0 6px; color: #cbd5e1; font-size: 13px; }
input { width: 100%; height: 40px; border: 1px solid rgba(255,255,255,.15); border-radius: 11px; background: #0b1420;  padding: 0 12px; outline: none; }
select { width: 100%; height: 40px; border: 1px solid rgba(255,255,255,.15); border-radius: 11px; background: #0b1420; color: #fff; padding: 0 12px; outline: none; }
select:focus, input:focus { border-color: #38bdf8; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.actions--stack { grid-template-columns: 1fr; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkrow { display: flex; align-items: center; gap: 8px; }
.checkrow input { width: auto; height: auto; }
.stats .kpi { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.stats .kpi:last-child { border-bottom: 0; }
.stats span { color: #cbd5e1; }
.stats b { font-size: 18px; }

.content { min-width: 0; min-height: 0; overflow: hidden; }
.page { display: none; height: 100%; min-height: 0; }
.page.active { display: flex; flex-direction: column; }
.pageHeader { flex: 0 0 auto; min-height: 58px; background: #fff; border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.pageHeader strong { display: block; font-size: 18px; }
.pageHeader span { color: var(--muted); font-size: 13px; }
.mapWrap { position: relative; flex: 1 1 auto; min-height: 0; }
#map { height: 100%; width: 100%; z-index: 1; }
.legend { position: absolute; left: 18px; bottom: 18px; z-index: 500; background: rgba(255,255,255,.94); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 280px; max-width: 420px; }
.legend h3 { margin: 0 0 8px; font-size: 14px; }
.legend__row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); flex: 0 0 auto; }
.dataCard { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 16px; padding: 16px; background: rgba(255,255,255,.98); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 2000; background: #111827; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); display: none; max-width: 520px; }
.marker-dot { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 8px rgba(0,0,0,.35); }
.popup h3 { margin: 0 0 8px; font-size: 16px; }
.popup p { margin: 4px 0; }
.popup .muted { color: #64748b; }

@media (max-width: 980px) {
  body { overflow: auto; }
  .topbar { height: auto; grid-template-columns: 1fr; position: relative; }
  .topbar__actions, .topnav { justify-content: flex-start; }
  .appShell { display: block; height: auto; }
  .sidebar { height: auto; }
  .content { overflow: visible; }
  .page { height: auto; min-height: 70vh; }
  .mapWrap { height: 70vh; }
  .pageHeader { flex-direction: column; align-items: stretch; }
  .legend { position: relative; left: auto; bottom: auto; margin: 10px; }
  .dataCard { margin: 10px; }
}

.popup__details {
  margin-top: 10px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.popup__details:hover {
  background: #115e59;
}


/* Строка ДОО, открытая с карты через кнопку «Подробнее» */
#dataTable tbody tr.selected-kindergarten-row > td {
  background: rgba(14, 143, 111, 0.14) !important;
  font-weight: 700;
}

.danger {
  border-color: rgba(239, 68, 68, 0.25) !important;
  color: #991b1b !important;
}

.loginBody {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef7ff 0%, #f8fafc 45%, #eefdf3 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
}

.loginCard {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(14px);
}

.brand--login {
  margin-bottom: 22px;
}

.loginForm {
  display: grid;
  gap: 10px;
}

.loginForm label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.loginForm input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  outline: none;
  font-size: 15px;
  background: #fff;
}

.loginForm input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.loginForm button {
  margin-top: 10px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.loginError {
  min-height: 20px;
  margin: 4px 0 0;
  color: #dc2626;
  font-size: 14px;
  font-weight: 700;
}
