/* Docs, sign-in, dashboard and 404: the bulletin world for reading and operating.
   Tokens, fonts and the base come from bulletin.css; this file adds what these surfaces need. */
@import url("/assets/bulletin.css");

/* Header: the same navy bar as the marketing pages */
.top {
  background: #0b1a2b;
  color: #e9edf1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 2rem;
  padding: 0.85rem var(--gutter);
  font-family: var(--broadcast);
  font-stretch: 75%;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}
.top .brand { margin-right: auto; color: inherit; text-decoration: none; font-weight: 900; letter-spacing: 0.12em; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.6rem; }
.top nav a { color: inherit; text-decoration: none; padding: 0.3rem 0; border-bottom: 3px solid transparent; }
.top nav a:hover, .top nav a[aria-current="page"] { border-bottom-color: var(--watch); }
.top button { color: #e9edf1; border-color: #e9edf1; }
.top button:hover { background: #e9edf1; color: #0b1a2b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .top { border-bottom: 4px solid #e9edf1; }
}

/* Page frame */
.wrap { max-width: 46rem; margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) 4rem; }
.wrap.wide { max-width: 72rem; }
h1, h2, h3, h4 {
  font-family: var(--broadcast);
  font-stretch: 68%;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); margin: 0 0 1.2rem; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 2.8rem 0 0.9rem; }
h3 { font-size: 1.45rem; font-stretch: 75%; margin: 2rem 0 0.6rem; }
h4 { font-size: 1.15rem; font-stretch: 75%; margin: 1.6rem 0 0.5rem; }
p, li { max-width: 70ch; }
.muted { color: var(--ink); opacity: 0.78; }
section { margin: 0 0 3rem; padding-top: 0.2rem; }
section + section { border-top: var(--rule); padding-top: 2rem; }
section > h1, section > h2 { margin-top: 0; }

/* Code and data in teletype */
code, kbd, samp { font-family: var(--teletype); font-size: 0.95em; }
:not(pre) > code { background: var(--paper); border: 2px solid var(--ink); padding: 0 0.3em; }
pre { font-family: var(--teletype); background: var(--paper); border: var(--rule); padding: 1rem 1.2rem; overflow-x: auto; line-height: 1.45; font-size: 0.92rem; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1.2rem 0 1.6rem; display: block; overflow-x: auto; }
thead th {
  font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 0.88rem; border-bottom: var(--rule); white-space: nowrap;
}
th, td { text-align: left; padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: var(--hair); vertical-align: baseline; }
td code { white-space: nowrap; }
td.num { text-align: right; font-family: var(--teletype); }

/* Controls */
.button, button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.3rem; cursor: pointer;
  font-family: var(--broadcast); font-stretch: 75%; font-weight: 800; font-size: 1.1rem;
  text-transform: uppercase; letter-spacing: 0.05em; text-decoration: none;
  background: #0b1a2b; color: var(--watch); border: 4px solid #0b1a2b; border-radius: 0;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.button:hover, button:hover { background: var(--watch); color: #0b1a2b; }
