:root {
  --bg: #06080b;
  --bg-deep: #131820;
  --card: rgba(18, 22, 28, 0.92);
  --card-soft: rgba(28, 34, 43, 0.86);
  --text: #f6f8fb;
  --muted: #b9c1cc;
  --accent: #dde5ed;
  --accent-soft: #7ce1ef;
  --line: rgba(255, 255, 255, 0.14);
  --success: #9be5ab;
  --error: #ff8d87;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.45);
  --radius: 24px;
  --mono: "Consolas", "Lucida Console", monospace;
  --sans: "Franklin Gothic Medium", "Arial Narrow", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top right, rgba(124, 225, 239, 0.14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(160deg, #030507 0%, #0a0e14 42%, #161d27 100%);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.backdrop {
  min-height: 100vh;
  padding: 1.2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1240px;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(31, 36, 44, 0.94), rgba(10, 12, 16, 0.96));
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4f7fa, #8f99a6);
  color: #11161d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-left: auto;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-badge {
  min-width: 1.4rem;
  min-height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #1b100a;
  font-size: 0.75rem;
  font-weight: 700;
  visibility: hidden;
}

.nav-badge:not(:empty) {
  visibility: visible;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
}

.hero,
.panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.hero-copy,
.panel-copy,
.card,
sb-dialer,
sb-contacts,
sb-phonebook,
sb-call-screen,
sb-voicemail,
sb-settings {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero-copy,
.panel-copy,
.card {
  padding: 2rem;
}

.hero-copy h1,
.panel-copy h1 {
  margin: 0.3rem 0 1rem;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.96;
}

.hero-card {
  padding: 2rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #2c333d, #0f1217 38%, #060708 100%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: var(--shadow);
}

.terminal-line {
  font-family: var(--mono);
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-copy-landline,
.panel-copy-landline {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    linear-gradient(180deg, rgba(38, 46, 58, 0.96), rgba(11, 14, 18, 0.96));
}

.hero-card-phone {
  position: relative;
  overflow: hidden;
}

.hero-card-phone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.16), transparent 22%, transparent 72%, rgba(255, 255, 255, 0.06));
  pointer-events: none;
}

.hero-handset {
  width: 72%;
  height: 1.1rem;
  margin: 0 auto 1.2rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #3e4651, #0d0f13);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 12px 20px rgba(0, 0, 0, 0.35);
}

.hero-screen,
.phone-screen {
  margin-bottom: 1.2rem;
  padding: 1rem 1.15rem;
  border-radius: 20px;
  background: linear-gradient(180deg, #c8d2bb, #7e9476);
  color: #132012;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -10px 18px rgba(52, 71, 53, 0.24);
}

.hero-screen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dial-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.dial-preview span,
.dial-key {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 24px;
  background: linear-gradient(180deg, #3d4653 0%, #171b22 18%, #050608 100%);
  color: #f7f9fc;
  font-size: 1.3rem;
  font-family: var(--mono);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -10px 14px rgba(0, 0, 0, 0.55),
    0 10px 18px rgba(0, 0, 0, 0.22);
}

.eyebrow {
  margin: 0;
  color: var(--accent-soft);
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-text,
.panel-copy p,
.card p,
.muted-text {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.primary-button,
.ghost-button,
.danger-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.8rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #f3f6fa, #98a5b2);
  color: #0d1218;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.ghost-button,
.secondary-button {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(53, 61, 71, 0.95), rgba(15, 18, 24, 0.95));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.danger-button {
  background: linear-gradient(180deg, rgba(127, 35, 31, 0.92), rgba(58, 13, 11, 0.94));
  border-color: rgba(255, 141, 135, 0.35);
  color: #fff0ef;
}

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

.flash-stack {
  max-width: 1240px;
  margin: 0 auto 1rem;
}

.flash {
  margin-bottom: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(18, 31, 40, 0.9);
  border: 1px solid var(--line);
}

.flash-success {
  border-color: rgba(143, 202, 109, 0.45);
}

.flash-error {
  border-color: rgba(255, 122, 89, 0.4);
}

.card.narrow-card {
  max-width: 520px;
  margin: 0 auto;
}

.stack-form,
.field-stack {
  display: grid;
  gap: 1rem;
}

label span,
.section-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

sb-dialer,
sb-contacts,
sb-phonebook,
sb-call-screen,
sb-voicemail,
sb-settings {
  display: block;
  padding: 1.4rem;
}

.status-line {
  min-height: 1.4rem;
  color: var(--accent-soft);
  font-family: var(--mono);
}

.dial-display {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: transparent;
  font-family: var(--mono);
  font-size: clamp(1.4rem, 6vw, 2.3rem);
  letter-spacing: 0.16em;
  text-align: left;
  min-height: 2.4rem;
  color: #102014;
}

.dial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.dial-key {
  position: relative;
  min-height: 5.4rem;
  cursor: pointer;
  overflow: hidden;
}

.dial-key::before {
  content: "";
  position: absolute;
  inset: 0.15rem 0.4rem auto 0.4rem;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.dial-key small {
  position: absolute;
  bottom: 0.95rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.9;
  color: #cdd6df;
}

.dial-actions,
.list-grid,
.control-grid {
  display: grid;
  gap: 0.8rem;
}

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

.list-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.call-card,
.list-card,
.settings-card {
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(33, 39, 49, 0.95), rgba(15, 18, 24, 0.96));
}

.call-state {
  font-family: var(--mono);
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.pill-accent {
  color: #1b100a;
  background: var(--accent-soft);
  border-color: rgba(255, 181, 99, 0.5);
}

.pill-success {
  color: #10210f;
  background: var(--success);
  border-color: rgba(143, 202, 109, 0.45);
}

.pill-muted {
  background: rgba(255, 255, 255, 0.05);
}

.hidden {
  display: none !important;
}

.split-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.audio-preview {
  width: 100%;
  margin-top: 0.6rem;
}

.record-status {
  color: var(--accent-soft);
  min-height: 1.4rem;
}

.call-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 1rem;
}

.section-title {
  margin: 0 0 0.8rem;
  font-size: 1.2rem;
}

.subtle {
  color: var(--muted);
  font-size: 0.92rem;
}

.system-message {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(124, 225, 239, 0.1);
  border: 1px solid rgba(124, 225, 239, 0.2);
  color: var(--text);
}

.empty-state {
  padding: 1rem;
  border-radius: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.phone-shell {
  padding: 1.2rem;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 18%),
    linear-gradient(180deg, #323943, #0a0c10 36%, #030405 100%);
  box-shadow: var(--shadow);
}

.phone-top {
  margin-bottom: 1rem;
}

.handset-bar {
  width: 68%;
  height: 1rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #4d5663, #0f1318);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.phone-screen-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.screen-number {
  margin-bottom: 0.35rem;
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.screen-badge {
  color: #1d2c1d;
}

.landline-grid {
  margin-bottom: 1rem;
}

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

.recent-calls-card {
  margin-top: 1rem;
}

@media (max-width: 960px) {
  .topbar,
  .hero,
  .panel-layout {
    grid-template-columns: 1fr;
    border-radius: 28px;
  }

  .topbar {
    display: grid;
    justify-items: start;
  }

  .topnav {
    margin-left: 0;
  }
}
