:root {
  color-scheme: light;
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #667085;
  --line: #d8e0e8;
  --blue: #0b6bcb;
  --green: #12805c;
  --amber: #a15c00;
  --red: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: 0; }
h2 { font-size: 17px; margin-bottom: 14px; }
button, input, select {
  font: inherit;
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}
button.ghost { background: #fff; color: var(--blue); }
input, select { background: #fff; padding: 0 10px; color: var(--ink); }
small { display: block; color: var(--muted); }

.app-shell { max-width: 1480px; margin: 0 auto; padding: 26px; }
.topbar {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.topbar p { color: var(--muted); margin-top: 4px; }
.topbar .updated-at { color: var(--ink); font-weight: 700; }
.place-search, .inline-form, .filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.place-search input { width: min(320px, 42vw); }
.place-select { min-width: min(420px, 100%); }
.inline-form .select2-container { min-width: min(420px, 100%) !important; }
.select2-container--default .select2-selection--single {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ink);
  line-height: 36px;
  padding-left: 10px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  min-height: 36px;
}
.select2-dropdown {
  border-color: var(--line);
  border-radius: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-grid article, .panel, .login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
}
.summary-grid article { padding: 14px; min-height: 86px; }
.summary-grid span { color: var(--muted); display: block; font-size: 12px; text-transform: uppercase; }
.summary-grid strong { display: block; margin-top: 8px; font-size: 18px; overflow-wrap: anywhere; }

.management-grid, .charts-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(520px, 1.4fr);
  gap: 16px;
  margin-bottom: 16px;
}
.charts-grid { grid-template-columns: repeat(3, minmax(320px, 1fr)); }
.panel { padding: 16px; margin-bottom: 16px; }
.filters label { display: grid; gap: 5px; color: var(--muted); }
.filters select, .filters input { min-width: 150px; }

.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7f9fb; color: #475467; font-size: 12px; text-transform: uppercase; position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
.compact table { white-space: normal; }

.status, .score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.status.ok, .score.excellent { background: #dff7ec; color: var(--green); }
.score.good { background: #e6f0ff; color: var(--blue); }
.score.warning { background: #fff1d6; color: var(--amber); }
.score.bad { background: #ffe4e0; color: var(--red); }
.status.muted { background: #eef2f6; color: var(--muted); }
.score.large { min-width: 52px; }

.weather-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  color: var(--blue);
}
.weather-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(380px, 100%);
  padding: 28px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
  margin-bottom: 18px;
}
.login-panel p { color: var(--muted); margin: 6px 0 22px; }
.login-panel form { display: grid; gap: 10px; }
.flash { margin-top: 14px; color: var(--red); }

canvas { width: 100% !important; height: 260px !important; }

@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .management-grid, .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { padding: 14px; }
  .topbar { display: block; }
  .place-search { margin-top: 14px; }
  .place-search input { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 23px; }
}
