/* ===========================================================
   FitCorner — стили на основе дизайн-токенов из Claude Design
   (design_handoff_fitcorner/README.md). Значения ниже — точные
   значения из прототипа, не менять "на глаз".
=========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #faf7f2;
  --color-surface: #f2ece2;
  --color-text: #2a2622;
  --color-divider: #e5ddd0;
  --color-accent: #7d6b52;
  --color-accent-600: #6b5a44;
  --color-accent-700: #5c4d3a;
  --color-accent-100: #f4efe6;
  --color-accent-200: #e9e0d0;
  --color-neutral-100: #fffdf9;
  --color-neutral-200: #f4efe7;
  --color-neutral-300: #ebe4d9;
  --color-neutral-400: #d9d0c2;
  --color-neutral-600: #93887a;
  --color-neutral-700: #6f665b;
  --color-neutral-800: #4a443c;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --font-heading: 'Archivo', 'Manrope', Arial, system-ui, sans-serif;
  --font-body: 'Manrope', Arial, system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(42,38,34,.05);
  --shadow-md: 0 4px 16px rgba(42,38,34,.07);
  --shadow-lg: 0 12px 40px rgba(42,38,34,.10);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;

  /* утилитарный цвет ошибок — в макете Claude Design не описан,
     подобран в тон тёплой палитре только для форм входа/админки */
  --color-error: #a8402f;
  --color-error-bg: #f7e9e4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-heading); }
p { margin: 0; }

a { color: var(--color-accent-700); text-decoration: none; }
a:hover { color: var(--color-accent); }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

button { font-family: inherit; }

/* ---------- Buttons (адаптация системы Modernist под токены FitCorner) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--color-text); color: var(--color-neutral-100); border-color: var(--color-text); }
.btn-primary:hover { background: var(--color-accent-700); border-color: var(--color-accent-700); }

.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: rgba(42,38,34,.06); }

.btn-ghost { color: var(--color-accent-700); }
.btn-ghost:hover { background: rgba(125,107,82,.10); color: var(--color-text); }

.btn-block { width: 100%; }

/* ---------- Forms ---------- */

.field { display: block; }
.field > span, .field > label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: var(--color-neutral-700);
}
.input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-600);
  border-radius: var(--radius-md);
}
.input::placeholder { color: var(--color-neutral-700); }
.input:hover { border-color: var(--color-neutral-700); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }

/* ---------- Table ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; border-radius: var(--radius-md); overflow: hidden; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-neutral-700); padding: 12px; border-bottom: 2px solid var(--color-divider);
}
.table td { padding: 12px; border-bottom: 1px solid var(--color-divider); }
.table tbody tr:hover { background: rgba(42,38,34,.03); }

/* ---------- Interactive helper classes (для :hover, который нельзя выразить инлайн-стилями) ---------- */

.nav-btn { background: none; border: 0; }
.nav-btn:hover { background: var(--color-surface); }

.chip { transition: border-color .15s ease; }
.chip:not([data-on="1"]):hover { border-color: var(--color-accent) !important; }

.text-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.text-btn:hover { color: var(--color-text) !important; }

.prompt-pill:hover { border-color: var(--color-accent) !important; }

.addon-plus:hover { border-color: var(--color-accent) !important; }

.unit-card { transition: box-shadow .18s ease, transform .18s ease; }
.unit-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.footer-link-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--color-accent-700); }
.footer-link-btn:hover { color: var(--color-accent); }

.chat-quick:hover { color: var(--color-text) !important; }

.icon-btn { background: none; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--color-surface); }

/* ---------- Auth modal (доп. поверх дизайна — вход/регистрация) ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(42,38,34,.32); }

.auth-modal {
  position: relative;
  width: min(400px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1;
  font-family: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 9px 12px; border-radius: 999px; border: 1px solid var(--color-divider);
  background: transparent; color: var(--color-neutral-800);
}
.auth-tabs button[data-on="1"] { background: var(--color-text); color: var(--color-neutral-100); border-color: var(--color-text); }

.auth-error {
  display: none;
  background: var(--color-error-bg); color: var(--color-error);
  font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.auth-error.show { display: block; }

.close-x {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 999px;
  background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--color-neutral-700);
}
.close-x:hover { background: var(--color-surface); }

/* ---------- Misc layout ---------- */

::selection { background: rgba(125,107,82,.25); }

@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}

