:root {
  --hr-ink: #182433;
  --hr-muted: #6b7c8f;
  --hr-line: #d5dde6;
  --hr-accent: #0f6e56;
  --hr-accent-soft: #e4f4ef;
  --hr-danger: #b42318;
  --hr-ok: #067647;
  --hr-ok-soft: #ecfdf3;
  --hr-bg: #eef3f8;
  --hr-card: #ffffff;
  --hr-radius: 14px;
  --hr-font: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--hr-font);
  color: var(--hr-ink);
  background: linear-gradient(180deg, var(--hr-bg) 0%, #f7f9fc 100%);
}

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

.hr-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--hr-line);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.hr-brand img { display: block; height: 36px; width: auto; }

.hr-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hr-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.hr-agent-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--hr-accent-soft);
  color: var(--hr-accent);
  font-size: 0.82rem;
  font-weight: 650;
}

.hr-agent-chip[hidden] { display: none !important; }

.hr-side-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.hr-agent-chip-side { font-size: 0.78rem; }

/* ── Page shell (Place a call | Call details) ── */
.hr-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.25rem 1.25rem;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}

.hr-page-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  background: #f0f4f8;
  border-radius: 12px;
  flex-shrink: 0;
}

.hr-page-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  background: transparent;
  padding: 0.7rem 1rem;
  border-radius: 9px;
  cursor: pointer;
  color: var(--hr-muted);
  font-weight: 650;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.hr-page-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.6);
  color: var(--hr-ink);
}

.hr-page-tab.active {
  background: #fff;
  color: var(--hr-accent);
  box-shadow: 0 2px 8px rgba(24, 36, 51, 0.08);
}

.hr-page-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--hr-accent-soft);
  color: var(--hr-accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.hr-page-tab-count[hidden] { display: none !important; }

.hr-page-pane {
  animation: hr-fade-in 0.18s ease;
}

@keyframes hr-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.hr-custom-input {
  margin-top: 0.4rem;
  width: 100%;
  border: 1px solid #b8c4d1;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: #fff;
  outline: none;
}

.hr-custom-input:focus {
  border-color: var(--hr-accent);
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.12);
}

.hr-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--hr-accent-soft);
  color: var(--hr-accent);
  font-size: 0.82rem;
  font-weight: 650;
}

.hr-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hr-ok);
  animation: hr-pulse 1.4s ease-in-out infinite;
}

@keyframes hr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}

.hr-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
  min-height: 0;
}

@media (max-width: 960px) {
  .hr-layout { grid-template-columns: 1fr; }
}

.hr-panel {
  background: var(--hr-card);
  border: 1px solid var(--hr-line);
  border-radius: var(--hr-radius);
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 12px 40px rgba(24, 36, 51, 0.06);
  min-width: 0;
}

/* Place form: no nested scrollbar — page/document may scroll if needed */
.hr-pane-place {
  overflow: visible;
}

/* Call details: only the session list scrolls */
.hr-pane-details {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 9.5rem);
  overflow: hidden;
}

.hr-pane-head {
  margin-bottom: 0.85rem;
}

.hr-copy-tight {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
}

.hr-place-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hr-place-actions {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hr-line);
}

.hr-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hr-muted);
  font-weight: 700;
}

.hr-heading,
.hr-side-heading {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.hr-copy {
  margin: 0.35rem 0 0.85rem;
  color: var(--hr-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.hr-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 0.85rem;
}

.hr-form-grid .full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .hr-form-grid { grid-template-columns: 1fr; }
}

.hr-field { margin: 0; min-width: 0; }

.hr-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
  color: #3d4f63;
}

.req { color: var(--hr-danger); }

.hr-field input,
.hr-field textarea,
.hr-field select {
  width: 100%;
  border: 1px solid #b8c4d1;
  border-radius: 10px;
  padding: 0.58rem 0.75rem;
  background: #fff;
  outline: none;
  color: var(--hr-ink);
}

.hr-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7c8f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.hr-field textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.4;
}

.hr-field input:focus,
.hr-field textarea:focus,
.hr-field select:focus {
  border-color: var(--hr-accent);
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.12);
}

.hr-btn {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 650;
  width: 100%;
}

.hr-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.hr-btn-sm { width: auto; padding: 0.5rem 0.85rem; font-size: 0.85rem; }

.hr-btn-primary {
  margin-top: 0.65rem;
  background: var(--hr-accent);
  color: #fff;
  font-size: 0.98rem;
}

