﻿:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --ink: #101828;
  --text: #243044;
  --muted: #667085;
  --line: #d9e1ec;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --dark: #07111f;
  --dark-2: #0d1b2d;
  --dark-line: rgba(255, 255, 255, .12);
  --blue: #155eef;
  --blue-2: #0f46ba;
  --blue-soft: #eaf1ff;
  --green: #078669;
  --green-soft: #dff7ee;
  --red: #c8203c;
  --red-soft: #ffe7ec;
  --amber: #c97700;
  --amber-soft: #fff1d1;
  --shadow: 0 22px 55px rgba(16, 24, 40, .14);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: #edf2f7;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 15px;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

button:hover:not(:disabled) {
  border-color: #b9c5d6;
  box-shadow: 0 12px 24px rgba(16, 24, 40, .12);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .46;
}

input {
  width: 100%;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 750;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, .12);
}

label {
  display: block;
  margin-top: 14px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.app {
  height: 100vh;
  overflow: hidden;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(360px, 430px);
  align-items: stretch;
  justify-content: center;
  gap: 0;
  height: 100vh;
  padding: 54px;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, .04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(7, 17, 31, .04) 1px, transparent 1px),
    #eef3f8;
  background-size: 42px 42px;
}

.signed-in .login-view,
.signed-out .workspace-view {
  display: none;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 620px;
  padding: 38px;
  border-radius: 8px 0 0 8px;
  background:
    linear-gradient(135deg, rgba(21, 94, 239, .18), transparent 38%),
    linear-gradient(180deg, var(--dark), var(--dark-2));
  color: #fff;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-lockup.compact {
  align-items: flex-start;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-mark.large {
  width: 66px;
  height: 66px;
  font-size: 18px;
}

.brand-lockup p,
.topbar p {
  margin: 0 0 5px;
  color: #6ea8ff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1,
.topbar h2 {
  margin: 0;
  font-size: 29px;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-signal {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--dark-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
}

.login-signal span {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 999px;
  background: #28d094;
  box-shadow: 0 0 0 6px rgba(40, 208, 148, .12);
}

.login-signal strong,
.login-signal small {
  display: block;
}

.login-signal small {
  grid-column: 2;
  margin-top: -8px;
  color: #a7b4c8;
  font-size: 13px;
  font-weight: 750;
}

.login-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.login-metrics div,
.rail-metrics div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--dark-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
}

.login-metrics span,
.rail-metrics span,
.account-line span {
  display: block;
  color: #9fb0c8;
  font-size: 12px;
  font-weight: 800;
}

.login-metrics strong,
.rail-metrics strong,
.account-line strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(430px, 100%);
  min-height: 620px;
  padding: 38px;
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
}

.section-head.dark {
  color: #fff;
}

.status,
.connection-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status.online,
.connection-pill.online {
  background: var(--green-soft);
  color: var(--green);
}

.status.offline,
.connection-pill.offline {
  background: var(--red-soft);
  color: var(--red);
}

.advanced {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.advanced summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  box-shadow: none;
  accent-color: var(--blue);
}

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--blue-2);
  border-color: var(--blue-2);
}

.wide {
  width: 100%;
  margin-top: 18px;
}

.workspace-view {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: #edf2f7;
}

.command-rail {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 22px;
  min-height: 0;
  padding: 22px;
  background:
    linear-gradient(160deg, rgba(21, 94, 239, .18), transparent 38%),
    linear-gradient(180deg, var(--dark), var(--dark-2));
  color: #fff;
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-nav span {
  min-height: 40px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  color: #b9c6d8;
  font-size: 13px;
  font-weight: 850;
}

.rail-nav span.active {
  background: rgba(255, 255, 255, .11);
  color: #fff;
}

.rail-card {
  align-self: end;
  border: 1px solid var(--dark-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  padding: 16px;
}

.account-line {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--dark-line);
}

.rail-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.operator-shell {
  display: grid;
  grid-template-rows: 78px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .07);
}

.topbar p {
  color: var(--blue);
}

.topbar h2 {
  font-size: 27px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.ghost {
  background: #fff;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(480px, 1fr) 390px;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.call-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.incoming-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(620px, calc(100% - 28px));
  padding: 14px 16px;
  border: 1px solid rgba(201, 119, 0, .35);
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 22px 44px rgba(201, 119, 0, .18);
  transform: translateX(-50%);
}

.incoming-banner[hidden] {
  display: none;
}

.incoming-banner span,
.live-call-card span,
.media-health span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.incoming-banner strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incoming-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.live-call-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .08);
  padding: 20px 22px;
}

