/* Portal CONTARE — CSS sem passo de build (alojamento partilhado). Cores da CONTARE; escuro desenhado à parte. */
:root {
  --plane: #f6f7f6; --surface: #ffffff; --ink: #1c2321; --ink-2: #4a5552; --muted: #6f7976; --line: #dfe3e1;
  --accent: #0f6e63; --accent-ink: #ffffff; --accent-soft: #e3f1ee; --critical: #b42318; --critical-soft: #fdecea; --good: #146c43;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --plane: #101413; --surface: #171d1b; --ink: #e8eeec; --ink-2: #b3bdb9; --muted: #8b9692; --line: #2a3330;
    --accent: #43b8a6; --accent-ink: #08201c; --accent-soft: #15302b; --critical: #f97066; --critical-soft: #3a1a17; --good: #4ade80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--plane); color: var(--ink); font: 15px/1.5 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }
header.top { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 700; letter-spacing: .08em; color: var(--ink); text-decoration: none; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
header.top nav a, header.top nav button { color: var(--ink-2); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 440px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password] { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
button, .button { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.danger { color: var(--critical); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); margin-bottom: 16px; }
.errors { padding: 10px 14px; border-radius: 8px; background: var(--critical-soft); color: var(--critical); margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--ink); }
.badge.connected { color: var(--good); }
.badge.disconnected { color: var(--critical); background: var(--critical-soft); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.inline { display: inline; }
.card > :first-child { margin-top: 0; }
/* Backoffice */
main.wide { max-width: 1240px; }
header.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.filters input[type=text], .filters select { width: auto; flex: 1 1 200px; max-width: 360px; }
.filters.compact { margin: 0; }
.filters.compact input[type=text] { height: 32px; }
.filters.compact button { height: 32px; padding: 0 10px; }
.filters a[aria-current="page"] { font-weight: 600; color: var(--ink); text-decoration: none; }
select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.two-columns { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.two-columns > .card { margin-bottom: 16px; }
.pager { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 12px; font-size: 13px; }
td.message { max-width: 420px; white-space: pre-line; overflow-wrap: anywhere; }
td { overflow-wrap: anywhere; }
.danger-zone { border-color: var(--critical); }
footer.bottom { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 13px; }
.prose h2 { margin-top: 24px; }
.prose li { margin-bottom: 6px; }
button, .button { white-space: nowrap; }
td form + form { margin-left: 4px; }
/* No telemóvel cada linha passa a cartão: as ações ficam à vista em vez de escondidas no scroll da tabela. */
@media (max-width: 560px) {
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  td { border: 0; padding: 2px 0; }
  td:last-child:not(:empty) { padding-top: 8px; }
}
