/* Page styles. Colors come from the theme tokens in theme.css only; the
   border color below is derived from them. No gradients, no shadows, no
   animation. */

:root {
  --line: color-mix(in srgb, var(--text) 16%, var(--page));
  --line-strong: color-mix(in srgb, var(--text) 32%, var(--page));
  --wash: color-mix(in srgb, var(--text) 5%, var(--page));
  --gap: 1.25rem;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

::selection { background: var(--selection); }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.75rem; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }

main {
  flex: 1;
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
main > section { margin-bottom: 2.25rem; }

/* Header and footer */
.site-header,
.site-footer {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}
.site-header { border-bottom: 1px solid var(--line); padding-bottom: 0.75rem; }
.site-title { font-size: 1.25rem; font-weight: 600; margin: 0; color: var(--text); text-decoration: none; }
a.site-title:hover { text-decoration: underline; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; font-size: 0.9375rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8125rem; }
.theme-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.palette-select { max-width: 11rem; }

/* Forms */
form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 0.875rem; }
.stack > label,
.inline-fields > label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9375rem; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 0.75rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; align-items: end; }
.fields > label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9375rem; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; padding-bottom: 0.4rem; }
.hint { color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

input,
select,
textarea,
button {
  font: inherit;
  color: var(--text);
  background: var(--page);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  min-width: 0;
}
input[type="checkbox"] { padding: 0; accent-color: var(--accent); }
input,
textarea { width: 100%; }
.inline-fields input { width: auto; }
.inline-fields input[type="number"] { width: 6rem; }
.fields input[type="number"] { width: 100%; }
textarea { resize: vertical; }
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  cursor: pointer;
  background: var(--accent);
  color: var(--page);
  border-color: var(--accent);
}
button:hover { opacity: 0.88; }
button:disabled { cursor: default; opacity: 0.55; }
button.secondary,
.theme-toggle {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  text-decoration: none;
}
button.link:hover { color: var(--text); text-decoration: underline; opacity: 1; }

.form-error {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.form-error:empty { display: none; }
.notice {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
.notice h2 { margin-bottom: 0.5rem; }
.panel { border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; margin-top: 2rem; }
.panel.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }
.panel h1,
.panel h2 { margin-bottom: 1rem; }
.mono,
pre,
#invite-link { font-family: var(--mono); font-size: 0.875rem; }

/* Banner: plain text, line breaks kept. */
.banner {
  white-space: pre-line;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.banner[data-severity="warning"] { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.banner[data-severity="error"] { color: var(--error); background: var(--error-bg); border-color: var(--error-border); }
.banner-meta { display: block; white-space: normal; font-size: 0.8125rem; opacity: 0.85; margin-top: 0.375rem; }

/* Status */
.summary { font-size: 1.125rem; font-weight: 600; margin-bottom: 1.5rem; }
.summary[data-status="UP"] { color: var(--up); }
.summary[data-status="DOWN"] { color: var(--down); }
.summary[data-status="UNKNOWN"] { color: var(--unknown); }
.empty { color: var(--muted); }
.group { margin-bottom: 1.75rem; }
.group-title { color: var(--muted); font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); padding-bottom: 0.375rem; }
.monitors { list-style: none; margin: 0; padding: 0; }
.monitor { padding: 0.875rem 0; border-bottom: 1px solid var(--line); }
.monitor:last-child { border-bottom: 0; }
.monitor.removed { opacity: 0.6; }
.monitor-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin-bottom: 0.5rem; }
.monitor-name { font-weight: 600; overflow-wrap: anywhere; }
.monitor-name a { color: var(--text); text-decoration: none; }
.monitor-name a:hover { text-decoration: underline; }
.monitor-status { font-size: 0.875rem; font-weight: 600; }
.monitor-status[data-status="UP"] { color: var(--up); }
.monitor-status[data-status="DOWN"] { color: var(--down); }
.monitor-status[data-status="UNKNOWN"] { color: var(--unknown); }
.monitor-meta { color: var(--muted); font-size: 0.8125rem; margin-top: 0.25rem; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 0.5rem;
}
.note { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.back { font-size: 0.875rem; }

/* Day bars */
.bars { display: block; width: 100%; height: 1.5rem; }
.bar-up { fill: var(--up); }
.bar-down { fill: var(--down); }
.bar-nodata { fill: var(--nodata); }

/* Facts */
.facts { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0 0 0.75rem; }
.facts > div { display: flex; gap: 0.375rem; font-size: 0.875rem; min-width: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.watch-status { border: 1px solid var(--line); border-radius: 4px; padding: 0.625rem 0.875rem; margin-bottom: 1.5rem; }
.watch-status .facts { margin: 0; }
.watch-error { color: var(--error); font-size: 0.875rem; margin: 0.5rem 0 0; overflow-wrap: anywhere; }

/* Errors and definitions */
details.failure { margin-top: 0.5rem; font-size: 0.875rem; }
details.failure summary { cursor: pointer; color: var(--down); overflow-wrap: anywhere; }
pre {
  margin: 0.5rem 0;
  padding: 0.625rem 0.75rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Monitor page */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-bottom: 0.75rem; font-size: 0.9375rem; }
.tabs a { color: var(--muted); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 0.3em; }
.chart-figure { margin: 0 0 0.5rem; }
.chart { display: block; width: 100%; height: 7.5rem; border: 1px solid var(--line); border-radius: 4px; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-max { fill: var(--nodata); }
.chart-line { fill: none; stroke: var(--text); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--text); }
figcaption { color: var(--muted); font-size: 0.8125rem; margin-top: 0.375rem; }
.table-scroll { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th,
td { text-align: left; padding: 0.375rem 0.75rem 0.375rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
.period[data-status="UP"] td:first-child { color: var(--up); }
.period[data-status="DOWN"] td:first-child { color: var(--down); }
.period[data-status="UNKNOWN"] td:first-child { color: var(--unknown); }
.period[data-status="NODATA"] td:first-child { color: var(--muted); }
.failures { list-style: none; margin: 0; padding: 0; }
.failure-item { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.failure-head { font-size: 0.875rem; overflow-wrap: anywhere; }

/* Settings, account, users */
.monitor-settings { border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.monitor-settings h3 { margin: 0; overflow-wrap: anywhere; }
.group-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; margin-bottom: 0.75rem; }
.group-row .inline-fields { margin: 0; }
.passkeys,
.users { list-style: none; margin: 0 0 1rem; padding: 0; }
.passkey,
.user { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.passkey-label,
.user-head { font-weight: 600; overflow-wrap: anywhere; }
.passkey-meta,
.user-meta { color: var(--muted); font-size: 0.8125rem; flex: 1 1 12rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
#invite-link { width: 100%; }

@media (max-width: 36rem) {
  main { padding-top: 1rem; }
  .panel.narrow { margin-top: 1rem; }
  .site-header,
  .site-footer { flex-direction: column; align-items: flex-start; }
  .facts { flex-direction: column; }
}
