:root {
  --bg: #f2f6fb;
  --bg-soft: #e6eef8;
  --surface: #ffffff;
  --surface-tint: #f7faff;
  --line: #d0dceb;
  --line-strong: #b0c0d4;
  --text: #142033;
  --text-muted: #5a6d85;
  --accent: #1a6fd4;
  --accent-hover: #1557ad;
  --accent-soft: rgba(26, 111, 212, 0.12);
  --accent-ring: rgba(26, 111, 212, 0.22);
  --highlight: #f07a12;
  --highlight-soft: rgba(240, 122, 18, 0.14);
  --energy: #e23b2f;
  --energy-soft: rgba(226, 59, 47, 0.12);
  --radius: 14px;
  --shadow: 0 12px 32px rgba(20, 48, 90, 0.08);
  --shadow-strong: 0 18px 40px rgba(26, 111, 212, 0.18);
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --container: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px));
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: clip;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 8% -5%, rgba(26, 111, 212, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 92% 8%, rgba(240, 122, 18, 0.14), transparent 50%),
    radial-gradient(ellipse 45% 35% at 70% 90%, rgba(226, 59, 47, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 50% at 40% 100%, rgba(170, 200, 235, 0.4), transparent 60%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 45%, #f2f6fb 100%);
}

.bg-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(26, 80, 160, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 80, 160, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 15%, transparent 72%);
  opacity: 0.7;
  animation: grid-drift 28s linear infinite;
}

@keyframes grid-drift {
  from { transform: translateY(0); }
  to { transform: translateY(64px); }
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.logo-img {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.logo-img--header {
  height: 31px;
  width: auto;
}

.logo-img--auth {
  height: 50px;
  width: auto;
  margin: 0 auto;
}

.logo-img--hero {
  height: clamp(3.15rem, 9.8vw, 5.25rem);
  width: auto;
}

.logo-img--footer {
  height: 25px;
  width: auto;
}

.logo-img--kp {
  height: 39px;
  width: auto;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.nav {
  display: flex;
  gap: 1.25rem;
}

.nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--accent);
}

.hero {
  padding: clamp(3.5rem, 10vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.hero-inner {
  max-width: 720px;
  animation: rise 0.8s ease both;
}

.hero-brand {
  margin: 0 0 1rem;
  line-height: 0;
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.7rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0f5cb8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(26, 111, 212, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2b7de0, var(--accent));
  box-shadow: var(--shadow-strong);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-block {
  width: 100%;
}

.section {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.section-head {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}

.section-head h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 600;
  color: var(--text);
}

.section-head h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
}

.section-head p {
  margin: 0;
  color: var(--text-muted);
}

.calc-layout,
.proposal-layout {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .calc-layout {
    grid-template-columns: 1.35fr 0.85fr;
    align-items: start;
  }

  .proposal-layout {
    grid-template-columns: 0.9fr 1.2fr;
    align-items: start;
  }
}

.calc-form,
.client-form,
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.summary-card {
  border-color: rgba(26, 111, 212, 0.3);
  box-shadow: var(--shadow-strong);
}

.field-group {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group legend {
  margin-bottom: 0.85rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.field span {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.field span small {
  opacity: 0.75;
}

.field-hint {
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--highlight-soft);
  border: 1px solid rgba(240, 122, 18, 0.3);
  color: #9a4e0a;
  font-size: 0.85rem;
  line-height: 1.4;
}

.lay-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .lay-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-tint);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

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

.street-suggest {
  position: relative;
}

.street-suggest-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-strong);
}

.street-suggest-list li {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.3;
}

.street-suggest-list li:hover,
.street-suggest-list li.is-active {
  background: var(--highlight-soft);
  color: #9a4e0a;
}

.stage-options {
  display: grid;
  gap: 0.55rem;
}

@media (min-width: 720px) {
  .stage-options {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stage-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-tint);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.stage-option:hover {
  border-color: rgba(26, 111, 212, 0.45);
}

.stage-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.stage-option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.stage-option strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
}

.stage-option:has(input:checked) strong {
  color: var(--accent-hover);
}

.stage-option small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pipe-mode-options {
  margin-bottom: 1rem;
}

.pipe-mode-options.stage-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 639px) {
  .pipe-mode-options.stage-options {
    grid-template-columns: 1fr;
  }
}

.extras {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.extras-dynamic {
  display: contents;
}

.summary-stage {
  border-bottom: 0 !important;
  padding-bottom: 0.15rem !important;
}

.summary-pipeline .line-name {
  color: var(--accent-hover);
  font-weight: 600;
}

.stage-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stage-badge--rough {
  background: var(--highlight-soft);
  color: #c45e00;
}

.stage-badge--finish {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.summary-split {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.summary-split div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.summary-split strong {
  color: var(--text);
  font-weight: 600;
}

.extra-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-tint);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.extra-item:hover {
  border-color: var(--line-strong);
}

.extra-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.extra-item input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.extra-item .extra-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  width: 100%;
}

.extra-item .extra-price {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.summary-panel {
  position: sticky;
  top: 84px;
}

.summary-card h3 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--accent-hover);
}

.summary-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-height: 340px;
  overflow: auto;
}

