:root {
  --page: #120f23;
  --panel: rgba(58, 16, 37, 0.42);
  --panel-soft: rgba(39, 25, 63, 0.9);
  --tile: linear-gradient(135deg, #27193f, #1a112a);
  --ink: #f8f4ff;
  --muted: #c8bce5;
  --line: rgba(255, 255, 255, 0.16);
  --sidebar: #1e1737;
  --sidebar-soft: rgba(255, 255, 255, 0.1);
  --accent: #ffd86b;
  --accent-dark: #ffa063;
  --accent-soft: rgba(255, 216, 107, 0.15);
  --warning: #ffb86c;
  --danger: #ff7b8b;
  --purple: #6750a4;
  --blue-orb: #79a6ff;
  --shadow: 0 24px 70px rgba(12, 9, 28, 0.38);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at -8% 4%, rgba(121, 166, 255, 0.35), transparent 22rem),
    radial-gradient(circle at 102% 8%, rgba(255, 122, 210, 0.34), transparent 24rem),
    radial-gradient(circle at 12% 105%, rgba(255, 184, 108, 0.28), transparent 20rem),
    linear-gradient(180deg, #5025c9 0%, #8e56f4 48%, #d4abfc 100%);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Poppins", "Trebuchet MS", "Aptos", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.hidden {
  display: none !important;
}

.app-frame {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #1e1737, #19132d 45%, #120f23);
  color: var(--ink);
  box-shadow: 14px 0 44px rgba(11, 7, 28, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffd86b, #ffa063);
  color: #171725;
  font-size: 1.5rem;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(255, 160, 99, 0.24);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #e7deff;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 1.3rem;
}

h2 {
  font-size: clamp(1.65rem, 2.3vw, 2.25rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.05rem;
}

.nav {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.nav-section-history {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-section-title {
  margin: 4px 0 2px;
  color: #bba7ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-section-hint {
  margin: -2px 0 4px;
  color: #c8bce5;
  font-size: 0.76rem;
  line-height: 1.35;
}

.nav-item,
.ghost-button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  color: #fff9ff;
  background: transparent;
  text-align: left;
}

.nav-item {
  position: relative;
  padding: 13px 14px 13px 40px;
  font-weight: 900;
}

.nav-item::before {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  content: "";
  transform: translateY(-50%);
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent), 0 12px 28px rgba(0, 0, 0, 0.16);
}

.nav-item.active::before {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  word-break: break-word;
}

.ghost-button {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.main {
  min-width: 0;
  padding: clamp(20px, 4vw, 44px);
}

.auth-panel,
.gate-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(58, 16, 37, 0.42), rgba(27, 58, 99, 0.34)),
    rgba(18, 15, 35, 0.42);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel {
  display: grid;
  gap: 26px;
  max-width: 1080px;
  padding: clamp(22px, 4vw, 42px);
}

.auth-copy {
  max-width: 620px;
}

.auth-copy p:last-child {
  color: var(--muted);
}

.auth-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.wide-left {
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
}

.panel,
.gate-panel {
  padding: 22px;
}

.gate-panel {
  max-width: 720px;
}

.diagnostics-panel {
  max-width: 1080px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(18, 15, 35, 0.62);
  box-shadow: 0 10px 30px rgba(12, 9, 28, 0.22);
  backdrop-filter: blur(16px);
}

.diagnostics-panel summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--accent);
  font-weight: 900;
}

.diagnostics-panel pre {
  overflow: auto;
  max-height: 220px;
  margin: 0;
  border-top: 1px solid var(--line);
  color: #f8f4ff;
  padding: 14px 16px;
  white-space: pre-wrap;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(39, 25, 63, 0.95), rgba(26, 17, 42, 0.95)),
    #1a112a;
  color: var(--ink);
  padding: 13px 15px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #b9a6da;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 216, 107, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 216, 107, 0.14);
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: 20px;
  font-weight: 900;
}

.primary-button,
.secondary-button {
  padding: 12px 16px;
}

.primary-button {
  margin-top: 18px;
  border: 1px solid rgba(255, 240, 201, 0.62);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #171725;
  box-shadow: 0 12px 28px rgba(255, 160, 99, 0.26);
}

