/* Satori Portal test site (issue 986). No external fonts or images: the CSP allows 'self' only. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #5f6b7a;
  --line: #d9dee5;
  --accent: #2f6fdb;
  --accent-soft: #dce7fb;
  --ok: #1f7a3f;
  --ok-soft: #e3f4e9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --warn-soft: #fff4d6;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --panel: #1d2128;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --line: #333a44;
    --accent: #7aa7ff;
    --accent-soft: #24324d;
    --ok: #6fd08f;
    --ok-soft: #1b3324;
    --bad: #ff8a80;
    --bad-soft: #3d2120;
    --warn-soft: #3a3220;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[hidden] {
  display: none !important;
}

h1 {
  margin: 0;
  font-size: 18px;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

h3 {
  margin: 20px 0 6px;
  font-size: 14px;
}

h4 {
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--muted);
}

button {
  font: inherit;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.link {
  padding: 2px 8px;
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
}

input,
select {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.tag {
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--warn-soft);
  font-size: 12px;
}

.who {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  color: var(--muted);
}

.status {
  margin: 12px 20px 0;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--accent-soft);
}

.status:empty {
  display: none;
}

.status.error {
  background: var(--bad-soft);
  color: var(--bad);
}

.status.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

main,
#signed-out {
  margin: 16px 20px 40px;
}

.panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.note {
  color: var(--muted);
  font-size: 12px;
}

.error {
  color: var(--bad);
}

.scope {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.scope label,
.explorer-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}

/* KPI tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.tile {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.tile.unavailable {
  background: var(--warn-soft);
}

.tile-label {
  color: var(--muted);
  font-size: 12px;
}

.tile-value {
  font-size: 22px;
  font-weight: 600;
}

.tile-sub,
.tile-id {
  font-size: 12px;
  color: var(--muted);
}

.tile-id {
  font-family: var(--mono);
  font-size: 11px;
}

.tile-availability {
  margin: 4px 0;
  font-weight: 600;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

/* Weekly bars: the bar height is set from the script through the CSSOM. */

.bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  overflow-x: auto;
}

.bar-column {
  display: flex;
  flex: 1 0 44px;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.bar-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 140px;
  background: var(--bg);
  border-radius: 3px;
}

.bar {
  width: 100%;
  min-height: 1px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

.bar-null {
  background: transparent;
}

.bar-value,
.bar-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Usage by domain: horizontal bars, width set through the CSSOM. */

.hbar-row {
  display: grid;
  grid-template-columns: 130px 1fr 170px;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.hbar-track {
  height: 14px;
  background: var(--bg);
  border-radius: 3px;
}

.hbar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.hbar-value {
  font-size: 12px;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  color: var(--muted);
}

.num {
  text-align: right;
}

.th-availability {
  font-weight: normal;
}

/* Explorer */

.explorer-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.explorer-form .grow {
  flex: 1 1 360px;
}

.explorer-form .grow input {
  width: 100%;
  font-family: var(--mono);
}

.explorer-form .inline {
  flex-direction: row;
  align-items: center;
}

.explorer-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.checks td.pass {
  color: var(--ok);
  font-weight: 600;
}

.checks td.fail {
  color: var(--bad);
  font-weight: 600;
}

.checks tbody tr {
  cursor: pointer;
}

.calls {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) 3fr;
  gap: 12px;
}

.calls-list {
  max-height: 520px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.call-button {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.call-status {
  min-width: 34px;
  font-weight: 600;
}

.call.ok .call-status {
  color: var(--ok);
}

.call.failed .call-status {
  color: var(--bad);
}

.call-url {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.call-detail {
  min-width: 0;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

pre.json {
  max-height: 360px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  background: var(--bg);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .calls {
    grid-template-columns: 1fr;
  }

  .hbar-row {
    grid-template-columns: 90px 1fr;
  }

  .hbar-value {
    grid-column: 2;
  }
}
