/* Temas: white | blue | gray | green (claros) | dark */

html {
  font-family: system-ui, sans-serif;
  line-height: 1.45;
  color-scheme: light;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

html[data-color-scheme='white'] {
  --page-bg: #f5f6fa;
  --panel-bg: #ffffff;
  --text: #263238;
  --text-muted: #546e7a;
  --label-color: #0d47a1;
  --border: #cfd8dc;
  --header-bg: #ffffff;
  --nav-inactive: #455a64;
  --nav-active-bg: #e8eaf6;
  --nav-active-border: #5c6bc0;
  --btn-bg: #e8eaf6;
  --btn-fg: #1a237e;
  --btn-border: #9fa8da;
  --btn-primary-bg: #3949ab;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #5c6bc0;
  --btn-danger-border: #c62828;
  --btn-danger-fg: #b71c1c;
  --input-bg: #ffffff;
  --select-bg: #eef1f8;
  --table-border: #e0e0e0;
  --table-head: #eceff1;
  --hint: #607d8b;
  --message-ok: #2e7d32;
  --error: #c62828;
  --dialog-bg: #ffffff;
  --dialog-backdrop: rgba(0, 0, 0, 0.35);
  --code-bg: #eceff1;
  --pre-bg: #f5f5f5;
  --pre-border: #cfd8dc;
  --link: #1565c0;
  --footer-muted: #78909c;
}

html[data-color-scheme='blue'] {
  --page-bg: #e3f2fd;
  --panel-bg: #f5f9ff;
  --text: #0d1b2a;
  --text-muted: #37474f;
  --label-color: #0d47a1;
  --border: #90caf9;
  --header-bg: #e1f5fe;
  --nav-inactive: #1565c0;
  --nav-active-bg: #bbdefb;
  --nav-active-border: #1976d2;
  --btn-bg: #bbdefb;
  --btn-fg: #0d47a1;
  --btn-border: #64b5f6;
  --btn-primary-bg: #1565c0;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #0d47a1;
  --btn-danger-border: #c62828;
  --btn-danger-fg: #b71c1c;
  --input-bg: #ffffff;
  --select-bg: #e1f5fe;
  --table-border: #b3e5fc;
  --table-head: #e1f5fe;
  --hint: #0277bd;
  --message-ok: #1b5e20;
  --error: #c62828;
  --dialog-bg: #f5fbff;
  --dialog-backdrop: rgba(0, 40, 80, 0.35);
  --code-bg: #e1f5fe;
  --pre-bg: #e8f4fc;
  --pre-border: #81d4fa;
  --link: #0d47a1;
  --footer-muted: #0277bd;
}

html[data-color-scheme='gray'] {
  --page-bg: #eceff1;
  --panel-bg: #fafafa;
  --text: #37474f;
  --text-muted: #546e7a;
  --label-color: #37474f;
  --border: #b0bec5;
  --header-bg: #f5f5f5;
  --nav-inactive: #546e7a;
  --nav-active-bg: #cfd8dc;
  --nav-active-border: #607d8b;
  --btn-bg: #cfd8dc;
  --btn-fg: #263238;
  --btn-border: #90a4ae;
  --btn-primary-bg: #455a64;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #37474f;
  --btn-danger-border: #c62828;
  --btn-danger-fg: #b71c1c;
  --input-bg: #ffffff;
  --select-bg: #f5f5f5;
  --table-border: #cfd8dc;
  --table-head: #eceff1;
  --hint: #607d8b;
  --message-ok: #2e7d32;
  --error: #c62828;
  --dialog-bg: #fafafa;
  --dialog-backdrop: rgba(0, 0, 0, 0.4);
  --code-bg: #eceff1;
  --pre-bg: #eceff1;
  --pre-border: #b0bec5;
  --link: #1565c0;
  --footer-muted: #78909c;
}

html[data-color-scheme='green'] {
  --page-bg: #e8f5e9;
  --panel-bg: #f9fff9;
  --text: #1b2e1b;
  --text-muted: #33691e;
  --label-color: #1b5e20;
  --border: #a5d6a7;
  --header-bg: #f1f8e9;
  --nav-inactive: #2e7d32;
  --nav-active-bg: #c8e6c9;
  --nav-active-border: #43a047;
  --btn-bg: #c8e6c9;
  --btn-fg: #1b5e20;
  --btn-border: #81c784;
  --btn-primary-bg: #2e7d32;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #1b5e20;
  --btn-danger-border: #c62828;
  --btn-danger-fg: #b71c1c;
  --input-bg: #ffffff;
  --select-bg: #f1f8e9;
  --table-border: #c8e6c9;
  --table-head: #e8f5e9;
  --hint: #388e3c;
  --message-ok: #1b5e20;
  --error: #c62828;
  --dialog-bg: #f9fff5;
  --dialog-backdrop: rgba(0, 50, 20, 0.35);
  --code-bg: #e8f5e9;
  --pre-bg: #f1f8e9;
  --pre-border: #a5d6a7;
  --link: #2e7d32;
  --footer-muted: #388e3c;
}

html[data-color-scheme='dark'] {
  color-scheme: dark;
  --page-bg: #13151a;
  --panel-bg: #1a1d24;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --label-color: #8ab4f8;
  --border: #3c4048;
  --header-bg: #16181e;
  --nav-inactive: #bdc1c6;
  --nav-active-bg: #2a2f3a;
  --nav-active-border: #5c6bc0;
  --btn-bg: #2d3139;
  --btn-fg: #e8eaed;
  --btn-border: #5f6368;
  --btn-primary-bg: #3949ab;
  --btn-primary-fg: #ffffff;
  --btn-primary-border: #5c6bc0;
  --btn-danger-border: #c62828;
  --btn-danger-fg: #ffcdd2;
  --input-bg: #1e2128;
  --select-bg: #252a33;
  --table-border: #2d3139;
  --table-head: #1e2128;
  --hint: #9aa0a6;
  --message-ok: #81c784;
  --error: #ef9a9a;
  --dialog-bg: #1a1d24;
  --dialog-backdrop: rgba(0, 0, 0, 0.55);
  --code-bg: #2d3139;
  --pre-bg: #13151a;
  --pre-border: #3c4048;
  --link: #8ab4f8;
  --footer-muted: #9aa0a6;
}

html,
body {
  background: var(--page-bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.panel {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Login: coluna centrada vertical e horizontalmente */
#view-login.panel {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-sizing: border-box;
}

#view-login .brand-block,
#view-login #form-login {
  width: 100%;
  max-width: 26ch;
}

#view-login .login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 0.65rem;
}

#view-login .login-logo-wrap .brand-logo-login {
  display: block;
  margin: 0 auto;
}

