:root {
  --nice-blue: #0a59cb;
  --nice-blue-dark: #0747a8;
  --nice-blue-soft: #e8f0ff;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f1f3f8;
  --border: #e1e6ef;
  --border-strong: #c8d0dd;

  --text-strong: #0f172a;
  --text: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --accept: #10b981;
  --accept-dark: #059669;
  --reject: #ef4444;
  --reject-dark: #dc2626;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);

  --radius: 10px;
  --radius-lg: 14px;
  --topbar-h: 56px;
  --rail-w: 56px;
  --interactions-w: 280px;
  --customer-w: 320px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.muted-text {
  color: var(--text-muted);
  font-size: 12px;
}

/* ─── Shell ────────────────────────────────────────────────────────────── */
.cxone-shell {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.cxone-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.cxone-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-glyph {
  width: 28px;
  height: 28px;
  background: var(--nice-blue);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
}

.brand-mock {
  background: var(--warning-soft);
  color: var(--warning-text);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.cxone-topbar__center {
  position: relative;
  justify-self: center;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-strong);
  transition: background 120ms;
}

.state-pill:hover {
  background: var(--surface-muted);
}

.state-pill .state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accept);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.state-pill[data-state="Unavailable"] .state-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.state-pill[data-state="LoggedOut"] .state-dot {
  background: var(--text-faint);
  box-shadow: none;
}

.state-pill .state-timer {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 12px;
}

.state-pill .chevron {
  font-size: 16px;
  color: var(--text-muted);
}

.state-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.state-menu[hidden] {
  display: none;
}

.state-menu button {
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

.state-menu button:hover {
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
}

.state-menu__divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.state-menu__divider:first-child {
  border-top: none;
  margin-top: 0;
}

.cxone-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.icon-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.icon-btn .material-symbols-rounded {
  font-size: 20px;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.agent-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nice-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.agent-chip__name {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-strong);
}

/* ─── Body grid ───────────────────────────────────────────────────────── */
.cxone-body {
  display: grid;
  grid-template-columns: var(--rail-w) var(--interactions-w) 1fr var(--customer-w);
  height: 100%;
  min-height: 0;
}

/* ─── Left rail ───────────────────────────────────────────────────────── */
.cxone-rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
}

.rail-spacer {
  flex: 1;
}

.rail-btn {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.rail-btn:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.rail-btn--active {
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
}

.rail-btn--active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--nice-blue);
}

.rail-btn .material-symbols-rounded {
  font-size: 20px;
}

/* ─── Interactions pane ───────────────────────────────────────────────── */
.cxone-interactions {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cxone-interactions__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cxone-interactions__header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.link-btn {
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--nice-blue);
  padding: 4px 8px;
  border-radius: 6px;
}

.link-btn:hover {
  background: var(--nice-blue-soft);
}

.link-btn .material-symbols-rounded {
  font-size: 16px;
}

.interaction-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.interaction-list__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  text-align: center;
  padding: 24px;
}

.interaction-list__empty .material-symbols-rounded {
  font-size: 36px;
  margin-bottom: 8px;
  color: var(--text-faint);
}

.interaction-list__empty p {
  margin: 0;
  font-size: 12px;
}

.interaction-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  position: relative;
  transition: background 120ms;
}

.interaction-item:hover {
  background: var(--surface-muted);
}

.interaction-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.interaction-item__icon .material-symbols-rounded {
  font-size: 18px;
}

.interaction-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.interaction-item__title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.interaction-item__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.interaction-item--alerting {
  border-color: var(--warning);
  background: #fffbeb;
}

.interaction-item--active {
  border-color: var(--accept);
  background: #f0fdf4;
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* ─── Stage ───────────────────────────────────────────────────────────── */
.cxone-stage {
  padding: 24px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: auto;
  min-height: 0;
}

.state-view[hidden] {
  display: none;
}

.stage-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  width: 100%;
  max-width: 480px;
  margin: auto;
}