.primary-button:hover {
  filter: brightness(1.04);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(180deg, #2c1c44, #211532);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: rgba(255, 216, 107, 0.66);
  color: var(--accent);
}

.secondary-button.active-filter {
  border-color: rgba(255, 216, 107, 0.72);
  background: linear-gradient(135deg, rgba(255, 216, 107, 0.2), rgba(255, 160, 99, 0.12));
  color: var(--accent);
}

.danger-button {
  border-color: rgba(255, 123, 139, 0.66);
  color: #ffd5dc;
}

.danger-button:hover {
  border-color: var(--danger);
  color: #ffffff;
}

.text-button {
  padding: 7px 9px;
  background: rgba(255, 216, 107, 0.14);
  color: var(--accent);
}

.inline-action {
  display: inline-block;
  margin-left: 8px;
  padding: 5px 8px;
}

.table-action {
  width: max-content;
  margin-top: 0;
  padding: 8px 11px;
  white-space: nowrap;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.action-groups {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.action-group {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(13, 10, 28, 0.16));
  padding: 14px;
}

.action-group-danger {
  border-color: rgba(255, 123, 139, 0.26);
  background: linear-gradient(180deg, rgba(255, 123, 139, 0.1), rgba(44, 16, 28, 0.2));
}

.action-group-heading {
  display: grid;
  gap: 4px;
}

.action-group-title,
.action-group-copy {
  margin: 0;
}

.action-group-title {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.action-group-copy {
  color: var(--muted);
  font-size: 0.9rem;
}

.action-group-danger .action-group-title {
  color: #ffd5dc;
}

.super-admin-intro .helper {
  max-width: 64ch;
}

.super-admin-grid {
  margin-top: 18px;
}

.super-admin-group-panel {
  display: grid;
  gap: 16px;
}

.super-admin-split,
.hub-launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.super-admin-block,
.hub-launcher-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(14, 11, 30, 0.18));
  padding: 16px;
}

.hub-launcher-card {
  border-color: rgba(255, 216, 107, 0.22);
  background:
    radial-gradient(circle at top right, rgba(255, 216, 107, 0.16), transparent 11rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(14, 11, 30, 0.18));
}

.super-admin-danger-block {
  border-color: rgba(255, 123, 139, 0.32);
  background:
    radial-gradient(circle at top right, rgba(255, 123, 139, 0.16), transparent 10rem),
    linear-gradient(180deg, rgba(255, 123, 139, 0.08), rgba(44, 16, 28, 0.18));
}

.hub-launcher-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.hub-launcher-top .primary-button,
.hub-launcher-top .secondary-button,
.hub-launcher-top .text-button {
  margin-top: 0;
}

.hub-launcher-title,
.hub-launcher-copy {
  margin: 0;
}

.hub-launcher-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.hub-launcher-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.super-admin-block .helper,
.hub-launcher-card .helper {
  margin-top: 0;
}

.live-call-list {
  display: grid;
  gap: 14px;
}

.live-call-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(121, 166, 255, 0.16), transparent 12rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(18, 13, 34, 0.18));
  padding: 10px;
  box-shadow: 0 14px 32px rgba(12, 9, 28, 0.16);
}

.live-call-card.live-call-card-busy {
  border-color: rgba(255, 160, 99, 0.52);
  background:
    radial-gradient(circle at top left, rgba(255, 160, 99, 0.26), transparent 12rem),
    radial-gradient(circle at bottom right, rgba(255, 216, 107, 0.16), transparent 10rem),
    linear-gradient(180deg, rgba(255, 180, 112, 0.12), rgba(40, 18, 8, 0.24));
  box-shadow: 0 18px 36px rgba(105, 52, 13, 0.24);
}

.live-call-card.live-call-card-connected {
  border-color: rgba(110, 255, 172, 0.9);
  background:
    radial-gradient(circle at top left, rgba(119, 255, 174, 0.46), transparent 14rem),
    linear-gradient(135deg, rgba(32, 168, 88, 0.58), rgba(13, 102, 57, 0.58));
  box-shadow: 0 18px 38px rgba(35, 176, 92, 0.42);
}