/* Server account forms reuse the storefront tokens. */
dialog.auth-modal { border: 0; margin: auto; padding-top: 44px; color: var(--color-text); }
dialog.auth-modal::backdrop { background: rgba(42,38,34,.4); }
.auth-modal h2 { font-size: 22px; line-height: 1.25; }
.form-intro { margin: 12px 0 20px; }
.profile-form { display: grid; gap: 16px; }
.profile-form .input { min-height: 44px; font-size: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-error { color: var(--color-error); background: var(--color-error-bg); padding: 12px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.muted { color: var(--color-neutral-700); }
.account-page { max-width: 900px; margin: auto; padding: 32px 16px 64px; }
.account-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.account-heading h1 { font-size: clamp(26px, 4vw, 34px); overflow-wrap: anywhere; }
.account-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.account-tab { padding: 10px 16px; border: 1px solid var(--color-divider); border-radius: 999px; font: inherit; cursor: pointer; background: transparent; }
.account-tab[data-on="1"] { background: var(--color-text); color: var(--color-neutral-100); }
.account-card { padding: clamp(20px, 4vw, 32px); background: var(--color-neutral-100); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); }
.empty-account { display: grid; gap: 16px; justify-items: start; }
.account-card h2 { font-size: 22px; }
.session-note { max-width: 900px; margin: 16px auto; }

/* Catalogue and quotes use the existing storefront palette and spacing. */
.catalog-note { color: var(--color-neutral-700); font-size: 14px; line-height: 1.55; }
.catalog-search { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 24px; }
.catalog-search input::placeholder { color: var(--color-neutral-700); }
.catalog-search .field { flex: 1 1 220px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(258px,100%),1fr)); gap: 16px; }
#catalog .chip,.catalog-search .btn,.unit-page .btn { min-height: 44px; }
.card-photo { position: relative; aspect-ratio: 4/3; background: var(--color-surface); overflow: hidden; flex: none; }
.card-photo > img,.card-photo > .photo-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; }
a.unit-card { color: inherit; text-decoration: none; }
a.unit-card:focus-visible { outline: 3px solid var(--color-accent-700); outline-offset: 4px; }
.photo-placeholder { display: grid; place-items: center; height: 100%; min-height: 150px; background: var(--color-surface); color: var(--color-neutral-700); }
.unit-page { max-width: 1180px; margin: auto; padding: 22px clamp(16px,3vw,28px) 60px; }
.unit-page > .text-btn { display: inline-block; margin-bottom: 22px; }
.unit-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(22px,3vw,40px); }
.unit-layout h1 { font-size: clamp(26px,3vw,36px); line-height: 1.15; margin: 16px 0; }
.unit-layout h2 { font-size: 18px; margin: 24px 0 12px; }
.unit-layout p { color: var(--color-neutral-800); margin: 0 0 12px; }
.unit-photo { aspect-ratio: 4/3; border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface); }
.unit-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.unit-thumb { width: 80px; aspect-ratio: 1; overflow: hidden; border-radius: 12px; padding: 0; border: 2px solid transparent; cursor: pointer; }
.unit-thumb[aria-pressed="true"] { border-color: var(--color-accent-700); }
.unit-meta,.unit-terms,.unit-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.unit-meta { font-size: 13px; color: var(--color-neutral-700); }
.unit-meta .chip { border-radius: 999px; background: var(--color-surface); padding: 5px 12px; }
.unit-quote { background: var(--color-surface); border-radius: var(--radius-lg); padding: 20px; margin: 22px 0; }
.unit-quote h2 { margin-top: 0; }
.quote-monthly strong { font-family: var(--font-heading); font-size: 30px; }
.quote-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.quote-row strong { white-space: nowrap; }
.quote-total { border-top: 1px solid var(--color-divider); margin-top: 10px; padding-top: 16px; font-size: 18px; }
.unit-specs { margin: 0; }
.unit-specs > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--color-divider); }
.unit-specs dt { color: var(--color-neutral-700); }
.unit-specs dd { margin: 0; text-align: right; font-weight: 600; }
@media (max-width: 760px) { .unit-layout { grid-template-columns: minmax(0,1fr); } }

/* Checkout shares account forms and catalogue quote tokens. */
.checkout-page { max-width: 1080px; margin: auto; padding: 28px 16px 64px; }
.checkout-page h1 { font-size: clamp(28px,4vw,38px); margin: 8px 0 24px; }
.checkout-layout { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 24px; align-items: start; }
.checkout-stack { display: grid; gap: 18px; }
.checkout-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkout-summary { background: var(--color-surface); }
.checkout-item { margin-bottom: 22px; }
.checkout-item h2 { font-size: 21px; margin: 6px 0; }
.checkout-item p { margin: 4px 0; }
.checkout-page .btn,.cart-dialog .btn { min-height: 44px; }
.checkout-page textarea { font: inherit; resize: vertical; }
.checkout-page .field > span,.checkout-page .field > label { color: var(--color-neutral-700); }
.checkout-page .input { border-color: var(--color-neutral-600); }
.delivery-summary { margin: 0; }
.delivery-summary > div { margin: 0 0 16px; }
.delivery-summary dt { color: var(--color-neutral-700); font-size: 14px; margin-bottom: 4px; }
.delivery-summary dd { margin: 0; overflow-wrap: anywhere; }
.demo-payment { border-top: 1px solid var(--color-divider); padding-top: 22px; }
.demo-payment p { margin: 12px 0 18px; }
.order-status { background: var(--color-surface); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 24px; }
.cart-dialog { margin: 0 0 0 auto; border: 0; padding: 24px; width: min(430px,100%); max-width: 100%; height: 100dvh; max-height: 100dvh; color: var(--color-text); background: var(--color-bg); box-shadow: var(--shadow-lg); }
.cart-dialog::backdrop { background: rgba(42,38,34,.4); }
.cart-dialog .form-actions { margin-top: 28px; }
.orders-toolbar,.order-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.orders-group { margin-top: 28px; }
.orders-group > h2 { font-size: 22px; margin-bottom: 16px; }
.orders-list { display: grid; gap: 16px; }
.order-card { display: grid; gap: 14px; }
.order-card-heading { margin: 0; }
.order-card h2,.order-card h3 { font-size: 19px; }
.order-card .order-status { margin: 0; }
.order-card .btn { min-height: 44px; }
.order-identity { display: flex; gap: 16px; align-items: center; }
.order-identity img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
@media (max-width: 760px) {
  .checkout-layout { grid-template-columns: minmax(0,1fr); }
  .checkout-review .checkout-summary { order: -1; }
}

