/* The monitoring panel (§193): the holding's brand, right to left, light and dark */
@font-face { font-family: "IRANYekanX"; src: url("/static/fonts/IRANYekanX-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IRANYekanX"; src: url("/static/fonts/IRANYekanX-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --brand: #1446aa;          /* Main Blue */
  --brand-ink: #0d3585;
  --brand-soft: #e8eefb;
  --page: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --line: #dfe6f0;
  --fg: #000d31;             /* Grayish Blue 9 */
  --fg-2: #496483;           /* Grayish Blue 5, 6.1:1 on white */
  --ok: #1f7a4d;
  --ok-soft: #e3f4ea;
  --warn: #886b1d;
  --warn-soft: #faf2dc;
  --bad: #b03030;
  --bad-soft: #fbe7e7;
  --series-1: #1446aa;
  --series-2: #c08a00;
  --grid: #e6ebf2;
  --logo-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8fb1ff;
    --brand-ink: #b9cdff;
    --brand-soft: #1b2a4d;
    --page: #0b1220;
    --surface: #121b2e;
    --surface-2: #17223a;
    --line: #26324b;
    --fg: #e8eefb;
    --fg-2: #a9b8d3;
    --ok: #6fd3a0;
    --ok-soft: #12321f;
    --warn: #e8c76a;
    --warn-soft: #33290f;
    --bad: #ff9b9b;
    --bad-soft: #3a1717;
    --series-1: #8fb1ff;
    --series-2: #e8c76a;
    --grid: #1f2a42;
    --logo-filter: brightness(0) invert(1);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* A rule of ours with display would otherwise beat the hidden attribute */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "IRANYekanX", Tahoma, sans-serif;
  background: var(--page);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.8;
  overflow-x: clip;
}
button, a.ghost {
  font: inherit; font-size: 14px; font-weight: 700;
  min-height: 40px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
@media (prefers-color-scheme: dark) { button { color: #0b1220; } }
button.ghost, a.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button[disabled] { opacity: .5; cursor: default; }

.muted { color: var(--fg-2); font-size: 13px; }
.logo { height: 35px; width: auto; filter: var(--logo-filter); }

/* header: the brand line on top, then the bar and the tabs */
.top { background: var(--surface); border-top: 6px solid var(--brand); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 12px; padding: 10px 16px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.title { font-weight: 700; font-size: 17px; color: var(--brand); }
.grow { flex: 1; }
.live { font-size: 13px; color: var(--ok); }
.live.stale { color: var(--bad); }
.tabs { display: flex; gap: 4px; padding: 0 16px; max-width: 1200px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: transparent; color: var(--fg-2); border-radius: 0; border-bottom: 3px solid transparent; padding: 0 12px; flex: none; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

.page { max-width: 1200px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.page > section { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 17px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--fg-2); border-radius: 0; min-height: 34px; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }

/* status cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.target { border-inline-start: 6px solid var(--ok); }
.target.down { border-inline-start-color: var(--bad); }
.target.slow { border-inline-start-color: var(--warn); }
.target .state { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); flex: none; }
.down .dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.slow .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.fact b { display: block; font-size: 18px; }
.fact span { font-size: 12px; color: var(--fg-2); }

.banner { border-radius: 12px; padding: 12px 16px; font-weight: 700; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* the chart */
.chart { width: 100%; min-height: 220px; position: relative; }
.chart svg { display: block; max-width: 100%; }
.chart .axis { fill: var(--fg-2); font-size: 11px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .fail { fill: var(--bad); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); }
.legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-inline-end: 6px; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--fg); color: var(--surface); font-size: 12px; border-radius: 8px; padding: 6px 10px; white-space: pre; }

/* tables: scroll inside their card, never the page */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); font-size: 12px; color: var(--fg-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.bar { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--bad-soft); vertical-align: middle; margin-inline-start: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.pill { display: inline-block; border-radius: 999px; padding: 0 10px; font-size: 12px; font-weight: 700; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }

.report, .event-text { white-space: pre-wrap; margin: 0; font: inherit; font-size: 14px; }
.events { display: flex; flex-direction: column; gap: 10px; }
.event { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.event .when { font-size: 12px; color: var(--fg-2); }
.empty { color: var(--fg-2); text-align: center; padding: 32px; background: var(--surface); border-radius: 16px; border: 1px dashed var(--line); }
.code { font-size: 22px; font-weight: 700; letter-spacing: 3px; direction: ltr; display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 4px 14px; }

/* sign-in page */
body.signin { display: grid; place-items: center; min-height: 100vh; padding: 16px; border-top: 6px solid var(--brand); }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; max-width: 460px; text-align: center; }
.signin-card h1 { font-size: 20px; color: var(--brand); }

@media (max-width: 599px) {
  .page { padding: 12px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .title { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