.live-call-card.live-call-card-offline {
  border-color: rgba(203, 211, 220, 0.5);
  background: linear-gradient(135deg, rgba(112, 122, 135, 0.35), rgba(48, 54, 64, 0.48));
  box-shadow: none;
}

.live-call-card.live-call-card-busy .live-call-side {
  border-color: rgba(255, 187, 120, 0.34);
  background: linear-gradient(180deg, rgba(255, 205, 144, 0.12), rgba(37, 18, 9, 0.24));
}

.live-call-card.live-call-card-busy .live-call-side.customer {
  border-color: rgba(255, 180, 97, 0.42);
  background:
    radial-gradient(circle at top left, rgba(255, 171, 84, 0.2), transparent 9rem),
    linear-gradient(180deg, rgba(255, 214, 148, 0.14), rgba(37, 18, 9, 0.24));
}

.live-call-card.live-call-card-busy .live-call-side.listener {
  border-color: rgba(255, 178, 107, 0.38);
  background:
    radial-gradient(circle at top right, rgba(255, 174, 93, 0.18), transparent 9rem),
    linear-gradient(180deg, rgba(255, 205, 144, 0.12), rgba(37, 18, 9, 0.24));
}

.live-call-card.live-call-card-connected .live-call-side {
  border-color: rgba(172, 255, 208, 0.74);
  background: linear-gradient(180deg, rgba(137, 255, 190, 0.3), rgba(17, 100, 57, 0.32));
}

.live-call-card.live-call-card-offline .live-call-side {
  border-color: rgba(218, 224, 231, 0.32);
  background: rgba(191, 201, 213, 0.11);
}

.live-call-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.live-call-card-top > div:first-child,
.live-call-side-top > div:first-child {
  min-width: 0;
}

.live-call-card-top h3,
.live-call-card-top p {
  margin: 0;
}

.live-call-card-title {
  font-size: 0.98rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.live-call-card-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.live-call-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.live-call-flow {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(215px, 255px) minmax(0, 0.82fr);
  gap: 9px;
  align-items: stretch;
}

.live-call-side {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(17, 13, 31, 0.2));
}

.live-call-side.customer {
  border-color: rgba(255, 216, 107, 0.28);
  background:
    radial-gradient(circle at top left, rgba(255, 216, 107, 0.14), transparent 10rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(17, 13, 31, 0.2));
}

.live-call-side.listener {
  border-color: rgba(121, 166, 255, 0.3);
  background:
    radial-gradient(circle at top right, rgba(121, 166, 255, 0.16), transparent 10rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(17, 13, 31, 0.2));
}

.live-call-side-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
}

.live-call-side-title {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.live-call-top-state-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.live-call-user-state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.45);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.live-call-side-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Dense identity-and-wallet snapshot used by both sides of a live call. */
.live-call-compact-rows {
  display: grid;
  gap: 1px;
}