.live-call-card strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.05;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-call-card > div:first-child {
  min-width: 0;
}

.live-call-card > div:last-child {
  min-width: 108px;
  text-align: right;
}

.live-call-card.idle strong {
  color: var(--muted);
  font-size: 20px;
}

.live-call-card.active {
  border-left: 5px solid var(--blue);
}

.live-call-card.incoming {
  border-left: 5px solid var(--amber);
  background: linear-gradient(90deg, #fff7e6 0%, #fff 38%);
}

.media-health {
  display: flex;
  align-items: center;
  justify-content: space-between;
  justify-self: center;
  width: min(500px, calc(100% - 28px));
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .07);
}

.media-health strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.media-health.ok {
  border-color: rgba(7, 134, 105, .28);
  background: #f3fffb;
}

.media-health.warn {
  border-color: rgba(201, 119, 0, .32);
  background: #fffaf0;
}

.media-health.bad {
  border-color: rgba(200, 32, 60, .28);
  background: #fff5f6;
}

.media-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.media-actions span {
  color: var(--ink);
  white-space: nowrap;
}

.media-actions button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.phone-shell {
  align-self: center;
  justify-self: center;
  width: min(500px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16, 24, 40, .11);
  padding: 22px;
}

.incoming .phone-shell {
  border-color: rgba(201, 119, 0, .45);
  box-shadow: 0 0 0 5px rgba(201, 119, 0, .12), 0 18px 48px rgba(16, 24, 40, .11);
}

.phone-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 31px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #98a2b3;
}

.state-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(7, 134, 105, .12);
}

.state-dot.busy {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(201, 119, 0, .14);
}

.state-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(200, 32, 60, .12);
}

.number-display {
  height: 72px;
  margin-top: 12px;
  text-align: center;
  font-size: clamp(27px, 4.5vw, 39px);
  font-weight: 950;
}

.dialpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dialpad button {
  height: 72px;
  padding: 0;
  border-color: #d8e0ea;
  background: linear-gradient(180deg, #fff, #f8fafc);
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
}

.dialpad button:hover:not(:disabled) {
  background: #eef4ff;
}

.dialpad span {
  display: block;
  margin-top: 7px;
  color: #74839a;
  font-size: 10px;
  font-weight: 850;
}

.call-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.call,
.answer,
.hangup,
.mute {
  color: #fff;
}

.call {
  background: var(--green);
  border-color: var(--green);
}

.answer {
  background: var(--blue);
  border-color: var(--blue);
}

.incoming .answer:not(:disabled) {
  background: var(--amber);
  border-color: var(--amber);
}

.hangup {
  background: var(--red);
  border-color: var(--red);
}

.mute {
  background: var(--dark);
  border-color: var(--dark);
}

.history-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .08);
  padding: 18px;
}

.text-button {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0 8px;
}

.log-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 15px;
}

.filter {
  min-height: 34px;
  padding: 0 8px;
  border-color: #d7e1ed;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.filter.active {
  border-color: #b9caf5;
  background: var(--blue-soft);
  color: var(--blue);
}

.call-search {
  min-height: 40px;
  margin-top: 10px;
  font-size: 13px;
}

.call-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #b8c6d7;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.call-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.call-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
}

.call-item.answered .call-icon {
  background: var(--green-soft);
  color: var(--green);
}

.call-item.failed .call-icon,
.call-item.missed .call-icon {
  background: var(--red-soft);
  color: var(--red);
}

.call-item.pending .call-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.call-main {
  min-width: 0;
}

.call-main strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-main span,
.call-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.callback {
  min-height: 32px;
  border-color: #bcd0f7;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 0 10px;
  font-size: 12px;
}

#log[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  html,
  body,
  .app {
    overflow: auto;
  }

  .workspace-view {
    grid-template-columns: 250px minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .work-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .history-panel {
    height: 290px;
  }
}

@media (max-width: 820px) {
  .login-view {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding: 18px;
  }

  .login-panel,
  .login-card {
    min-height: 0;
    border-radius: 8px;
  }

  .workspace-view {
    grid-template-columns: 1fr;
  }

  .command-rail {
    grid-template-rows: auto auto auto;
  }

  .operator-shell {
    height: auto;
    min-height: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .call-stage {
    min-height: 720px;
  }

  .incoming-banner {
    width: calc(100% - 20px);
    top: 10px;
  }

  .phone-shell {
    width: calc(100% - 20px);
    padding: 16px;
  }

  .live-call-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-call-card > div:last-child {
    text-align: left;
  }

  .call-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
