:root {
  --line: #2f2f2f;
  --muted: #a1a1aa;
  --text: #ececec;

  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --blue-dark: #2563eb;

  --card: #1f1f1f;
  --card-2: #171717;
  --card-3: #2a2a2a;
  --bg: #212121;

  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.24);

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.app {
  width: 100%;
  min-width: 840px;
  height: calc(100vh - 16px);
  min-height: calc(100vh - 16px);
  background: var(--card-2);
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.left-rail {
  background: var(--card-2);
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 12px;
  min-height: 0;
}

.rail-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  width: calc(100% - 16px);
}

.main {
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.dashboard-panel {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
}

.dashboard-header {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--bg);
}

.dashboard-header-left {
  min-width: 0;
}

.dashboard-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-content {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 100%;
}

.setting-panel {
  background: var(--card);
  border: 1px solid #343434;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.panel-head {
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: #232323;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.panel-title svg {
  width: 18px;
  height: 18px;
  stroke: #d7d7db;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.panel-body {
  padding: 18px;
  flex: 1;
}

.section-note {
  margin-bottom: 18px;
}

.section-note h3 {
  font-size: 24px;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.section-note p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.section-note a {
  color: #8cb8ff;
}

.warn-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.warn-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-1px);
}

.install-card {
  border: 1px solid #343434;
  background: #242424;
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.install-card--split {
  overflow: hidden;
}

.install-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.install-main,
.install-aside {
  min-width: 0;
}

.install-aside {
  display: flex;
}

.widget-grid,
.install-widget-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.install-note-card {
  margin-bottom: 0;
  padding: 20px;
  height: 100%;
  flex: 1;
  border-radius: 18px;
  border: 1px solid #3a3a3a;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.install-note-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  margin-bottom: 14px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  background: rgba(59, 130, 246, 0.12);
  color: #d8e8ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.install-note-card h3 {
  font-size: 22px;
  line-height: 1.22;
  margin-bottom: 12px;
}

.install-note-card p {
  margin: 0;
  max-width: none;
}

.share-link-box--full {
  max-width: none;
}

.install-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.install-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #1d1d1d;
  border: 1px solid #343434;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8e8ff;
  flex-shrink: 0;
}

.install-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.install-head h4 {
  font-size: 22px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.steps {
  margin: 4px 0 18px 22px;
  color: var(--text);
}

.steps li {
  margin-bottom: 10px;
  line-height: 1.7;
  font-size: 14px;
}

.steps code {
  color: #8cb8ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-box-wrap {
  position: relative;
  margin: 0;
}

.copy-btn,
.copy-link-btn,
.customize-btn,
.ghost-btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.copy-btn,
.copy-link-btn {
  border: 1px solid transparent;
  background: #2f6fed;
  color: #fff;
}

.copy-btn:hover,
.copy-link-btn:hover {
  background: #3b7cff;
  transform: translateY(-1px);
}

.customize-btn,
.ghost-btn {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ececec;
}

.customize-btn:hover,
.ghost-btn:hover {
  background: #323232;
  color: #fff;
  border-color: #474747;
  transform: translateY(-1px);
}

.copy-btn svg,
.copy-link-btn svg,
.ghost-btn svg,
.customize-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.install-snippet-wrap .copy-btn {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

.code-box {
  background: #171717;
  border: 1px solid #2f2f2f;
  border-radius: 16px;
  padding: 18px;
  overflow: auto;
  min-height: 168px;
}

.code-box pre {
  color: #d7d7db;
  font-size: 13px;
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.install-snippet-wrap {
  margin-bottom: 0;
}

.install-snippet-box {
  min-height: 0;
  height: 220px;
  max-height: 220px;
  padding: 56px 14px 14px 16px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.install-snippet-pre {
  margin: 0;
  padding-right: 18px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.install-snippet-box::-webkit-scrollbar,
.dashboard-content::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.install-snippet-box::-webkit-scrollbar-track,
.dashboard-content::-webkit-scrollbar-track {
  background: transparent;
}

.install-snippet-box::-webkit-scrollbar-thumb,
.dashboard-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.install-snippet-box::-webkit-scrollbar-thumb:hover,
.dashboard-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.install-snippet-box::-webkit-scrollbar-corner {
  background: transparent;
}

.help-label {
  margin-top: 10px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
}

.help-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-page-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.chat-share,
.chat-preview {
  border-radius: 18px;
  min-height: 320px;
}

.chat-share {
  background: #242424;
  border: 1px solid #343434;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-share h3 {
  font-size: 24px;
  line-height: 1.25;
  margin-bottom: 16px;
}

.chat-share p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 18px;
  max-width: 460px;
}

.chat-share .test-link {
  color: #8cb8ff;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 26px;
}

.chat-share .test-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.share-link-box {
  width: 100%;
  max-width: 520px;
  min-height: 54px;
  border-radius: 16px;
  background: #171717;
  border: 1px solid #2f2f2f;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.share-link-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  padding: 0 10px;
}

.share-link-box input::placeholder,
.data-area::placeholder {
  color: var(--muted);
}

.chat-preview {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid #343434;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 22px;
  position: relative;
}

.chat-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(140, 184, 255, 0.24), transparent 24%), linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 80%);
  pointer-events: none;
}

.preview-card {
  width: min(100%, 480px);
  min-height: 250px;
  background: linear-gradient(180deg, #f5f7fb 0%, #ecf0f8 100%);
  border-radius: 24px;
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 1;
}

.preview-left {
  padding: 28px 22px;
  color: #0e1627;
}

.chat-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1557d6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 10px 18px rgba(21, 87, 214, 0.18);
}

.chat-logo svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.preview-left h4 {
  font-size: 18px;
  margin-bottom: 12px;
}

.preview-left p {
  font-size: 13px;
  line-height: 1.6;
  color: #384256;
}

.preview-right {
  background: linear-gradient(180deg, #8fb4f4 0%, #b9d3ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.phone {
  width: 128px;
  height: 232px;
  background: #f8f9fb;
  border-radius: 12px;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.14);
  padding: 14px 12px;
  position: relative;
}

.phone::before {
  content: "";
  width: 48px;
  height: 6px;
  border-radius: 999px;
  background: #d5d8df;
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
}

.ph-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d5d8df;
  margin: 20px auto 16px;
}

