:root {
  --forest: #17201d;
  --forest-deep: #0d1412;
  --paper: #eee9dc;
  --paper-dim: #cbc4b4;
  --orange: #f05a36;
  --orange-pale: #ffb39f;
  --green: #78d6ad;
  --line: rgba(238, 233, 220, 0.16);
  --display: Georgia, "Times New Roman", serif;
  --body: Bahnschrift, "Aptos Narrow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 15% 20%, rgba(120, 214, 173, 0.08), transparent 28rem),
    radial-gradient(circle at 86% 72%, rgba(240, 90, 54, 0.08), transparent 32rem),
    var(--forest-deep);
  font-family: var(--body);
}

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

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.16;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
}

.site-header,
main,
footer {
  width: min(1220px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  font-weight: 800;
}

.wordmark-icon { display: flex; gap: 3px; align-items: end; height: 17px; }
.wordmark-icon i { display: block; width: 3px; background: var(--orange); }
.wordmark-icon i:nth-child(1) { height: 7px; }
.wordmark-icon i:nth-child(2) { height: 17px; }
.wordmark-icon i:nth-child(3) { height: 11px; }

nav { display: flex; gap: 7px; }
.nav-link {
  padding: 9px 12px;
  border: 1px solid transparent;
  color: #8c978f;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.62rem;
}
.nav-link:hover { color: var(--paper); }
.nav-link.active { border-color: var(--line); color: var(--orange-pale); }

.intro {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 80px;
  align-items: end;
  padding: 72px 0 58px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--orange);
  letter-spacing: 0.18em;
  font-size: 0.66rem;
  font-weight: 800;
}

h1, h2 { font-family: var(--display); font-weight: 400; }
h1 {
  margin: 0;
  font-size: clamp(3.1rem, 6.4vw, 6.4rem);
  line-height: 0.91;
  letter-spacing: -0.055em;
}
h1 em { color: var(--paper-dim); font-weight: 400; }
h2 { margin: 4px 0 0; font-size: 2rem; letter-spacing: -0.03em; }

