:root {
  --background: #ffffff;
  --surface: #ffffff;
  --foreground: #171717;
  --muted: #5f6368;
  --border: #d9dbdf;
  --accent: #171717;
  --accent-text: #ffffff;
  --danger: #c5221f;
  --danger-text: #ffffff;
  --danger-soft: rgba(197, 34, 31, 0.1);
  --amber: #b06000;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --success-soft: rgba(30, 142, 62, 0.12);
  --success: #1e8e3e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --surface: #111214;
    --foreground: #ededed;
    --muted: #a1a5ab;
    --border: #2c2e33;
    --accent: #ededed;
    --accent-text: #0a0a0a;
    --danger: #ea4335;
    --danger-text: #ffffff;
    --amber: #fbbc04;
    --success: #5bb974;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: clamp(1rem, calc(0.40625rem + min(1.3vh, 0.8vw)), 1.5rem); }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: Arial, Helvetica, sans-serif; line-height: 1.45; }
a { color: inherit; text-underline-offset: 4px; }
h1 { font-size: 1.6rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: 0.02em; }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-box { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-footer { display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.9rem; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

.account-page { max-width: 42rem; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.field input, .field select { font: inherit; font-size: 1rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); color: var(--foreground); width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--foreground); outline-offset: 1px; }

.button { font: inherit; font-size: 0.95rem; padding: 0.6rem 1rem; border-radius: 0.5rem; border: 1px solid var(--border); background: transparent; color: var(--foreground); cursor: pointer; }
.button:disabled { opacity: 0.55; cursor: default; }
.button-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button-danger { background: var(--danger); color: var(--danger-text); border-color: var(--danger); }
.button-wide { width: 100%; }

.alert { border-radius: 0.5rem; padding: 0.7rem 0.9rem; font-size: 0.92rem; border: 1px solid; }
.alert-error { background: var(--danger-soft); border-color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: var(--success); }
.alert-amber { background: var(--amber-soft); border-color: var(--amber); }
.alert-info { border-color: var(--border); }

.card { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.confirm-panel { border: 1px solid var(--danger); border-radius: 0.5rem; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.75rem; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li { padding: 0.8rem 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.6rem; }
.list > li:first-child { border-top: 0; padding-top: 0; }
.tag { font-size: 0.75rem; border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.5rem; color: var(--muted); }
.language-choice { display: flex; gap: 0.5rem; }
.link-button { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.link-button[aria-current='true'] { font-weight: 700; text-decoration: none; }

@media (pointer: coarse) {
  .button, .field input, .field select { min-height: 2.75rem; }
}

.monitor-page { max-width: 76rem; margin: 0 auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.monitor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
/* On a phone the events come right after the applications: they are why you open this page. */
@media (max-width: 800px) {
  .monitor-grid { grid-template-columns: minmax(0, 1fr); }
  .monitor-grid > .stack { display: contents; }
  monitor-event-types-card { order: 1; }
}
.button-link { display: block; text-align: center; text-decoration: none; }
.row-tight { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--muted); flex: none; }
.dot-connected { background: var(--success); }
.dot-disconnected { background: var(--danger); }
.dot-webhook { background: var(--amber); }
.live-status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--amber); }
.live-status-on { color: var(--success); }
.live-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.live-status-on .live-dot { animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: 0.35; } }
.event-head { font: inherit; color: inherit; background: none; border: 0; padding: 0; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; text-align: left; }
.event-seq { min-width: 2.5rem; font-variant-numeric: tabular-nums; }
.event-type { font-weight: 600; overflow-wrap: anywhere; }
.event-time { margin-left: auto; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.event-subject { overflow-wrap: anywhere; }
.event-data { margin: 0; padding: 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.85rem; overflow-x: auto; }
.event-row-new { animation: event-in 1.2s ease-out; }
@keyframes event-in { from { background: var(--success-soft); } }
@media (prefers-reduced-motion: reduce) { .live-status-on .live-dot, .event-row-new { animation: none; } }
