:root {
  --bg: #101216;
  --surface: #171b22;
  --surface-2: #202631;
  --line: #303846;
  --text: #eef3f7;
  --muted: #9aa7b6;
  --accent: #66d6a6;
  --accent-ink: #062017;
  --blue: #80aaff;
  --warn: #f2c766;
  --danger: #ff7a70;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #0d0f13;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 34px;
}

.brand strong {
  font-size: 1.05rem;
}

.brand span,
.user-block {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.logout-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  text-decoration: none;
  padding: 11px 12px;
  cursor: pointer;
}

.nav a:hover,
.nav a.active,
.logout-button:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.sidebar-footer {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 14px;
}

.main {
  padding: 34px;
  min-width: 0;
}

.page-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
}

.page-heading h1 {
  margin: 0 0 6px;
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  letter-spacing: 0;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.content-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
}

.incoming-panel {
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-inner {
  padding: 20px;
}

.stat {
  min-height: 116px;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  padding: 22px 16px;
}

.incoming-list {
  display: grid;
  gap: 12px;
}

.incoming-call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(102, 214, 166, 0.42);
  border-radius: 8px;
  background: #111a17;
  padding: 16px;
}

.live-panel {
  margin-bottom: 18px;
}

.live-call-card {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(128, 170, 255, 0.32);
  border-radius: 8px;
  background: #111720;
  padding: 16px;
}

.live-call-card strong,
.live-call-card span {
  display: block;
}

.live-call-card strong {
  color: var(--blue);
  font-size: 1.2rem;
}

.live-call-card span {
  color: var(--muted);
  margin-top: 4px;
}

.call-media {
  display: grid;
  gap: 12px;
}

.call-media[hidden] {
  display: none;
}

.call-media-status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.call-media-frame {
  width: 100%;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0e13;
}

.call-media-frame[hidden] {
  display: none;
}

.call-media-frame iframe {
  display: block;
  width: 100% !important;
  min-height: 180px;
  border: 0;
}

.incoming-call strong,
.incoming-call span {
  display: block;
}

.incoming-call strong {
  color: var(--accent);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  letter-spacing: 0;
}

.incoming-call span {
  margin-top: 4px;
  color: var(--muted);
}

.call-action-message {
  min-height: 24px;
  margin: 14px 0 0;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  background: #11151c;
  white-space: nowrap;
}

.badge.good {
  color: var(--accent);
  border-color: rgba(102, 214, 166, 0.34);
}

.badge.warn {
  color: var(--warn);
  border-color: rgba(242, 199, 102, 0.34);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
.button-secondary,
.button-danger,
.button-ghost {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button {
  color: var(--accent-ink);
  background: var(--accent);
}

.button-secondary {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.button-danger {
  color: #210200;
  background: var(--danger);
}

.button-ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.form {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 0.9rem;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1319;
  color: var(--text);
  padding: 12px 14px;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(128, 170, 255, 0.42);
  outline-offset: 2px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.checkbox-row input {
  width: 20px;
  height: 20px;
}

.error-list,
.flash {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.error-list {
  border: 1px solid rgba(255, 122, 112, 0.38);
  color: #ffd7d3;
  background: rgba(255, 122, 112, 0.1);
}

.flash.success {
  border: 1px solid rgba(102, 214, 166, 0.34);
  color: #cdf6e3;
  background: rgba(102, 214, 166, 0.1);
}

.flash.error {
  border: 1px solid rgba(255, 122, 112, 0.38);
  color: #ffd7d3;
  background: rgba(255, 122, 112, 0.1);
}

.inline-form {
  display: inline;
}

.copy-link {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px;
  min-width: 440px;
}

.copy-link input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #0f1319;
  padding: 10px 12px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #101216;
}

.auth-card {
  width: min(100%, 480px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.simple-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #101216;
  background: #f6f8f7;
}

.simple-shell {
  width: min(100%, 760px);
  display: grid;
  gap: 28px;
  text-align: center;
}

.simple-name {
  margin: 0;
  color: #5c6973;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
}

.call-button {
  width: 100%;
  min-height: clamp(180px, 38vh, 320px);
  border: 0;
  border-radius: 8px;
  color: #062017;
  background: #66d6a6;
  box-shadow: 0 20px 50px rgba(6, 32, 23, 0.18);
  font-size: clamp(2.6rem, 9vw, 5.9rem);
  line-height: 1.02;
  font-weight: 850;
  letter-spacing: 0;
  cursor: pointer;
  padding: 24px;
}

.call-button:active {
  transform: translateY(1px);
}

.call-button[disabled] {
  color: #4e555a;
  background: #cdd6d2;
  cursor: not-allowed;
  box-shadow: none;
}

.call-button-cancel {
  color: #210200;
  background: #ff7a70;
}

.simple-status {
  min-height: 34px;
  color: #35424a;
  font-size: clamp(1rem, 3vw, 1.35rem);
  margin: 0;
}

.simple-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.simple-call-media {
  width: 100%;
  border: 1px solid #d6dedb;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(6, 32, 23, 0.08);
}

.simple-call-media .call-media-status {
  color: #35424a;
  font-size: clamp(1rem, 3vw, 1.25rem);
}

.simple-call-media .call-media-frame {
  border-color: #d6dedb;
  background: #101216;
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-footer {
    position: static;
    margin-top: 18px;
  }

  .main {
    padding: 24px;
  }

  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-heading,
  .toolbar {
    display: grid;
  }

  .copy-link {
    grid-template-columns: 1fr;
    min-width: 300px;
  }

  .actions {
    display: grid;
  }

  .incoming-call {
    align-items: stretch;
    display: grid;
  }

  .simple-actions {
    grid-template-columns: 1fr;
  }
}
