:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101214;
  color: #edf1f4;
  font-synthesis: none;
  --surface: #1a1d20;
  --surface-2: #22262a;
  --border: #343a40;
  --muted: #9aa3ab;
  --green: #5bc97a;
  --cyan: #48b7dc;
  --orange: #f0a34a;
  --red: #ef6b73;
  --purple: #a38bd4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #101214; }
a { color: inherit; }
button, input, select { font: inherit; letter-spacing: 0; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 18, 20, .96);
  backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; font-weight: 750; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--cyan); color: #071216; font-size: 12px; font-weight: 900; }
.brand-mark.large { width: 46px; height: 46px; font-size: 15px; }
.main-nav { display: flex; align-self: stretch; justify-self: center; }
.main-nav a { display: grid; place-items: center; min-width: 106px; padding: 0 16px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 650; }
.main-nav a:hover { color: #fff; }
.main-nav a.active { color: #fff; border-bottom-color: var(--cyan); }
.account-area { display: flex; align-items: center; justify-self: end; gap: 8px; }
.account-link { display: grid; padding: 8px 10px; border-radius: 7px; color: #e7edf0; text-decoration: none; line-height: 1.1; }
.account-link:hover, .account-link.active { background: var(--surface-2); }
.account-link strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-link span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.logout-form { margin: 0; }
.text-button { padding: 9px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.text-button:hover { color: #fff; }

.app-main { width: min(1420px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin: 2px 0 0; font-size: 32px; line-height: 1.15; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--cyan); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.heading-copy, .section-heading p { margin: 7px 0 0; color: var(--muted); }

.live-state { display: flex; align-items: center; gap: 11px; min-width: 210px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.live-state strong, .live-state span { display: block; }
.live-state div > span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(154,163,171,.12); }
.live-state[data-tone="available"] .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(91,201,122,.13); }
.live-state[data-tone="offline"] .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(239,107,115,.13); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 42px; }
.summary-card { min-height: 128px; display: flex; flex-direction: column; justify-content: center; padding: 20px; border: 1px solid var(--border); border-top-width: 3px; border-radius: 8px; background: var(--surface); }
.summary-card strong { margin: 4px 0 1px; font-size: 36px; line-height: 1; }
.summary-card strong.metric-text { font-size: 24px; }
.summary-card > span:last-child { color: var(--muted); font-size: 13px; }
.summary-label { color: #dbe1e5; font-size: 14px; font-weight: 750; }
.summary-card.available { border-top-color: var(--green); }
.summary-card.charging { border-top-color: var(--cyan); }
.summary-card.suspended { border-top-color: var(--orange); }
.summary-card.other { border-top-color: var(--red); }
.summary-card.neutral { border-top-color: var(--purple); }

.location-section, .audit-section { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--border); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: 0; }
.section-heading p { font-size: 13px; }
.connector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.connector-card { overflow: hidden; padding: 20px; border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 8px; background: var(--surface); }
.connector-card[data-tone="available"] { border-left-color: var(--green); }
.connector-card[data-tone="charging"] { border-left-color: var(--cyan); }
.connector-card[data-tone="suspended"] { border-left-color: var(--orange); }
.connector-card[data-tone="offline"] { border-left-color: var(--red); }
.connector-topline { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.connector-label { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.connector-card h3 { margin: 2px 0 0; font-size: 23px; letter-spacing: 0; }
.state-badge { max-width: 210px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 750; text-align: center; overflow-wrap: anywhere; }
.state-badge[data-tone="available"] { border-color: rgba(91,201,122,.45); color: var(--green); }
.state-badge[data-tone="charging"] { border-color: rgba(72,183,220,.45); color: var(--cyan); }
.state-badge[data-tone="suspended"], .state-badge[data-tone="warning"], .state-badge[data-tone="preparing"] { border-color: rgba(240,163,74,.45); color: var(--orange); }
.state-badge[data-tone="offline"] { border-color: rgba(239,107,115,.45); color: var(--red); }
.connector-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 22px 0 0; }
.connector-details div { min-width: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.connector-details dt { color: var(--muted); font-size: 12px; }
.connector-details dd { margin: 4px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.data-alert, .alert { margin-top: 20px; padding: 13px 15px; border: 1px solid rgba(239,107,115,.45); border-radius: 7px; background: rgba(239,107,115,.09); color: #ffc8cc; }

.login-main { min-height: 100vh; display: grid; place-items: center; width: 100%; padding: 32px 20px; }
.login-panel { width: min(420px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand h1 { margin: 3px 0 0; font-size: 24px; letter-spacing: 0; }
.login-copy { margin: 22px 0; color: var(--muted); }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 7px; color: #dce2e6; font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #495158; border-radius: 6px; outline: none; background: #111416; color: #fff; }
.login-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(72,183,220,.14); }
.primary-button { height: 44px; margin-top: 13px; border: 0; border-radius: 6px; background: var(--cyan); color: #071216; font-weight: 850; cursor: pointer; }
.primary-button:hover { background: #67c8e7; }

.primary-link, .secondary-button, .danger-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
}
.primary-link { border: 1px solid var(--cyan); background: var(--cyan); color: #071216; }
.primary-link:hover { background: #67c8e7; }
.secondary-button { border: 1px solid #4b535a; background: var(--surface-2); color: #edf1f4; }
.secondary-button:hover { border-color: #707a82; }
.danger-button { border: 1px solid rgba(239,107,115,.65); background: rgba(239,107,115,.1); color: #ffb9be; }
.danger-button:hover { background: rgba(239,107,115,.18); }
button:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.button-row form { margin: 0; }
.primary-button.compact { min-height: 40px; height: 40px; margin: 0; padding: 0 14px; }

.compact-heading { align-items: center; }
.management-section, .form-section { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--border); }
.form-section { width: min(680px, 100%); }
.management-form { display: grid; gap: 9px; width: min(520px, 100%); }
.management-form label { margin-top: 8px; color: #dce2e6; font-size: 13px; font-weight: 700; }
.management-form input, .management-form select, .inline-form select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #495158;
  border-radius: 6px;
  outline: none;
  background: #111416;
  color: #fff;
}
.management-form input:focus, .management-form select:focus, .inline-form select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(72,183,220,.14); }
.management-form .primary-button { width: max-content; min-width: 180px; padding: 0 18px; }

.credential-section { width: min(720px, 100%); margin: 30px auto 0; }
.credential-section h1 { margin: 5px 0 8px; font-size: 32px; }
.credential-section > p:not(.eyebrow) { color: var(--muted); }
.credential-box { margin: 28px 0; border-top: 1px solid var(--border); }
.credential-box div { display: grid; grid-template-columns: 180px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.credential-box dt { color: var(--muted); }
.credential-box dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.credential-box code { color: var(--cyan); font-size: 15px; }

.table-subline { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.table-action { text-align: right; white-space: nowrap; }
.table-action a { color: var(--cyan); font-weight: 750; text-decoration: none; }
.pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 780; white-space: nowrap; }
.pill.available { border-color: rgba(91,201,122,.45); color: var(--green); }
.pill.warning { border-color: rgba(240,163,74,.45); color: var(--orange); }
.pill.offline { border-color: rgba(239,107,115,.45); color: var(--red); }

.count-badge { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--green); font-weight: 850; }
.live-list { border-top: 1px solid var(--border); }
.live-row { display: grid; grid-template-columns: 12px minmax(180px, 1fr) 130px 150px 180px; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); text-decoration: none; }
.live-row:hover { background: rgba(255,255,255,.025); }
.live-row > span:nth-child(2) { display: grid; }
.live-row small { margin-top: 2px; color: var(--muted); }
.live-row time { color: var(--muted); text-align: right; font-size: 12px; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(91,201,122,.12); }

.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; }
.distribution-list { display: grid; gap: 14px; }
.distribution-row { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 12px; font-size: 13px; }
.distribution-row > div { height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.distribution-row i { display: block; height: 100%; border-radius: inherit; background: var(--cyan); }
.distribution-row strong { text-align: right; }
.hour-chart { height: 128px; display: flex; align-items: end; gap: 4px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.hour-chart span { min-height: 2px; flex: 1; background: var(--purple); border-radius: 2px 2px 0 0; }
.hour-labels { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 10px; }
.ranking-list, .session-list { border-top: 1px solid var(--border); }
.ranking-list > div, .session-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 58px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.ranking-list span, .session-list span { display: grid; min-width: 0; }
.ranking-list small, .session-list small { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.ranking-list b { min-width: 34px; color: var(--cyan); font-size: 18px; text-align: right; }
.session-list > div > span:last-child { text-align: right; }

.user-control-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -8px 0 28px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.user-control-bar > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.control-note { color: var(--muted); font-size: 12px; }
.inline-form { display: flex; align-items: center; gap: 7px; }
.inline-form select { width: 150px; min-height: 40px; }
.error-page { width: min(620px, 100%); margin: 12vh auto 0; text-align: center; }
.error-page h1 { margin: 6px 0 10px; font-size: 34px; }
.error-page > p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }

.audit-heading { align-items: center; }
.range-tabs { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.range-tabs a { padding: 8px 12px; border-radius: 5px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.range-tabs a.active { background: #343a40; color: #fff; }
.audit-summary { margin-bottom: 20px; }
.chart { height: 220px; display: flex; align-items: stretch; gap: 5px; overflow-x: auto; padding: 12px 4px 0; border-bottom: 1px solid var(--border); }
.chart-day { min-width: 28px; flex: 1 0 28px; display: grid; grid-template-rows: 1fr 24px; gap: 7px; text-align: center; color: var(--muted); font-size: 10px; }
.chart-bars { display: flex; align-items: end; justify-content: center; gap: 2px; }
.bar { display: block; width: 6px; min-height: 2px; border-radius: 2px 2px 0 0; }
.bar.success, .chart-legend .success::before { background: var(--green); }
.bar.failure, .chart-legend .failure::before { background: var(--red); }
.bar.views, .chart-legend .views::before { background: var(--cyan); }
.chart-legend { display: flex; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.chart-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; }
.audit-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #dce7ed; }
.ua { max-width: 360px; color: var(--muted); overflow-wrap: anywhere; }
.event { display: inline-block; white-space: nowrap; font-weight: 700; }
.event-login_success { color: var(--green); }
.event-login_failure, .event-login_blocked { color: var(--red); }
.event-page_view { color: var(--cyan); }
.event-logout { color: var(--muted); }
.event-user_created, .event-user_enabled, .event-password_changed { color: var(--green); }
.event-user_disabled, .event-password_reset { color: var(--orange); }
.event-user_role_changed { color: var(--purple); }
.event-push_enabled, .event-push_preferences, .event-push_test { color: var(--green); }
.event-push_disabled { color: var(--orange); }
.empty-state { padding: 24px; border: 1px dashed var(--border); color: var(--muted); text-align: center; }

.settings-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 42px; margin-top: 12px; }
.settings-section { min-width: 0; padding-top: 24px; border-top: 1px solid var(--border); }
.section-heading.compact { margin-bottom: 20px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.fit-button { width: max-content; min-width: 150px; margin: 0; padding: 0 16px; }
.install-hint { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.feedback-banner { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--muted); }
.feedback-banner[data-tone="success"] { border-color: rgba(91,201,122,.45); background: rgba(91,201,122,.08); color: #b9f3c9; }
.feedback-banner[data-tone="error"] { border-color: rgba(239,107,115,.45); background: rgba(239,107,115,.09); color: #ffc8cc; }
.alert-preferences { display: grid; gap: 0; }
.switch-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 18px; min-height: 72px; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row > span:first-child { display: grid; }
.switch-row strong { font-size: 14px; }
.switch-row small { margin-top: 4px; color: var(--muted); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { position: relative; width: 44px; height: 24px; border: 1px solid #525b62; border-radius: 12px; background: #292e32; transition: background .15s ease, border-color .15s ease; }
.switch-control::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c4cbd0; transition: transform .15s ease, background .15s ease; }
.switch-row input:checked + .switch-control { border-color: var(--cyan); background: rgba(72,183,220,.22); }
.switch-row input:checked + .switch-control::after { transform: translateX(20px); background: var(--cyan); }
.switch-row input:focus-visible + .switch-control { outline: 3px solid rgba(72,183,220,.25); outline-offset: 2px; }
.connector-options { display: grid; gap: 0; margin: 24px 0; padding: 0; border: 0; }
.connector-options legend { margin-bottom: 8px; color: #dce2e6; font-size: 13px; font-weight: 780; }
.connector-option-group { display: grid; grid-template-columns: minmax(160px, 1fr) auto; align-items: center; gap: 18px; min-height: 58px; border-bottom: 1px solid var(--border); }
.connector-option-group > strong { font-size: 13px; }
.connector-option-group > div { display: flex; gap: 8px; }
.check-option { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.check-option:has(input:checked) { border-color: rgba(72,183,220,.55); color: var(--cyan); }
.check-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--cyan); }
.check-option span { font-size: 12px; font-weight: 780; }
.device-list { border-top: 1px solid var(--border); }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 66px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.device-row > span { display: grid; min-width: 0; }
.device-row small { margin-top: 4px; color: var(--muted); }
.device-row form { margin: 0; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connector-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-grid { grid-template-columns: 1fr; gap: 0; }
  .live-row { grid-template-columns: 12px minmax(160px, 1fr) 100px 150px; }
  .live-row time { display: none; }
  .user-control-bar { align-items: flex-start; flex-direction: column; }
  .settings-layout { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 640px) {
  .app-header { grid-template-columns: auto 1fr; gap: 8px; min-height: 58px; padding: 0 14px; }
  .brand > span:last-child { display: none; }
  .account-area { grid-column: 2; grid-row: 1; }
  .account-link strong { max-width: 120px; }
  .account-link span { display: none; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; width: 100%; height: 46px; justify-content: stretch; overflow-x: auto; border-top: 1px solid var(--border); }
  .main-nav a { min-width: 100px; flex: 1; padding: 0 10px; }
  .app-main { width: min(100% - 28px, 1420px); padding-top: 24px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading h1 { font-size: 28px; }
  .live-state { width: 100%; }
  .summary-grid, .connector-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 108px; }
  .connector-topline { align-items: start; }
  .connector-details { grid-template-columns: 1fr 1fr; }
  .connector-details dd { font-size: 13px; }
  .section-heading { align-items: start; }
  .audit-heading .range-tabs { width: 100%; }
  .range-tabs a { flex: 1; text-align: center; }
  .login-panel { padding: 24px; }
  .live-row { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .live-row > span:nth-child(4), .live-row time { display: none; }
  .user-control-bar .button-row, .inline-form { width: 100%; }
  .inline-form { flex-wrap: wrap; }
  .inline-form select { flex: 1; }
  .credential-box div { grid-template-columns: 1fr; gap: 6px; }
  .button-row > form, .button-row > a { width: 100%; }
  .button-row button, .button-row a { width: 100%; }
  .device-actions { display: grid; grid-template-columns: 1fr; }
  .device-actions button, .fit-button { width: 100%; }
  .connector-option-group { grid-template-columns: 1fr; gap: 9px; padding: 13px 0; }
  .connector-option-group > div { width: 100%; }
  .check-option { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
