:root {
  --osai-ink: #17202a;
  --osai-muted: #5b6570;
  --osai-brand: #c65a1e;
  --osai-surface: #fff8f2;
  --osai-line: rgba(23, 32, 42, 0.1);
  --osai-shadow: 0 24px 70px rgba(29, 22, 16, 0.22);
}

.osai-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--osai-ink);
}

.osai-widget[data-mode="shortcode"] {
  position: relative;
  right: auto;
  bottom: auto;
}

.osai-launcher {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--osai-brand), #ef8b4e);
  color: #fff;
  padding: 16px 22px;
  font-weight: 700;
  box-shadow: var(--osai-shadow);
  cursor: pointer;
}

.osai-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(430px, calc(100vw - 24px));
  height: min(760px, calc(100vh - 96px));
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.72), transparent 30%),
    linear-gradient(180deg, #fffefc 0%, var(--osai-surface) 100%);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--osai-shadow);
}

.osai-panel[hidden] {
  display: none !important;
}

.osai-widget[data-mode="shortcode"] .osai-panel {
  position: relative;
  right: auto;
  bottom: auto;
}

.osai-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 16px;
  background: linear-gradient(135deg, rgba(198, 90, 30, 0.12), rgba(255, 255, 255, 0.8));
}

.osai-kicker {
  margin: 0 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8f3f15;
  font-weight: 700;
}

.osai-header h2,
.osai-journey-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.osai-close {
  border: 0;
  background: rgba(255,255,255,0.85);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
}

.osai-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow-y: auto;
}

.osai-guide {
  padding: 0 18px 16px;
}

.osai-journey-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.osai-journey-tabs button,
.osai-request-code,
.osai-verify-code,
.osai-composer button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
}

.osai-journey-tabs button {
  padding: 12px 14px;
  font-weight: 700;
  background: rgba(23, 32, 42, 0.06);
}

.osai-journey-tabs button.is-active {
  background: var(--osai-brand);
  color: #fff;
}

.osai-journey-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--osai-line);
}

.osai-journey-card p,
.osai-message p,
.osai-status {
  margin: 0;
  color: var(--osai-muted);
  line-height: 1.5;
}

.osai-auth-fields,
.osai-verify {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.osai-auth-fields label span,
.osai-verify label span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.osai-auth-fields input,
.osai-verify input,
.osai-composer textarea {
  width: 100%;
  border: 1px solid var(--osai-line);
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
  font: inherit;
}

.osai-request-code,
.osai-verify-code,
.osai-composer button {
  background: var(--osai-brand);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
}

.osai-status {
  min-height: 22px;
  margin-top: 12px;
}

.osai-status.is-error {
  color: #b42318;
}

.osai-messages {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
  align-content: start;
  min-height: 0;
}

.osai-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.osai-quick-actions button,
.osai-footer-links a,
.osai-choice-grid button,
.osai-show-more-addons {
  border: 1px solid var(--osai-line);
  background: rgba(255,255,255,0.92);
  color: var(--osai-ink);
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
}

.osai-choice-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.osai-choice-grid button.is-selected {
  background: var(--osai-brand);
  color: #fff;
}

.osai-funnel-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.osai-funnel-form input,
.osai-funnel-form textarea {
  border: 1px solid var(--osai-line);
  border-radius: 16px;
  font: inherit;
  padding: 12px 14px;
  width: 100%;
}

.osai-funnel-form textarea {
  min-height: 74px;
  resize: vertical;
}

.osai-funnel-submit {
  background: var(--osai-brand);
  color: #fff;
}

.osai-message {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 18px;
}

.osai-assistant {
  background: #fff;
  border: 1px solid var(--osai-line);
}

.osai-user {
  margin-left: auto;
  background: linear-gradient(135deg, var(--osai-brand), #ef8b4e);
  color: #fff;
}

.osai-user p {
  color: #fff;
}

.osai-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--osai-line);
  background: rgba(255,255,255,0.85);
  position: relative;
  z-index: 1;
}

.osai-composer textarea {
  min-height: 52px;
  max-height: 120px;
  resize: vertical;
}

.osai-footer-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 18px 18px;
  background: rgba(255,255,255,0.92);
  border-top: 1px solid rgba(23, 32, 42, 0.04);
}

@media (max-width: 640px) {
  .osai-widget {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .osai-panel {
    width: 100%;
    height: min(82vh, 760px);
    bottom: 70px;
  }

  .osai-launcher {
    width: 100%;
  }

  .osai-composer {
    grid-template-columns: 1fr;
  }
}
