:root {
  color-scheme: dark;
  --bg: #06080c;
  --panel: rgba(18, 25, 31, 0.82);
  --panel-strong: rgba(31, 43, 51, 0.9);
  --line: rgba(152, 184, 197, 0.26);
  --text: #e6edf0;
  --muted: #8fa6ae;
  --cyan: #63d7ff;
  --blue: #4d7cff;
  --amber: #f0bd58;
  --red: #ff6975;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(99, 215, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(99, 215, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 72% 18%, rgba(77, 124, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 18% 82%, rgba(240, 189, 88, 0.09), transparent 24rem),
    var(--bg);
  background-size: 56px 56px, 56px 56px, auto, auto, auto;
}

button,
input,
textarea {
  font: inherit;
}

.mcc-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  align-content: center;
  gap: 22px;
}

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.agency-logo {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border: 1px solid rgba(152, 184, 197, 0.22);
  border-radius: 50%;
  opacity: 0.72;
  filter: drop-shadow(0 0 12px rgba(99, 215, 255, 0.12));
}

.access-page .agency-logo {
  width: 144px;
  height: 144px;
}

.agency-code,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.system-card {
  min-width: 220px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  border: 1px solid var(--line);
  background: rgba(4, 9, 14, 0.42);
  padding: 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
}

.system-card span,
.telemetry span {
  color: var(--muted);
  text-transform: uppercase;
}

.system-card strong {
  color: var(--text);
  text-align: right;
}

.access-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.75fr);
  gap: 18px;
}

.control-panel,
.artifact-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(99, 215, 255, 0.11), transparent 54%),
    var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.access-panel {
  min-height: 260px;
  padding: clamp(20px, 4vw, 34px);
  display: grid;
  align-content: center;
  gap: 12px;
}

label {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.field-stack {
  display: grid;
  gap: 8px;
}

.entry-row-action {
  grid-template-columns: auto;
  justify-content: start;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 215, 255, 0.14);
}

textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 215, 255, 0.14);
}

button {
  min-height: 42px;
  border: 1px solid rgba(99, 215, 255, 0.72);
  border-radius: 4px;
  padding: 0 16px;
  background: rgba(99, 215, 255, 0.14);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
}

button:hover {
  background: rgba(99, 215, 255, 0.22);
}

.alert {
  margin: 0;
  color: var(--red);
  font-family: "Courier New", Courier, monospace;
}

.signal-panel {
  min-height: 260px;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.radar {
  position: relative;
  min-height: 150px;
  border: 1px solid rgba(99, 215, 255, 0.18);
  background:
    linear-gradient(90deg, transparent 49%, rgba(99, 215, 255, 0.18) 50%, transparent 51%),
    linear-gradient(transparent 49%, rgba(99, 215, 255, 0.18) 50%, transparent 51%),
    radial-gradient(circle, transparent 0 28%, rgba(99, 215, 255, 0.16) 29% 30%, transparent 31% 52%, rgba(99, 215, 255, 0.12) 53% 54%, transparent 55%);
  overflow: hidden;
}

.radar span {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 44%;
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--cyan), transparent);
  animation: sweep 5s linear infinite;
}

.telemetry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  font-family: "Courier New", Courier, monospace;
}

.telemetry strong {
  color: var(--amber);
}

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.briefing-main {
  grid-column: 1 / -1;
  padding: clamp(20px, 4vw, 34px);
}

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

.briefing-copy p {
  margin-bottom: 14px;
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.7;
}

.action-form {
  margin-top: 22px;
}

.briefing-main p,
.artifact-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.briefing-main .briefing-copy p {
  margin-bottom: 14px;
  color: var(--text);
}

.briefing-access-note {
  margin-top: 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.artifact-card {
  min-height: 170px;
  padding: 18px;
  display: grid;
  align-content: start;
}

.material-note {
  margin-bottom: 12px;
}

.material-state-analysis {
  color: #ffe45c;
  font-weight: 700;
  text-shadow:
    0 0 10px rgba(255, 228, 92, 0.55),
    0 0 22px rgba(255, 228, 92, 0.28);
}

.material-analysis-headline {
  margin-bottom: 1rem;
}

.analysis-log {
  margin-top: 12px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 228, 92, 0.18);
  border-radius: 4px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.28);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
}

