:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #f0f7f4;
  --ink: #1d2522;
  --muted: #65716b;
  --line: #d9ded8;
  --green: #217c5b;
  --green-dark: #155a42;
  --coral: #c75c44;
  --amber: #c6902c;
  --violet: #7461c9;
  --shadow: 0 18px 40px rgba(31, 41, 36, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(33, 124, 91, 0.08), transparent 38%),
    linear-gradient(300deg, rgba(199, 92, 68, 0.1), transparent 34%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.login-panel h1,
.page-title h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.02;
  letter-spacing: 0;
}

.login-panel p,
.page-title p,
.muted {
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(33, 124, 91, 0.14);
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #fcfaf5;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-row strong {
  display: block;
  font-size: 17px;
}

.brand-row small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button,
.icon-button,
.primary,
.secondary,
.danger,
.ghost {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius);
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.nav button {
  justify-content: flex-start;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.nav button:hover,
.nav button.active {
  background: #ebf3ef;
  color: var(--green-dark);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--amber);
}

.status-dot.live {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(33, 124, 91, 0.12);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

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

.primary {
  padding: 10px 15px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

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

.secondary {
  padding: 10px 14px;
  background: #e9eee9;
  color: var(--ink);
  font-weight: 800;
}

.danger {
  padding: 10px 14px;
  background: var(--coral);
  color: white;
  font-weight: 800;
}

.ghost {
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.grid > * {
  min-width: 0;
}

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

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

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(31, 41, 36, 0.06);
  min-width: 0;
}

.panel {
  padding: 18px;
}

.card {
  padding: 16px;
}

.metric {
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.metric strong {
  font-size: 31px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.profile-stat strong {
  font-size: 18px;
  line-height: 1.25;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2,
.card h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.card h3 {
  font-size: 16px;
}

.provider-card.active,
.voice-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(33, 124, 91, 0.12), 0 10px 24px rgba(31, 41, 36, 0.06);
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.voice-card {
  min-height: 138px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 7px;
  align-content: start;
}

.voice-card strong,
.voice-card span,
.voice-card p {
  overflow-wrap: anywhere;
}

.voice-card span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.voice-card p {
  margin: 0;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.tag.warn {
  background: #fff2d7;
  color: #815b14;
}

.tag.coral {
  background: #ffe6df;
  color: #8f3e2e;
}

.call-stage {
  display: grid;
  grid-template-columns: minmax(290px, 410px) minmax(0, 1fr);
  gap: 18px;
}

.call-orb {
  aspect-ratio: 1;
  max-width: 270px;
  margin: 10px auto;
  border-radius: 999px;
  background:
    radial-gradient(circle at 44% 42%, #fff 0 11%, transparent 12%),
    conic-gradient(from 180deg, var(--green), #79b66f, var(--amber), var(--coral), var(--violet), var(--green));
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 22px 55px rgba(33, 124, 91, 0.18);
}

.call-orb.live {
  animation: pulse 1.4s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: scale(0.98); filter: saturate(0.92); }
  to { transform: scale(1.02); filter: saturate(1.15); }
}

.transcript {
  height: min(58vh, 560px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #eef3ef;
  color: var(--ink);
}

.bubble.assistant {
  justify-self: start;
  border-left: 4px solid var(--green);
}

.bubble.user {
  justify-self: end;
  background: #fff0e8;
  border-right: 4px solid var(--coral);
}

.bubble small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 4px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
}

.customer-list {
  display: grid;
  gap: 9px;
}

.customer-button {
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--ink);
}

.customer-button.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(33, 124, 91, 0.12);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  padding: 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 36px));
  background: var(--ink);
  color: white;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav button {
    justify-content: center;
  }

  .grid.cols-2,
  .grid.cols-3,
  .call-stage,
  .profile-layout,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .nav button span {
    display: none;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }

  .panel {
    overflow-x: auto;
  }
}
