/* Aqualita Pulse — tema claro compartilhado (ADR-IMPL-019/020).
   Fonte única de verdade dos tokens de cor e componentes comuns usados por
   Pulse Coach, Pulse Manager e Portal do Aluno (Pulse Live tem sua própria
   folha — é um telão passivo com ambientação diferente, gradiente animado
   de fundo; estas 3 telas são de trabalho/leitura, priorizam legibilidade
   de tabelas/formulários em vez de flourish visual). Cada página mantém só
   o CSS realmente específico do próprio layout.
*/
:root {
  --bg-1: #eef2ff;
  --bg-2: #fdf2f8;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-2: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: rgba(100, 116, 139, 0.2);
  --brand: #1e3a8a;

  --accent: #16a34a;
  --accent-ink: #ffffff;
  --gold: #b45309;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fecaca;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --warn-border: #fde68a;
  --online: #16a34a;
  --online-bg: #dcfce7;
  --offline: #dc2626;
  --offline-bg: #fee2e2;
  --degraded: #c2410c;
  --degraded-bg: #ffedd5;
  --info: #2563eb;
  --info-bg: #dbeafe;

  --shadow-out: 6px 6px 18px rgba(148, 163, 184, 0.22), -6px -6px 18px rgba(255, 255, 255, 0.75);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; min-height: 100%; color: var(--text);
  font-family: "Poppins", "Segoe UI", Roboto, system-ui, sans-serif;
}
body {
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

header .brand { font-size: 20px; font-weight: 800; color: var(--brand); }
header .brand span { color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 14px; }
header .org { font-size: 13px; color: var(--muted); }

nav { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
nav button {
  background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; box-shadow: none; font-weight: 600;
}
nav button.active { background: #ffffff; color: var(--brand); border-color: var(--border); }

#unit-filter-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
#unit-filter-bar select { font-size: 13px; padding: 6px 10px; width: auto; }

.card {
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 16px; padding: 16px 18px;
  box-shadow: var(--shadow-out);
}
.card h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.stat .value { font-size: 24px; font-weight: 800; color: var(--brand); }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .section-grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 12px; }
td.insufficient { color: var(--muted); font-style: italic; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.ONLINE, .badge.AVAILABLE { background: var(--online-bg); color: var(--online); }
.badge.OFFLINE, .badge.REVOKED { background: var(--offline-bg); color: var(--offline); }
.badge.DEGRADED, .badge.MAINTENANCE, .badge.PROVISIONING { background: var(--degraded-bg); color: var(--degraded); }
.badge.IN_USE { background: var(--info-bg); color: var(--info); }
.badge.UNKNOWN { background: var(--panel-2); color: var(--muted); }

.readiness-badge { display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.readiness-badge.READY { background: var(--online-bg); color: var(--online); }
.readiness-badge.READY_WITH_WARNING { background: var(--warn-bg); color: var(--warn); }
.readiness-badge.NOT_READY { background: var(--danger-bg); color: var(--danger); }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.error { text-align: center; padding: 30px 10px; color: var(--danger); }
.error button {
  margin-top: 12px; background: #ffffff; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px;
}

.skeleton { background: var(--panel-2); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton.line { height: 14px; margin-bottom: 8px; }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.95; } }

a.link { color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600; }
a.link:hover { text-decoration: underline; }
button.link {
  background: none; border: none; box-shadow: none; color: var(--accent); font-size: 12px; padding: 0;
  cursor: pointer; text-decoration: none; font-weight: 600;
}
button.link:hover { text-decoration: underline; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Botões grandes, touch-friendly (Cap. 11 §84 "evitar botões de 20px") */
button {
  font-size: 15px; padding: 13px 20px; border-radius: 10px; border: 1px solid var(--border);
  background: #ffffff; color: var(--text); cursor: pointer; font-weight: 600;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
button.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
button.small { font-size: 13px; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

select, input, textarea {
  background: #ffffff; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; width: 100%; font-family: inherit;
}

.who { font-size: 12px; color: var(--muted); }
.user-bar { display: flex; align-items: center; gap: 10px; }
.user-bar .who { font-size: 13px; }
.user-bar button { font-size: 13px; padding: 7px 14px; }

#offline-banner {
  display: none; padding: 10px 16px; border-radius: 10px; background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn-border); font-size: 13px; text-align: center;
}
#offline-banner.show { display: block; }

#login-screen { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
#login-card {
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 18px; padding: 28px; width: 100%;
  max-width: 340px; box-shadow: var(--shadow-out);
}
#login-card h1 { font-size: 20px; margin: 0 0 4px; color: var(--brand); font-weight: 800; }
#login-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
#login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
#login-card button[type="submit"], #login-card button {
  width: 100%; margin-top: 18px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
}
#login-card .login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; font-weight: 600; }

#app.hidden, #login-screen.hidden { display: none; }
.hidden { display: none; }
