/*
 * Workloom status — the design canvas's "Status page" artboards (All clear,
 * Active incident, Maintenance and subscribe, Incident write-up), to the pixel
 * where the canvas gives one. Light only, as drawn.
 */
:root {
    --ground: #FBF8F2;
    --card: #FFFFFF;
    --soft: #F6F6F3;
    --seg: #EDEDE8;
    --ink: #16181F;
    --text: #3C3F4B;
    --muted: #5D6172;
    --hint: #818698;
    --line: #1A1C2414;
    --line-strong: #1A1C2433;
    --link: #4450BE;
    --link-hover: #353F9E;
    --ok: #0C8A5C;
    --degraded: #B7791F;
    --partial: #C2410C;
    --major: #BF3932;
    --maint: #4450BE;
    --unknown: #5D6172;
    --nodata: #E4E2DA;
    --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ground);
    color: var(--text);
    font: 400 14px/1.45 Archivo, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
button { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1072px; margin: 0 auto; padding: 0 16px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* States: anything carrying data-state takes its colour from here. */
[data-state="operational"] { --s: var(--ok); }
[data-state="degraded"] { --s: var(--degraded); }
[data-state="partial_outage"] { --s: var(--partial); }
[data-state="major_outage"] { --s: var(--major); }
[data-state="maintenance"] { --s: var(--maint); }
[data-state="unknown"] { --s: var(--unknown); }
[data-state="no_data"] { --s: var(--nodata); }

/* The woven thread along the top: 24 px blocks in six threads. */
.weave {
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='144' height='10'%3E%3Crect width='24' height='10' fill='%2314B8A6'/%3E%3Crect x='4' y='2' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3Crect x='24' width='24' height='10' fill='%23F59E0B'/%3E%3Crect x='28' y='4' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3Crect x='48' width='24' height='10' fill='%23EC4899'/%3E%3Crect x='52' y='2' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3Crect x='72' width='24' height='10' fill='%238B5CF6'/%3E%3Crect x='76' y='4' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3Crect x='96' width='24' height='10' fill='%235B6CFF'/%3E%3Crect x='100' y='2' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3Crect x='120' width='24' height='10' fill='%2322C55E'/%3E%3Crect x='124' y='4' width='16' height='4' rx='2' fill='%23fff' fill-opacity='.25'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
}

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-row { height: 72px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { display: block; height: 24px; width: auto; }
.brand-word { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.top-links { margin-left: auto; display: flex; gap: 24px; font-size: 14px; }
.top-links a { color: var(--text); }
.top-links a:hover { color: var(--ink); }
.btn-dark {
    height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--ink); color: #FFFFFF;
    font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-left: 12px;
}
.btn-dark:hover { background: #2A2D38; }
.btn-dark:disabled { opacity: .6; cursor: default; }
@media (max-width: 720px) {
    .top-links { display: none; }
    .top-row .btn-dark { margin-left: auto; height: 34px; padding: 0 12px; font-size: 13px; }
    .brand img { height: 20px; }
}

/* Page */
.page { flex: 1; width: 100%; max-width: 1072px; margin: 0 auto; padding: 40px 16px 60px; display: flex; flex-direction: column; gap: 22px; }
.h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }

/* Hero */
.hero { background: var(--s); border-radius: 20px; padding: 26px 30px; display: flex; align-items: center; gap: 18px; color: #FFFFFF; }
.hero-mark { width: 46px; height: 46px; border-radius: 23px; background: #FFFFFF; color: var(--s); font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-mark.spin { background: transparent; border: 4px solid #FFFFFF55; border-top-color: #FFFFFF; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-mark.spin { animation: none; } }
.hero-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.hero-sub { margin: 0; font-size: 14px; opacity: .9; }
.tz { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #FFFFFF26; flex-shrink: 0; }
.tz button { padding: 6px 12px; border: 0; border-radius: 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; background: transparent; color: #FFFFFF; cursor: pointer; }
.tz button[aria-pressed="true"] { background: #FFFFFF; color: var(--s); }
@media (max-width: 720px) {
    .hero { flex-wrap: wrap; padding: 20px; gap: 14px; }
    .hero-title { font-size: 21px; }
    .tz { margin-left: 64px; }
}

.info { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); padding: 0 4px; margin: 0; }
.info-i { width: 18px; height: 18px; border-radius: 9px; border: 1.5px solid var(--muted); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Badges: coloured dot-with-glyph + words */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--s); white-space: nowrap; }
.badge.lg { font-size: 13px; }
.badge-dot { width: 18px; height: 18px; border-radius: 9px; background: var(--s); color: #FFFFFF; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: flex-end; align-items: center; padding: 0 4px; }
.legend .range { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* Groups of systems */
.group { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: visible; }
.group-head {
    width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--soft);
    border: 0; border-radius: 16px; cursor: pointer; text-align: left;
}
.group.open .group-head { border-bottom: 1px solid var(--line); border-radius: 16px 16px 0 0; }
.group-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.group-count { font-size: 12px; color: var(--muted); }
.group-state { margin-left: auto; }
.caret { color: var(--muted); font-size: 12px; width: 10px; text-align: center; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 250px 150px minmax(0, 1fr) 70px; gap: 16px; align-items: center; padding: 12px 20px; }
.row + .row { border-top: 1px solid var(--line); }
.row-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name b { font-size: 14px; font-weight: 500; color: var(--ink); }
.row-name span { font-size: 12px; color: var(--muted); }
.row-uptime { font-family: var(--mono); font-size: 12px; color: var(--text); text-align: right; }
@media (max-width: 860px) {
    .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "bars bars" "up up"; row-gap: 10px; }
    .row-name { grid-area: name; }
    .row > .badge { grid-area: state; }
    .row .bars-wrap { grid-area: bars; }
    .row-uptime { grid-area: up; text-align: left; margin-top: -4px; }
}

.bars-wrap { position: relative; }
.bars { display: flex; gap: 1px; align-items: flex-end; height: 34px; }
.bar { flex: 1 1 0; min-width: 0; height: 34px; padding: 0; border: 0; border-radius: 2px; background: var(--s); cursor: pointer; }
.bar[data-state="operational"] { opacity: .85; }
.bar.old { display: none; }
@media (min-width: 861px) { .bar.old { display: block; } }
.bars.hovering .bar:not(.on) { opacity: .45; }
.bar:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.tip {
    position: absolute; bottom: 100%; z-index: 20; width: 250px; margin-bottom: 8px; padding: 12px 14px; background: var(--card);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #16181F1F; font-size: 12px;
}
.tip-date { font-family: var(--mono); color: var(--muted); }
.tip .badge { margin-top: 6px; }
.tip-words { margin-top: 4px; color: var(--muted); }
.tip ul { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); }
.tip li + li { margin-top: 4px; }

/* Incidents and maintenance */
.incident {
    background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--s); border-radius: 16px;
    padding: 22px 26px; display: flex; flex-direction: column; gap: 12px;
}
.incident-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.incident-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.incident-title a { color: inherit; }
.incident-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.incident-when { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.box { background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.box-label { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.box-text { font-size: 14px; line-height: 20px; color: var(--ink); white-space: pre-line; }
.update { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.incident > .update:last-child { padding-bottom: 0; }
.incident > .update:first-child { border-top: 0; padding-top: 0; }
.update-status { display: flex; flex-direction: column; gap: 2px; }
.update-status b { font-size: 13px; font-weight: 700; color: var(--ink); }
.update-status span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.update-body { margin: 0; font-size: 14px; line-height: 21px; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.incident-foot { display: flex; align-items: center; gap: 10px; padding-top: 6px; font-size: 13px; color: var(--muted); }
.incident-foot .link-btn { margin-left: auto; }
.link-btn { border: 0; background: none; padding: 0; font-size: 13px; font-weight: 600; color: var(--link); cursor: pointer; }
.link-btn:hover { color: var(--link-hover); }
.stack > .link-btn { align-self: flex-start; }
.btn-outline {
    align-self: flex-start; height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card);
    font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; cursor: pointer; color: var(--ink);
}
.btn-outline:hover { background: var(--soft); }
.incident.compact { padding: 18px 26px; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
.incident.compact .incident-title { font-size: 16px; }
.incident.compact .meta { font-size: 13px; color: var(--muted); }
.incident.compact .link-btn { margin-left: auto; }
@media (max-width: 720px) {
    .incident { padding: 18px 18px 18px 16px; }
    .boxes { grid-template-columns: 1fr; }
    .update { grid-template-columns: 1fr; gap: 6px; }
    .incident-when { margin-left: 0; width: 100%; }
}

/* Past incidents */
.list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.list-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 160px; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); color: inherit; }
a.list-row:hover { background: #FCFBF8; color: inherit; }
.list-date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-main b { font-size: 14px; font-weight: 600; color: var(--ink); }
.list-main span { font-size: 12px; color: var(--muted); }
.list-state { text-align: right; }
.list-foot { display: block; padding: 12px 20px; font-size: 13px; font-weight: 600; }
.list-empty { padding: 16px 20px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); }
@media (max-width: 720px) {
    .list-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "date state" "main main"; row-gap: 6px; }
    .list-date { grid-area: date; } .list-main { grid-area: main; } .list-state { grid-area: state; }
}

/* Incident write-up page */
.crumb { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.page-title { margin: 0; font-size: 40px; line-height: 46px; font-weight: 600; color: var(--ink); letter-spacing: -0.03em; }
.page-meta { margin: 0; font-size: 14px; color: var(--muted); }
.writeup { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; }
.writeup b { font-size: 13px; font-weight: 700; color: var(--ink); }
.writeup p { margin: 0; font-size: 14px; line-height: 21px; color: var(--text); white-space: pre-line; }
.stack { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 720px) {
    .page-title { font-size: 30px; line-height: 36px; }
    .writeup { grid-template-columns: 1fr; gap: 6px 0; padding: 18px; }
    .writeup p { margin-bottom: 10px; }
}

/* Footer */
.foot { margin-top: auto; border-top: 1px solid var(--line); }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 26px; padding-bottom: 26px; font-size: 13px; color: var(--muted); }
.foot-row .end { margin-left: auto; }
.foot-row .link-btn { font-size: 13px; font-weight: 400; color: var(--muted); }
.foot-row .link-btn:hover { color: var(--ink); }
@media (max-width: 720px) { .foot-row .end { margin-left: 0; } }

/* Subscribe dialog */
.scrim { position: fixed; inset: 0; background: #16181F59; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; overflow-y: auto; }
.dialog { position: relative; width: 520px; max-width: 100%; background: var(--card); border-radius: 20px; padding: 26px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px #00000055; }
.dialog-title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 700; color: var(--ink); padding-right: 32px; }
.dialog-close { position: absolute; top: 20px; right: 20px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.dialog-close:hover { background: var(--soft); color: var(--ink); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--seg); }
.seg button { flex: 1 1 0; padding: 8px 0; border: 0; border-radius: 8px; font-size: 13px; font-weight: 600; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: #FFFFFF; color: var(--ink); }
.field { height: 42px; width: 100%; border-radius: 10px; border: 1px solid var(--line-strong); padding: 0 12px; font: inherit; font-size: 14px; color: var(--ink); background: #FFFFFF; }
.field::placeholder { color: var(--hint); }
.field:focus { outline: 2px solid var(--link); outline-offset: 1px; border-color: transparent; }
.label { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: #FFFFFF; color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.chip[aria-pressed="true"] { background: #4450BE14; color: var(--ink); border-color: #4450BE38; }
.switch { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; font-size: 13px; line-height: 18px; color: var(--text); }
.switch-track { width: 30px; height: 16px; border-radius: 8px; background: #C9CAD0; position: relative; flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 6px; background: #FFFFFF; transition: left .15s ease-out; }
.switch[aria-checked="true"] .switch-track { background: var(--link); }
.switch[aria-checked="true"] .switch-track::after { left: 16px; }
.btn-block { height: 44px; border: 0; border-radius: 10px; background: var(--ink); color: #FFFFFF; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-block:hover { background: #2A2D38; }
.btn-block:disabled { opacity: .6; cursor: default; }
.msg { margin: 0; font-size: 13px; line-height: 19px; }
.msg.err { color: var(--major); }
.msg.ok { color: var(--ok); }
.note { margin: 0; font-size: 14px; line-height: 21px; color: var(--text); }
.copy-row { display: flex; gap: 8px; }
.copy-row .field { font-family: var(--mono); font-size: 12px; }