#view-login .app-footer {
  width: 100%;
  max-width: min(100%, 28rem);
  text-align: center;
  border-top: none;
  margin-top: 0.25rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  color: var(--label-color);
  font-weight: 500;
}

input {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

select {
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--select-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button {
  font: inherit;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
}

button.primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-fg);
}

button.danger {
  border-color: var(--btn-danger-border);
  color: var(--btn-danger-fg);
  background: var(--btn-bg);
}

.hint {
  font-size: 0.88rem;
  color: var(--hint);
  margin: 0 0 1rem;
}

.hint code {
  background: var(--code-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.92em;
}

.message {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  color: var(--message-ok);
}

.field-msg-error {
  color: var(--error) !important;
}

.error {
  color: var(--error);
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

table.entries {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

table.entries th,
table.entries td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--table-border);
}

table.entries thead th {
  background: var(--table-head);
  font-weight: 600;
  font-size: calc(0.92rem + 2pt);
}

table.entries code {
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
}

.actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--dialog-bg);
  color: var(--text);
  padding: 1rem 1.25rem;
  max-width: 420px;
  width: calc(100% - 2rem);
}

dialog::backdrop {
  background: var(--dialog-backdrop);
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0;
  list-style: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.app-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  flex-shrink: 0;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  object-fit: contain;
  border-radius: 6px;
}

.brand-logo-dash {
  max-height: 55px;
  width: auto;
  height: auto;
}

.brand-logo-login {
  width: 185px;
  height: 74px;
  max-width: 100%;
  object-fit: contain;
}

.company-title {
  font-weight: 600;
  font-size: 36px;
  line-height: 1.2;
  color: var(--text);
  margin: 0;
}

