/* Reservas de Padel · Câmara Municipal da Ribeira Grande
   Paleta institucional CMRG (azul-petróleo + verde-lima), modo escuro automático. */

:root {
  --primary: #03505f;
  --primary-strong: #034654;
  --primary-soft: #e1eff1;
  --accent: #95c900;
  --accent-ink: #1d2a00;
  --bg: #f1f6f7;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --text: #10252b;
  --muted: #55686e;
  --border: #d6e2e5;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --success: #2e7d32;
  --success-soft: #e8f5e9;
  --warning: #8a5a00;
  --warning-soft: #fff4dc;
  --header-bg: linear-gradient(100deg, #034654, #03505f 45%, #027584);
  --shadow: 0 1px 2px rgba(16, 37, 43, .06), 0 4px 16px rgba(16, 37, 43, .06);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #5cc3cf;
    --primary-strong: #7fd0da;
    --primary-soft: #15292d;
    --bg: #111719;
    --surface: #182124;
    --surface-2: #1d282b;
    --text: #e4edef;
    --muted: #9aacb1;
    --border: #2a383c;
    --danger: #ef6b5e;
    --danger-soft: #3a1d1a;
    --success: #7bc47f;
    --success-soft: #1b2e1d;
    --warning: #e8b64c;
    --warning-soft: #33290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  overflow-x: hidden;
}

a { color: var(--primary); }
a:hover { color: var(--primary-strong); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.65rem; color: var(--primary); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
code, .code { font-family: var(--mono); }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 28px; padding-bottom: 48px; outline: none; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }

/* ---------- Cabeçalho ---------- */
.site-header {
  background: var(--header-bg);
  border-bottom: 4px solid var(--accent);
  color: #fff;
  position: relative;
  z-index: 20;
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 76px;
}
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; min-width: 0; margin-right: auto; }
.brand:hover { color: #fff; }
.brand-logo { height: 52px; width: auto; display: block; flex-shrink: 0; }
.brand-sep { width: 1px; height: 38px; background: rgba(255, 255, 255, .45); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.12rem; white-space: nowrap; }
.brand-text small { font-size: .8rem; opacity: .85; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: .95rem;
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .18); box-shadow: inset 0 -2px 0 var(--accent); }
.nav .nav-cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-left: 4px; }
.nav .nav-cta:hover { background: #a6dc0f; color: var(--accent-ink); }
.nav .nav-user { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.nav .nav-user .avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.nav-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .3); margin: 0 4px; }

.menu-toggle {
  display: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px;
  font-size: 1.3rem;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}