.ph-line,
.ph-box {
  background: #d9dbe1;
  border-radius: 7px;
  margin-bottom: 10px;
}

.ph-line {
  height: 13px;
  width: 78px;
  margin-left: auto;
  margin-right: auto;
}

.ph-line.short {
  width: 62px;
}

.ph-box {
  width: 58px;
  height: 24px;
  margin-left: auto;
  margin-right: 0;
}

.ph-box.big {
  width: 72px;
  height: 42px;
  margin-top: 18px;
  margin-right: auto;
  margin-left: auto;
}

.ph-dot {
  width: 7px;
  height: 7px;
  background: #e1e3e8;
  border-radius: 50%;
  position: absolute;
  bottom: 12px;
  right: 12px;
}

.widget-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.install-subcard {
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #353535;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.018) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.install-subcard-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.install-subcard-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.install-subcard-desc code {
  color: #8cb8ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.install-subcard-body {
  min-width: 0;
}

.install-subcard .field-label {
  font-size: 14px;
  color: #f2f2f4;
  letter-spacing: 0.01em;
}

.install-subcard .share-link-box,
.install-subcard .code-box {
  box-shadow: none;
}

.install-subcard .share-link-box {
  max-width: none;
}

.install-subcard .install-snippet-wrap {
  margin: 0;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: #d7d7db;
}

.panel-subtext {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 18px;
}

.data-area {
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #2f2f2f;
  background: #171717;
  color: #fff;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}

.data-area.code {
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.data-area:focus,
.share-link-box:focus-within,
.code-box:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#workspaceWidgetPanel:empty {
  display: none;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1a1a1a;
  border: 1px solid #343434;
  color: #eef2fb;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 99;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .chat-page-grid {
    grid-template-columns: 1fr;
  }

  .chat-share,
  .chat-preview {
    min-height: auto;
  }

  .install-layout {
    grid-template-columns: 1fr;
  }

  .install-aside {
    order: -1;
  }
}

@media (max-width: 980px) {
  body {
    padding: 0;
  }

  .app {
    min-height: 100vh;
    border-radius: 0;
    max-width: none;
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .dashboard-panel {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .dashboard-header {
    padding: 12px 14px;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-content,
  .panel-body {
    padding: 14px;
  }

  .panel-head {
    min-height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .install-card {
    padding: 16px;
  }

  .install-snippet-wrap .copy-btn {
    position: static;
    margin-bottom: 12px;
  }

  .share-link-box {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-link-btn {
    justify-content: center;
  }

  .preview-card {
    grid-template-columns: 1fr;
  }

  .preview-right {
    min-height: 220px;
  }

  .install-snippet-box {
    height: 180px;
    max-height: 180px;
    padding: 12px 10px 12px 14px;
  }

  .install-snippet-pre {
    padding-right: 16px;
    font-size: 11.5px;
    line-height: 1.45;
  }

  .install-note-card {
    padding: 18px;
  }

  .install-note-card h3 {
    font-size: 20px;
  }

  .install-subcard {
    padding: 14px;
  }

  .install-subcard-desc {
    font-size: 12.5px;
  }
}

.rail-icon .rail-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.rail-icon.has-avatar {
  padding: 0;
  overflow: hidden;
}

.rail-icon.has-avatar svg {
  display: none;
}