.company-tagline {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 500;
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

.brand-inline .brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  justify-content: center;
  min-height: 100%;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-start;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown__panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  margin-top: 0.25rem;
  min-width: 11rem;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.4rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.nav-dropdown:hover .nav-dropdown__panel,
.nav-dropdown:focus-within .nav-dropdown__panel {
  display: flex;
}

.nav-dropdown__item {
  font: inherit;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--nav-inactive);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.nav-dropdown__item:hover {
  border-color: var(--border);
  background: var(--btn-bg);
}

.nav-dropdown__item.active {
  border-color: var(--nav-active-border);
  background: var(--nav-active-bg);
  color: var(--text);
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--nav-inactive);
}

.nav-btn:hover {
  border-color: var(--border);
}

.nav-btn.active {
  border-color: var(--nav-active-border);
  color: var(--text);
  background: var(--nav-active-bg);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.theme-label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0;
  font-size: calc(0.85rem + 2pt);
}

.theme-label select {
  min-width: 7rem;
}

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.page.page--scroll,
.page.page--entries {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding-bottom: 0.5rem;
}

.page-entries-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
  color: var(--label-color);
}

.table-wrap--entries {
  margin-bottom: 0;
}

/* Auditoria: área mais larga + células numa linha (scroll horizontal se necessário) */
.app-main.app-main--audit {
  max-width: min(1920px, 100%);
  width: 100%;
}

/* Métricas: usar largura do ecrã e grelha mais ampla */
.app-main.app-main--metrics {
  max-width: min(1920px, 100%);
  width: 100%;
  padding-left: clamp(0.75rem, 2vw, 2rem);
  padding-right: clamp(0.75rem, 2vw, 2rem);
  box-sizing: border-box;
}

.page h2 {
  margin-top: 0;
  color: var(--text);
}

/* Login: caixas ~25 caracteres de largura */
.login-field {
  width: 25ch;
  max-width: 100%;
  box-sizing: border-box;
}

/* Busca + contadores + Nova entrada (rótulos por cima das caixas) */
.search-new-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 100%;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.toolbar-field-label {
  font-size: calc(0.82rem + 1pt);
  font-weight: 600;
  color: var(--label-color);
  line-height: 1.2;
}

.toolbar-field-label--action {
  visibility: hidden;
  user-select: none;
  min-height: 1em;
}

.toolbar-field--search {
  flex: 1 1 16rem;
  min-width: min(100%, 12rem);
  max-width: 42ch;
}

.toolbar-field--stat {
  flex: 0 1 auto;
}

.toolbar-field--action {
  flex: 0 0 auto;
  align-self: flex-end;
}

.search-new-toolbar .search-field-40 {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.search-new-toolbar #btn-new {
  box-sizing: border-box;
}

.count-badge {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--select-bg);
  color: var(--text);
  white-space: nowrap;
  font-size: 0.95rem;
  text-align: center;
}

.count-badge--filtered {
  color: var(--label-color);
  font-weight: 500;
}

.count-badge--cert {
  border-left: 3px solid #15803d;
  padding-left: 0.5rem;
}

html[data-color-scheme='dark'] .count-badge--cert {
  border-left-color: #22c55e;
}

/* Comboboxes alinhadas na mesma linha que os botões */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  margin-bottom: 1rem;
}

.filters-row .filter-field {
  flex: 1 1 10rem;
  min-width: 9.5rem;
  max-width: 15rem;
  margin-bottom: 0;
  font-size: calc(0.9rem + 2pt);
}

.filters-row .filter-field select {
  width: 100%;
}

.filters-row .filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: min(100%, 22rem);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.table-wrap.tall {
  max-height: min(70vh, 720px);
  overflow-y: auto;
}

.entries.compact td {
  font-size: 0.85rem;
}

.entries td.td-https {
  text-align: center;
  min-width: 4.5rem;
}

.entry-https-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: #15803d;
}

html[data-color-scheme='dark'] .entry-https-lock {
  color: #22c55e;
}

.entry-https-pending-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: #a16207;
}

html[data-color-scheme='dark'] .entry-https-pending-icon {
  color: #fbbf24;
}

.certbot-error-dlg .certbot-err-summary {
  margin: 0.75rem 0;
  line-height: 1.45;
}

