:root {
  --paper: #fbfbfb;
  --ink: #050505;
  --muted: #535353;
  --hair: #141414;
  --blue: #78b8ff;
  --blue-strong: #2f86ed;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper);
  font-family: "Courier New", Courier, monospace;
  font-size: 17px;
  letter-spacing: 0;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 5px);
}

button,
select {
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--hair);
  border-radius: 0;
  box-shadow: none;
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 42px;
  padding: 7px 16px;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
}

button:hover,
button[aria-pressed="true"],
button:focus-visible,
select:focus-visible {
  color: var(--paper);
  background: var(--ink);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
}

button:disabled:hover {
  color: inherit;
  background: transparent;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
}

.topbar {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px 24px;
  border-bottom: 3px solid var(--hair);
  background: rgba(255, 255, 255, 0.9);
}

.monitor-panel {
  position: relative;
  display: grid;
  grid-template-columns: 170px minmax(360px, 1fr) 72px;
  gap: 24px;
  align-items: center;
  width: min(1680px, 100%);
  border: 3px solid var(--hair);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.78);
}

.brand-mark {
  align-self: stretch;
  display: grid;
  align-items: center;
  justify-items: start;
  min-height: 132px;
  border-right: 2px solid var(--hair);
  padding-right: 24px;
}

.brand-mark img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 132px;
  object-fit: contain;
}

.settings-gear {
  align-self: start;
  justify-self: end;
  width: 62px;
  height: 62px;
  min-height: 62px;
  padding: 0;
  border-width: 3px;
  font-size: 36px;
  line-height: 1;
}

.settings-gear:focus-visible {
  color: var(--ink);
  background: var(--paper);
}

.monitor-stats {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 18px;
  max-width: 720px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.monitor-stats dt {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.monitor-stats dt::after {
  content: ":";
  float: right;
}

.monitor-stats dd {
  margin: 0;
  font-weight: 700;
}

#modeValue,
.is-live #modeValue {
  color: var(--blue-strong);
  font-weight: 900;
  text-transform: uppercase;
}

.inline-check {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-transform: lowercase;
}

.inline-check.manual:hover {
  color: var(--blue-strong);
  background: transparent;
  outline: 0;
}

.inline-check.live {
  min-width: 38px;
  color: var(--blue-strong);
  text-decoration: none;
}

main {
  padding: 0 18px 46px;
}

.dashboard-meta {
  display: flex;
  justify-content: space-between;
  min-height: 46px;
  padding: 13px 8px 9px;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.news-shell {
  width: 100%;
  border-top: 3px solid var(--hair);
}

.protocol-head,
.protocol-row {
  display: grid;
  grid-template-columns: 150px 190px minmax(380px, 1fr) 150px;
  gap: 0;
  align-items: stretch;
}

.protocol-head {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--hair);
  background: rgba(251, 251, 251, 0.96);
  font-weight: 900;
  text-transform: uppercase;
}

.protocol-head span {
  padding: 10px 14px;
  border-right: 2px solid var(--hair);
}

.protocol-head span:last-child {
  border-right: 0;
}

.protocol-row {
  min-height: 86px;
  border-bottom: 2px solid var(--hair);
  color: inherit;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

.protocol-row:hover,
.protocol-row:focus-visible {
  background: #f5f9ff;
  outline: 2px solid var(--hair);
  outline-offset: -2px;
}

.protocol-row.is-new {
  background: #eef6ff;
}

.protocol-row > * {
  min-width: 0;
  padding: 11px 14px;
  border-right: 2px solid var(--hair);
}

.protocol-row > *:last-child {
  border-right: 0;
}

.protocol-row time {
  font-weight: 700;
  white-space: pre-line;
}

.source-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-weight: 700;
  line-height: 1.25;
}

.story-cell h2 {
  margin: 0 0 7px;
  font-size: 1.08rem;
  line-height: 1.18;
}

.story-cell p {
  margin: 0;
  color: #242424;
  line-height: 1.3;
}

.status-cell {
  display: grid;
  place-items: center;
}

.status-badge {
  display: inline-grid;
  place-items: center;
  width: 120px;
  min-height: 34px;
  border: 2px solid var(--hair);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-new {
  background: var(--blue);
}

.status-read {
  background: var(--paper);
}

.empty-state {
  padding: 42px 12px;
  border-bottom: 2px solid var(--hair);
  text-align: center;
  font-weight: 900;
}

.settings-open .topbar,
.settings-open .dashboard-meta {
  display: none;
}

.settings-view {
  min-height: 100vh;
  padding: 26px 14px 48px;
}

.settings-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--hair);
}

