/* Settings (Ajustes): only what the shared styles don't cover. Switches, rule rows, catalog coverage tiles, the report cover
   preview, SLA and glossary rows, and the audit detail. Tokens from styles.css; shared tables, facts and banners from modules.css. */

/* ---------- On/off switch drawn from a checkbox ---------- */
input[type=checkbox].st-switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 44px; height: 26px; margin: 0; border: 1px solid var(--control); border-radius: 99px; background: #0f2a3d; cursor: pointer; transition: background .15s, border-color .15s; }
input[type=checkbox].st-switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
input[type=checkbox].st-switch:checked { border-color: var(--accent); background: var(--accent); }
input[type=checkbox].st-switch:checked::before { transform: translateX(18px); background: var(--deep); }
input[type=checkbox].st-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.st-switches { display: flex; flex-direction: column; }
.st-switches.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.st-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.st-switches > .st-switch-row:first-child, .st-switches.two > .st-switch-row:nth-child(2) { border-top: 0; }
.st-switches.lined > .st-switch-row:first-child { border-top: 1px solid var(--line-soft); }
.field > .st-switch-row { min-height: 0; padding: 4px 0; border-top: 0; }
.st-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-text b { color: var(--ink); font-size: .9rem; font-weight: 600; }
.st-text small { font-size: .8rem; line-height: 1.45; }

/* ---------- Shared bits ---------- */
.st-seg { align-self: flex-start; }
.st-foot-start { margin-right: auto; }
/* Long tables scroll inside their frame (sticky header) instead of growing the page. */
.table-wrap.st-scroll { max-height: min(70vh, 860px); overflow-y: auto; scroll-padding-top: 44px; }
.table-wrap.st-scroll thead th { position: sticky; top: 0; z-index: 1; }
.st-when { white-space: nowrap; }
.st-when small { font: 11px var(--mono); }
.st-results { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-body > .st-calm-action { flex-wrap: wrap; }
.st-row-actions { gap: 6px; justify-content: flex-end; }
/* The "this device" notice, shown only when no server is answering. */
.st-local { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--gap); border-left: 3px solid var(--accent); }
.st-local h3 { font-size: 1rem; }
.st-local p { margin: 0; }

.st-wiz { display: flex; flex-direction: column; gap: 16px; }
.st-sub { margin: 18px 0 4px; color: var(--accent); font-size: .85rem; }

