/* JARABOT Status: one stylesheet for the public page and the admin. No framework. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #111827;
  --radius: 10px;
  --operational: #16a34a;
  --maintenance: #2563eb;
  --degraded: #ca8a04;
  --partial_outage: #ea580c;
  --major_outage: #dc2626;
  /* Darker shades for white text on them (the banner) and for status text on light surfaces: 4.5:1 or more. */
  --operational-strong: #15803d;
  --maintenance-strong: #1d4ed8;
  --degraded-strong: #a16207;
  --partial_outage-strong: #c2410c;
  --major_outage-strong: #b91c1c;
  --operational-text: var(--operational-strong);
  --maintenance-text: var(--maintenance-strong);
  --degraded-text: var(--degraded-strong);
  --partial_outage-text: var(--partial_outage-strong);
  --major_outage-text: var(--major_outage-strong);
  --none: #d1d5db;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #2a2f38;
    --accent: #e5e7eb;
    --none: #3a404a;
    --operational-text: #4ade80;
    --maintenance-text: #93c5fd;
    --degraded-text: #facc15;
    --partial_outage-text: #fb923c;
    --major_outage-text: #f87171;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; font-size: 16px; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }

.container { max-width: 860px; margin: 0 auto; padding: 0 1rem; }
.container--wide { max-width: 1200px; }
.section { margin: 1.5rem 0; }
.narrow { max-width: 520px; margin: 2rem auto; }

/* Header and footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: 60px; flex-wrap: wrap; padding: .75rem 1rem; }
.brand { text-decoration: none; display: flex; gap: .4rem; align-items: baseline; font-size: 1.1rem; }
.brand__mark { font-weight: 800; letter-spacing: .06em; }
.brand__name { color: var(--muted); }
.site-nav { display: flex; gap: 1rem; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--text); }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .85rem; padding-top: 1rem; padding-bottom: 2rem; border-top: 1px solid var(--border); margin-top: 2rem; flex-wrap: wrap; }

.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav__link { text-decoration: none; padding: .35rem .6rem; border-radius: 6px; color: var(--muted); }
.nav__link:hover { color: var(--text); background: var(--bg); }
.nav__link--active { color: var(--text); background: var(--bg); font-weight: 600; }
.whoami { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.card__header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

/* Statuses */
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--none); flex: none; }
.dot--operational { background: var(--operational); }
.dot--maintenance { background: var(--maintenance); }
.dot--degraded { background: var(--degraded); }
.dot--partial_outage { background: var(--partial_outage); }
.dot--major_outage { background: var(--major_outage); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.badge--operational { color: var(--operational-text); }
.badge--maintenance { color: var(--maintenance-text); }
.badge--degraded { color: var(--degraded-text); }
.badge--partial_outage { color: var(--partial_outage-text); }
.badge--major_outage { color: var(--major_outage-text); }
.badge--none { color: var(--muted); }

.overall { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.5rem; border-radius: var(--radius); color: #fff; background: var(--operational-strong); }
.overall h1 { margin: 0; font-size: 1.35rem; }
.overall .dot { background: #fff; width: .9rem; height: .9rem; }
.overall--maintenance { background: var(--maintenance-strong); }
.overall--degraded { background: var(--degraded-strong); }
.overall--partial_outage { background: var(--partial_outage-strong); }
.overall--major_outage { background: var(--major_outage-strong); }

/* Components and uptime */
.component { padding: 1rem 0; border-top: 1px solid var(--border); }
.component:first-of-type { border-top: none; }
.component__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .5rem; }
.uptime__bars { display: flex; gap: 2px; height: 32px; }
.uptime__bar { flex: 1; border-radius: 2px; background: var(--operational); min-width: 0; }
.uptime__bar--maintenance { background: var(--maintenance); }
.uptime__bar--degraded { background: var(--degraded); }
.uptime__bar--partial_outage { background: var(--partial_outage); }
.uptime__bar--major_outage { background: var(--major_outage); }
.uptime__bar--none { background: var(--none); }
.uptime__legend { display: flex; justify-content: space-between; margin-top: .25rem; gap: .5rem; }
.uptime__from--30 { display: none; }
@media (max-width: 600px) {
  .uptime__bar:nth-child(-n+60) { display: none; }
  .uptime__from--90 { display: none; }
  .uptime__from--30 { display: inline; }
}

/* Incidents */
.incident { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--operational); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem; }
.incident--maintenance { border-left-color: var(--maintenance); }
.incident--degraded { border-left-color: var(--degraded); }
.incident--partial_outage { border-left-color: var(--partial_outage); }
.incident--major_outage { border-left-color: var(--major_outage); }
.incident__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.incident__header h3, .incident__header h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.incident__header a { text-decoration: none; }
.incident__header a:hover { text-decoration: underline; }
.incident__latest { color: var(--muted); }
.incident-detail { border-left-width: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem 1.5rem; margin: 1rem 0; }
.facts dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .35rem; margin: 0 .5rem .25rem 0; }