.certbot-err-summary-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.certbot-err-line-intro {
  margin: 0;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.certbot-err-line-host {
  margin: 0 0 0.35rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--label-color);
  word-break: break-all;
  line-height: 1.35;
}

.certbot-err-line-rest {
  margin: 0;
  text-align: left;
  color: var(--text);
  line-height: 1.5;
}

.certbot-error-dlg .certbot-err-actions {
  margin: 0.5rem 0 0.75rem;
}

.certbot-err-details-wrap.hidden {
  display: none;
}

.certbot-err-copy-bar {
  margin: 0 0 0.5rem;
}

.certbot-err-details {
  max-height: min(50vh, 420px);
  overflow: auto;
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-muted, #f4f4f5);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 6px;
}

html[data-color-scheme='dark'] .certbot-err-details {
  background: #18181b;
  border-color: #3f3f46;
}

.table-wrap-audit {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.audit-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

table.audit-table th,
table.audit-table td {
  white-space: nowrap;
  vertical-align: top;
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
}

table.audit-table td.audit-td-body {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.nowrap {
  white-space: nowrap;
}

.brand-block {
  text-align: center;
  margin-bottom: 1rem;
}

.modal.wide {
  max-width: 520px;
}

.edit-tls-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.65rem 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.edit-tls-row input[type='checkbox'] {
  margin-top: 0.2rem;
}

.dlg-cert-hint {
  font-size: 0.82rem;
  margin: 0.35rem 0 0.5rem;
}

.dlg-secondary-actions {
  margin: 0.5rem 0 0.75rem;
}

.dlg-secondary-actions button {
  font-size: 0.9rem;
}

.dlg-cert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cert-inspect-dlg .cert-inspect-intro {
  margin: 0 0 0.35rem;
}

.cert-inspect-path {
  font-size: 0.85rem;
  word-break: break-all;
}

.cert-inspect-pre {
  max-height: min(60vh, 520px);
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.75rem;
  background: var(--panel-bg, #f5f5f5);
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.filters.audit-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filters.audit-filters label {
  flex: 1 1 140px;
  margin-bottom: 0;
}

.settings-form {
  max-width: 420px;
}

#page-metrics .metrics-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 1rem;
}

#page-metrics .metrics-page-head h2 {
  margin-bottom: 0;
}

#page-metrics .metrics-hint-inline {
  margin: 0;
  flex: 1 1 16rem;
  max-width: none;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

#page-metrics .metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0.85rem 1rem;
}

/* 3 colunas em ecrã médio */
@media (min-width: 720px) {
  #page-metrics .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 4 colunas: gráficos mem / cpu / rede / disco na mesma linha em ecrã largo */
@media (min-width: 1100px) {
  #page-metrics .metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem 1.1rem;
  }
}

@media (min-width: 1600px) {
  #page-metrics .metrics-grid {
    gap: 1rem 1.35rem;
  }
}

#page-metrics .metric-card-proxy-row {
  grid-column: 1 / -1;
  max-width: min(100%, 44rem);
  width: 100%;
  justify-self: center;
  box-sizing: border-box;
}

.metrics-tls-summary {
  margin: 0;
}

.metrics-tls-lead {
  margin: 0 0 0.65rem;
  line-height: 1.45;
  color: var(--text);
}

.metrics-tls-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
}

table.metrics-tls-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.4;
  table-layout: auto;
}

table.metrics-tls-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--label-color);
  padding: 0.4rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: bottom;
  white-space: nowrap;
}

table.metrics-tls-table thead th:nth-child(3) {
  text-align: right;
}

table.metrics-tls-table tbody td {
  padding: 0.45rem 0.5rem 0.45rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  word-break: break-word;
}

table.metrics-tls-table tbody tr:last-child td {
  border-bottom: none;
}

.metrics-tls-col-url {
  font-weight: 600;
  color: var(--text);
}

.metrics-tls-col-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.metrics-tls-col-days {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text);
}

.metrics-tls-more {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Nginx + Access log: dois cartões lado a lado, tabelas chave/valor */
.metrics-proxy-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem 1rem;
  align-items: stretch;
}

@media (min-width: 720px) {
  .metrics-proxy-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#page-metrics .metric-card-proxy-table {
  padding: 0.65rem 0.75rem;
  min-width: 0;
}