.hr-btn-primary:hover:not(:disabled) { background: #0b5a46; }

.hr-btn-danger {
  background: var(--hr-danger);
  color: #fff;
  margin-top: 0.75rem;
}

.hr-btn-soft {
  background: #fff;
  border: 1px solid var(--hr-line);
  color: var(--hr-ink);
  margin-top: 0;
}

.hr-btn-advanced {
  margin-top: 0;
  width: 100%;
  font-size: 0.88rem;
  padding: 0.65rem 1rem;
}

.hr-advanced {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--hr-line);
}

.hr-error {
  margin: 0.65rem 0 0;
  color: var(--hr-danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.hr-candidate-name {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.hr-candidate-phone {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  color: #3d4f63;
}

.hr-candidate-role {
  margin: 0.35rem 0 1.1rem;
  color: var(--hr-muted);
  font-size: 0.95rem;
}

.hr-call-card {
  border: 1px solid var(--hr-line);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  background: #f9fbfd;
}

.hr-call-label {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--hr-muted);
  font-weight: 600;
}

.hr-status-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 650;
  color: var(--hr-ok);
}

.hr-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hr-ok);
}

.hr-status-row[data-state="connecting"] { color: #b54708; }
.hr-status-row[data-state="connecting"] .hr-status-dot { background: #f79009; }
.hr-status-row[data-state="failed"] { color: var(--hr-danger); }
.hr-status-row[data-state="failed"] .hr-status-dot { background: var(--hr-danger); }
.hr-status-row[data-state="completed"] { color: var(--hr-muted); }
.hr-status-row[data-state="completed"] .hr-status-dot { background: var(--hr-muted); }

.hr-timer {
  margin: 0.75rem 0 0.15rem;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.hr-summary-box {
  margin-top: 0.5rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--hr-accent-soft);
  color: #0b5a46;
  font-size: 1rem;
  line-height: 1.55;
  min-height: 4rem;
}

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

.hr-empty-box {
  text-align: center;
  color: var(--hr-muted);
  padding: 2.5rem 1rem;
  border: 1px dashed var(--hr-line);
  border-radius: 12px;
}

.hr-session-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 0.1rem;
}

.hr-call-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.hr-hint {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--hr-muted);
}

.hr-screening {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #3d4f63;
}

.hr-call-record {
  border: 1px solid var(--hr-line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.hr-call-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.55rem;
}

.hr-call-id {
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  color: #3d4f63;
  word-break: break-all;
  min-width: 0;
}

.hr-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--hr-ok-soft);
  color: var(--hr-ok);
  flex-shrink: 0;
  text-transform: uppercase;
}

.hr-pill.err {
  background: #fef3f2;
  color: var(--hr-danger);
}

.hr-failure-box {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #fecdca;
  background: #fef3f2;
  color: var(--hr-danger);
  font-size: 0.875rem;
}

.hr-failure-box strong {
  display: block;
  margin-bottom: 0.25rem;
}

.hr-failure-box p {
  margin: 0;
  line-height: 1.4;
}

.hr-kv.full {
  grid-column: 1 / -1;
}

.hr-pill.pending {
  background: #fff4e5;
  color: #b54708;
}

.hr-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--hr-line);
  overflow-x: auto;
}

.hr-tabs button {
  border: none;
  background: transparent;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  color: var(--hr-muted);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.hr-tabs button.active {
  color: var(--hr-accent);
  border-bottom-color: var(--hr-accent);
}

.hr-tab-body { padding: 0.9rem 1rem 1rem; }

.hr-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

@media (max-width: 520px) {
  .hr-kv-grid { grid-template-columns: 1fr; }
}

.hr-kv { min-width: 0; }

.hr-kv span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hr-muted);
  font-weight: 700;
}

.hr-kv strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-word;
}

.hr-empty {
  margin: 0;
  color: var(--hr-muted);
  font-size: 0.88rem;
}

.hr-transcript {
  max-height: min(48vh, 380px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hr-turn {
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: #f3f6fa;
}

.hr-turn-agent { background: var(--hr-accent-soft); }

.hr-turn-role {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hr-muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.hr-turn-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.hr-foot {
  text-align: center;
  padding: 1rem;
  color: var(--hr-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.hr-foot a {
  color: var(--hr-accent);
  text-decoration: none;
  font-weight: 600;
}

.hr-toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  background: var(--hr-ink);
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  max-width: 360px;
  z-index: 50;
  display: none;
}

.hr-toast.show { display: block; }
.hidden { display: none !important; }
