:root {
  --bg-0: #0a1119;
  --bg-1: #101a26;
  --bg-2: #1b2a3a;
  --line: #355a73;
  --text: #d5e3ef;
  --muted: #89a3b7;
  --ok: #3fd497;
  --warn: #f4bf4a;
  --danger: #ef5d5d;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #24384d 0%, #0c141d 45%, #05090e 100%);
  overflow-x: hidden;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(61, 111, 136, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 111, 136, 0.2) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
  pointer-events: none;
}

.console {
  width: min(1000px, 94vw);
  margin: 18px auto;
  display: grid;
  gap: 14px;
  animation: fadein 420ms ease-out both;
}

.header-card,
.panel {
  border: 1px solid #2a4257;
  background: linear-gradient(180deg, rgba(18, 32, 45, 0.95), rgba(10, 18, 27, 0.95));
  box-shadow: 0 14px 38px rgba(1, 4, 7, 0.45);
  border-radius: 10px;
  padding: 14px;
}

.header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eyebrow {
  margin: 0;
  color: #80cde7;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: 0.73rem;
}

h1 {
  margin: 2px 0 0;
  font-family: "Rajdhani", sans-serif;
  font-size: clamp(1.4rem, 4vw, 2.05rem);
  letter-spacing: 0.04em;
}

.status-box {
  padding: 8px 12px;
  border: 1px solid #365970;
  border-radius: 6px;
  color: var(--warn);
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

.status-box.connected {
  color: var(--ok);
  border-color: rgba(63, 212, 151, 0.7);
  box-shadow: inset 0 0 16px rgba(63, 212, 151, 0.2);
}

.status-box.active {
  animation: pulse 1.1s infinite;
}

.panel-title {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #86cde6;
  margin-bottom: 10px;
}

.field-row {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

label {
  font-size: 0.88rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
select {
  border: 1px solid #34546c;
  background: #111f2d;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
}

.meta {
  color: #99b2c5;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.actions,
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn {
  border: 1px solid #456a82;
  background: #132534;
  color: var(--text);
  padding: 8px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #1c789e, #145575);
  border-color: #2f89ac;
}

.btn.active {
  border-color: rgba(95, 245, 181, 0.8);
  box-shadow: inset 0 0 10px rgba(95, 245, 181, 0.2);
}

.btn-danger {
  background: linear-gradient(180deg, #8f2a2a, #6f1f1f);
  border-color: #bb5252;
}

.comms-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
}

.ptt {
  border: 2px solid #346984;
  background: linear-gradient(180deg, #204965, #1a3449);
  color: #d8eef8;
  border-radius: 12px;
  min-height: 120px;
  font-family: "Rajdhani", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
}

.ptt:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ptt.talking {
  border-color: #5ef6b4;
  background: linear-gradient(180deg, #127a56, #0e6043);
  animation: pulse 1s infinite;
}

.volume-label {
  align-self: center;
}

input[type="range"] {
  width: min(320px, 100%);
}

.call-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.incoming-call {
  margin-top: 10px;
  border: 1px solid rgba(244, 191, 74, 0.8);
  border-radius: 8px;
  background: rgba(91, 65, 8, 0.22);
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.incoming-call.hidden {
  display: none;
}

.latch-row {
  margin-top: 10px;
}

.participant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.participant-list li {
  border: 1px solid #2a4a5f;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  background: rgba(13, 27, 39, 0.85);
}

.participant-list li.speaking {
  border-color: rgba(95, 245, 181, 0.8);
  box-shadow: inset 0 0 10px rgba(95, 245, 181, 0.2);
}

.log-panel pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.83rem;
  color: #a3d7ea;
}

.admin-events {
  display: grid;
  gap: 10px;
}

.admin-event-card {
  border: 1px solid #2a4a5f;
  border-radius: 10px;
  padding: 10px;
  background: rgba(8, 19, 29, 0.7);
}

.admin-event-head {
  display: grid;
  gap: 8px;
}

.admin-room-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-room-item,
.admin-room-create {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.wizard-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wizard-step.active {
  border-color: rgba(95, 245, 181, 0.8);
  box-shadow: inset 0 0 10px rgba(95, 245, 181, 0.2);
}

.wizard-body {
  display: grid;
  gap: 10px;
}

.field-inline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.wizard-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #2f4f64;
  border-radius: 6px;
  padding: 4px 7px;
}

.acl-wrap {
  overflow: auto;
}

.acl-table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

.acl-table th,
.acl-table td {
  border: 1px solid #2f4f64;
  padding: 6px;
  text-align: center;
}

.acl-table th {
  background: rgba(20, 39, 54, 0.9);
  color: #9ed6eb;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(67, 215, 153, 0.42); }
  100% { box-shadow: 0 0 0 16px rgba(67, 215, 153, 0); }
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .comms-layout {
    grid-template-columns: 1fr;
  }

  .call-row,
  .admin-room-item,
  .admin-room-create,
  .field-inline,
  .wizard-split {
    grid-template-columns: 1fr;
  }

  .ptt {
    min-height: 95px;
  }
}
