:root {
  --bg: #f5efe4;
  --bg-strong: #efe2cb;
  --surface: rgba(255, 251, 244, 0.88);
  --surface-strong: #fffaf2;
  --line: rgba(53, 41, 25, 0.14);
  --ink: #1d1a15;
  --muted: #675c4b;
  --accent: #bb5a2f;
  --accent-deep: #8f4120;
  --accent-soft: rgba(187, 90, 47, 0.14);
  --danger: #a61f2f;
  --ok: #1f7a53;
  --shadow: 0 24px 60px rgba(72, 48, 17, 0.14);
  --radius: 28px;
  --radius-sm: 16px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(135deg, #f1eadf 0%, #e4d2b3 45%, #f6efe4 100%);
}

body {
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

input, textarea, select {
  width: 100%;
  padding: 0.86rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(40, 31, 21, 0.14);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 9rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

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

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

.app-shell {
  width: min(1480px, calc(100vw - 2rem));
  margin: 1rem auto;
  padding: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.6rem 1.8rem;
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(255, 250, 242, 0.96), rgba(248, 238, 221, 0.88));
  border: 1px solid rgba(53, 41, 25, 0.08);
  box-shadow: var(--shadow);
}

.topbar h1 {
  max-width: 46rem;
  font-size: clamp(1.6rem, 2vw, 2.5rem);
  line-height: 1.05;
}

.topbar-meta {
  display: grid;
  gap: 1rem;
  min-width: 18rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(53, 41, 25, 0.09);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.session-box {
  display: grid;
  gap: 0.3rem;
  justify-items: end;
}

.session-box span {
  color: var(--muted);
  font-size: 0.92rem;
}

.layout {
  margin-top: 1rem;
}

.auth-grid,
.console-grid,
.supervisor-grid,
.admin-grid {
  display: grid;
  gap: 1rem;
}

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

.console-grid {
  grid-template-columns: 1.05fr 1.2fr 1.1fr;
}

.supervisor-grid {
  grid-template-columns: 1.5fr 1fr 1fr;
}

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

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

.card {
  border-radius: var(--radius);
  border: 1px solid rgba(53, 41, 25, 0.08);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 1.3rem;
}

.auth-card {
  min-height: 28rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-head.compact {
  margin-bottom: 0.9rem;
}

.card-head h2 {
  font-size: 1.28rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

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

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

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

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 16px;
  padding: 0.88rem 1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #d77949);
  color: #fff8f1;
  box-shadow: 0 16px 30px rgba(187, 90, 47, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(53, 41, 25, 0.1);
  color: var(--ink);
}

.danger-button {
  background: linear-gradient(135deg, var(--danger), #cb4153);
  color: white;
}

.tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tab-button {
  border: 1px solid rgba(53, 41, 25, 0.08);
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.75rem 1rem;
}

.tab-button.is-active {
  background: var(--ink);
  color: #fef7ec;
}

.softphone-summary,
.selection-box,
.queue-panel {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(53, 41, 25, 0.08);
  padding: 1rem;
  min-height: 4.5rem;
}

.softphone-actions,
.assistant-actions,
.dialer-actions {
  display: grid;
  gap: 0.75rem;
}

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

.dialer-box {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

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

.call-chip-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin-top: 1rem;
}

.call-chip,
.operator-item,
.activity-item,
.transcript-item,
.admin-item,
.call-card {
  border-radius: 18px;
  border: 1px solid rgba(53, 41, 25, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.call-chip {
  padding: 0.85rem;
}

.call-chip strong,
.operator-item strong,
.activity-item strong,
.call-card strong,
.admin-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.live-caption {
  min-height: 4.2rem;
  margin-bottom: 0.8rem;
  padding: 0.9rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 240, 229, 0.9), rgba(255, 248, 242, 0.92));
  border: 1px dashed rgba(187, 90, 47, 0.24);
  color: var(--muted);
}

.transcript-list,
.operator-list,
.activity-feed,
.admin-list,
.active-calls-grid {
  display: grid;
  gap: 0.75rem;
}

.transcript-list,
.activity-feed {
  max-height: 40rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.transcript-item {
  width: 100%;
  padding: 0.95rem;
  text-align: left;
}

.transcript-item.is-selected {
  border-color: rgba(187, 90, 47, 0.45);
  background: rgba(255, 241, 232, 0.96);
}

.transcript-item small,
.operator-item small,
.call-card small,
.activity-item small,
.admin-item small {
  color: var(--muted);
}

.active-calls-grid {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.call-card,
.operator-item,
.activity-item,
.admin-item {
  padding: 1rem;
}

.call-card ul,
.operator-item ul {
  margin: 0.55rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
}

.activity-item {
  display: grid;
  gap: 0.35rem;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.75rem;
  z-index: 50;
}

.toast {
  min-width: 18rem;
  max-width: 24rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(29, 26, 21, 0.92);
  color: #fffaf2;
  box-shadow: var(--shadow);
}

.toast.is-error {
  background: rgba(166, 31, 47, 0.94);
}

[hidden] {
  display: none !important;
}

#remoteAudio {
  display: none;
}

@media (max-width: 1180px) {
  .console-grid,
  .supervisor-grid,
  .admin-grid,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .session-box {
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100vw - 1rem);
    margin: 0.5rem auto;
    padding: 0.5rem;
  }

  .topbar,
  .card {
    border-radius: 24px;
    padding: 1rem;
  }

  .tabs,
  .pill-row,
  .two-columns,
  .softphone-actions,
  .assistant-actions,
  .dialer-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tabs {
    gap: 0.5rem;
  }
}