:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --text: #111a18;
  --muted: #5f6d68;
  --line: #dce5e1;
  --accent: #0f6b5b;
  --accent-strong: #0c3f38;
  --blue: #2364aa;
  --orange: #d87812;
  --warn: #8a430b;
  --danger: #a53034;
  --shadow: 0 16px 42px rgba(17, 26, 24, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 107, 91, 0.11), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 18px 16px 36px;
}

.app-content[hidden],
.auth-panel[hidden],
.profile-panel[hidden] {
  display: none;
}

.auth-panel {
  min-height: calc(100vh - 54px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 28px;
}

.auth-copy,
.auth-actions {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-copy {
  padding: 28px;
}

.auth-actions {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.telegram-login-slot {
  min-height: 44px;
}

.telegram-open {
  display: block;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.auth-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.auth-points span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.intro-panel,
.work-surface,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.intro-panel {
  padding: 18px;
  margin-bottom: 14px;
}

.brand-row,
.result-head,
.form-head,
.profile-head,
.profile-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  align-items: center;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: white;
}

.brand-row > div {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 30px;
  line-height: 1.08;
}

h2 {
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.state-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
}

.icon-button[hidden] {
  display: none;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 18px;
}

.lead {
  margin: 0;
  max-width: 680px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
}

.trust-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.trust-list li {
  position: relative;
  padding-left: 22px;
}

.trust-list li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--blue);
}

.demo-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.demo-card strong,
.demo-card span {
  display: block;
}

.demo-card span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.work-surface {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 0;
  overflow: hidden;
}

.estimate-form,
.result-panel {
  padding: 18px;
}

.estimate-form {
  display: grid;
  gap: 14px;
  border-right: 1px solid var(--line);
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.voice-status,
.profile-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fbfdfc;
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(29, 111, 95, 0.16);
  border-color: var(--accent);
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

button,
.pdf-link,
.pilot-link,
.upgrade-link,
.sample-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 9px 12px;
  font-size: 13px;
}

button:hover,
.pdf-link:hover,
.pilot-link:hover,
.upgrade-link:hover,
.telegram-open:hover {
  filter: brightness(0.96);
}

.sample-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 8px 10px;
  font-size: 13px;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.fine-print,
.disclaimer,
.status-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.fine-print {
  margin: -4px 0 0;
}

.result-panel {
  align-self: stretch;
  background: var(--surface-soft);
}

.result-panel[hidden] {
  display: none;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 800;
}

.status-line[data-kind="error"] {
  color: var(--danger);
}

.profile-status[data-kind="error"] {
  color: var(--danger);
}

.pdf-link {
  display: block;
  margin-top: 12px;
}

.pilot-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.pilot-box p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pilot-link {
  background: var(--accent-strong);
  white-space: nowrap;
}

.paywall {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.paywall[hidden] {
  display: none;
}

.paywall p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0 0;
}

.paywall-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.upgrade-link {
  background: var(--accent-strong);
  white-space: nowrap;
}

.profile-panel {
  margin-top: 14px;
  padding: 18px;
}

.profile-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-actions {
  align-items: center;
}

.profile-actions button {
  min-width: 180px;
}

.profile-form input:disabled,
.profile-form button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 820px) {
  .auth-panel,
  .intro-grid,
  .work-surface,
  .profile-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell {
    padding: 12px 10px 28px;
  }

  .intro-panel,
  .estimate-form,
  .result-panel,
  .profile-panel {
    padding: 14px;
  }

  .brand-row,
  .form-head,
  .result-head,
  .profile-head,
  .profile-actions {
    gap: 10px;
  }

  .brand-row {
    flex-wrap: wrap;
  }

  .session-box {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .auth-panel {
    min-height: auto;
  }

  .auth-copy,
  .auth-actions {
    padding: 16px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  h1 {
    font-size: 23px;
  }

  .lead {
    font-size: 16px;
  }

  .grid-two,
  .pilot-box {
    grid-template-columns: 1fr;
  }

  .sample-button,
  .secondary-button,
  .state-pill {
    font-size: 12px;
  }

  .profile-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Usage / paywall bar — Phase 4 */
.usage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(29, 111, 95, 0.07);
  border: 1px solid rgba(29, 111, 95, 0.18);
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 14px;
  font-size: 13px;
}

.usage-bar.is-pro {
  background: rgba(29, 111, 95, 0.12);
  border-color: rgba(29, 111, 95, 0.35);
  color: #0d4d40;
}

.usage-bar.is-warning {
  background: rgba(214, 110, 36, 0.10);
  border-color: rgba(214, 110, 36, 0.35);
  color: #8a430b;
}

.usage-bar.is-blocked {
  background: rgba(193, 41, 46, 0.12);
  border-color: rgba(193, 41, 46, 0.45);
  color: #872023;
}

.usage-label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.usage-upgrade {
  text-decoration: none;
  background: #1d6f5f;
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.usage-upgrade:hover {
  background: #16574a;
}

.usage-pro-info {
  margin: 6px 0 0 0;
  font-size: 12px;
  color: #6b6259;
  line-height: 1.4;
  padding: 0 14px;
}

.usage-pro-info[data-state="warning"] {
  color: #8a430b;
}

.usage-pro-info[data-state="blocked"] {
  color: #872023;
  font-weight: 500;
}