.analysis-log-entry {
  margin: 0;
}

.analysis-log-time {
  display: block;
  color: var(--muted);
}

.analysis-log-text {
  display: block;
  color: #ffe45c;
  text-shadow: 0 0 8px rgba(255, 228, 92, 0.28);
}

.artifact-card .material-state-released {
  color: var(--muted);
}

.transcript-block {
  margin-top: 12px;
  border: 1px solid rgba(99, 215, 255, 0.16);
  border-radius: 4px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.34);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.76rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.transcript-block p {
  margin: 0 0 7px;
}

.transcript-block p:last-child {
  margin-bottom: 0;
}

.transcript-line {
  color: var(--text);
}

.transcript-speaker-agent {
  color: var(--amber);
  font-weight: 700;
}

.transcript-speaker-unknown {
  color: var(--cyan);
  font-weight: 700;
}

.transcript-meta {
  color: var(--muted);
}

.material-preview-link {
  display: block;
  margin-top: 4px;
  border: 1px solid rgba(99, 215, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.material-preview-link:hover {
  border-color: rgba(99, 215, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(99, 215, 255, 0.12);
}

.material-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  height: min(400px, 58vh);
  object-fit: contain;
}

.material-actions {
  margin-top: 10px;
}

.material-actions .text-link {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.76rem;
}

.material-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 1px solid rgba(99, 215, 255, 0.36);
  border-radius: 6px;
  padding: 48px 14px 14px;
  background: rgba(6, 8, 12, 0.96);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.72);
}

.material-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
}

.material-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

.material-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.72rem;
}

.chat-panel {
  padding: clamp(18px, 3vw, 26px);
}

.material-control {
  padding: clamp(18px, 3vw, 26px);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.material-control p {
  margin-bottom: 0;
  color: var(--muted);
}

.material-control strong {
  color: var(--amber);
  font-family: "Courier New", Courier, monospace;
}

.material-control-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.material-control-form button[aria-pressed="true"] {
  border-color: rgba(240, 189, 88, 0.82);
  background: rgba(240, 189, 88, 0.14);
  color: var(--amber);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  border-bottom: 1px solid rgba(152, 184, 197, 0.18);
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.chat-header span {
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.chat-log {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(99, 215, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  padding: 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
}

.chat-line {
  display: grid;
  grid-template-columns: auto 5ch auto minmax(0, 1fr);
  gap: 6px;
  margin: 0 0 5px;
  color: var(--text);
  line-height: 1.35;
}

.chat-line time {
  color: var(--muted);
}

.chat-sender {
  display: inline-block;
  width: 5ch;
  font-weight: 700;
}

.chat-sender-agent {
  color: var(--amber);
}

.chat-sender-mcc {
  color: var(--cyan);
}

.chat-separator {
  color: rgba(152, 184, 197, 0.48);
}

.chat-text {
  white-space: pre-wrap;
}

.chat-empty {
  margin: 0;
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
}

.chat-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.chat-form textarea {
  min-height: 58px;
  padding: 8px 10px;
  font-size: 0.78rem;
}

.chat-form button {
  min-height: 58px;
  align-self: stretch;
}

.not-found {
  padding: 28px;
}

@keyframes sweep {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .mcc-header,
  .access-grid,
  .briefing-grid {
    grid-template-columns: 1fr;
  }

  .mcc-header {
    display: grid;
    align-items: start;
  }

  .agency-logo {
    width: 80px;
    height: 80px;
  }

  .access-page .agency-logo {
    width: 120px;
    height: 120px;
  }

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

  .chat-header {
    display: grid;
  }

  .chat-line {
    grid-template-columns: auto 5ch auto minmax(0, 1fr);
    gap: 5px;
    border-bottom: 1px solid rgba(152, 184, 197, 0.12);
    padding-bottom: 8px;
  }

  .material-control {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .material-control-form {
    justify-content: start;
  }

  .system-card {
    min-width: 0;
  }
}