.stage-empty__glyph {
  font-size: 56px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.stage-empty h2 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text-strong);
  font-weight: 600;
}

.stage-empty p {
  margin: 0;
  font-size: 13px;
}

.interaction-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.interaction-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge .material-symbols-rounded {
  font-size: 14px;
}

.badge--alerting {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.badge--connected {
  background: #dcfce7;
  color: #166534;
}

.badge--wrapup {
  background: #e0e7ff;
  color: #3730a3;
}

.skill-chip {
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
}

.timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
}

.interaction-card__caller {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.avatar {
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar--xl {
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
}

.avatar--xl .material-symbols-rounded {
  font-size: 48px;
}

.caller-name {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-strong);
}

.caller-phone {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.caller-status {
  margin: 8px 0 0;
  color: var(--warning-text);
  font-size: 13px;
  font-weight: 500;
}

.muted-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--reject);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 8px;
}

.muted-pill .material-symbols-rounded {
  font-size: 14px;
}

/* ─── Ringing actions (Accept/Reject) ─────────────────────────────────── */
.ringing-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  transition: background-color 120ms;
}

.btn .material-symbols-rounded {
  font-size: 18px;
}

.btn--primary {
  background: var(--nice-blue);
}

.btn--primary:hover:not(:disabled) {
  background: var(--nice-blue-dark);
}

.btn--accept {
  background: var(--accept);
}

.btn--accept:hover:not(:disabled) {
  background: var(--accept-dark);
}

.btn--reject {
  background: var(--reject);
}

.btn--reject:hover:not(:disabled) {
  background: var(--reject-dark);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-muted);
}

.btn:disabled {
  opacity: 0.5;
}

/* ─── Voice control strip ─────────────────────────────────────────────── */
.voice-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.ctl {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  min-width: 64px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  transition: background 120ms, border-color 120ms;
}

.ctl .material-symbols-rounded {
  font-size: 22px;
  color: var(--text-strong);
}

.ctl:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.ctl:disabled {
  opacity: 0.4;
}

.ctl--end {
  border-color: var(--reject);
  background: var(--reject);
  color: #fff;
}

.ctl--end .material-symbols-rounded {
  color: #fff;
}

.ctl--end:hover:not(:disabled) {
  background: var(--reject-dark);
  border-color: var(--reject-dark);
}

/* ─── Customer Card pane ──────────────────────────────────────────────── */
.cxone-app-space {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.cxone-app-space__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cxone-app-space__header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.cxone-app-space__header .material-symbols-rounded {
  color: var(--text-muted);
  font-size: 18px;
}

.app-space-empty {
  padding: 24px;
}

.customer-card {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.customer-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--nice-blue-soft);
  color: var(--nice-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.customer-card__avatar .material-symbols-rounded {
  font-size: 32px;
}

.customer-card h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.customer-card .muted-text {
  margin: 2px 0 16px;
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  border-top: 1px solid var(--border);
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.meta-list li span {
  color: var(--text-muted);
}

.meta-list li strong {
  color: var(--text-strong);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* ─── Dev drawer ──────────────────────────────────────────────────────── */
.dev-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--text-strong);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.dev-toggle:hover {
  background: #1e293b;
}

.dev-toggle .material-symbols-rounded {
  font-size: 16px;
}

.dev-panel {
  position: fixed;
  bottom: 64px;
  right: 16px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 99;
  overflow: hidden;
}

.dev-panel[hidden] {
  display: none;
}

.dev-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--text-strong);
  color: #fff;
}

.dev-panel__header h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dev-panel__header .icon-btn {
  color: #fff;
  width: 28px;
  height: 28px;
}

.dev-panel__header .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.dev-panel__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dev-panel__body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dev-panel__body input,
.dev-panel__body select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-strong);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.dev-panel__body input:focus,
.dev-panel__body select:focus {
  outline: 2px solid var(--nice-blue);
  outline-offset: -1px;
}

.dev-panel__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.dev-panel__actions .btn {
  padding: 8px 12px;
  font-size: 12px;
}