.settings-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.settings-head h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.7rem);
  line-height: 1;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(210px, 280px) 1fr;
  gap: 28px;
  padding-top: 24px;
}

.settings-section {
  border: 3px solid var(--hair);
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.settings-section h2 {
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--hair);
  font-size: 1.2rem;
  text-transform: uppercase;
}

.monitor-options,
.time-window-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.source-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.source-toggle {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 70px;
  padding: 12px;
  border: 2px solid var(--hair);
  background: var(--paper);
  cursor: pointer;
}

.source-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-box {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--hair);
  background: var(--paper);
}

.source-toggle input:checked + .toggle-box {
  background: var(--blue);
  box-shadow: inset 0 0 0 4px var(--paper);
}

.source-toggle strong,
.source-toggle small {
  display: block;
}

.source-toggle strong {
  margin-bottom: 5px;
  line-height: 1.15;
}

.source-toggle small {
  color: var(--muted);
  line-height: 1.2;
}

.settings-note {
  margin: 0;
  color: var(--muted);
}

.settings-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 28px;
  align-items: end;
  margin-top: 54px;
  padding: 18px 0 0;
  border-top: 3px solid var(--hair);
  font-size: 0.86rem;
  line-height: 1.35;
}

.settings-footer strong,
.settings-footer span,
.settings-footer a {
  display: block;
}

.settings-footer strong {
  margin-bottom: 4px;
  text-transform: lowercase;
}

.settings-footer address {
  margin: 0;
  color: var(--ink);
  font-style: normal;
  text-align: right;
}

.settings-footer a {
  color: var(--ink);
  text-decoration: underline;
}

.settings-footer > span:last-child {
  font-weight: 900;
  text-align: right;
}

@media (max-width: 980px) {
  .news-shell {
    overflow-x: auto;
  }

  .protocol-head,
  .protocol-row {
    grid-template-columns: 118px 150px minmax(310px, 1fr) 130px;
    min-width: 820px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .monitor-panel {
    grid-template-columns: 150px 1fr 60px;
    gap: 18px;
  }

  .brand-mark {
    min-height: 116px;
    padding-right: 18px;
  }

  .brand-mark img {
    height: 116px;
  }
}

@media (max-width: 680px) {
  html {
    font-size: 15px;
  }

  .topbar {
    min-height: auto;
    padding: 14px;
  }

  .monitor-panel {
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 18px;
  }

  .brand-mark {
    grid-column: 1;
    grid-row: 1;
    min-height: 92px;
    border-right: 0;
    padding-right: 0;
    align-items: start;
  }

  .brand-mark img {
    width: auto;
    height: 92px;
  }

  .settings-gear {
    grid-column: 2;
    grid-row: 1;
    width: 50px;
    height: 50px;
    min-height: 50px;
    font-size: 28px;
  }

  .monitor-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 132px 1fr;
    font-size: 0.95rem;
  }

  main {
    padding: 0 10px 48px;
  }

  .news-shell {
    overflow-x: visible;
  }

  .protocol-head {
    display: none;
  }

  .protocol-row {
    grid-template-columns: 94px minmax(0, 1fr) 104px;
    min-width: 0;
    min-height: 0;
  }

  .protocol-row time {
    grid-column: 1;
  }

  .source-cell {
    grid-column: 2;
  }

  .status-cell {
    grid-column: 3;
    border-right: 0;
  }

  .story-cell {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 2px solid var(--hair);
    border-right: 0;
  }

  .story-cell h2 {
    font-size: 1rem;
  }

  .status-badge {
    width: 86px;
    min-height: 32px;
    font-size: 0.75rem;
  }

  .settings-footer {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .settings-footer address,
  .settings-footer > span:last-child {
    text-align: left;
  }
}