.intro-note {
  display: flex;
  gap: 14px;
  padding: 19px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.intro-note strong { display: block; font-size: 0.78rem; letter-spacing: 0.07em; text-transform: uppercase; }
.intro-note p { margin: 7px 0 0; color: #89928b; font-size: 0.76rem; line-height: 1.55; }
.live-mark {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #66716b;
  box-shadow: 0 0 0 5px rgba(102, 113, 107, 0.1);
}
.live-mark.ready { background: var(--green); box-shadow: 0 0 0 5px rgba(120, 214, 173, 0.1), 0 0 18px rgba(120, 214, 173, 0.55); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(390px, 0.86fr);
  min-height: 660px;
  border: 1px solid var(--line);
  background: rgba(23, 32, 29, 0.78);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.27);
}

.dial-panel { padding: clamp(28px, 5vw, 58px); }
.panel-heading, .monitor-topline, .history-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.panel-heading span, .monitor-topline span, .channel-label {
  color: #7e8b83;
  letter-spacing: 0.16em;
  font-size: 0.6rem;
}

.field { display: grid; gap: 8px; }
.field > span { color: #9da59f; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.62rem; }
.field small { color: #6f7a73; font-size: 0.66rem; }
.field input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(238, 233, 220, 0.25);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--display);
  transition: border-color 180ms ease;
}
.field input:focus { border-color: var(--orange); }
.token-field { margin-top: 38px; }
.token-field input { padding: 10px 0; font-family: var(--body); font-size: 0.88rem; letter-spacing: 0.08em; }

.number-route {
  display: grid;
  grid-template-columns: 1fr 46px 1fr;
  gap: 15px;
  align-items: center;
  margin-top: 42px;
}
.number-field input { padding: 11px 0 9px; font-size: clamp(1.35rem, 2.6vw, 2.15rem); letter-spacing: -0.03em; }

.swap-button, .refresh-button {
  border: 1px solid var(--line);
  background: rgba(238, 233, 220, 0.03);
  cursor: pointer;
}
.swap-button { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; }
.swap-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.swap-button:hover { color: var(--orange); border-color: var(--orange); }

.route-preview {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 44px;
  padding: 20px;
  background: #111917;
}
.route-node span { display: block; color: var(--orange); font-size: 0.58rem; letter-spacing: 0.13em; }
.route-node strong { display: block; margin-top: 5px; font-family: var(--display); font-size: 1rem; font-weight: 400; }
.route-node:last-child { text-align: right; }
.route-line { display: flex; align-items: center; gap: 7px; color: #68736d; font-size: 0.5rem; letter-spacing: 0.1em; }
.route-line i { flex: 1; height: 1px; background: #47514c; position: relative; }
.route-line i:first-child::after { content: ""; position: absolute; right: 0; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }

.caller-strip {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: #7e8982;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.caller-strip strong { color: var(--paper-dim); font-weight: 500; }

.call-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  margin-top: 28px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  background: var(--orange);
  color: #190b08;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.7rem;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease;
}
.call-button:hover:not(:disabled) { transform: translateY(-2px); background: #ff7352; }
.call-button:disabled { cursor: wait; opacity: 0.56; }
.call-icon { width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--orange); background: currentColor; }
.form-message { min-height: 19px; margin: 13px 0 0; color: #77827b; text-align: center; font-size: 0.68rem; }
.form-message.error { color: var(--orange-pale); }
.form-message.success { color: var(--green); }

.monitor-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 46px);
  border-left: 1px solid var(--line);
  background:
    linear-gradient(rgba(120, 214, 173, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 214, 173, 0.035) 1px, transparent 1px),
    #111917;
  background-size: 28px 28px, 28px 28px, auto;
}
.monitor-topline time { color: var(--paper-dim); font-family: var(--display); font-size: 1.1rem; }

.status-orbit { position: relative; display: grid; place-items: center; height: 300px; }
.orbit-ring { position: absolute; border: 1px solid rgba(238, 233, 220, 0.1); border-radius: 50%; }
.ring-one { width: 230px; height: 230px; border-style: dashed; animation: rotate 24s linear infinite; }
.ring-two { width: 280px; height: 155px; transform: rotate(-17deg); border-color: rgba(240, 90, 54, 0.18); }
.status-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 176px;
  aspect-ratio: 1;
  padding: 20px;
  border: 1px solid rgba(120, 214, 173, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 214, 173, 0.1), #111917 68%);
  text-align: center;
}
.status-orbit.active .status-core { border-color: var(--orange); box-shadow: 0 0 45px rgba(240, 90, 54, 0.11); }
.status-core span { color: var(--orange); letter-spacing: 0.18em; font-size: 0.53rem; }
.status-core strong { margin-top: 5px; font-family: var(--display); font-size: 1.35rem; font-weight: 400; text-transform: capitalize; }
.status-core small { display: block; width: 110px; margin-top: 7px; overflow: hidden; color: #65716a; text-overflow: ellipsis; white-space: nowrap; font-size: 0.57rem; }

.leg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.leg-card { padding: 17px; background: #111917; }
.leg-card span { color: var(--orange); letter-spacing: 0.14em; font-size: 0.54rem; }
.leg-card strong { display: block; margin-top: 6px; font-size: 0.78rem; text-transform: capitalize; }
.leg-card small { display: block; margin-top: 5px; color: #65716a; font-size: 0.62rem; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0 0; }
.metrics div { padding: 0 12px; border-left: 1px solid var(--line); }
.metrics div:first-child { padding-left: 0; border-left: 0; }
.metrics dt { color: #68746d; font-size: 0.58rem; }
.metrics dd { margin: 7px 0 0; font-family: var(--display); font-size: 1.1rem; }
.hangup-note { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: #66726b; font-size: 0.64rem; text-align: center; }

.history-section { padding: 92px 0 110px; }
.history-heading { align-items: end; }
.history-heading .eyebrow { margin-bottom: 8px; }
.history-heading h2 { font-size: clamp(2.5rem, 5vw, 4.4rem); }
.refresh-button { padding: 10px 14px; color: #9ca59f; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.62rem; }
.refresh-button:hover { color: var(--paper); border-color: #707a74; }

.history-table-wrap { margin-top: 30px; overflow-x: auto; border-top: 2px solid var(--paper); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 17px 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #67736c; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.57rem; }
td { color: var(--paper-dim); font-size: 0.76rem; }
.history-status { display: inline-flex; align-items: center; gap: 7px; text-transform: capitalize; }
.history-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #78817c; }
.history-status.completed::before { background: var(--green); }
.history-status.failed::before, .history-status.no-answer::before, .history-status.busy::before { background: var(--orange); }
.empty-history { padding: 32px 13px; color: #68736d; text-align: center; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: #626c66;
  letter-spacing: 0.12em;
  font-size: 0.55rem;
}

button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
@keyframes rotate { to { transform: rotate(360deg); } }

@media (max-width: 920px) {
  .intro { grid-template-columns: 1fr; gap: 36px; }
  .intro-note { max-width: 520px; }
  .workspace { grid-template-columns: 1fr; }
  .monitor-panel { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 620px) {
  .site-header, main, footer { width: min(100% - 28px, 1220px); }
  .site-header { min-height: 76px; }
  .wordmark { font-size: 0.66rem; }
  .nav-link { padding: 8px; }
  .intro { padding: 52px 0 42px; }
  h1 { font-size: clamp(3rem, 16vw, 4.6rem); }
  .dial-panel, .monitor-panel { padding: 24px 18px; }
  .number-route { grid-template-columns: 1fr; }
  .swap-button { transform: rotate(90deg); justify-self: center; }
  .route-preview { grid-template-columns: 1fr; }
  .route-line { padding: 5px 0; }
  .route-node:last-child { text-align: left; }
  .metrics { gap: 12px; }
  .metrics div { padding: 0 0 0 9px; }
  footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