.summary-lines li {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.summary-lines .line-name {
  font-size: 0.92rem;
}

.summary-lines .line-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 1.1rem 0 0.75rem;
  padding: 0.9rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft), var(--energy-soft));
  border: 1px solid rgba(226, 59, 47, 0.22);
}

.summary-total span {
  font-weight: 600;
  color: var(--accent-hover);
}

.summary-total strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--energy);
}

.summary-note {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0;
}

@media (min-width: 960px) {
  .proposal-layout > .client-form {
    grid-column: 1;
    grid-row: 1;
  }

  .proposal-layout > .proposal-actions {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
  }

  .proposal-layout > .proposal-preview-wrap {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

.proposal-action-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(26, 111, 212, 0.18);
  -webkit-user-select: none;
  user-select: none;
}

.proposal-action-btn .btn-label-short {
  display: none;
}

.proposal-action-btn:disabled {
  opacity: 0.65;
  pointer-events: none;
}

.proposal-preview-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.proposal-sheet {
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  background: #fff;
  color: #1a2a32;
  border-radius: 4px;
  padding: 1.5rem 1.4rem 2rem;
  min-height: 980px;
  box-shadow: 0 10px 30px rgba(20, 48, 90, 0.1);
}

.proposal-sheet .kp-top {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 0.35rem;
}

.proposal-sheet .kp-top td {
  border: 0;
}

.proposal-sheet .kp-brand {
  line-height: 0;
}

.proposal-sheet .kp-company {
  margin: 0;
  font-size: 12px;
  color: #5a717c;
  line-height: 1.35;
}

.proposal-sheet .kp-top-line {
  display: block;
  width: 100%;
  height: 1.5px;
  margin: 0 0 0.85rem;
  padding: 0;
  border: 0;
}

.kp-id-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.55rem;
  align-items: start;
}

.kp-id-row #proposalNumber[readonly] {
  min-height: 44px;
  height: auto;
  resize: none;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bg-soft);
  color: var(--text);
  cursor: default;
}

