/* ── 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; }

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 {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
}

.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;
}

/* ── 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;
}
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__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--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; }

/* ── 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; }
.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;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container, .container--wide { padding: 0 .75rem; }
  .card { padding: 1.1rem; }
  th, td { padding: .5rem .5rem; }
  .hide-mobile { display: none; }
}
