/* SYSCHARGE — design system (light, sala de controlo de energia) */

:root {
  /* superfícies */
  --bg-page: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-raised: #eef1f6;
  --bg-inset: #f6f8fb;
  --hairline: rgba(16, 32, 54, 0.09);
  --hairline-strong: rgba(16, 32, 54, 0.16);

  /* tinta */
  --ink: #16222f;
  --ink-2: #4c5d72;
  --ink-3: #6d7f94;

  /* séries de dados (validadas p/ superfície clara) */
  --c-grid: #2a78d6;      /* rede */
  --c-solar: #eda100;     /* fotovoltaico */
  --c-building: #4a3aa7;  /* edifício */
  --c-ev: #0a9648;        /* carregamento VE */

  /* acentos de interface (chrome, não dados) */
  --accent: #0e9d57;             /* ícones, realces, indicadores */
  --accent-strong: #0b7d43;      /* botões primários (texto branco) */
  --accent-dim: rgba(14, 157, 87, 0.12);
  --solar-glow: #b07d00;         /* âmbar legível em fundo claro */

  /* estado (reservados, sempre com ícone/etiqueta) */
  --st-good: #0ca30c;
  --st-warn: #b07b00;
  --st-serious: #c9603a;
  --st-critical: #d03b3b;

  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(42, 120, 214, 0.06), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(14, 157, 87, 0.05), transparent 60%),
    var(--bg-page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.num { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent-strong); text-decoration: none; }
button { font-family: inherit; }

/* ---------------------------------------------------------------- cartões */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(20, 40, 70, 0.04);
}
.card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 12px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-strong);
  background: var(--bg-surface);
  color: var(--ink);
  font-size: 14px; font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--bg-raised); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-strong);
  border-color: transparent;
  color: #ffffff;
  font-weight: 700;
}
.btn-primary:hover { background: #096b39; }
.btn-danger { border-color: rgba(208, 59, 59, 0.4); color: #c22f2f; }
.btn-danger:hover { background: rgba(208, 59, 59, 0.08); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }

/* ---------------------------------------------------------------- formulários */
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); }
label.field span { display: block; margin-bottom: 5px; font-weight: 550; }
input, select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-strong);
  background: var(--bg-surface);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus { outline: 2px solid rgba(14, 157, 87, 0.35); border-color: transparent; }

/* ---------------------------------------------------------------- badges de estado */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-raised); color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.available { color: #128a4a; }
.badge.charging { color: var(--accent-strong); }
.badge.charging::before { animation: pulse 1.6s infinite; }
.badge.paused { color: var(--st-warn); }
.badge.offline, .badge.disabled { color: var(--ink-3); }
.badge.error { color: var(--st-critical); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* modos */
.mode-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; letter-spacing: 0.04em; }
.mode-solar { background: rgba(237, 161, 0, 0.16); color: #8a6400; }
.mode-normal { background: rgba(42, 120, 214, 0.12); color: #1d5da8; }
.mode-boost { background: rgba(236, 90, 50, 0.13); color: #b34a22; }

/* ---------------------------------------------------------------- tabelas */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 8px 10px;
  color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--hairline-strong);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--hairline); }
table.data tr:hover td { background: rgba(16, 32, 54, 0.025); }
table.data td.r, table.data th.r { text-align: right; }

/* ---------------------------------------------------------------- modal + toast */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 32, 48, 0.38);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius); padding: 22px; width: min(440px, calc(100vw - 32px));
  max-height: 88vh; overflow: auto;
  box-shadow: 0 18px 50px rgba(20, 40, 70, 0.22);
}
.modal h2 { font-size: 17px; margin-bottom: 16px; }

#toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--bg-surface); border: 1px solid var(--hairline-strong);
  border-radius: 10px; padding: 10px 18px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(20, 40, 70, 0.18);
  animation: toast-in 0.25s ease-out;
}
.toast.err { border-color: rgba(208, 59, 59, 0.55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- logotipo */
.logo { display: flex; align-items: center; gap: 10px; user-select: none; }
.logo svg { flex: none; }
.logo .word { font-weight: 750; letter-spacing: 0.02em; font-size: 17px; }
.logo .word b { color: var(--accent-strong); font-weight: 750; }
.logo .sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.14em; text-transform: uppercase; }

/* scrollbars discretas */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c4cfdc; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