/* ---------- Company: colour field and report cover preview ---------- */
.st-color-row { display: flex; align-items: center; gap: 12px; }
input[type=color].st-color { flex: none; width: 64px; min-width: 64px; height: 44px; padding: 4px; cursor: pointer; }
.st-brand { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--gap); align-items: center; }
.st-brand-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* The preview is a sheet of paper (reports print on white), so dark logos stay visible. */
.st-cover { display: flex; flex-direction: column; gap: 14px; min-height: 190px; padding: 16px 18px 12px; border-top: 6px solid #1f4e79; border-radius: var(--radius-sm); background: #f4f7fa; color: #1c2935; }
.st-cover-logo { display: block; max-width: 150px; height: 44px; object-fit: contain; object-position: left center; }
.st-cover-nologo { display: grid; place-items: center; width: 110px; height: 44px; border: 1px dashed #b9c6d3; border-radius: 6px; color: #6a7b8b; font-size: .72rem; }
.st-cover-title { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.st-cover-title b { font-size: 1rem; }
.st-cover-title span { color: #4b5d6e; font-size: .78rem; }
.st-cover small { min-height: 1.7em; padding-top: 8px; border-top: 1px solid #d3dce5; color: #66788a; font-size: .68rem; }

/* ---------- Modules: catalog coverage tiles ---------- */
.st-cov { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.st-cov-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid #3a5a72; border-radius: var(--radius-sm); background: #071827; }
.st-cov-tile.included { border-left-color: var(--good); }
.st-cov-tile.local { border-left-color: var(--accent); }
.st-cov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-cov-id { color: var(--muted); font: 11px var(--mono); letter-spacing: .06em; flex: none; white-space: nowrap; }
.st-cov-head .badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-cov-tile b { min-height: 2.7em; font-size: .84rem; font-weight: 600; line-height: 1.35; }

/* ---------- Policies: SLA rows ---------- */
.st-sla { display: flex; flex-direction: column; }
.st-sla-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.st-sla-row:first-child { padding-top: 0; border-top: 0; }
.st-days { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.st-days input[type=number] { width: 96px; min-height: 38px; padding: 6px 10px; text-align: right; }

/* ---------- Fields: groups and glossary rows ---------- */
.st-group { display: flex; flex-direction: column; gap: 8px; }
.st-group h3 { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: .85rem; }
.st-gloss { display: flex; flex-direction: column; gap: 8px; }
.st-gloss-head, .st-gloss-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.st-gloss-head { color: var(--muted); font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.st-gloss:not(:has(.st-gloss-row)) .st-gloss-head, .st-gloss:not(.open) .st-extra { display: none; }
.st-gloss-row input:not([type=checkbox]) { min-height: 38px; padding: 6px 10px; font-size: .88rem; }
.st-gloss-empty { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: .9rem; text-align: center; }

/* ---------- Automation: rule rows ---------- */
.st-rules { display: flex; flex-direction: column; }
.st-rule { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.st-rule:first-child { padding-top: 0; border-top: 0; }
.st-rule > .st-text { flex: 1; }
.st-rule-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.st-rule-actions .st-switch { margin-left: 8px; }

/* ---------- Integrations ---------- */
.st-copy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-copy code { font-size: .95rem; }
.st-notes { display: flex; flex-direction: column; gap: 4px; padding-left: 18px; color: var(--muted); font-size: .85rem; }
.st-url { font: 600 .85rem var(--mono); overflow-wrap: anywhere; }
.st-method { display: inline-block; min-width: 58px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent); font: 11px/1.5 var(--mono); text-align: center; }
.st-m-post { border-color: #2b6b5d; color: var(--good); }
.st-m-put { border-color: #6b5a39; color: var(--warn); }
.st-m-delete { border-color: #774153; color: var(--bad); }
.st-secret:not(:focus) { -webkit-text-security: disc; }

/* ---------- Data: system health ---------- */
.st-kv { display: flex; flex-direction: column; margin: 0; }
.st-kv > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: .85rem; }
.st-kv dt { color: var(--muted); }
.st-kv dd { min-width: 0; margin: 0; }
.st-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.st-counts b { color: var(--ink); font-weight: 600; }
.st-error-line { display: block; color: var(--bad); font: 12px var(--mono); }
.st-path { display: flex; align-items: center; gap: 6px; }
.st-path code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-formats { display: block; margin-top: 2px; font: 11px var(--mono); }

/* ---------- Audit ---------- */
.st-filters { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 10px; min-width: 0; }
.banner.st-ok { border-color: #2b6b5d; border-left-color: var(--good); background: #0b2a27; }
.st-banner-text { display: flex; flex-direction: column; gap: 2px; }
.st-banner-text .muted { font-size: .82rem; }
.st-change { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); font-size: .88rem; }
.st-diff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.st-diff > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-diff small { font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.st-hash { margin-top: 16px; }

@media (min-width: 721px) {
  .st-audit-table .dtable td:first-child { width: 1%; white-space: nowrap; }
  .st-trash-table .dtable td:last-child { width: 1%; }
  .st-trash-table .st-row-actions { flex-wrap: nowrap; }
  /* Field groups share column widths so the tables line up. */
  .st-fields-table .dtable { table-layout: fixed; }
  .st-fields-table th:nth-child(1) { width: 38%; } .st-fields-table th:nth-child(2) { width: 14%; }
  .st-fields-table th:nth-child(3) { width: 34%; } .st-fields-table th:nth-child(4) { width: 14%; }
}
@media (max-width: 720px) {
  .st-switches.two { grid-template-columns: 1fr; }
  .st-switches.two > .st-switch-row:nth-child(2) { border-top: 1px solid var(--line-soft); }
  .st-rule { flex-wrap: wrap; gap: 10px; }
  .st-rule-actions { width: 100%; }
  .st-rule-actions .st-switch { margin-left: auto; }
  .st-cov { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-brand { grid-template-columns: 1fr; }
  .st-diff { grid-template-columns: 1fr; }
  .st-kv > div { grid-template-columns: 1fr; gap: 2px; }
  .st-row-actions { flex-wrap: wrap; }
  .st-filters select { flex: 1 1 100%; }
  /* Compact rows on phones instead of label/value cards. Audit: time and action, the item, then who (entity and
     fields are in the detail). Endpoints: path and method, then the description. */
  .st-audit-table .dtable tr, .st-endpoints .dtable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
  .st-audit-table .dtable td, .st-endpoints .dtable td { display: block; width: auto; margin: 0; padding: 0; border: 0; }
  .st-audit-table .dtable td::before, .st-endpoints .dtable td::before { display: none; }
  .st-audit-table .dtable td:nth-child(1), .st-endpoints .dtable td:nth-child(1) { grid-area: 1 / 1; width: auto; margin: 0; padding: 0; border: 0; }
  .st-audit-table .dtable td:nth-child(3), .st-endpoints .dtable td:nth-child(2) { grid-area: 1 / 2; }
  .st-audit-table .dtable td:nth-child(5) { grid-area: 2 / 1 / 3 / 3; }
  .st-audit-table .dtable td:nth-child(2) { grid-area: 3 / 1 / 4 / 3; color: var(--muted); font-size: .78rem; }
  .st-audit-table .dtable td:nth-child(4), .st-audit-table .dtable td:nth-child(6) { display: none; }
  .st-endpoints .dtable td:nth-child(3) { grid-area: 2 / 1 / 3 / 3; color: var(--muted); font-size: .82rem; }
}
