:root {
  --paper: #eef2f4;
  --paper-raised: #f9fbfc;
  --ink: #13232e;
  --ink-muted: #63737d;
  --line: #cdd7dc;
  --blue: #2458d3;
  --blue-soft: #dce7ff;
  --orange: #e56a2f;
  --orange-soft: #ffe4d7;
  --green: #19745a;
  --green-soft: #d9eee7;
  --shadow: 0 16px 40px rgb(23 41 53 / 9%);
  --display: Bahnschrift, "Arial Narrow", sans-serif;
  --body: "Segoe UI Variable", "Segoe UI", sans-serif;
  --utility: "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  font-family: var(--body);
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 31px, rgb(36 88 211 / 7%) 32px, transparent 33px)
      0 0 / 100% 100%,
    var(--paper);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(36 88 211 / 30%);
  outline-offset: 3px;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked > .masthead,
body.auth-locked > .page-shell {
  filter: blur(7px);
  opacity: 0.58;
  transform: scale(0.992);
  user-select: none;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 31px, rgb(36 88 211 / 8%) 32px, transparent 33px)
      0 0 / 100% 100%,
    rgb(238 242 244 / 88%);
  backdrop-filter: blur(10px);
}

.access-card {
  width: min(430px, 100%);
  padding: 36px 38px 30px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  box-shadow: 0 30px 90px rgb(12 29 40 / 23%);
  animation: access-card-in 220ms ease-out both;
}

.access-code-mark {
  width: 84px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 24px;
}

.access-code-mark span {
  height: 4px;
  background: var(--blue);
}

.access-code-mark span:nth-child(2) {
  opacity: 0.72;
}

.access-code-mark span:nth-child(3) {
  opacity: 0.44;
}

.access-code-mark span:nth-child(4) {
  opacity: 0.2;
}

.access-kicker {
  margin: 0 0 9px;
  color: var(--blue);
  font: 650 10px/1 var(--utility);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-card h2 {
  margin: 0;
  font: 680 clamp(34px, 8vw, 46px)/1 var(--display);
  letter-spacing: -0.04em;
}

.access-copy {
  max-width: 330px;
  margin: 16px 0 26px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
}

.access-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-form label {
  grid-column: 1 / -1;
  color: var(--ink-muted);
  font: 650 9px/1 var(--utility);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.access-form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 650 19px/1 var(--utility);
  letter-spacing: 0.32em;
}

.access-form .button {
  height: 46px;
}

.access-error {
  min-height: 18px;
  grid-column: 1 / -1;
  margin: 3px 0 0;
  color: #a33a23;
  font-size: 12px;
}

.access-note {
  margin: 16px 0 0;
  padding-top: 15px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
  font: 9px/1.4 var(--utility);
}

@keyframes access-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.signal-line {
  position: fixed;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--orange);
  z-index: 20;
}

.masthead {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 28px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.wordmark-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 9px 2px 9px 2px;
  font: 650 14px/1 var(--utility);
  letter-spacing: -0.04em;
}

.wordmark strong,
.wordmark small {
  display: block;
}

.wordmark strong {
  font: 650 15px/1.1 var(--display);
  letter-spacing: 0.02em;
}

.wordmark small {
  margin-top: 4px;
  color: var(--ink-muted);
  font: 11px/1 var(--utility);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-muted);
  font: 12px/1 var(--utility);
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.sync-state.is-ok .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.sync-state.is-error .sync-dot {
  background: #b52f3b;
  box-shadow: 0 0 0 4px #f9d9dc;
}

.page-shell {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.briefing {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(300px, 0.65fr);
  align-items: end;
  gap: 64px;
  padding-bottom: 48px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 14px;
  color: var(--blue);
  font: 650 11px/1 var(--utility);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.briefing h1 {
  max-width: 760px;
  margin: 0;
  font: 700 clamp(58px, 7vw, 112px) / 0.83 var(--display);
  letter-spacing: -0.065em;
}

.briefing-copy {
  padding: 0 0 8px 24px;
  border-left: 3px solid var(--orange);
}

.briefing-copy p {
  max-width: 480px;
  margin: 0 0 25px;
  color: #40525e;
  font-size: 18px;
  line-height: 1.55;
}

.briefing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  font: 650 12px/1 var(--utility);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.button-primary {
  color: white;
  background: var(--blue);
  box-shadow: 0 7px 18px rgb(36 88 211 / 18%);
}

.button-primary:hover {
  background: #1749bd;
}

.button-secondary {
  color: var(--ink);
  background: rgb(255 255 255 / 58%);
  border-color: var(--line);
}

.button-secondary:hover {
  background: white;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 0.55fr)) minmax(200px, 1.35fr);
  border-block: 1px solid var(--line);
  background: rgb(255 255 255 / 26%);
}