.live-call-compact-row {
  display: grid;
  grid-template-columns: minmax(84px, 0.42fr) minmax(0, 1fr);
  align-items: start;
  gap: 5px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-call-compact-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.live-call-compact-row > span {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.25;
  text-transform: uppercase;
}

.live-call-compact-row .live-call-detail-value {
  min-width: 0;
  gap: 1px;
}

.live-call-compact-row .live-call-detail-value b {
  font-size: 0.7rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.live-call-compact-row .live-call-detail-value small {
  font-size: 0.65rem;
  line-height: 1.2;
}

.live-call-field-grid {
  margin: 0;
}

.live-call-field-grid .detail-card {
  min-height: 70px;
  padding: 10px;
}

.live-call-center {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 7px;
}

.live-call-arrow-icon {
  color: var(--accent);
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 10px 26px rgba(255, 216, 107, 0.5);
}

.live-call-center > .live-call-compact-rows {
  width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(17, 13, 31, 0.16);
}

.live-call-center .live-call-compact-rows {
  gap: 0;
}

.live-call-center .live-call-compact-row {
  grid-template-columns: minmax(58px, 0.36fr) minmax(0, 1fr);
  gap: 5px;
  padding: 3px 0;
}

.live-call-center .live-call-compact-row > span {
  font-size: 0.5rem;
  line-height: 1.15;
}

.live-call-center .live-call-compact-row .live-call-detail-value b {
  font-size: 0.68rem;
  line-height: 1.14;
}

.live-call-center .live-call-compact-row .live-call-detail-value small {
  font-size: 0.62rem;
  line-height: 1.1;
}

.live-call-center-grid {
  width: 100%;
  display: grid;
  gap: 8px;
}

.live-call-center-field-grid {
  display: grid;
  gap: 8px;
}

.live-call-center-field-grid .detail-card {
  min-height: 0;
  padding: 10px;
  text-align: left;
}

.live-call-center-field-grid .detail-card span {
  font-size: 0.66rem;
}

.live-call-center-field-grid .detail-card strong {
  font-size: 0.82rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.live-call-center-field-grid .detail-card:first-child strong {
  font-family: "IBM Plex Mono", "Fira Code", Consolas, monospace;
  font-size: 0.78rem;
}

.live-call-action-stack {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.live-call-action-stack .text-button,
.live-call-action-stack .secondary-button {
  margin-top: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.74rem;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
}

.live-call-side .uid-chip {
  align-self: start;
  max-width: 100%;
  font-size: 0.74rem;
  padding: 7px 10px;
}

.live-call-chip-row .uid-chip {
  max-width: 100%;
  font-size: 0.74rem;
  padding: 7px 10px;
  white-space: normal;
  line-height: 1.25;
}

.live-call-status-chip {
  border-width: 1px;
  border-style: solid;
}

.live-call-status-in-call {
  border-color: rgba(255, 160, 99, 0.62);
  background: linear-gradient(135deg, rgba(230, 125, 57, 0.3), rgba(125, 57, 16, 0.36));
  color: #fff0dd;
  box-shadow: 0 10px 22px rgba(125, 57, 16, 0.22);
}

.live-call-status-online {
  border-color: rgba(101, 230, 161, 0.56);
  background: linear-gradient(135deg, rgba(66, 179, 126, 0.26), rgba(35, 104, 69, 0.34));
  color: #d5ffe7;
}

.live-call-status-offline {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.live-call-status-unknown {
  border-color: rgba(255, 216, 107, 0.3);
  background: rgba(255, 216, 107, 0.08);
  color: var(--accent);
}

.live-call-field-grid .detail-card span,
.live-call-center-grid .detail-card span {
  font-size: 0.68rem;
}

.live-call-field-grid .detail-card strong,
.live-call-center-grid .detail-card strong {
  font-size: 0.88rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.live-call-detail-value {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.live-call-detail-value b {
  font: inherit;
  font-weight: 700;
}

.live-call-detail-value small {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.3;
}

.live-call-detail-value.live-call-coin-added,
.live-call-detail-value.live-call-coin-added b {
  color: #72f5a8;
}

.live-call-detail-value.live-call-coin-reset,
.live-call-detail-value.live-call-coin-reset b {
  color: #ff9b9b;
}

.compact-button-row {
  justify-content: flex-end;
  gap: 6px;
}

@media (max-width: 1180px) {
  .live-call-flow {
    grid-template-columns: 1fr;
  }

  .live-call-center {
    justify-items: stretch;
  }

  .live-call-arrow-icon {
    justify-self: center;
    transform: rotate(90deg);
  }

  .live-call-field-grid {
    grid-template-columns: 1fr;
  }
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}

.check-row input {
  width: auto;
}

.three-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.top-progress {
  position: sticky;
  top: 14px;
  z-index: 45;
  display: grid;
  gap: 8px;
  margin: -10px 0 18px;
  border: 1px solid rgba(255, 216, 107, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 216, 107, 0.2), transparent 12rem),
    rgba(20, 16, 38, 0.86);
  padding: 10px 12px;
  box-shadow: 0 16px 42px rgba(12, 9, 28, 0.28);
  backdrop-filter: blur(14px);
}

.top-progress-track {
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.top-progress-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark), #79a6ff);
  animation: top-progress-slide 1.05s ease-in-out infinite;
}

.top-progress p {
  margin: 0;
  color: #fff4c4;
  font-size: 0.82rem;
  font-weight: 900;
}

@keyframes top-progress-slide {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(90%);
  }
  100% {
    transform: translateX(260%);
  }
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.uid-chip {
  max-width: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  padding: 9px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.view.active.scrollable-admin-view {
  align-content: start;
  max-height: calc(100vh - 172px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  padding-bottom: 28px;
  scrollbar-gutter: stable;
}

.scrollable-admin-view .sticky-panel {
  position: static;
}

.view.active.scrollable-admin-view::-webkit-scrollbar {
  width: 10px;
}

.view.active.scrollable-admin-view::-webkit-scrollbar-thumb {
  border: 2px solid rgba(18, 15, 35, 0.8);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.view.active.scrollable-admin-view::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

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

.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.wide-dashboard-card {
  grid-column: 1 / -1;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  padding: 20px;
  box-shadow: 0 12px 32px rgba(12, 9, 28, 0.18);
}

.stat-card::after {
  position: absolute;
  right: -24px;
  bottom: -32px;
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 216, 107, 0.78), rgba(255, 160, 99, 0.16));
  content: "";
  opacity: 0.68;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  letter-spacing: -0.05em;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.list-item,
.empty-state {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--tile);
  padding: 13px;
}

.list-item {
  position: relative;
  overflow: hidden;
}

.selected-item {
  border-color: rgba(255, 216, 107, 0.72);
  background: linear-gradient(135deg, rgba(255, 216, 107, 0.18), rgba(39, 25, 63, 0.94));
}

.list-item::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  content: "";
}

.call-card {
  gap: 8px;
  background:
    radial-gradient(circle at top right, rgba(255, 216, 107, 0.18), transparent 12rem),
    var(--tile);
}

.listener-card::before {
  background: linear-gradient(180deg, #79a6ff, #9d7cff);
}

.customer-card::before {
  background: linear-gradient(180deg, #ffd86b, #ffa063);
}

.role-pill {
  display: inline-flex;
  width: max-content;
  margin-bottom: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role-pill.listener {
  background: rgba(121, 166, 255, 0.2);
  color: #d8deff;
}

.role-pill.customer {
  background: rgba(255, 216, 107, 0.18);
  color: #fff0a3;
}

.role-pill.user {
  background: rgba(187, 167, 255, 0.2);
  color: #e7deff;
}

.danger-text {
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 900;
}

.list-item span,
.empty-state,
.helper {
  color: var(--muted);
}

.list-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-panel {
  margin-top: 16px;
}

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

.detail-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-card {
  grid-column: 1 / -1;
}

.listener-admin-grid {
  margin-top: 16px;
}

.detail-card {
  border: 1px solid rgba(244, 201, 142, 0.28);
  border-radius: 20px;
  background: var(--tile);
  padding: 12px;
}

.detail-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-card strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.detail-section-title {
  margin-top: 18px;
}

.compact-json {
  min-height: 160px;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.action-stack .primary-button {
  margin-top: 0;
}

.listener-table-actions {
  min-width: 360px;
  align-items: flex-start;
}

.listener-action-toggle {
  width: max-content;
}

.listener-table-actions .text-button {
  font-size: 0.74rem;
  line-height: 1.1;
}

.control-card {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 216, 107, 0.2), transparent 11rem),
    var(--panel);
}

.mini-form {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(18, 15, 35, 0.44);
  padding: 13px;
}

.mini-form .eyebrow {
  margin-bottom: 8px;
}

.callout {
  margin: 14px 0;
  border: 1px solid rgba(255, 216, 107, 0.36);
  border-radius: 20px;
  background: rgba(255, 216, 107, 0.12);
  color: #fff0a3;
  padding: 13px 15px;
  font-weight: 800;
}

.banner-preview {
  display: grid;
  align-items: end;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(18, 15, 35, 0.9), rgba(103, 80, 164, 0.66)),
    radial-gradient(circle at top right, rgba(255, 216, 107, 0.48), transparent 16rem);
  background-position: center;
  background-size: cover;
  color: #ffffff;
  padding: 24px;
  box-shadow: var(--shadow);
}

.banner-preview .helper,
.banner-preview .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.ai-preview {
  min-height: 220px;
  margin-bottom: 14px;
}

.gemini-live-panel {
  min-height: 620px;
}

.tall-textarea {
  min-height: 150px;
}

.gemini-transcript {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.gemini-message {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(39, 25, 63, 0.94), rgba(26, 17, 42, 0.92)),
    #1a112a;
  padding: 14px;
}

.gemini-message strong {
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gemini-message span {
  color: #f8f4ff;
  line-height: 1.45;
}

.gemini-message small {
  color: var(--muted);
  font-weight: 800;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-weight: 900;
}

.weekly-trend-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.weekly-trend-item {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.weekly-trend-bar-wrap {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  height: 132px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px;
}

.weekly-trend-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.weekly-trend-item strong {
  color: var(--ink);
}

.weekly-trend-item small {
  font-size: 0.72rem;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(10, 7, 24, 0.72);
  padding: 22px;
  backdrop-filter: blur(8px);
}

.modal-card {
  overflow: auto;
  width: min(1080px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(255, 216, 107, 0.14), transparent 16rem),
    linear-gradient(180deg, #251c42, #18132d);
  padding: 22px;
  box-shadow: 0 26px 80px rgba(6, 4, 18, 0.52);
}

.secondary-modal {
  z-index: 70;
  background: rgba(10, 7, 24, 0.78);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
}

.modal-actions .secondary-button {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 20px rgba(12, 9, 28, 0.12);
}

.path-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.path-list code,
.helper code,
.gate-panel code {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff0a3;
  padding: 3px 7px;
}

.toolbar {
  justify-content: space-between;
}

.toolbar input {
  max-width: 560px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1a1530;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 0.93rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.06);
}

.sticky-panel {
  position: sticky;
  top: 22px;
  align-self: start;
}

.helper {
  margin: 15px 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.json-box {
  overflow: auto;
  min-height: 280px;
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #100d1f;
  color: #e7deff;
  padding: 15px;
  white-space: pre-wrap;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(255, 216, 107, 0.35);
  border-radius: 20px;
  background: #18132d;
  color: #ffffff;
  padding: 13px 16px;
  box-shadow: var(--shadow);
}

.mobile-menu-button {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 28px rgba(12, 9, 28, 0.16);
}

.mobile-menu-button span {
  display: block;
  width: 18px;
  height: 3px;
  margin: 2px 0;
  border-radius: 999px;
  background: #ffffff;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(10, 7, 24, 0.62);
  backdrop-filter: blur(4px);
}

.admin-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 60;
  display: none;
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(185, 212, 184, 0.72);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 241, 255, 0.95)),
    #f7f2ff;
  padding: 8px 10px 10px;
  box-shadow: 0 18px 44px rgba(12, 9, 28, 0.32);
  transform: translateX(-50%);
}

.admin-bottom-nav::before {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #c7b8e8;
  content: "";
  transform: translateX(-50%);
}

.bottom-nav-item {
  display: grid;
  flex: 1;
  justify-items: center;
  min-height: 74px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: #6d5a94;
  padding: 16px 6px 8px;
  font-size: 0.76rem;
  font-weight: 900;
}

.bottom-nav-item.active {
  background: linear-gradient(180deg, #f2e9ff, #e5d8ff);
  color: #2f1c58;
}

.bottom-nav-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 14px;
  background: rgba(103, 80, 164, 0.12);
  color: #6750a4;
  font-size: 0.86rem;
}

.bottom-nav-item.active .bottom-nav-icon {
  background: linear-gradient(135deg, #ffd86b, #ffa063);
  color: #171725;
}

@media (max-width: 980px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 65;
    width: min(300px, calc(100vw - 42px));
    height: 100vh;
    overflow: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu-button {
    display: grid;
  }

  .admin-bottom-nav {
    display: flex;
  }

  .nav-section {
    grid-template-columns: 1fr;
  }

  .main {
    padding-bottom: 128px;
  }

  .view.active.scrollable-admin-view {
    max-height: calc(100vh - 190px);
  }

  .stats-grid,
  .dashboard-analytics-grid,
  .auth-grid,
  .two-column,
  .wide-left {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }

  .toast {
    bottom: 118px;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px 14px 124px;
  }

  .view.active.scrollable-admin-view {
    max-height: calc(100vh - 216px);
    padding-right: 2px;
  }

  .sidebar {
    padding: 18px;
  }

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

  .nav-section {
    grid-template-columns: 1fr;
  }

  .topbar,
  .toolbar,
  .topbar-actions {
    align-items: stretch;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(24, 19, 45, 0.72);
    padding: 10px;
    backdrop-filter: blur(18px);
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    flex-direction: column;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar input,
  .secondary-button,
  .primary-button {
    max-width: none;
    width: 100%;
  }

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

  .super-admin-split,
  .hub-launcher-grid {
    grid-template-columns: 1fr;
  }

  .hub-launcher-top {
    flex-direction: column;
    align-items: stretch;
  }

  .live-call-card-top,
  .live-call-side-top {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .live-call-chip-row {
    justify-content: flex-start;
    gap: 5px;
  }

  .live-call-card {
    gap: 8px;
    border-radius: 18px;
    padding: 10px;
  }

  .live-call-side {
    gap: 8px;
    border-radius: 16px;
    padding: 9px;
  }

  .live-call-flow {
    gap: 8px;
  }

  .live-call-card-title {
    font-size: 0.84rem;
    line-height: 1.22;
  }

  .live-call-card-copy {
    margin-top: 2px;
    font-size: 0.72rem;
    line-height: 1.22;
  }

  .live-call-side-title {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .live-call-side-copy {
    display: none;
  }

  .live-call-side .uid-chip,
  .live-call-chip-row .uid-chip {
    font-size: 0.66rem;
    line-height: 1.15;
    padding: 5px 8px;
  }

  .live-call-field-grid .detail-card,
  .live-call-center-field-grid .detail-card {
    min-height: 0;
    padding: 7px 8px;
    border-radius: 14px;
  }

  .detail-grid.live-call-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .live-call-center {
    gap: 6px;
    align-content: start;
  }

  .live-call-center-grid {
    gap: 0;
  }

  .live-call-center-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .live-call-arrow-icon {
    display: block;
    font-size: 2rem;
  }

  .live-call-field-grid .detail-card span,
  .live-call-center-field-grid .detail-card span {
    font-size: 0.58rem;
    letter-spacing: 0.05em;
  }

  .live-call-field-grid .detail-card strong,
  .live-call-center-field-grid .detail-card strong {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .live-call-center-field-grid .detail-card:first-child strong {
    font-size: 0.7rem;
  }

  .live-call-detail-value {
    gap: 2px;
  }

  .live-call-detail-value small {
    font-size: 0.72em;
    line-height: 1.18;
  }

  .live-call-action-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .live-call-action-stack .text-button,
  .live-call-action-stack .secondary-button {
    width: 100%;
    min-height: 36px;
    padding: 7px 8px;
    font-size: 0.72rem;
    line-height: 1.12;
  }

  .four-buttons,
  .three-buttons {
    grid-template-columns: 1fr;
  }

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

  .weekly-trend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .gate-panel {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 104px;
    padding: 16px;
  }

  .modal {
    align-items: end;
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 28px 28px 0 0;
    padding-bottom: 106px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .listener-table-actions {
    min-width: 0;
    width: 100%;
    margin-top: 8px;
  }

  .listener-action-toggle {
    width: 100%;
    min-height: 40px;
  }

  .listener-table-actions .text-button {
    flex: 1 1 calc(50% - 7px);
  }

  .admin-bottom-nav {
    bottom: 10px;
    width: calc(100vw - 20px);
    padding: 8px 7px 8px;
  }

  .bottom-nav-item {
    min-height: 68px;
    padding: 15px 3px 6px;
    font-size: 0.68rem;
  }

  .bottom-nav-icon {
    width: 32px;
    height: 32px;
  }
}
