:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

.operator-page {
  min-height: 100vh;
  overflow: hidden;
  background: #eef3f7;
  color: #111827;
}

.operator-boot,
.login-shell,
.agent-shell {
  min-height: 100vh;
}

.operator-boot,
.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(520px, 100%);
  display: grid;
  gap: 22px;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 28px;
  box-shadow: 0 24px 80px rgb(15 23 42 / 12%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand p,
.eyebrow {
  margin: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-brand h1,
.agent-header h1,
.panel-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-brand h1 {
  font-size: 30px;
  line-height: 1.1;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.login-form input {
  min-width: 0;
  height: 44px;
  border: 1px solid #cad6e3;
  border-radius: 8px;
  padding: 0 14px;
  color: #111827;
  outline: none;
}

.login-form input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 12%);
}

.primary-button,
.header-actions button,
.status-actions button,
.softphone-actions button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #cad6e3;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  padding: 8px 14px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button,
.softphone-actions .answer,
.status-actions .selected {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.login-log {
  display: grid;
  gap: 6px;
}

.log-line {
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
  padding: 9px 10px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.log-line.ok {
  border-color: #0f766e;
}

.log-line.warn {
  border-color: #f59e0b;
}

.log-line.error {
  border-color: #dc2626;
}

.agent-shell {
  height: 100vh;
  padding: 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.agent-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 14px;
  box-shadow: 0 12px 36px rgb(15 23 42 / 6%);
}

.agent-header h1 {
  font-size: 24px;
  line-height: 1.05;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0f766e;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.agent-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 236px minmax(660px, 1fr) 360px;
  gap: 10px;
}

.agent-sidebar,
.agent-main,
.agent-aside {
  min-height: 0;
}

.agent-sidebar,
.agent-aside,
.agent-main {
  display: grid;
  gap: 10px;
}

.agent-sidebar {
  align-content: start;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.sidebar-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

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

.nav-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  border-color: #99f6e4;
  background: #ecfdf5;
  color: #0f766e;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.nav-count,
.panel-count {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e7edf4;
  color: #475467;
  font-size: 13px;
  font-weight: 900;
}

.nav-item.active .nav-count {
  background: #0f766e;
  color: #ffffff;
}

.agent-main {
  grid-template-rows: auto minmax(176px, 0.34fr) minmax(0, 1fr);
}

.agent-aside {
  grid-template-rows: minmax(180px, 0.46fr) minmax(0, 1fr);
}

.status-card,
.softphone-card,
.line-panel,
.side-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  overflow: hidden;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-title,
.panel-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-title {
  justify-content: flex-start;
}

.status-title strong {
  display: block;
  font-size: 28px;
  line-height: 1.05;
}

.status-actions,
.softphone-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.softphone-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.panel-title h2 {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.softphone-meta,
.panel-subtitle {
  margin: 0;
  color: #667085;
  font-size: 14px;
  font-weight: 750;
}

.call-details {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  overflow: auto;
}

.call-details div {
  min-width: 0;
}

.call-details dt {
  color: #667085;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.call-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.line-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.line-list,
.side-list,
.queue-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
}

.icon-badge {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #eef2f6;
  color: #475467;
  position: relative;
}

.icon-badge.teal {
  background: #ccfbf1;
  color: #0f766e;
}

.icon-badge.green {
  background: #dcfce7;
  color: #15803d;
}

.icon-badge.amber {
  background: #fef3c7;
  color: #b45309;
}

.icon-badge.red {
  background: #fee2e2;
  color: #dc2626;
}

.icon-badge.slate {
  background: #e7edf4;
  color: #475467;
}

.icon-badge.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid currentColor;
  border-radius: 10px;
  opacity: 0;
  animation: iconPulse 1.55s ease-out infinite;
}

@keyframes iconPulse {
  0% {
    opacity: 0.36;
    transform: scale(0.86);
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e7edf4;
  color: #475467;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.active {
  background: #dcfce7;
  color: #047857;
}

.status-pill.ringing {
  background: #fef3c7;
  color: #b45309;
}

.status-pill.critical {
  background: #fee2e2;
  color: #b91c1c;
}

.status-pill.idle {
  background: #e7edf4;
  color: #475467;
}

.call-row,
.history-row,
.queue-card {
  min-width: 0;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.call-row,
.history-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.2fr) minmax(180px, 0.8fr) auto;
  align-items: center;
  gap: 10px;
}

.call-row.robot,
.call-row.dispatcher {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.call-row.incident {
  border-color: #fecaca;
  background: #fff1f2;
}

.call-main,
.call-side,
.history-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.call-main strong,
.call-side strong,
.history-row strong {
  min-width: 0;
  overflow: hidden;
  color: #1d2939;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-main span,
.call-side span,
.history-row span {
  min-width: 0;
  overflow: hidden;
  color: #667085;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cad6e3;
  border-radius: 8px;
  background: #f8fafc;
  color: #667085;
  padding: 16px;
  text-align: center;
}

.empty-icon {
  color: #98a2b3;
}

.empty-state strong {
  color: #1d2939;
  font-size: 16px;
}

.empty-state span {
  max-width: 460px;
  font-size: 13px;
  font-weight: 750;
}

.side-panel.emergency {
  border-color: #fecaca;
  background: #fff7f7;
}

.side-panel.emergency h2 {
  color: #991b1b;
}

.panel-count.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.checked-at {
  color: #667085;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.queue-card {
  background: #ffffff;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-head strong {
  min-width: 0;
  overflow: hidden;
  color: #1d2939;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-strip span {
  border-radius: 999px;
  background: #eef2f6;
  color: #667085;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
}

.queue-live {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.queue-live .call-row,
.side-list .call-row {
  grid-template-columns: 34px minmax(0, 1fr);
}

.queue-live .call-side,
.queue-live .status-pill,
.side-list .call-side,
.side-list .status-pill {
  display: none;
}

@media (max-width: 1320px) {
  .agent-layout {
    grid-template-columns: 208px minmax(560px, 1fr) 320px;
  }
}

@media (max-width: 1100px) {
  .operator-page {
    overflow: auto;
  }

  .agent-shell {
    height: auto;
    overflow: visible;
  }

  .agent-layout {
    grid-template-columns: 1fr;
  }

  .agent-sidebar {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

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

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

@media (max-width: 760px) {
  .agent-header,
  .status-card,
  .agent-aside,
  .agent-sidebar,
  .sidebar-nav {
    display: grid;
  }

  .header-actions,
  .status-actions,
  .softphone-actions {
    justify-content: stretch;
  }

  .header-actions a,
  .header-actions button,
  .status-actions button,
  .softphone-actions button {
    width: 100%;
  }

  .call-row,
  .history-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .call-side,
  .history-row .status-pill {
    display: none;
  }

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