.button.secondary, button.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.secondary:hover, button.secondary:hover { background: var(--ink); color: var(--fog); }
button.danger { background: transparent; color: var(--ink); border-color: var(--warning); }
button.danger:hover { background: var(--warning); color: var(--on-warning); border-color: var(--warning); }
button.small { min-height: 2.1rem; padding: 0 0.7rem; font-size: 0.9rem; border-width: 2px; }
button[disabled] { opacity: 0.55; cursor: progress; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button:not(.secondary), :root:not([data-theme="light"]) button:not(.secondary):not(.danger) { background: var(--watch); color: #0b1a2b; border-color: var(--watch); }
  :root:not([data-theme="light"]) .button:not(.secondary):hover, :root:not([data-theme="light"]) button:not(.secondary):not(.danger):hover { background: transparent; color: var(--watch); }
  :root:not([data-theme="light"]) .top button { background: transparent; color: #e9edf1; border-color: #e9edf1; }
}

label {
  display: block; margin: 1rem 0 0.35rem;
  font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.92rem;
}
input, select, textarea {
  font: inherit; font-family: var(--teletype); color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 0; padding: 0.55rem 0.7rem; min-height: 3rem; width: 100%; max-width: 30rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 4px solid var(--advisory); outline-offset: 0; }
::placeholder { color: var(--ink); opacity: 0.55; }
.row { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; }
.row > div { flex: 1 1 12rem; }
.row > div.end { flex: 0 0 auto; }
.row input, .row select { max-width: none; }

/* Notices: a field, never a coloured side stripe */
.notice { border: var(--rule); background: var(--paper); padding: 0.9rem 1.1rem; margin: 1.2rem 0; }
.notice:empty { display: none; }
.notice.ok { background: var(--watch); color: #0b1a2b; border-color: #0b1a2b; }
.notice.error { background: var(--warning); color: var(--on-warning); border-color: var(--warning); }
.notice p { margin: 0.3rem 0; }

/* Delivery statuses use the event fields */
.status-delivered { font-weight: 700; }
.status-failed, .status-deferred, .status-queued {
  font-family: var(--broadcast); font-stretch: 75%; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.4rem;
}
.status-failed { background: var(--warning); color: var(--on-warning); }
.status-deferred { background: var(--watch); color: #0b1a2b; }
.status-queued { border: 2px solid var(--ink); }

.secret { word-break: break-all; user-select: all; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Docs: a ruled index column beside a reading column */
.docs-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: calc(100svh - 3.6rem); }
.docs-nav { border-right: var(--rule); padding: 2rem 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 1rem; }
.docs-nav a {
  display: block; padding: 0.45rem var(--gutter) 0.45rem 1.4rem; text-decoration: none;
  font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 1.02rem;
}
.docs-nav a:hover { background: var(--ink); color: var(--fog); }
.docs-nav a[aria-current="page"] { background: var(--watch); color: #0b1a2b; }
.docs-layout > main { padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) 4rem; max-width: 52rem; }
.docs-layout > main h2 { border-top: var(--rule); padding-top: 1.4rem; }
.docs-layout > main h1 + p { font-size: 1.15rem; }
blockquote { margin: 1.4rem 0; padding: 0.9rem 1.1rem; background: var(--paper); border: var(--rule); }
blockquote p { margin: 0.3rem 0; }
hr { border: 0; border-top: var(--rule); margin: 2.5rem 0; }
.md-link { margin-top: 3rem; padding-top: 1rem; border-top: var(--hair); font-family: var(--teletype); font-size: 0.92rem; }
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { border-right: 0; border-bottom: var(--rule); padding: 0.4rem 0; }
  .docs-nav ul { position: static; display: flex; flex-wrap: wrap; gap: 0; padding: 0 var(--gutter); }
  .docs-nav a { padding: 0.45rem 0.7rem; font-size: 0.95rem; }
}

/* Keep visually hidden labels inside their table's scroll box */
table { position: relative; }

/* Heading permalinks sit in the margin and show on hover or focus */
h1, h2, h3, h4 { position: relative; }
.anchor { position: absolute; left: -0.9em; width: 0.8em; text-decoration: none; color: inherit; opacity: 0; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus-visible { opacity: 0.5; }
.row > div.end { margin-top: 1rem; }
.top button, .top button.secondary { background: transparent; color: #e9edf1; border-color: #e9edf1; }
.top button:hover, .top button.secondary:hover { background: #e9edf1; color: #0b1a2b; }

/* Admin console */
.admin-nav { display: flex; flex-wrap: wrap; gap: 0 1.4rem; padding: 0.6rem var(--gutter); border-bottom: var(--rule); position: sticky; top: 0; background: var(--fog); z-index: 2; }
.admin-nav a { font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.95rem; text-decoration: none; padding: 0.3rem 0; border-bottom: 3px solid transparent; }
.admin-nav a:hover { border-bottom-color: var(--advisory); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); border: var(--rule); }
.stat { padding: 1rem 1.1rem; border-right: var(--hair); border-bottom: var(--hair); display: flex; flex-direction: column; gap: 0.2rem; margin: 0 -2px -2px 0; }
.stat-label { font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; }
.stat-value { font-family: var(--broadcast); font-stretch: 68%; font-weight: 800; font-size: 2.6rem; line-height: 1; }
.stat-note { font-family: var(--teletype); font-size: 0.85rem; opacity: 0.8; }
.tag { margin-left: 0.5rem; background: var(--watch); color: #0b1a2b; font-family: var(--broadcast); font-stretch: 75%; font-weight: 800; text-transform: uppercase; font-size: 0.8rem; padding: 0 0.35rem; }
td.actions { white-space: nowrap; text-align: right; }
td.err code, td.detail code { white-space: normal; word-break: break-word; font-size: 0.85rem; }
.row > div.check { display: flex; align-items: center; gap: 0.5rem; min-height: 3rem; }
.row > div.check label { margin: 0; }
.row > div.check input { width: 1.4rem; height: 1.4rem; min-height: 0; accent-color: #0b1a2b; }
[hidden] { display: none !important; }
main h1, main h2 { scroll-margin-top: 4.5rem; }
.notice.info { background: var(--paper); }
.plan-control { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.plan-select { width: auto; min-height: 2.1rem; padding: 0.2rem 0.4rem; }
.setup-prompt { white-space: pre-wrap; margin: 0 0 1rem; }
.row-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }
.small-print { font-size: 0.92rem; }
.setup-prompt { overflow-wrap: anywhere; }

/* Inside yellow and red notices, code and controls use fixed light-field colours in both schemes */
.notice.ok code, .notice.error code { background: #ffffff; color: #0b1a2b; border-color: #0b1a2b; }
.notice.ok button, .notice.ok button.secondary { background: transparent; color: #0b1a2b; border-color: #0b1a2b; }
.notice.ok button:hover, .notice.ok button.secondary:hover { background: #0b1a2b; color: var(--watch); }
.notice.ok .secret { display: inline-block; padding: 0.3rem 0.5rem; font-size: 1rem; }

/* Inputs and selects in a row share one height so labels line up */
.row input, .row select { height: 3rem; min-height: 3rem; }

/* Activate page */
fieldset.scope { border: var(--hair); padding: 0.6rem 1rem 0.9rem; margin: 1.4rem 0; max-width: 42rem; }
fieldset.scope legend { font-family: var(--broadcast); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0.4rem; }
label.choice { display: flex; gap: 0.6rem; align-items: baseline; text-transform: none; letter-spacing: 0; font-family: var(--broadcast); font-stretch: 100%; font-weight: 400; font-size: 1rem; margin: 0.6rem 0 0; }
label.choice input { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: #0b1a2b; flex: none; }
#code { text-transform: uppercase; letter-spacing: 0.12em; }
#request { margin-top: 2.5rem; }
