:root {
  color-scheme: dark;
  --bg: #0d1210;
  --panel: #141a17;
  --panel-2: #18201c;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f5f3;
  --muted: #8e9b94;
  --green: #54d68b;
  --green-deep: #2aae67;
  --red: #f16e6e;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -20%, rgba(69, 173, 112, 0.13), transparent 35%),
    var(--bg);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar, .hero, .workspace, footer, .card-heading, .microphone-title, .incoming-actions, .call-controls {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-family: Manrope, sans-serif;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.brand b { color: var(--green); font-weight: 700; }

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(84, 214, 139, 0.35);
  border-radius: 10px;
  background: rgba(84, 214, 139, 0.08);
}

.brand-mark svg { width: 23px; stroke: var(--green); stroke-width: 2.2; stroke-linecap: round; }

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  font-size: 12px;
  font-weight: 600;
}

.status-dot, .permission-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #68736d;
}

.connection-pill[data-state="connected"] { color: #bcefd0; border-color: rgba(84,214,139,.22); }
.connection-pill[data-state="connected"] .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(84,214,139,.1); }
.connection-pill[data-state="connecting"] .status-dot { background: #e2bd65; animation: pulse 1.2s infinite; }
.connection-pill[data-state="error"] .status-dot { background: var(--red); }

.hero {
  justify-content: space-between;
  gap: 48px;
  padding: 74px 8px 44px;
}

.eyebrow, .label {
  margin: 0 0 11px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.7px;
}

.hero h1 {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: clamp(38px, 5vw, 61px);
  line-height: 1.04;
  letter-spacing: -3.2px;
}

.hero h1 span { color: #8d9a93; }

.intro {
  max-width: 550px;
  margin: 19px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button svg { width: 19px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.secondary { border: 1px solid var(--line); background: #171d1a; box-shadow: 0 8px 35px rgba(0,0,0,.16); }
.button.compact { min-height: 44px; font-size: 13px; }
.button-icon { display: grid; width: 22px; height: 22px; place-items: center; color: var(--green); }
.button.primary { color: #07130d; background: var(--green); }
.button.primary:hover:not(:disabled) { background: #64e298; }

.workspace {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(330px, .86fr) minmax(400px, 1.14fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(24, 31, 27, .96), rgba(18, 24, 21, .96));
  box-shadow: var(--shadow);
}

.dialer { padding: 28px; }
.card-heading { justify-content: space-between; margin-bottom: 27px; }
.card h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 21px; letter-spacing: -.6px; }
.availability { padding: 6px 9px; color: var(--muted); border-radius: 7px; background: rgba(255,255,255,.045); font-size: 10px; font-weight: 600; }
.availability.online { color: #aee9c6; background: rgba(84,214,139,.08); }
.field-label { display: block; margin: 0 0 9px; color: #bec7c2; font-size: 12px; font-weight: 600; }

.phone-field {
  display: flex;
  align-items: center;
  height: 61px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 10, 8, .34);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.phone-field:focus-within { border-color: rgba(84,214,139,.56); box-shadow: 0 0 0 3px rgba(84,214,139,.08); }
.phone-prefix { padding-left: 17px; color: var(--green); font-size: 22px; }
.phone-field input { width: 100%; height: 100%; padding: 0 17px 0 7px; color: var(--text); border: 0; outline: 0; background: transparent; font-family: Manrope, sans-serif; font-size: 20px; letter-spacing: .2px; }
.phone-field input::placeholder { color: #536059; }
.field-hint { margin: 8px 0 23px; color: #6f7c75; font-size: 11px; }

.microphone-block { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.018); }
.microphone-title { justify-content: space-between; }
.microphone-title .field-label { margin-bottom: 10px; }
.text-button, .demo-button { padding: 0; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-size: 11px; }
.text-button:hover, .demo-button:hover { color: var(--green); }
.text-button:disabled, .demo-button:disabled { cursor: not-allowed; opacity: .42; }
.select-wrap { position: relative; }
.select-wrap > svg { position: absolute; z-index: 1; top: 50%; left: 12px; width: 17px; transform: translateY(-50%); pointer-events: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; }
.select-wrap select { width: 100%; height: 44px; padding: 0 36px; color: #dfe5e1; border: 1px solid var(--line); border-radius: 10px; outline: 0; appearance: none; background: #111714 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e9b94' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") calc(100% - 13px) center no-repeat; font-size: 12px; }
.select-wrap select:disabled, .phone-field input:disabled { cursor: not-allowed; opacity: .5; }
.permission-button { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-size: 11px; }
.permission-button.ready { color: #afe8c6; }
.permission-button.ready .permission-dot { background: var(--green); }
.call-button { width: 100%; margin-top: 18px; }

.call-stage { position: relative; display: grid; min-height: 470px; overflow: hidden; place-items: center; text-align: center; }
.call-stage::before { position: absolute; width: 340px; height: 340px; content: ""; border-radius: 50%; background: radial-gradient(circle, rgba(84,214,139,.07), transparent 66%); pointer-events: none; }
.stage-idle, .stage-active, .incoming { position: relative; z-index: 1; width: min(390px, calc(100% - 50px)); }
.stage-idle p:last-child { max-width: 330px; margin: 12px auto 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.stage-idle h2 { font-size: 24px; }

.orb { display: flex; align-items: center; justify-content: center; gap: 5px; width: 76px; height: 76px; margin: 0 auto 23px; border: 1px solid rgba(84,214,139,.2); border-radius: 50%; background: rgba(84,214,139,.06); }
.orb span, .level-bars i { width: 3px; border-radius: 4px; background: var(--green); }
.orb span:nth-child(1), .orb span:nth-child(5) { height: 11px; opacity: .5; }
.orb span:nth-child(2), .orb span:nth-child(4) { height: 23px; opacity: .8; }
.orb span:nth-child(3) { height: 34px; }
.avatar { display: grid; width: 82px; height: 82px; margin: 6px auto 18px; place-items: center; color: #09150e; border-radius: 50%; background: linear-gradient(145deg, #69e49d, #3ebf76); font-family: Manrope, sans-serif; font-size: 23px; font-weight: 700; box-shadow: 0 0 0 10px rgba(84,214,139,.055); }
.call-status { margin: 7px 0 0; color: var(--green); font-size: 12px; }
.call-time { margin: 9px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.media-status { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 25px; margin-top: 10px; color: #d8b96f; font-size: 10px; }
.media-status > span:first-child { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(216,185,111,.08); }
.media-status[data-state="ready"] { color: #aee9c6; }
.media-status[data-state="ready"] > span:first-child { box-shadow: 0 0 0 4px rgba(84,214,139,.08); }
.media-status button { margin-left: 4px; padding: 4px 8px; color: var(--text); border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.045); cursor: pointer; font-size: 10px; }
.media-status button:hover:not(:disabled) { border-color: rgba(84,214,139,.28); color: var(--green); }
.media-status button:disabled { cursor: wait; opacity: .45; }
.media-quality { min-height: 14px; margin: 3px 0 0; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.level-bars { display: flex; align-items: center; justify-content: center; gap: 4px; height: 38px; margin: 14px 0; }
.level-bars i { height: 8px; opacity: .38; }
.call-stage[data-connected="true"] .level-bars i { animation: levels .8s ease-in-out infinite alternate; }
.level-bars i:nth-child(2), .level-bars i:nth-child(6) { animation-delay: -.25s !important; }
.level-bars i:nth-child(3), .level-bars i:nth-child(5) { animation-delay: -.5s !important; }
.call-controls { justify-content: center; gap: 42px; margin-top: 13px; }
.round-control { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-size: 10px; }
.round-control:disabled { cursor: not-allowed; opacity: .42; }
.round-control svg { width: 50px; height: 50px; padding: 14px; color: var(--text); border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.045); stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.round-control.active svg { color: var(--bg); background: var(--text); }
.round-control.hangup svg { color: white; border-color: transparent; background: #df5555; }

.incoming-ring { display: grid; width: 75px; height: 75px; margin: 0 auto 22px; place-items: center; color: var(--green); border-radius: 50%; background: rgba(84,214,139,.1); animation: ring 1.7s infinite; }
.incoming-ring svg { width: 30px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.incoming > p:not(.label) { margin: 9px 0 25px; color: var(--muted); font-size: 13px; }
.incoming-actions { justify-content: center; gap: 10px; }
.button.reject { color: #f7b1b1; border: 1px solid rgba(241,110,110,.18); background: rgba(241,110,110,.08); }
.button.accept { color: #07130d; background: var(--green); }

.event-console { margin-top: 18px; padding: 23px 26px 0; overflow: hidden; }
.event-console-heading, .event-console-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.event-console-heading { padding-bottom: 18px; }
.event-console-heading .label { margin-bottom: 6px; }
.event-console-heading h2 { font-size: 18px; }
.event-console-tools { justify-content: flex-end; }
.event-stream-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.event-stream-state > span { width: 6px; height: 6px; border-radius: 50%; background: #77827c; }
.event-stream-state[data-state="online"] { color: #aee9c6; }
.event-stream-state[data-state="online"] > span { background: var(--green); box-shadow: 0 0 0 4px rgba(84,214,139,.08); }
.event-list { height: 260px; margin: 0 -26px; padding: 8px 26px 22px; overflow-y: auto; border-top: 1px solid var(--line); background: rgba(5,9,7,.28); scrollbar-color: #35413a transparent; }
.event-empty { margin: 34px 0; color: #637068; text-align: center; font-size: 11px; }
.event-row { display: grid; grid-template-columns: 72px minmax(190px, .75fr) minmax(260px, 1.25fr); gap: 12px; align-items: baseline; min-height: 31px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.035); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; line-height: 1.5; }
.event-time { color: #66736c; font-variant-numeric: tabular-nums; }
.event-type { color: #b8c3bd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-detail { color: #748078; overflow-wrap: anywhere; }
.event-row[data-tone="success"] .event-type { color: var(--green); }
.event-row[data-tone="warning"] .event-type { color: #e2bd65; }
.event-row[data-tone="error"] .event-type { color: #f28a8a; }

.qr-panel { display: flex; align-items: center; justify-content: space-between; gap: 35px; margin-top: 18px; padding: 28px 36px; }
.qr-panel p:last-child { max-width: 460px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.qr-frame { flex: 0 0 auto; padding: 9px; border-radius: 15px; background: white; }
.qr-frame img { display: block; width: 170px; height: 170px; }

footer { justify-content: space-between; padding: 18px 7px 0; color: #5f6c65; font-size: 10px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(360px, calc(100% - 48px)); padding: 13px 17px; color: #eaf0ec; border: 1px solid var(--line); border-radius: 11px; background: #202923; box-shadow: 0 14px 50px rgba(0,0,0,.35); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast[data-tone="success"] { border-color: rgba(84,214,139,.28); }
.toast[data-tone="error"] { border-color: rgba(241,110,110,.35); background: #30201f; }

[hidden] { display: none !important; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes levels { from { height: 6px; opacity: .3; } to { height: 28px; opacity: 1; } }
@keyframes ring { 50% { box-shadow: 0 0 0 14px rgba(84,214,139,0); } }

@media (max-width: 800px) {
  .shell { width: min(100% - 28px, 600px); padding-top: 20px; }
  .hero { align-items: flex-start; flex-direction: column; gap: 24px; padding: 55px 2px 32px; }
  .hero h1 { letter-spacing: -2.3px; }
  .workspace { grid-template-columns: 1fr; }
  .event-console-heading { align-items: flex-start; flex-direction: column; }
  .event-console-tools { width: 100%; justify-content: flex-start; }
  .event-row { grid-template-columns: 62px minmax(150px, 1fr); }
  .event-detail { grid-column: 1 / -1; padding-left: 74px; }
  .call-stage { min-height: 420px; }
  .qr-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 450px) {
  .connection-pill { padding: 8px; }
  .connection-pill span:last-child { display: none; }
  .dialer { padding: 22px; }
  .hero .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
