:root {
  color-scheme: light;
  --bg: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --soft: #eef2ff;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef2ff;
  --success: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --focus: rgba(79, 70, 229, 0.14);
  --shadow-soft: 0 18px 55px -32px rgba(15, 23, 42, 0.45);
  --shadow-panel: 0 14px 40px -28px rgba(15, 23, 42, 0.5);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(238, 242, 255, 0.82), rgba(248, 250, 252, 0) 320px),
    var(--bg);
}

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

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(560px, 1fr);
  gap: 24px;
  width: min(1500px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0;
  min-height: 100vh;
  align-items: start;
}

.phone-stage {
  position: sticky;
  top: 24px;
  display: flex;
  justify-content: center;
}

.phone {
  width: min(100%, 390px);
  min-height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
  border: 12px solid #18181b;
  border-radius: 36px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.phone-header {
  display: grid;
  grid-template-columns: 40px 1fr 116px;
  gap: 10px;
  align-items: center;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #334155;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  color: #0f172a;
  font-weight: 760;
}

h2 {
  font-size: 24px;
  color: #0f172a;
  font-weight: 760;
}

h3 {
  font-size: 16px;
  color: #0f172a;
  font-weight: 720;
}

.country-switch,
.route-strip label,
.field,
.business-field {
  display: grid;
  gap: 7px;
}

.country-switch span,
.route-strip span,
.field-label,
.business-field label {
  color: var(--muted);
  font-size: 12px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

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

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
  background: #fff;
}

.route-strip {
  padding: 14px 18px;
  display: grid;
  gap: 10px;
  background: var(--soft);
  border-bottom: 1px solid #e0e7ff;
}

.route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 12px;
  font-weight: 600;
}

.mobile-form {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  scrollbar-color: #cbd5e1 transparent;
}

.field {
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}

.inline-field-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.inline-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.inline-field .field-top {
  min-height: 20px;
}

.inline-field .field-label {
  font-size: 12px;
}

.inline-field .badge {
  display: none;
}

.inline-field input,
.inline-field select {
  min-width: 0;
  padding-left: 9px;
  padding-right: 9px;
}

.field-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  color: #334155;
  font-weight: 650;
}

.badge {
  flex: none;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--muted);
  background: #f1f5f9;
}

.badge.required {
  color: var(--warn);
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.phone-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.03);
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 24px -12px rgba(79, 70, 229, 0.45);
}

.secondary-button {
  color: #fff;
  background: #334155;
}

.primary-button:hover {
  background: var(--accent-strong);
  box-shadow: 0 16px 30px -14px rgba(79, 70, 229, 0.55);
}

.secondary-button:hover {
  background: #1e293b;
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.99);
}

.web-stage {
  min-height: calc(100vh - 48px);
}

.empty-panel,
.web-panel {
  min-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.empty-panel {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  border-radius: 20px;
  text-align: center;
}

.web-panel {
  border-radius: 20px;
  overflow: hidden;
  height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(500px, 1.16fr) minmax(330px, 0.84fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "params json";
}

.is-hidden {
  display: none;
}

.web-header {
  grid-area: header;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
}

.web-header h2 {
  font-size: 24px;
  line-height: 1.2;
}

.web-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.panel-grid {
  grid-area: params;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.68);
  scrollbar-color: #cbd5e1 transparent;
}

.param-section,
.json-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-panel);
}

.section-title {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.copy-button {
  min-height: 30px;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 0 12px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.copy-button:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.copy-button:active {
  transform: scale(0.97);
}

.readonly-list,
.business-form {
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
}

.readonly-row {
  display: grid;
  grid-template-columns: minmax(104px, 0.38fr) 1fr;
  gap: 10px;
  align-items: start;
  padding-bottom: 7px;
  border-bottom: 1px solid #e2e8f0;
}

.readonly-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.readonly-row dt {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.readonly-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  color: #0f172a;
  font-weight: 500;
}

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

.business-field {
  gap: 5px;
}

.business-field label {
  line-height: 1.2;
}

.web-panel input,
.web-panel select,
.web-panel textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
}

.web-panel textarea {
  min-height: 58px;
}

.business-field.wide {
  grid-column: 1 / -1;
}

.json-section {
  grid-area: json;
  min-height: 0;
  margin: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

pre {
  margin: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 14px 16px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.34;
  border-radius: 0 0 16px 16px;
  scrollbar-color: #475569 #1e1e1e;
}

pre::selection {
  background: rgba(99, 102, 241, 0.35);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100vw - 24px));
    gap: 18px;
  }

  .phone-stage {
    position: static;
  }

  .phone {
    min-height: 720px;
    max-height: none;
  }

  .web-stage,
  .empty-panel,
  .web-panel {
    min-height: 420px;
  }

  .web-panel {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(420px, 70vh);
    grid-template-areas:
      "header"
      "params"
      "json";
  }

  .panel-grid {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .shell {
    width: 100%;
    padding: 0;
  }

  .phone {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .phone-header {
    grid-template-columns: 36px 1fr 108px;
    padding-top: 16px;
  }

  .web-panel,
  .empty-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .web-header,
  .panel-grid,
  .json-section {
    margin: 0;
  }

  .panel-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .business-form {
    grid-template-columns: 1fr;
  }

  .json-section {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
}