.timeline { list-style: none; padding: 0; margin: .5rem 0 0; }
.timeline__item { padding: .75rem 0 .75rem 1rem; border-left: 2px solid var(--border); position: relative; }
.timeline__item::before { content: ""; position: absolute; left: -6px; top: 1.1rem; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.timeline__item:first-child::before { background: var(--text); }
.timeline__meta { font-size: .85rem; color: var(--muted); }
.timeline__meta strong { color: var(--text); }
.timeline__body p:last-child { margin-bottom: 0; }

/* Forms */
.form .field, .field { margin-bottom: 1rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1 1 200px; }
label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .65rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-size: .8rem; margin: .25rem 0 0; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }
.actions { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }
.inline-form input { flex: 1; }
details summary { cursor: pointer; color: var(--muted); margin: .5rem 0; }
.component-select__row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 400; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.component-select__row select { width: auto; min-width: 12rem; }

.button { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid var(--accent);
  background: var(--accent); color: var(--surface); padding: .5rem 1rem; border-radius: 6px; line-height: 1.2; }
.button:hover { opacity: .9; }
.button--small { padding: .3rem .6rem; font-size: .85rem; }
.button--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button--danger { background: transparent; color: var(--major_outage); border-color: var(--major_outage); }

.subscribe__form { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.subscribe__form input[type=email] { flex: 1 1 240px; width: auto; }

/* The Turnstile check after "Odebírat" */
.dialog { width: min(24rem, calc(100vw - 2rem)); padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgb(0 0 0 / .5); }
.dialog h2 { margin-top: 0; }
.dialog__widget { display: flex; justify-content: center; min-height: 65px; margin: 1rem 0; }
.dialog__error { color: var(--major_outage-text); }
.dialog__actions { display: flex; justify-content: flex-end; margin: 0; }

/* Flash, tables, misc */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); }
.flash--notice { border-left: 4px solid var(--operational); }
.flash--alert { border-left: 4px solid var(--major_outage); }
.table { width: 100%; border-collapse: collapse; padding: 0; overflow: hidden; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table__actions { text-align: right; white-space: nowrap; }
.table__actions form, .table__actions a { margin-left: .25rem; }
.table td code { overflow-wrap: anywhere; }
.pagination { display: flex; justify-content: space-between; gap: 1rem; margin: 1rem 0; }
.code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .75rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.token-reveal { border-color: var(--operational); margin-bottom: 1.5rem; }

/* Phones */
@media (max-width: 600px) {
  .site-header { margin-bottom: 1rem; }
  .site-header__inner { min-height: 0; }
  .brand { font-size: 1rem; }
  .site-nav { gap: .75rem; font-size: .95rem; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .overall { padding: 1rem 1.1rem; }
  .overall h1 { font-size: 1.15rem; }
  .incident { padding: .9rem 1rem; }
  .incident__header { flex-wrap: wrap; gap: .5rem; }

  /* Admin: name and logout on the first row, the menu one scrollable row below. */
  .site-header--admin .whoami { order: 2; }
  .site-header--admin .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav__link { white-space: nowrap; }
}

/* Admin tables become one card per row on narrow screens. */
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table.card { padding: 0; }
  .table tr { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: none; }
  .table td, .table tr:last-child td { padding: .1rem 0; border: none; }
  .table__actions { text-align: left; white-space: normal; padding-top: .5rem !important; }
  .table__actions form, .table__actions a { margin: 0 .25rem .25rem 0; }
  .component-select__row { flex-wrap: wrap; gap: .25rem; }
  .component-select__row select { width: 100%; min-width: 0; }
  .inline-form { flex-wrap: wrap; }
}