.phone-input {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-tint);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.phone-input:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.phone-prefix {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 0.75rem;
  border-right: 1px solid var(--line);
  background: rgba(26, 111, 212, 0.08);
  color: var(--accent-hover);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.phone-input input[type='tel'] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.phone-input input[type='tel']:focus {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.address-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.address-cell {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.address-cell span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.address-cell input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-tint);
  outline: none;
}

.address-cell input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

@media (max-width: 720px) {
  .address-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .address-grid .address-cell:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .address-grid {
    grid-template-columns: 1fr;
  }
}

.proposal-sheet .kp-meta {
  text-align: right;
  font-size: 0.95rem;
}

.proposal-sheet .kp-meta strong {
  display: block;
  font-size: 1.05rem;
  color: var(--accent);
  line-height: 1.25;
  word-break: break-word;
}

.proposal-sheet .kp-meta-phone {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.proposal-sheet .kp-meta-date {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #5a717c;
}

.proposal-sheet h1 {
  margin: 1rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: #0f2a36;
}

.proposal-sheet .kp-client {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.proposal-sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}

.proposal-sheet th,
.proposal-sheet td {
  border: 1.5px solid var(--line);
  padding: 0.45rem 0.4rem;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.proposal-sheet .kp-top,
.proposal-sheet .kp-top table {
  width: auto;
  table-layout: auto;
  font-size: inherit;
}

.proposal-sheet .kp-top td,
.proposal-sheet .kp-top th {
  border: 0 !important;
  word-wrap: normal;
  overflow-wrap: normal;
}

.proposal-sheet .kp-top td,
.proposal-sheet .kp-top th {
  padding: 0;
  background: transparent;
}

.proposal-sheet td:nth-child(2),
.proposal-sheet th:nth-child(2) {
  width: auto;
}

.proposal-sheet th {
  background: #eef5f7;
  text-align: left;
  font-weight: 600;
}

.proposal-sheet td.num,
.proposal-sheet th.num {
  text-align: right;
  white-space: nowrap;
}

.proposal-sheet .kp-stage-row td {
  background: #e8f1fb;
  font-size: 0.9rem;
  color: var(--accent-hover);
}

.proposal-sheet .kp-substage-row td {
  background: #f3f6fa;
  font-size: 0.82rem;
  color: #5a6d85;
}

.proposal-sheet .kp-material-row td {
  background: #f7fbff;
}

.proposal-sheet .kp-pipeline-row td {
  background: #eaf2fc;
  font-weight: 600;
  color: var(--accent-hover);
}

.proposal-sheet .kp-credit-row td {
  color: #6a7f89;
  font-style: italic;
}

.proposal-sheet .kp-subtotal,
.proposal-sheet .kp-discount {
  margin-top: 0.55rem;
  text-align: right;
  font-size: 0.95rem;
  color: #4d636e;
}

.proposal-sheet .kp-discount {
  color: #c45e00;
  font-weight: 600;
}

.proposal-sheet .kp-total {
  margin-top: 0.45rem;
  text-align: right;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--energy);
}

.proposal-sheet .kp-notes {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1.5px solid #d5e0e6;
  font-size: 0.85rem;
  color: #4d636e;
}

.proposal-sheet .kp-notes ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.proposal-sheet .kp-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
  font-size: 0.9rem;
}

.proposal-sheet .kp-sign .line {
  margin-top: 2rem;
  border-top: 1.5px solid #9aabb4;
  padding-top: 0.35rem;
  color: #6a7f89;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2rem;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.55);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 959px) {
  .summary-panel {
    position: static;
    top: auto;
  }

  .proposal-sheet {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 1.25rem, var(--container));
  }

  .header-inner {
    min-height: 56px;
  }

  .nav {
    gap: 0.55rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero {
    padding: 2.25rem 0 1.75rem;
  }

  .hero-actions {
    gap: 0.5rem;
  }

  .hero-actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
  }

  .hero-actions .btn-primary {
    flex: 1 1 100%;
  }

  .section {
    padding: 2rem 0;
  }

  .calc-form,
  .client-form,
  .summary-card {
    padding: 1rem;
  }

  .kp-id-row {
    grid-template-columns: 1fr;
  }

  .kp-id-row #proposalNumber[readonly] {
    font-size: 0.86rem;
  }

  .proposal-layout {
    gap: 0.85rem;
  }

  /* Keep actions between form and preview (no sticky — it overlaid the form) */
  .proposal-layout > .proposal-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    position: static;
    margin: 0;
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }

  .proposal-action-btn {
    min-height: 48px;
    width: 100%;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    font-size: 0.9rem;
    border-radius: var(--radius);
  }

  .proposal-action-btn .btn-label-full {
    display: none;
  }

  .proposal-action-btn .btn-label-short {
    display: inline;
  }

  .proposal-preview-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
  }

  .proposal-sheet {
    padding: 0.85rem 0.7rem 1.25rem;
    min-height: auto;
    border-radius: 0;
    box-shadow: none;
  }

  .proposal-sheet .kp-top,
  .proposal-sheet .kp-top table {
    width: 100% !important;
    display: block;
  }

  .proposal-sheet .kp-top tbody,
  .proposal-sheet .kp-top tr {
    display: block;
    width: 100%;
  }

  .proposal-sheet .kp-top td {
    display: block;
    width: 100% !important;
    padding: 0 0 0.55rem !important;
  }

  .proposal-sheet .kp-meta,
  .proposal-sheet .kp-meta[style] {
    text-align: left !important;
    white-space: normal !important;
  }

  .proposal-sheet .kp-meta strong {
    white-space: normal;
    font-size: 0.95rem;
  }

  .proposal-sheet .logo-img--kp {
    height: 32px;
  }

  .proposal-sheet h1 {
    white-space: normal;
    font-size: 0.88rem;
  }

  .proposal-sheet .kp-client {
    font-size: 0.88rem;
  }

  .proposal-sheet table:not(.kp-top) {
    font-size: 0.68rem;
  }

  .proposal-sheet table:not(.kp-top) th,
  .proposal-sheet table:not(.kp-top) td {
    padding: 0.3rem 0.22rem;
  }

  .proposal-sheet table:not(.kp-top) th:nth-child(1),
  .proposal-sheet table:not(.kp-top) td:nth-child(1) {
    width: 1.4rem;
  }

  .proposal-sheet table:not(.kp-top) th.num,
  .proposal-sheet table:not(.kp-top) td.num {
    width: auto;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    font-size: 0.65rem;
  }

  .proposal-sheet .kp-sign {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .site-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .nav a {
    font-size: 0.78rem;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
  }

  .proposal-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .extra-item .extra-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .extra-item .extra-price {
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .proposal-actions {
    grid-template-columns: 1fr;
  }

  .proposal-action-btn .btn-label-full {
    display: inline;
  }

  .proposal-action-btn .btn-label-short {
    display: none;
  }
}

@media print {
  .bg-atmosphere,
  .site-header,
  .hero,
  .calculator-section,
  .site-footer,
  .client-form,
  .section-head,
  .auth-gate,
  .proposal-actions {
    display: none !important;
  }

  .proposal-section,
  .proposal-layout,
  .proposal-preview-wrap {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .proposal-sheet {
    box-shadow: none !important;
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
  }

  body {
    background: #fff !important;
  }
}

/* —— Auth gate —— */
body.auth-locked .app-shell {
  display: none !important;
}

body.auth-unlocked .auth-gate {
  display: none !important;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(26, 111, 212, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(240, 122, 18, 0.16), transparent 50%),
    linear-gradient(180deg, #e8f0fa 0%, #f2f6fb 50%, #e6eef8 100%);
}

.auth-card {
  width: min(100%, 380px);
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-strong);
  display: grid;
  gap: 0.85rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-lead {
  margin: -0.25rem 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-error {
  margin: 0;
  color: var(--energy);
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-submit {
  width: 100%;
  margin-top: 0.25rem;
}