.stats-strip > div {
  min-height: 85px;
  padding: 17px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
}

.stats-strip > div:last-child {
  border-right: 0;
}

.stats-strip span {
  color: var(--ink-muted);
  font: 10px/1 var(--utility);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats-strip strong {
  font: 650 29px/1 var(--display);
}

.stats-strip .ranking-state strong {
  color: var(--blue);
  font-size: 19px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(310px, 0.72fr);
  gap: 24px;
  margin-top: 28px;
}

.priority-board,
.queue-bay {
  background: var(--paper-raised);
  border: 1px solid #d8e0e4;
  box-shadow: var(--shadow);
}

.priority-board {
  min-height: 690px;
  padding: 26px 28px 30px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font: 680 35px/1 var(--display);
  letter-spacing: -0.04em;
}

.section-tools {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.section-tools > p {
  margin: 0;
  color: var(--ink-muted);
  font: 10px/1.4 var(--utility);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sort-control {
  display: grid;
  gap: 5px;
}

.sort-control span {
  color: var(--ink-muted);
  font: 9px/1 var(--utility);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sort-control small {
  color: var(--ink-muted);
  font: 9px/1 var(--utility);
}

.sort-control select {
  min-width: 142px;
  height: 34px;
  padding: 0 30px 0 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 11px/1 var(--utility);
  cursor: pointer;
}

.priority-rail {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.priority-rail::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 23px;
  width: 2px;
  background: linear-gradient(var(--orange), var(--blue));
  opacity: 0.72;
}

.priority-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 17px;
  align-items: center;
  min-height: 92px;
  padding: 11px 0;
  border-bottom: 1px solid #e2e8eb;
}

.priority-item:last-child {
  border-bottom: 0;
}

.rank-marker {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
  border: 5px solid var(--paper-raised);
  border-radius: 50%;
  font: 650 13px/1 var(--utility);
}

.priority-item:nth-child(-n + 3) .rank-marker {
  background: var(--orange);
}

.issue-main {
  min-width: 0;
}

.issue-topline,
.issue-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.issue-identifier {
  color: var(--blue);
  font: 650 10px/1 var(--utility);
  letter-spacing: 0.05em;
}

.issue-state {
  padding: 4px 7px;
  color: #4d5d67;
  background: #e7ecef;
  border-radius: 3px;
  font: 10px/1 var(--utility);
}

.attention-marker {
  padding: 4px 7px;
  color: #8c3511;
  background: var(--orange-soft);
  border-radius: 3px;
  font: 650 10px/1 var(--utility);
}

.issue-title-button {
  width: 100%;
  margin: 7px 0 6px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: none;
  border: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 630 17px/1.3 var(--body);
  cursor: pointer;
}

.issue-title-button:hover {
  color: var(--blue);
}

.issue-reason {
  margin: 0 0 7px;
  color: #465a66;
  font-size: 13px;
  line-height: 1.4;
}

.issue-meta {
  color: var(--ink-muted);
  font: 10px/1.25 var(--utility);
}

.issue-meta span + span::before {
  content: "·";
  margin-right: 8px;
  color: #a0acb3;
}

.issue-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-button {
  min-height: 31px;
  padding: 0 10px;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font: 10px/1 var(--utility);
  cursor: pointer;
}

.mini-button:hover,
.mini-button.is-active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #c5d5fb;
}

.side-bays {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.queue-bay {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 19px 18px 8px;
}

.queue-bay > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.queue-bay > header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.queue-bay h2 {
  margin: 0;
  font: 650 18px/1 var(--display);
}

.queue-bay > header > span {
  color: var(--ink-muted);
  font: 11px/1 var(--utility);
}

.queue-signal {
  width: 8px;
  height: 21px;
  border-radius: 2px;
}

.queue-signal-orange {
  background: var(--orange);
}

.queue-signal-blue {
  background: var(--blue);
}

.queue-signal-green {
  background: var(--green);
}

.compact-list {
  min-width: 0;
  max-width: 100%;
  display: grid;
}

.compact-item {
  min-width: 0;
  max-width: 100%;
  padding: 13px 2px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-bottom: 1px solid #e4eaed;
}

.compact-item:last-child {
  border-bottom: 0;
}

.compact-item > div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.compact-item button {
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: none;
  border: 0;
  text-align: left;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  cursor: pointer;
}

.compact-item button:hover {
  color: var(--blue);
}

.compact-item small {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 9px/1.3 var(--utility);
}

.priority-pill {
  align-self: start;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 9px/1 var(--utility);
}

.compact-empty {
  margin: 0;
  padding: 16px 2px;
  color: var(--ink-muted);
  font-size: 12px;
}

.empty-state {
  margin: 70px auto 0;
  max-width: 360px;
  padding: 28px;
  text-align: center;
  border: 1px dashed #b7c4ca;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 13px;
}

.issue-dialog {
  width: min(680px, calc(100% - 32px));
  padding: 30px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  box-shadow: 0 28px 90px rgb(12 29 40 / 32%);
}

.issue-dialog::backdrop {
  background: rgb(16 32 43 / 55%);
  backdrop-filter: blur(5px);
}

.dialog-close {
  float: right;
  padding: 4px 0;
  color: var(--ink-muted);
  background: none;
  border: 0;
  font: 10px/1 var(--utility);
  cursor: pointer;
}

.dialog-identifier {
  margin: 14px 0 8px;
  color: var(--blue);
  font: 650 11px/1 var(--utility);
}

.issue-dialog h2 {
  max-width: 500px;
  margin: 0 0 18px;
  font: 680 31px/1.1 var(--display);
  letter-spacing: -0.035em;
}

.dialog-reason {
  padding: 14px 16px;
  color: #324b59;
  background: var(--blue-soft);
  border-left: 4px solid var(--blue);
  font-size: 14px;
  line-height: 1.45;
}

.dialog-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 18px;
  margin: 24px 0;
}

.dialog-meta dt {
  color: var(--ink-muted);
  font: 10px/1.4 var(--utility);
  text-transform: uppercase;
}

.dialog-meta dd {
  margin: 0;
  font-size: 13px;
}

.dialog-next {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.dialog-comment {
  margin: -8px 0 22px;
  padding: 12px 14px;
  color: #40525e;
  background: #edf1f3;
  border-left: 3px solid var(--green);
  font-size: 13px;
  line-height: 1.5;
}

.dialog-next::before {
  content: "Next: ";
  color: var(--orange);
  font: 650 10px/1 var(--utility);
  text-transform: uppercase;
}

.dialog-workflow {
  margin-top: 24px;
  padding: 18px;
  background: #f0f4f6;
  border: 1px solid var(--line);
}

.dialog-workflow > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dialog-workflow h3 {
  margin: 0;
  font: 650 16px/1 var(--display);
}

.dialog-workflow > header span,
.dialog-status-row label > span,
.dialog-comment-composer > span {
  color: var(--ink-muted);
  font: 9px/1 var(--utility);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dialog-status-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto auto;
  align-items: end;
  gap: 8px;
}

.dialog-status-row label,
.dialog-comment-composer {
  display: grid;
  gap: 6px;
}

.dialog-status-row select,
.dialog-comment-composer textarea {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.dialog-status-row select {
  height: 42px;
  padding: 0 32px 0 11px;
  font-size: 12px;
}

.button-done {
  color: white;
  background: var(--green);
}

.button-done:hover {
  background: #115e48;
}

.dialog-comment-composer {
  margin-top: 15px;
}

.dialog-comment-composer textarea {
  min-height: 84px;
  padding: 10px 11px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.45;
}

#dialogPostComment {
  margin-top: 8px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(380px, calc(100% - 48px));
  padding: 13px 16px;
  color: white;
  background: var(--ink);
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .briefing {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .briefing-copy {
    max-width: 680px;
  }

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

  .side-bays {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    background: var(--paper);
  }

  .masthead,
  .page-shell {
    width: min(100% - 30px, 1440px);
  }

  .masthead {
    padding-top: 20px;
  }

  .page-shell {
    padding-top: 38px;
  }

  .briefing {
    padding-bottom: 34px;
  }

  .briefing h1 {
    font-size: clamp(52px, 18vw, 78px);
  }

  .briefing-copy {
    padding-left: 16px;
  }

  .stats-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-strip > div {
    min-height: 76px;
    padding: 14px 12px;
  }

  .stats-strip .ranking-state {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .priority-board {
    padding: 20px 15px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-tools {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

  .dialog-status-row {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-status-row label {
    grid-column: 1 / -1;
  }

  .priority-item {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .priority-rail::before {
    left: 20px;
  }

  .rank-marker {
    width: 42px;
    height: 42px;
  }

  .issue-controls {
    grid-column: 2;
    justify-content: flex-start;
  }

  .side-bays {
    grid-template-columns: 1fr;
  }

  .sync-state span:last-child {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 440px) {
  .access-gate {
    padding: 15px;
  }

  .access-card {
    padding: 30px 24px 24px;
  }

  .access-form {
    grid-template-columns: 1fr;
  }

  .access-form label,
  .access-error {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
