:root {
  --bg: #eef3ef;
  --surface: #fbfcfa;
  --panel: #ffffff;
  --ink: #142019;
  --muted: #637067;
  --line: #d8e1d7;
  --green: #167247;
  --green-dark: #0f5634;
  --green-soft: #e6f5ec;
  --mint: #f3faf5;
  --amber: #a46512;
  --amber-soft: #fff3d8;
  --danger: #a33a2d;
  --shadow: 0 12px 28px rgba(20, 32, 25, 0.1);
  --soft-shadow: 0 8px 18px rgba(20, 32, 25, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

h1 {
  font-size: 19px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(100%, 390px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 22px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.55;
}

.phone-shell {
  width: min(100vw, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  padding-bottom: 154px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 8;
  background: rgba(251, 252, 250, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(216, 225, 215, 0.75);
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.app-header > div:first-child {
  min-width: 0;
}

#statusText {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 7px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  box-shadow: var(--soft-shadow);
}

.tabbar {
  position: sticky;
  top: 74px;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px 14px;
  background: rgba(251, 252, 250, 0.96);
  border-bottom: 1px solid rgba(216, 225, 215, 0.72);
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-weight: 800;
}

.tab.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 14px rgba(20, 32, 25, 0.16);
}

.view {
  display: none;
  padding: 14px;
}

.view.active {
  display: block;
}

.onboarding-card {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(22, 114, 71, 0.18);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--ink);
  box-shadow: var(--soft-shadow);
}

.onboarding-card span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
}

.onboarding-card p {
  color: var(--muted);
  line-height: 1.55;
}

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

.industry-choice-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.subheading {
  margin-top: 14px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.industry-choice {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: none;
}

.industry-choice.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(22, 114, 71, 0.16);
}

.full-button {
  width: 100%;
  margin-top: 12px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.flow-step {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 8px;
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  box-shadow: var(--soft-shadow);
}

.flow-step b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
}

.flow-step span {
  font-size: 12px;
  font-weight: 850;
}

.flow-step.done {
  border-color: rgba(22, 114, 71, 0.24);
  background: var(--green-soft);
  color: var(--green-dark);
}

.flow-step.done b {
  background: var(--green);
  color: #fff;
}

.flow-step.active {
  border-color: var(--ink);
  color: var(--ink);
}

.flow-step.active b {
  background: var(--ink);
  color: #fff;
}

.profile-strip,
.block,
.script-card,
.history-item,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.profile-strip {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-color: rgba(22, 114, 71, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, var(--mint) 100%);
}

.profile-strip div,
.section-title,
.empty-state {
  display: grid;
  gap: 5px;
}

.profile-strip b {
  font-size: 17px;
}

#statusText,
.section-title span,
.profile-strip span,
.history-item span,
.hint,
.empty-state span {
  color: var(--muted);
  font-size: 12px;
}

.today-actions {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.sticky-actions,
.voice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.hint {
  margin: 12px 2px;
  line-height: 1.45;
}

.compliance-banner {
  border: 1px solid #e2c576;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #70480c;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 12px;
  padding: 10px 12px;
}

.section-title {
  margin-bottom: 12px;
}

.block {
  padding: 14px;
  margin-bottom: 12px;
}

.block h3 {
  margin-bottom: 10px;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  padding: 14px;
}

.profile-card-head {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.profile-card-head > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.profile-card-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.current-industry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(22, 114, 71, 0.22);
  border-radius: 8px;
  background: var(--mint);
  cursor: pointer;
}

.current-industry:focus-visible {
  outline: 3px solid rgba(22, 114, 71, 0.18);
  outline-offset: 2px;
}

.current-industry span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.current-industry b {
  font-size: 17px;
}

.current-industry .mini-button {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  min-width: 82px;
}

.industry-picker {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}

.chip.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.input-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 11px;
  font-weight: 700;
}

.field-stack {
  display: grid;
  gap: 10px;
}

.field-stack .input-label {
  margin-top: 0;
}

.custom-industry-field {
  margin-top: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 114, 71, 0.13);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
}

.profile-save-actions {
  position: sticky;
  bottom: 12px;
  z-index: 3;
  background: rgba(251, 252, 250, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  box-shadow: var(--soft-shadow);
}

.primary-button,
.secondary-button,
.send-button,
.small-button,
.mini-button {
  border-radius: 8px;
  font-weight: 850;
}

.primary-button,
.secondary-button,
.send-button,
.small-button {
  min-height: 46px;
  padding: 12px;
}

.primary-button,
.send-button {
  border: 0;
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 18px rgba(22, 114, 71, 0.22);
}

.main-action {
  min-height: 58px;
  font-size: 17px;
}

.secondary-button,
.mini-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  color: var(--danger);
}

.small-button {
  border: 1px solid var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.mini-button {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
}

.today-result {
  display: grid;
  gap: 12px;
}

.empty-state {
  padding: 18px;
}

.empty-state b {
  font-size: 16px;
}

.empty-state.danger {
  border-color: rgba(163, 58, 45, 0.32);
  color: var(--danger);
}

.loading-state {
  border-color: rgba(22, 114, 71, 0.36);
  background: var(--mint);
  gap: 8px;
}

.loading-head {
  display: flex;
  gap: 9px;
  align-items: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #c5e5cf;
  border-top-color: var(--green);
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}

.loading-note {
  color: var(--green-dark);
}

.analysis-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.analysis-list span {
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(22, 114, 71, 0.2);
  color: var(--green-dark);
  padding: 5px 8px;
  font-weight: 750;
}

.script-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.primary-script {
  border-color: rgba(22, 114, 71, 0.34);
  box-shadow: var(--shadow);
}

.script-card.compact {
  gap: 12px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.card-head span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
}

.script-section {
  display: grid;
  gap: 4px;
}

.topic-section h3 {
  font-size: 18px;
  line-height: 1.38;
}

.script-section b,
.remix-group b,
.script-card.compact > b {
  color: var(--muted);
  font-size: 12px;
}

.script-section p,
.script-card.compact span {
  line-height: 1.65;
  white-space: pre-wrap;
}

.aligned-list {
  list-style: none;
  counter-reset: item;
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
}

.aligned-list li {
  counter-increment: item;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 6px;
  align-items: start;
  line-height: 1.55;
}

.aligned-list li::before {
  content: counter(item) ".";
  color: var(--green-dark);
  font-weight: 850;
  text-align: right;
}

.aligned-list li span {
  min-width: 0;
}

.tag-row,
.script-actions,
.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.script-actions .mini-button {
  flex: 1 1 86px;
}

.profile-assistant {
  display: block;
}

.tag-row span {
  border-radius: 999px;
  background: var(--mint);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}

.chat-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.message {
  display: grid;
}

.message.user {
  justify-items: end;
}

.bubble {
  max-width: 94%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mint);
  padding: 11px 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.user .bubble {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.pending-message .bubble {
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 13px 0 0 rgba(22, 114, 71, 0.45), 26px 0 0 rgba(22, 114, 71, 0.22);
  animation: pulse 0.9s ease-in-out infinite alternate;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 13px;
  display: grid;
  gap: 9px;
}

.history-item div:first-child {
  display: grid;
  gap: 3px;
}

.history-item p {
  color: var(--ink);
  line-height: 1.5;
}

.composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 9;
  width: min(100vw, 480px);
  background: rgba(251, 252, 250, 0.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
}

body[data-view="profile"] .composer,
body[data-view="history"] .composer,
body[data-onboarding="true"] .composer {
  display: none;
}

body[data-view="profile"] .phone-shell,
body[data-view="history"] .phone-shell,
body[data-onboarding="true"] .phone-shell {
  padding-bottom: 18px;
}

body[data-onboarding="true"] .tabbar {
  display: none;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-bottom: 9px;
}

.quick-row button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 800;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr 68px;
  gap: 8px;
  align-items: end;
}

.composer textarea {
  min-height: 48px;
  max-height: 120px;
}

.send-button {
  min-height: 48px;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(23, 33, 27, 0.28);
  display: grid;
  place-items: center;
  padding: 20px;
}

.drawer[hidden] {
  display: none;
}

.drawer-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  body {
    background: #e9eee9;
  }

  .phone-shell {
    margin-top: 18px;
    margin-bottom: 18px;
    min-height: calc(100vh - 36px);
    border: 1px solid var(--line);
    box-shadow: 0 22px 44px rgba(20, 32, 25, 0.12);
  }

  .composer {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  from {
    opacity: 0.45;
  }

  to {
    opacity: 1;
  }
}