/* Native modal keeps keyboard focus inside the scenario assistant. */
.assistant-dialog { width: min(560px,calc(100vw - 24px)); height: min(760px,calc(100dvh - 24px)); max-width: none; max-height: none; border: 1px solid var(--color-divider); border-radius: var(--radius-lg); padding: 0; color: var(--color-text); background: var(--color-bg); box-shadow: var(--shadow-lg); overflow: hidden; }
.assistant-dialog[open] { display: flex; flex-direction: column; }
.assistant-dialog::backdrop { background: rgba(42,38,34,.4); }
.assistant-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--color-divider); }
.assistant-header h2 { font-size: 20px; margin: 0; }
.assistant-header p { font-size: 13px; color: var(--color-neutral-700); margin: 5px 0 0; }
.assistant-header .icon-btn { flex: none; width: 44px; height: 44px; cursor: pointer; background: var(--color-surface); border: 0; border-radius: 50%; font: inherit; }
.chat-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px; overscroll-behavior: contain; }
.assistant-note { font-size: 13px; line-height: 1.55; color: var(--color-neutral-700); margin: 0 0 18px; }
.chat-exchange { margin: 0 0 22px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-question { margin: 0 0 10px 20px; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--color-text); color: var(--color-neutral-100); }
.chat-answer { background: var(--color-surface); padding: 14px; border-radius: 4px 16px 16px 16px; }
.chat-answer p { margin: 0; white-space: pre-line; }
.chat-answer time { display: block; color: var(--color-neutral-700); font-size: 12px; margin-top: 12px; }
.chat-links { display: grid; gap: 4px; margin-top: 10px; }
.chat-links a { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; }
.chat-prompts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; }
.chat-quick { font: inherit; font-size: 12px; font-weight: 600; color: var(--color-text); border: 1px solid var(--color-divider); border-radius: 999px; padding: 10px 12px; min-height: 44px; background: var(--color-surface); cursor: pointer; }
.assistant-dialog #chatForm { padding: 14px 20px 20px; border-top: 1px solid var(--color-divider); }
#chatForm label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.chat-input-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-input-row input { flex: 1 1 150px; min-width: 0; border-color: var(--color-neutral-600); }
.chat-input-row button { min-height: 44px; }

/* P0 navigation remains reachable by keyboard and compact on small screens. */
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 100; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb,var(--color-bg) 88%,transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--color-divider); }
.header-inner { max-width: 1180px; margin: auto; padding: 12px clamp(16px,3vw,28px); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.site-brand { display: flex; align-items: center; gap: 10px; padding: 0; background: none; border: 0; min-height: 44px; color: var(--color-text); cursor: pointer; }
.site-brand img { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; mix-blend-mode: multiply; }
.site-brand span { font-family: var(--font-heading); font-weight: 800; font-size: 18px; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.header-nav { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.header-nav .nav-btn { font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: 8px 12px; border-radius: 999px; color: var(--color-neutral-800); }
.header-nav [aria-current="page"] { background: var(--color-surface); color: var(--color-text); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.site-header .btn,.nav-btn,.text-btn,.footer-link-btn { min-height: 44px; }
footer a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; }
.chat-quick:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 760px) {
  .header-inner { display: grid; grid-template-columns: auto auto; gap: 6px 8px; }
  .header-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .site-brand { gap: 6px; }
  .site-brand img { width: 32px; height: 32px; border-radius: 9px; }
  .site-brand span { font-size: 14px; }
  .header-actions { gap: 6px; justify-content: end; }
  .header-actions .btn { padding: 10px 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn,.chip,.unit-card { transition: none; }
  .unit-card:hover { transform: none; }
}

.contacts-page > .account-card { margin-top: 24px; }
.contacts-page .account-card a { min-height: 44px; display: flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; }
