/* Limoengroen EMS — CCC design framework, green accent version (see DESIGN.md) */
:root {
  /* Lime ramp anchored on the Limoengroen logo green (#cedb7a = primary-200). */
  --primary-100: #f6f8e7; --primary-200: #cedb7a; --primary-300: #b3c445;
  --primary-400: #6b7722; --primary-500: #3d4314;
  --secondary-100: #e6f0f0; --secondary-300: #71d1d4; --secondary-400: #1a9294;
  --secondary-500: #194142; --secondary-600: #021b1c;
  --neutral-100: #f5f4ef; --neutral-200: #ebe9e1; --neutral-300: #b9b5ae;
  --neutral-400: #8a867d; --neutral-500: #615d52;
  --success-100: #d4efe2; --success-400: #1ca462; --success-500: #0d462a;
  --danger-text: #721c24; --danger-bg: #f8d7da; --danger-border: #f5c6cb;
  --radius-card: 16px; --radius-btn: 12px; --radius-input: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--neutral-100); color: var(--secondary-500);
  font: 400 16px/1.5 "Poppins", system-ui, sans-serif;
}
h1 { font-weight: 700; font-size: 28px; margin: 0 0 4px; }
h2 { font-weight: 600; font-size: 18px; margin: 0 0 8px; }
a { color: var(--secondary-400); }
.muted { color: var(--neutral-400); font-size: 14px; }
.dim { color: var(--neutral-400); }

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 272px; flex: 0 0 272px; background: #fff; border-right: 1px solid var(--neutral-200);
  display: flex; flex-direction: column; padding: 20px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar-logo img { height: 44px; width: auto; display: block; }
.sidebar nav { flex: 1; margin-top: 20px; }
.nav-section {
  font-size: 12px; font-weight: 600; color: var(--neutral-400);
  letter-spacing: .04em; text-transform: uppercase; margin: 16px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: var(--neutral-500); text-decoration: none; font-weight: 600; font-size: 15px;
}
.nav-item:hover { background: var(--neutral-100); }
.nav-item.active { background: var(--neutral-100); color: var(--secondary-500); }
.nav-ico { color: var(--neutral-400); width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: #e86c70; color: #fff; border-radius: 30px;
  font-size: 11px; font-weight: 600; padding: 1px 8px;
}
.nav-item.active .nav-ico { color: var(--primary-400); }
.profile {
  border-top: 1px solid var(--neutral-200); padding-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.profile-name { font-weight: 600; font-size: 14px; }
.profile-role { display: block; font-weight: 400; font-size: 12px; color: var(--neutral-400); }

.content { flex: 1; padding: 20px 24px 48px; max-width: 1240px; }

/* ---- page header band ---- */
.page-band {
  background: var(--primary-200);
  background-image: radial-gradient(ellipse 90% 140% at 110% -20%, rgba(255,255,255,.28), transparent 60%),
                    radial-gradient(ellipse 60% 120% at -10% 120%, rgba(61,67,20,.12), transparent 55%);
  border-radius: var(--radius-card); padding: 28px 28px 24px; margin-bottom: 20px;
  color: var(--primary-500);
}
.page-band p { margin: 0; font-weight: 600; }
.crumb { color: var(--primary-500); font-size: 13px; font-weight: 600; text-decoration: none; }

/* ---- cards ---- */
.card {
  background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--radius-card);
  padding: 20px 24px; margin-bottom: 20px;
}

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; background: var(--primary-100); color: var(--secondary-500);
  font-weight: 600; padding: 10px 12px;
}
.table th a {
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; text-decoration: none;
}
.table th a:hover { color: var(--primary-400); }
.table th .sort-ind { color: var(--primary-400); font-size: 11px; }
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--neutral-200); }
.table tr:last-child td { border-bottom: 0; }
.rowlink { color: var(--secondary-500); font-weight: 600; text-decoration: none; }
.rowlink:hover { color: var(--primary-400); }

/* ---- chips ---- */
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 3px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-ok { background: var(--primary-200); color: var(--primary-500); }
.chip-set { background: var(--success-100); color: var(--success-500); }
.chip-todo { background: var(--neutral-200); color: var(--neutral-500); }
.chip-error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }

