/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f5f5;
  --surface:   #ffffff;
  --primary:   #2d6a4f;
  --primary-h: #1e4d38;
  --text:      #1a1a1a;
  --muted:     #6b6b6b;
  --error:     #c0392b;
  --success:   #27ae60;
  --info:      #2471a3;
  --border:    #e0e0e0;
  --radius:    12px;
  --shadow:    0 2px 8px rgba(0,0,0,.08);
}

html { font-size: 16px; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
}

.site-header .brand img {
  width: auto;
  height: 42px;
  flex: 0 0 auto;
}

.site-header nav a {
  color: rgba(255,255,255,.85);
  font-size: .9rem;
  margin-left: 1rem;
}
.site-header nav a:hover { color: #fff; text-decoration: none; }

.container {
  max-width: 480px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.container--wide {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.container--users {
  max-width: 1280px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ── Alerts / flash messages ──────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.alert--error   { background: #fdecea; color: var(--error);   border: 1px solid #f5b7b1; }
.alert--success { background: #eafaf1; color: #1e8449;        border: 1px solid #a9dfbf; }
.alert--info    { background: #eaf4fb; color: var(--info);    border: 1px solid #a9cce3; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}

.form-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .2rem;
  accent-color: var(--primary);
}

.form-check label {
  margin: 0;
  font-weight: 400;
  line-height: 1.45;
}

.form-check input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(45,106,79,.25);
  outline-offset: 2px;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,.15);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .7rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  min-height: 44px;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}
.btn--primary:hover { background: var(--primary-h); text-decoration: none; color: #fff; }

.btn--secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  width: 100%;
}
.btn--secondary:hover { background: #f0f7f4; text-decoration: none; }

.btn--danger {
  background: var(--error);
  color: #fff;
}
.btn--danger:hover { background: #a93226; text-decoration: none; color: #fff; }

.btn--small {
  padding: .4rem .9rem;
  font-size: .88rem;
  min-height: 36px;
  width: auto;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Charge card (dashboard) ──────────────────────────────────────────────── */
.charge-card {
  text-align: center;
  padding: 2rem 1.5rem;
}

.charge-card__status {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.charge-card__watts {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: .5rem 0;
}

.charge-card__watts span { font-size: 1rem; font-weight: 400; color: var(--muted); }

.charge-card__metrics {
  display: flex;
  justify-content: center;
  gap: 1rem;
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: .5rem;
}

.charge-card__meta {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: .4rem;
  vertical-align: middle;
}
.status-dot--on  { background: var(--success); box-shadow: 0 0 6px rgba(39,174,96,.5); }
.status-dot--off { background: var(--muted); }
.status-dot--err { background: var(--error); }

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge--active          { background: #eafaf1; color: #1e8449; }
.badge--pending         { background: #fef9e7; color: #9a7d0a; }
.badge--pending_approval { background: #fff3cd; color: #7d6608; }
.badge--blocked         { background: #fdecea; color: var(--error); }
.badge--inactive        { background: #f2f3f4; color: var(--muted); }
.badge--paid            { background: #eafaf1; color: #1e8449; }
.badge--pending_payment { background: #fef9e7; color: #9a7d0a; }
.badge--active-charge   { background: #eaf4fb; color: var(--info); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

th, td {
  padding: .65rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
  background: #fafafa;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody tr:hover { background: #f9f9f9; }

.status-form {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 210px;
}

.status-form select {
  min-height: 36px;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

/* ── Divider / helper ─────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.text-muted  { color: var(--muted); font-size: .9rem; }
.text-center { text-align: center; }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }

/* ── Page heading ─────────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* ── Admin layout helpers ────────────────────────────────────────────────── */
.dashboard-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-stat {
  flex: 1;
  min-width: 160px;
  text-align: center;
}

.dashboard-stat__value {
  font-size: 2rem;
  font-weight: 800;
}

.admin-action-form { margin-bottom: 1rem; }
.admin-form-row, .admin-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.admin-form-row { align-items: flex-end; }

.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* ── Usage agreement ─────────────────────────────────────────────────────── */
.legal-page { line-height: 1.65; }

.legal-main {
  max-width: 850px;
  margin: 2rem auto;
  padding: 0 1rem 3rem;
}

.legal-article {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.legal-article h1 {
  line-height: 1.25;
  margin: 0 0 .5rem;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
}

.legal-article h2 {
  line-height: 1.3;
  margin: 2.25rem 0 .75rem;
  font-size: 1.25rem;
  scroll-margin-top: 5rem;
}

.legal-article p { margin: .6rem 0; }
.legal-article ol, .legal-article ul { padding-left: 1.5rem; }
.legal-article li { margin: .45rem 0; }
.legal-article address { font-style: normal; margin: 1rem 0; }
.legal-article .subtitle { color: var(--muted); margin-bottom: 1.5rem; }

.legal-article .summary {
  background: #edf6f1;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.legal-article .summary h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.legal-article .summary ul { margin-bottom: 0; }
.legal-article .notice { color: var(--muted); font-size: .9rem; }
.legal-article .parties {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.legal-article .alpha { list-style-type: lower-alpha; }

.legal-footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin-top: 1.25rem;
}

/* ── Site footer ──────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 1.5rem 1rem 2rem;
}
.site-footer a { color: var(--muted); }
.site-footer__sep { margin: 0 .5rem; }

/* ── Cookie notice ────────────────────────────────────────────────────────── */
.cookie-notice {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 32rem;
  margin: 0 auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem 1.1rem;
  font-size: .9rem;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0; }
.cookie-notice__close {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .25rem;
}
.cookie-notice__close:hover { color: var(--text); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { align-items: flex-start; gap: .5rem; }
  .site-header .brand img { height: 36px; }
  .site-header .brand span { max-width: 9rem; line-height: 1.2; }
  .container, .container--wide { padding: 0 .75rem; }
  .card { padding: 1.1rem; }
  th, td { padding: .5rem .5rem; }
  .hide-mobile { display: none; }
}

@media print {
  .legal-page { background: #fff; }
  .legal-page .site-header, .legal-footer { display: none; }
  .legal-main { margin: 0; max-width: none; padding: 0; }
  .legal-article { box-shadow: none; padding: 0; }
}