#page-metrics .metric-card-proxy-table h3 {
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.metric-proxy-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.metric-kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.35;
}

table.metric-kv-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.28rem 0.65rem 0.28rem 0;
  vertical-align: top;
  width: 42%;
  border-bottom: 1px solid var(--border);
}

table.metric-kv-table td {
  padding: 0.28rem 0;
  vertical-align: top;
  word-break: break-word;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

table.metric-kv-table tr:last-child th,
table.metric-kv-table tr:last-child td {
  border-bottom: none;
}

table.metric-kv-table td.metric-proxy-error-cell {
  color: var(--text);
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--panel-bg);
}

.metric-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
}

.metric-card-wide {
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .metric-card-wide {
    grid-column: span 2;
  }
}

/* Métricas: cartões com gráfico mais compactos */
#page-metrics .metric-card:not(.metric-card-proxy-row) {
  padding: 0.65rem 0.75rem;
}

#page-metrics .metric-card:not(.metric-card-proxy-row) h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

#page-metrics .metric-card:not(.metric-card-proxy-row) .metric-summary {
  min-height: 2.2rem;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.metric-summary {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

#page-metrics .metric-summary {
  min-height: 2.75rem;
  word-break: break-word;
  color: var(--text);
}

.metric-chart-wrap {
  position: relative;
  height: 220px;
  width: 100%;
}

#page-metrics .metric-chart-wrap {
  height: 140px;
}

#view-app .app-footer {
  flex-shrink: 0;
}

.app-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--footer-muted);
  padding: 0.75rem 1rem 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.app-footer .footer-brand {
  font-size: inherit;
  font-weight: 600;
  color: var(--label-color);
}

.app-footer .footer-rest {
  font-size: inherit;
}

.app-footer .footer-rest a {
  color: var(--link);
  text-decoration: none;
}

.app-footer .footer-rest a:hover {
  text-decoration: underline;
}

.app-footer .footer-text {
  display: inline-block;
  max-width: 100%;
}

.app-footer .footer-tagline {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.92em;
  font-weight: 400;
  color: var(--footer-muted);
}

.cell-clip {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.audit-detail-modal {
  max-width: min(960px, 96vw);
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
}

.audit-detail-modal h3 {
  margin-top: 0;
}

.audit-detail-meta {
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.audit-detail-meta p {
  margin: 0.35rem 0;
  word-break: break-word;
}

.audit-pre-label {
  display: block;
  font-size: 0.82rem;
  margin: 0.5rem 0 0.35rem;
  color: var(--label-color);
}

.audit-pre {
  max-height: min(36vh, 320px);
  overflow: auto;
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  background: var(--pre-bg);
  border: 1px solid var(--pre-border);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
  color: var(--text);
}

.btn-inline {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.toolbar h1 {
  margin: 0;
}

/* Início — Cidades vs Corporativo + agrupamento por domínio */
.home-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.home-scope-tab {
  font: inherit;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
}

.home-scope-tab:hover {
  filter: brightness(0.97);
}

.home-scope-tab.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  font-weight: 600;
}

.entries-group-hint {
  margin: 0.35rem 0 0.75rem;
}

.entries-standalone-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--label-color);
}

.entry-domain-details {
  margin-bottom: 0.5rem;
  border: 1px solid var(--table-border);
  border-radius: 8px;
  background: var(--panel-bg);
  padding: 0 0.5rem;
}

.entry-domain-apex-cert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.35rem 0.35rem 0.65rem;
  border-bottom: 1px dashed var(--border);
}

.entry-domain-apex-hint {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.82rem;
}

.entry-domain-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.entry-domain-summary::-webkit-details-marker {
  display: none;
}

.entry-domain-title {
  font-weight: 600;
  color: var(--label-color);
}

.entry-domain-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.entry-domain-table-wrap {
  padding: 0 0 0.65rem 0.35rem;
}

.entries-nested {
  font-size: 0.92rem;
}

.entries-nested th,
.entries-nested td {
  padding: 0.35rem 0.5rem;
}

.settings-subtitle {
  margin: 1.25rem 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--label-color);
}

.settings-cert-delete-wrap {
  margin: 0.75rem 0;
  padding: 0.75rem 0;
  border-top: 1px dashed var(--border);
}