/* ---- forms & buttons ---- */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input, select {
  width: 100%; padding: 10px 14px; margin-top: 4px; border: 1px solid var(--neutral-200);
  border-radius: var(--radius-input); background: var(--neutral-100);
  font: inherit; color: var(--secondary-500);
}
input:focus, select:focus { outline: 2px solid var(--primary-300); outline-offset: 1px; background: #fff; }
input::placeholder { color: var(--neutral-400); }
.btn-primary {
  background: var(--primary-200); color: var(--primary-500); border: 0;
  border-radius: var(--radius-btn); padding: 12px 22px; font: 600 15px "Poppins", sans-serif;
  cursor: pointer;
}
.btn-primary:hover { background: var(--primary-300); }
.btn-ghost {
  background: none; border: 1px solid var(--neutral-200); border-radius: var(--radius-btn);
  padding: 7px 14px; font: 600 13px "Poppins", sans-serif; color: var(--neutral-500); cursor: pointer;
}
.btn-ghost:hover { border-color: var(--neutral-300); color: var(--secondary-500); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 12px; }
.form-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.inline-form { display: flex; gap: 12px; align-items: center; }
.inline-form input { flex: 1; margin: 0; }
.inline-form select { width: auto; margin: 0; }

/* ---- segmented period toggle (DESIGN.md: pill group, active = lime) ---- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--neutral-100); border: 1px solid var(--neutral-200); border-radius: 30px; padding: 3px; }
.seg {
  padding: 5px 14px; border-radius: 30px; font-size: 13px; font-weight: 600;
  color: var(--neutral-500); text-decoration: none;
}
.seg-active { background: var(--primary-200); color: var(--primary-500); }

/* ---- stat tiles & charts (portfolio) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile {
  background: #fff; border: 1px solid var(--neutral-200); border-radius: 12px; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.tile-accent { background: var(--primary-100); border-color: var(--primary-200); }
.tile-label { font-size: 12px; font-weight: 600; color: var(--neutral-400); text-transform: uppercase; letter-spacing: .03em; }
.tile-value { font-size: 26px; font-weight: 700; color: var(--secondary-500); font-variant-numeric: tabular-nums; }
.tile-value small { font-size: 14px; font-weight: 600; color: var(--neutral-400); }
.chart-box { position: relative; height: 260px; margin-top: 8px; }
.chart-box + .chart-box { margin-top: 24px; }
.empty-state { text-align: left; }

/* ---- building freshness grid ---- */
.building-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.building-cell {
  border: 1px solid var(--neutral-200); border-radius: 12px; padding: 12px 14px;
  text-decoration: none; display: flex; flex-direction: column; gap: 2px;
}
.building-cell:hover { border-color: var(--primary-300); }
.building-name { font-weight: 600; font-size: 14px; color: var(--secondary-500); }
.building-meta { font-size: 12px; color: var(--neutral-400); }
.pill { font-size: 11px; font-weight: 600; margin-top: 6px; }
.pill-live { color: var(--primary-400); }
.pill-stale { color: #856404; }
.pill-offline { color: var(--danger-text); }
.pill-none { color: var(--neutral-400); }

/* ---- alert items & action log ---- */
.alert-item { border-top: 1px solid var(--neutral-200); padding: 14px 0; }
.alert-item:first-child { border-top: 0; }
.alert-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.alert-msg { font-weight: 600; font-size: 14px; flex: 1; min-width: 240px; }
.alert-item.resolved .alert-msg { font-weight: 400; color: var(--neutral-500); }
.action-log { margin: 8px 0 0 12px; padding-left: 14px; border-left: 2px solid var(--neutral-200); }
.action-row { font-size: 13px; padding: 3px 0; }
.action-row .dim { margin-right: 6px; }
.action-form { margin-top: 8px; max-width: 640px; }
.action-form input { font-size: 13px; padding: 8px 12px; }

/* ---- alerts ---- */
.alert { border-radius: var(--radius-input); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.alert-ok { background: var(--success-100); color: var(--success-500); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.notes { margin-top: 14px; font-size: 13px; color: var(--neutral-500); background: var(--neutral-100); border-radius: 8px; padding: 12px 16px; }

/* ---- login ---- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background-color: var(--secondary-600);
  background-image: linear-gradient(rgba(2,27,28,.55), rgba(25,65,66,.65)),
                    url("/static/branding/login-bg.webp");
  background-size: cover; background-position: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius-card);
  padding: 36px; box-shadow: 0 4px 4px rgba(0,0,0,.16);
}
.login-logo { height: 48px; width: auto; display: block; margin-bottom: 16px; }
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card form { margin-top: 18px; display: grid; gap: 14px; }
.login-card .btn-primary { width: 100%; }
.resend { margin-top: 10px; text-align: center; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; }
  .sidebar nav { display: flex; margin: 0 12px; flex: 1; }
  .nav-section { display: none; }
  .grid-form { grid-template-columns: 1fr; }
}