@media (max-width: 1180px) {
  .brand-text small { display: none; }
}
@media (max-width: 1040px) {
  .menu-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 16px 14px;
    background: #03505f;
    border-bottom: 4px solid var(--accent);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .2);
  }
  .nav.open { display: flex; }
  .nav a, .nav button { text-align: left; padding: 11px 12px; }
  .nav .nav-cta { margin: 6px 0 0; text-align: center; }
  .nav-sep { width: auto; height: 1px; margin: 6px 0; }
  .nav .nav-user { max-width: none; }
}
@media (max-width: 560px) {
  .header-inner { min-height: 62px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-logo { height: 40px; }
  .brand-sep { height: 30px; }
  .brand-text strong { font-size: .98rem; }
}
@media (max-width: 340px) {
  .brand-sep, .brand-text { display: none; }
}

/* ---------- Rodapé ---------- */
.site-footer { background: var(--surface); border-top: 4px solid var(--accent); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
  min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
.card-plain { border-top-width: 1px; }
.card h2 { color: var(--primary); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .94rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn, .btn:hover { color: #0b1a1d; } }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #a6dc0f; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(.92); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .85rem; border-radius: 6px; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--danger); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
  vertical-align: middle;
}
.badge-accent { background: var(--accent); color: var(--accent-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border-left: 4px solid var(--primary); background: var(--primary-soft); }
.alert > :last-child { margin-bottom: 0; }
.alert-error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.alert-success { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.alert-warning { border-color: var(--warning); background: var(--warning-soft); color: var(--warning); }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.form-narrow { max-width: 440px; }
.field { display: grid; gap: 5px; }
.field label, .field .label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=date], input[type=time], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  min-height: 40px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
input.code-input { font-family: var(--mono); font-size: 1.15rem; letter-spacing: 1.5px; text-transform: uppercase; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: .93rem; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.input-row { display: flex; gap: 8px; }
.input-row > input { flex: 1; min-width: 0; }

/* ---------- Página inicial ---------- */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 30px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.hero h1 { font-size: 2rem; }
.hero .lead { font-size: 1.08rem; color: var(--muted); max-width: 560px; }
.hero-art {
  border-radius: 12px;
  background: var(--header-bg);
  min-height: 200px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.hero-art svg { width: 82%; max-width: 330px; height: auto; }
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
  .hero h1 { font-size: 1.6rem; }
  .hero-art { min-height: 150px; }
}
.info-tile .big { font-size: 1.5rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.info-tile h3 { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); background: var(--primary-soft); color: var(--primary); padding: 3px 9px; border-radius: 6px; font-size: .88rem; }

/* ---------- Reservar ---------- */
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; text-align: right; }
.counter strong { font-size: 1.35rem; color: var(--primary); }
.counter.full strong { color: var(--danger); }

.date-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.date-nav input[type=date] { width: auto; }

.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  min-width: 0;
  position: relative;
}
.day:hover { border-color: var(--primary); }
.day .dow { font-size: .78rem; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.day .dnum { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.day .dmon { font-size: .78rem; color: var(--muted); }
.day .free { margin-top: 6px; font-size: .78rem; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .free .zero { color: var(--danger); font-weight: 700; }
.day.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.day.selected .dow, .day.selected .dmon { color: rgba(255, 255, 255, .85); }
.day.selected .free .zero { color: #ffd2cc; }
@media (prefers-color-scheme: dark) {
  .day.selected { color: #0b1a1d; }
  .day.selected .dow, .day.selected .dmon { color: rgba(11, 26, 29, .75); }
  .day.selected .free .zero { color: #8b1a12; }
}
.day-tip {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: .8rem;
  text-align: left;
  width: max-content;
  max-width: 240px;
  box-shadow: var(--shadow);
  display: none;
  pointer-events: none;
}
.day:hover .day-tip, .day:focus-visible .day-tip { display: block; }
.day-tip b { display: block; margin-top: 3px; }
.day-tip b:first-child { margin-top: 0; }
@media (max-width: 700px) {
  .day-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .day { flex: 0 0 108px; scroll-snap-align: start; }
  .day .free { font-size: .72rem; }
  .day-tip { display: none !important; }
}

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.data-table td { font-size: .92rem; }
.data-table code { white-space: nowrap; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.slot-grid { table-layout: fixed; }
.slot-grid th:first-child, .slot-grid td:first-child { width: 128px; white-space: nowrap; }
.slot-grid td { padding: 6px; }
.slot-time { font-family: var(--mono); font-weight: 600; }
.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 46px;
  border-radius: 8px;
  padding: 6px 10px;
  width: 100%;
  font: inherit;
  font-size: .92rem;
  text-align: center;
}
button.slot-free {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px dashed var(--primary);
  cursor: pointer;
  font-weight: 600;
}
button.slot-free:hover:not(:disabled) { background: var(--primary); color: #fff; border-style: solid; }
@media (prefers-color-scheme: dark) { button.slot-free:hover:not(:disabled) { color: #0b1a1d; } }
button.slot-free:disabled { opacity: .45; cursor: not-allowed; }
.slot-mine { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.slot-mine code { background: rgba(255, 255, 255, .55); padding: 1px 6px; border-radius: 4px; font-size: .82rem; }
.slot-mine .link-btn { color: #6b0f09; font-size: .85rem; }
.slot-taken { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.slot-taken .link-btn { color: var(--danger); font-size: .85rem; }
.slot-past { color: var(--muted); opacity: .6; }
.slot-blocked {
  flex-direction: column; gap: 0; line-height: 1.25;
  background: repeating-linear-gradient(135deg, var(--warning-soft), var(--warning-soft) 8px, transparent 8px, transparent 14px);
  border: 1px solid var(--warning); color: var(--warning); font-weight: 600;
}
.slot-blocked small { font-weight: 400; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.block-notice p { margin: 0 0 6px; }
.day { position: relative; }
.day-flag { position: absolute; top: 4px; right: 6px; font-size: .8rem; color: var(--warning); }
.day.selected .day-flag { color: inherit; }
@media (max-width: 640px) {
  .slot-grid th:first-child, .slot-grid td:first-child { width: 64px; }
  .slot-grid .slot-end { display: none; }
  .slot { padding: 4px; font-size: .8rem; min-height: 42px; gap: 4px; }
  .slot-grid td { padding: 3px; }
  .slot .arrow, .slot-mine .label { display: none; }
  .slot-mine code { font-size: .68rem; padding: 1px 3px; }
}

/* ---------- Reservas (cartões) ---------- */
.booking-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.booking-card { margin: 0; }
.booking-card .when { font-size: 1.1rem; font-weight: 700; color: var(--primary); text-transform: capitalize; }
.booking-card .meta { color: var(--muted); margin-bottom: 12px; }
.code-box {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 1.5px;
  background: var(--primary-soft);
  color: var(--primary);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  padding: 8px 12px;
  display: inline-block;
  margin-bottom: 12px;
}
.code-box.big { font-size: 1.7rem; padding: 14px 20px; display: block; text-align: center; margin: 10px 0 14px; }
@media (max-width: 420px) { .code-box.big { font-size: 1.3rem; } }

/* ---------- Verificação ---------- */
.verify-result { border-radius: 10px; padding: 18px; margin-top: 18px; border: 1px solid var(--border); }
.verify-result .vr-head { display: flex; align-items: center; gap: 12px; font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.verify-result .vr-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.verify-result.ok { background: var(--success-soft); border-color: var(--success); }
.verify-result.ok .vr-icon { background: var(--success); color: #fff; }
.verify-result.bad { background: var(--danger-soft); border-color: var(--danger); }
.verify-result.bad .vr-icon { background: var(--danger); color: #fff; }
.verify-result.old { background: var(--warning-soft); border-color: var(--warning); }
.verify-result.old .vr-icon { background: var(--warning); color: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Backoffice ---------- */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -2px 0 var(--border); margin-bottom: 22px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--accent); }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .88rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1 1 240px; width: auto; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.perm-list { display: grid; gap: 8px; }
.perm-list .check small { display: block; color: var(--muted); }
.lookup { position: relative; }
.lookup-list {
  list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); max-height: 220px; overflow-y: auto;
}
.lookup-list li button { width: 100%; text-align: left; background: none; border: 0; padding: 7px 9px; border-radius: 6px; font: inherit; color: var(--text); cursor: pointer; }
.lookup-list li button:hover { background: var(--primary-soft); }
.lookup-list li small { color: var(--muted); display: block; }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); }
.court-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--border); }
.court-row:last-child { border-bottom: 0; }
.court-row input { flex: 1 1 180px; width: auto; }

/* ---------- Segurança (backoffice) ---------- */
.sec-views { margin-bottom: 18px; }
.ip-only.is-off { opacity: .5; }
.ip-only.is-off h2::after { content: " (controlo por IP desligado)"; font-size: .8rem; font-weight: 400; color: var(--muted); }
.stat-warn { border-top-color: var(--warning); }
.stat-warn .num { color: var(--warning); }
.sec-chart { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 4px; height: 160px; align-items: end; padding-bottom: 18px; }
.sec-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.sec-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 0; }
.sec-bar-fail { background: var(--danger); }
.sec-bar-blocked { background: var(--warning); opacity: .75; }
.sec-col span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); }
.sec-col:nth-child(odd) span { visibility: hidden; }
.sec-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.sw-fail { background: var(--danger); }
.sw-blocked { background: var(--warning); }
.sec-limits input[type=number] { width: 86px; min-height: 34px; padding: 4px 8px; }
.sec-settings .card h2 { margin-bottom: 6px; }
.sec-num .input-row { align-items: center; max-width: 280px; }
.sec-num input { max-width: 140px; }
.sec-unit { white-space: nowrap; }
.sec-settings .check { margin: 8px 0; }
.sec-allow { width: 100%; font-family: var(--mono); padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); }
.sec-save { position: sticky; bottom: 12px; background: var(--bg); padding: 10px 0; }
input[type=number] { padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; min-height: 40px; }

/* ---------- Campo-isco contra robôs (invisível para pessoas e leitores de ecrã) ---------- */
.hp-field { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Regras da palavra-passe ---------- */
.pw-rules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: .84rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: baseline; gap: 6px; }
.pw-rules .pw-icon { width: 1em; text-align: center; font-weight: 700; flex-shrink: 0; }
.pw-rules li.ok { color: var(--success); }
.pw-rules li.fail { color: var(--danger); }

/* ---------- Dias da semana (bloqueios semanais) ---------- */
.weekday-picker { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.weekday-picker legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
.weekday { position: relative; cursor: pointer; }
.weekday input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.weekday span {
  display: inline-block; min-width: 50px; text-align: center; padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .9rem; color: var(--muted);
}
.weekday input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .weekday input:checked + span { color: #0b1a1d; } }
.weekday input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.except-editor { margin-top: 8px; }
.except-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); }
.except-chip button { background: none; border: 0; color: var(--danger); font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 2px; }

/* ---------- Contactos ---------- */
.contact { font-style: normal; line-height: 1.6; }
.help-contact { display: flex; gap: 12px 32px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.help-contact > div { flex: 1 1 260px; }
.help-contact h2 { margin-bottom: 4px; }
.footer-contact { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-bottom: 18px; font-size: .85rem; }

/* ---------- Ajuda ---------- */
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 16px; padding: 14px; }
.help-toc ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.help-toc .link-btn { text-align: left; text-decoration: none; font-size: .92rem; }
.help-toc .link-btn:hover { text-decoration: underline; }
.help-topic { padding: 0; }
.help-topic summary { cursor: pointer; padding: 16px 22px; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-topic summary::-webkit-details-marker { display: none; }
.help-topic summary::after { content: "+"; font-size: 1.4rem; color: var(--primary); line-height: 1; }
.help-topic[open] summary::after { content: "−"; }
.help-topic summary h2 { margin: 0; font-size: 1.08rem; }
.help-topic .prose { padding: 0 22px 18px; }
.help-topic h4 { margin: 1em 0 .3em; color: var(--primary); }
@media (max-width: 860px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; }
}

/* ---------- MFA ---------- */
.mfa-steps { padding-left: 1.3em; margin: 0; display: grid; gap: 14px; }
.mfa-qr { background: #fff; display: block; width: max-content; padding: 8px; border-radius: 10px; border: 1px solid var(--border); margin: 10px 0 6px; }
.mfa-qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.mfa-steps details { margin-top: 6px; }
.mfa-steps summary { cursor: pointer; color: var(--primary); font-size: .9rem; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: 1px; text-align: center; padding: 8px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); }

/* ---------- Paginação ---------- */
.pager { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 10px 0; font-size: .88rem; color: var(--muted); }
.pager-size { display: inline-flex; align-items: center; gap: 8px; }
.pager-size select { width: auto; min-height: 32px; padding: 4px 8px; }
.pager-nav { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.pager-page { padding: 0 4px; white-space: nowrap; color: var(--text); }
@media (max-width: 640px) {
  .pager-nav { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .pager-edge { display: none; }
}

/* ---------- Diálogo ---------- */
dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(8, 24, 28, .55); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; border-top: 5px solid var(--accent); }
.dlg header h2 { margin: 0; color: var(--primary); }
.dlg-x { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.dlg-body { padding: 4px 22px 8px; overflow-y: auto; }
.dlg .dlg-error { margin: 8px 22px 0; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; flex-wrap: wrap; }
.dlg-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.dlg-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; width: min(460px, calc(100vw - 32px)); }
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--accent);
  animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.loading { color: var(--muted); padding: 30px 0; text-align: center; }
.empty { color: var(--muted); padding: 18px; text-align: center; background: var(--surface-2); border-radius: 8px; }
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.4em; color: var(--primary); }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .3em; }
