@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Thin.otf") format("opentype");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Ultralight.otf") format("opentype");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Book.otf") format("opentype");
  font-weight: 450;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-SemiBold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-Black.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-ThinItalic.otf") format("opentype");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-UltralightItalic.otf") format("opentype");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-LightItalic.otf") format("opentype");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-RegularItalic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-BookItalic.otf") format("opentype");
  font-weight: 450;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-MediumItalic.otf") format("opentype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-SemiBoldItalic.otf") format("opentype");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-BoldItalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Suisse Intl";
  src: url("../assets/fonts/suisse-intl/SuisseIntl-BlackItalic.otf") format("opentype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.48);
  --line: rgba(31, 29, 24, 0.12);
  --line-strong: rgba(31, 29, 24, 0.2);
  --text: #1f1d18;
  --muted: rgba(31, 29, 24, 0.58);
  --soft: rgba(31, 29, 24, 0.06);
  --soft-strong: rgba(31, 29, 24, 0.1);
  --accent: #c76d4d;
  --accent-soft: rgba(199, 109, 77, 0.13);
  --positive: #476b5c;
  --shadow: 0 24px 70px rgba(42, 35, 25, 0.1);
  --radius-lg: 34px;
  --radius-md: 24px;
  --radius-sm: 16px;
  --font: "Suisse Intl", "Onest", "Helvetica Neue", Arial, sans-serif;
  --mono: var(--font);

  /* ── Typography scale ──────────────────────────────────────
     display  — hero / landing only
     h1       — page title
     h2       — section heading
     body     — default text
     small    — labels, captions, metadata
  ─────────────────────────────────────────────────────────── */
  --type-display: clamp(34px, 4.2vw, 56px);
  --type-h1:      clamp(28px, 3.2vw, 40px);
  --type-h2:      clamp(20px, 1.8vw, 26px);
  --type-body:    15px;
  --type-small:   12px;
  --type-caption: 11px;

  /* ── Button heights ────────────────────────────────────────
     btn-lg  — primary CTA
     btn-md  — default (most buttons)
     btn-sm  — compact / inline actions
  ─────────────────────────────────────────────────────────── */
  --btn-height-lg: 52px;
  --btn-height-md: 44px;
  --btn-height-sm: 32px;
  --btn-radius:    999px;

  /* ── Input / form ──────────────────────────────────────────
     unified across all views
  ─────────────────────────────────────────────────────────── */
  --input-height:  42px;
  --input-radius:  14px;
  --input-padding: 0 13px;
  --input-fs:      14px;
  --label-fs:      var(--type-caption);
  --field-gap:     7px;

  /* Figma design tokens — DesiDoc Home (node 49:328) */
  --ddoc-color-bg-base: #020201;
  --ddoc-color-title: #373737;
  --ddoc-color-body-muted: #c8c4c4;
  --ddoc-color-button-bg: #262626;
  --ddoc-color-button-label: #c8c4c4;
  --ddoc-color-card-solid: #ffffff;
  --ddoc-color-glass-card: rgba(0, 0, 0, 0.10);
  --ddoc-color-card-border: rgba(255, 255, 255, 0.50);
  --ddoc-color-glass-pill: rgba(255, 255, 255, 0.32);
  --ddoc-color-text-on-glass: rgba(255, 255, 255, 0.7);
  --ddoc-color-brand-line: rgba(255, 255, 255, 0.8);
  --ddoc-blur-glass: 22.75px;
  --ddoc-radius-card: 63.394px;
  --ddoc-radius-pill: 30.5px;
  --ddoc-radius-button-desktop: 24px;
  --ddoc-radius-button-mobile: 21px;
  --ddoc-shadow-button: 0px 59px 16px 0px rgba(127, 67, 52, 0), 0px 38px 15px 0px rgba(127, 67, 52, 0.01), 0px 21px 13px 0px rgba(127, 67, 52, 0.05), 0px 9px 9px 0px rgba(127, 67, 52, 0.09), 0px 2px 5px 0px rgba(127, 67, 52, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171612;
  --surface: rgba(38, 36, 30, 0.76);
  --surface-strong: #23211c;
  --surface-muted: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 247, 232, 0.12);
  --line-strong: rgba(255, 247, 232, 0.22);
  --text: #f6efe2;
  --muted: rgba(246, 239, 226, 0.62);
  --soft: rgba(255, 255, 255, 0.07);
  --soft-strong: rgba(255, 255, 255, 0.12);
  --accent: #e19a76;
  --accent-soft: rgba(225, 154, 118, 0.16);
  --positive: #a6c3b2;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

html:has(body[data-view="home"]) {
  background:
    linear-gradient(180deg, rgba(34, 28, 25, 0.08), rgba(34, 28, 25, 0.12)),
    url("../assets/deedoc-landscape.png") center / cover no-repeat,
    #d8b1a3;
}

/* ── Mobile tap highlight — убираем синюю вспышку на iOS/Android ── */
a, button, [role="button"], .deedoc-card, .project-option, .outline-link, .optional-toggle {
  -webkit-tap-highlight-color: transparent;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 8% 6%, rgba(199, 109, 77, 0.16), transparent 30vw),
    radial-gradient(circle at 88% 12%, rgba(80, 111, 99, 0.13), transparent 28vw),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.02em;
}

body[data-view="home"] {
  background:
    linear-gradient(180deg, rgba(34, 28, 25, 0.08), rgba(34, 28, 25, 0.12)),
    url("../assets/deedoc-landscape.png") center / cover no-repeat,
    #d8b1a3;
}

button,
input,
textarea {
  font: inherit;
}

input[type="checkbox"],
input[type="date"],
input[type="time"],
input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

button {
  color: inherit;
}

.deedoc-pill:focus-visible,
.deedoc-toggle:focus-visible,
.deedoc-user__avatar:focus-visible {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

textarea:focus,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
}
.deedoc-card:focus-visible,
.modal__close:focus-visible,
.chooser-close:focus-visible,
[data-action="close-modal"]:focus-visible {
  outline: none;
}

.app {
  min-height: 100vh;
  padding-left: 88px;
}

.rail {
  position: fixed;
  inset: 20px auto 20px 20px;
  z-index: 20;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brand,
.mobile-brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.brand {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  letter-spacing: -0.05em;
}

.rail__nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rail__link {
  width: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: transparent;
  text-decoration: none;
  position: relative;
}

.rail__link::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.rail__link.is-active {
  background: var(--soft);
}

.rail__link.is-active::before {
  width: 18px;
  height: 18px;
  background: var(--accent);
}

.rail__link.is-muted::before {
  opacity: 0.35;
}

.theme-toggle,
.topbar__theme {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  cursor: pointer;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.theme-toggle__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--text));
}

.workspace {
  min-height: 100vh;
  padding: 34px clamp(22px, 4vw, 68px) 140px;
}

.topbar {
  display: none;
}

.view {
  display: none;
}

.app[data-view="home"] .view--home,
.app[data-view="calculator"] .view--calculator,
.app[data-view="contract"] .view--contract {
  display: block;
}

.app[data-view="home"] {
  padding-left: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(34, 28, 25, 0.08), rgba(34, 28, 25, 0.12)),
    url("../assets/deedoc-landscape.png") center / cover no-repeat,
    #d8b1a3;
}

.app[data-view="home"] .rail,
.app[data-view="home"] .topbar {
  display: none;
}

.app[data-view="home"] .workspace {
  padding: 0;
}

.app[data-view="home"],
.app[data-view="home"] .workspace,
.app[data-view="home"] .view--home {
  min-height: 100vh;
}

.deedoc-home {
  --home-margin: 33px;
  --home-gutter: 18px;
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--home-margin);
  isolation: isolate;
  background: #d8b1a3;
}

/* Parallax background wrapper — oversized so layers never reveal edges */
.deedoc-home__bg {
  position: absolute;
  inset: -8%;
  z-index: -2;
  pointer-events: none;
}

/* Base layer rules — each layer is full-size within the wrapper */
.deedoc-home__bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

/* Sky — slowest (furthest). Fallback: full landscape until sky.png is ready */
.deedoc-home__bg-layer[data-layer="sky"] {
  background-image:
    linear-gradient(180deg, rgba(34, 28, 25, 0.08), rgba(34, 28, 25, 0.12)),
    url("../assets/deedoc-landscape.png");
  background-color: #d8b1a3;
  z-index: 1;
  /* swap to layer file once ready: url("../assets/backgrounds/deedoc-bg-sky.png") */
}

/* Mountains — medium speed. Hidden until file is provided */
.deedoc-home__bg-layer[data-layer="mountains"] {
  z-index: 2;
  /* uncomment when ready: */
  /* background-image: url("../assets/backgrounds/deedoc-bg-mountains.png"); */
}

/* Water / foreground — fastest (closest). Hidden until file is provided */
.deedoc-home__bg-layer[data-layer="water"] {
  z-index: 3;
  /* uncomment when ready: */
  /* background-image: url("../assets/backgrounds/deedoc-bg-water.png"); */
}

/* Night variants — crossfade on each layer */
.deedoc-home__bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.deedoc-home__bg-layer[data-layer="sky"]::after {
  background:
    linear-gradient(180deg, rgba(2, 2, 1, 0.18), rgba(2, 2, 1, 0.32)),
    url("../assets/backgrounds/deedoc-landscape-night.png") center / cover no-repeat,
    #08070f;
  /* swap to: url("../assets/backgrounds/deedoc-bg-night-sky.png") */
}

[data-theme="dark"] .deedoc-home__bg-layer::after {
  opacity: 1;
}

.deedoc-home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 48% 56%, rgba(255, 255, 255, 0.04), transparent 28%),
    linear-gradient(90deg, rgba(50, 34, 29, 0.08), transparent 38%, rgba(34, 25, 22, 0.1));
}

/* Dark theme */
[data-theme="dark"] .deedoc-home {
  --ddoc-color-card-solid: rgba(255, 255, 255, 0.09);
  --ddoc-color-glass-card: rgba(255, 255, 255, 0.09);
  --ddoc-color-card-border: rgba(255, 255, 255, 0.12);
  --ddoc-color-title: rgba(255, 255, 255, 0.92);
  --ddoc-color-body-muted: rgba(255, 255, 255, 0.48);
  --ddoc-color-button-bg: rgba(255, 255, 255, 0.13);
  --ddoc-color-button-label: rgba(255, 255, 255, 0.80);
}

.deedoc-home__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.deedoc-home__nav-spacer {
  height: 61px; /* matches original header row height (toggle = 61px) */
}

.deedoc-home__top--global {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 22px 33px;
  pointer-events: none;
}

.deedoc-home__top--global > * {
  pointer-events: auto;
}

.deedoc-home__top--global .deedoc-user,
.deedoc-home__top--global .deedoc-home__tools {
  gap: 10px;
}


/* "Главная" visible only on non-home screens */
/* back-pill убран — вместо него аватар как home-кнопка */

.deedoc-user,
.deedoc-home__tools {
  display: inline-flex;
  align-items: center;
  gap: var(--home-gutter);
}

/* Pill «Мои данные» — right of avatar */

.deedoc-user__avatar {
  width: 61px;
  height: 61px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255,255,255,0.32);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(32, 20, 16, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  user-select: none;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.deedoc-user__avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(32, 20, 16, 0.22);
}

.deedoc-user__avatar:active {
  transform: scale(0.95);
}

.deedoc-section-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  height: 61px;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.deedoc-section-nav[hidden] { display: none; }

.deedoc-section-tab {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  height: 51px;
  box-sizing: border-box;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.65);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.tab-icon {
  flex-shrink: 0;
  display: block;
}

.tab-label {
  display: block;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  transition: max-width 0.25s cubic-bezier(0.4,0,0.2,1),
              opacity 0.2s ease,
              margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}

.deedoc-section-tab:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
}

.deedoc-section-tab:hover .tab-label,
.deedoc-section-tab.is-current .tab-label {
  max-width: 90px;
  opacity: 1;
  margin-left: 6px;
}

.deedoc-section-tab.is-current {
  background: rgba(255,255,255,0.28);
  color: rgba(255,255,255,1);
  font-weight: 500;
  pointer-events: none;
}

[data-theme="dark"] .deedoc-section-nav {
  background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .deedoc-section-tab.is-current {
  background: rgba(255,255,255,0.18);
}

.deedoc-pill,
.deedoc-toggle,
.deedoc-card__button {
  border: 0;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.deedoc-pill {
  min-height: unset;
  display: inline-flex;
  align-items: center;
  border-radius: var(--ddoc-radius-pill);
  background: var(--ddoc-color-glass-pill);
  color: var(--ddoc-color-text-on-glass);
  padding: 23px 25px 22px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  backdrop-filter: blur(var(--ddoc-blur-glass));
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass));
}

/* Slot-machine эффект на пилюлях */
.pill-clip {
  display: block;
  overflow: hidden;
  line-height: 1.1;
}

.pill-reel {
  display: block;
  position: relative;
  line-height: 1;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-reel::after {
  content: attr(data-text);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding-top: 0.2em;
}

.deedoc-pill:hover .pill-reel {
  transform: translateY(-120%);
}

.deedoc-toggle {
  position: relative;
  width: 87px;
  height: 61px;
  border-radius: 30.5px;
  background: #FFFBFA;
  flex-shrink: 0;
  overflow: hidden;
}

/* dark inner track */
.deedoc-toggle::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 12px;
  width: 61px;
  height: 37px;
  border-radius: 18.5px;
  background: #262626;
  z-index: 0;
}

/* moon icon — left of track, visible in light mode */
.deedoc-toggle__moon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  display: block;
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* sun icon — right of track, visible in dark mode */
.deedoc-toggle__sun {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

[data-theme="dark"] .deedoc-toggle__moon {
  opacity: 0;
}

[data-theme="dark"] .deedoc-toggle__sun {
  opacity: 1;
}

/* sliding knob — covers the inactive icon */
.deedoc-toggle__knob {
  position: absolute;
  z-index: 2;
  display: block;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #FFFBFA;
  box-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.10),
    3px 4px 4px rgba(0, 0, 0, 0.09),
    6px 8px 6px rgba(0, 0, 0, 0.05),
    11px 15px 7px rgba(0, 0, 0, 0.01);
  top: 17px;
  left: 43px; /* light mode default: knob on right */
  transition: left 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* dark mode: knob slides to left, exposing the sun */
[data-theme="dark"] .deedoc-toggle__knob {
  left: 17px;
}

.deedoc-hero {
  align-self: center;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}

.deedoc-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.deedoc-hero h1 {
  margin: 0;
  color: rgba(255, 255, 255, 0.90);
  font-size: 38px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: left;
}

.deedoc-hero h1 em {
  font-style: normal;
  font-weight: 500;
}

.deedoc-actions {
  display: flex;
  align-items: stretch;
  gap: var(--home-gutter);
}

.deedoc-card {
  width: 267px;
  height: 267px;
  flex: 0 0 267px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--ddoc-radius-card);
  transition: background 0.9s ease, background-color 0.9s ease, border-color 0.9s ease, backdrop-filter 0.9s ease;
}

[data-theme="dark"] .deedoc-card {
  border: 1px solid var(--ddoc-color-card-border);
}

.deedoc-card--quick {
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  cursor: pointer;
  background: var(--ddoc-color-glass-card);
  backdrop-filter: blur(var(--ddoc-blur-glass));
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass));
  color: var(--ddoc-color-text-on-glass);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

/* Proximity + hover: transform handled by JS, CSS handles shadow/color */
.deedoc-card {
  transition: background 0.9s ease, background-color 0.9s ease,
              border-color 0.9s ease, backdrop-filter 0.9s ease,
              box-shadow 0.3s ease;
}

.deedoc-card--quick:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.44);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 28px 60px rgba(0,0,0,0.22);
}

.deedoc-card--paper:hover {
  box-shadow: 0 28px 70px rgba(32, 20, 16, 0.22), 0 8px 20px rgba(0,0,0,0.08);
}

[data-theme="dark"] .deedoc-card--paper:hover {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 64px rgba(0,0,0,0.50), 0 4px 16px rgba(0,0,0,0.30);
}

.deedoc-card__plus {
  width: 16px;
  height: 16px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  color: var(--ddoc-color-text-on-glass);
}

.deedoc-card.deedoc-card--quick p {
  margin: 0;
  color: var(--ddoc-color-text-on-glass);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
}

.deedoc-card--paper {
  padding: 35px 30px;
  background-color: var(--ddoc-color-card-solid);
  color: var(--ddoc-color-title);
}

[data-theme="dark"] .deedoc-card--paper {
  backdrop-filter: blur(var(--ddoc-blur-glass));
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass));
}

.deedoc-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ddoc-color-title);
  transition: color 0.9s ease;
}

.deedoc-card p {
  margin: 0;
  color: var(--ddoc-color-body-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  transition: color 0.9s ease;
}

.deedoc-card__button {
  min-height: 48px;
  height: 48px;
  width: 207px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--ddoc-radius-button-desktop);
  background: var(--ddoc-color-button-bg);
  color: var(--ddoc-color-button-label);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  box-shadow: var(--ddoc-shadow-button);
  transition: opacity 180ms ease, transform 180ms ease;
}

.deedoc-card__button:hover {
  opacity: 0.88;
}

.deedoc-card__button::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22rgba(200%2C196%2C196%2C0.8)%22%20stroke-width%3D%221.2%22/%3E%3Cpath%20d%3D%22M8%205.5V10.5M5.5%208H10.5%22%20stroke%3D%22rgba(200%2C196%2C196%2C0.8)%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E");
}

.deedoc-card__button::after {
  display: none;
}

.deedoc-home__footer {
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ddoc-color-brand-line);
}

.deedoc-home__footer strong {
  display: block;
  width: 61px;
  height: 40px;
  line-height: 40px;
  color: var(--ddoc-color-brand-line);
  flex: 0 0 auto;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.1em;
}

.deedoc-home__footer p {
  max-width: 778px;
  margin: 0;
  text-indent: 80px;
  color: var(--ddoc-color-brand-line);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.35;
}

.deedoc-home__footer-legal {
  text-indent: 0 !important;
  font-size: 13px !important;
  opacity: 0.55;
  margin-top: 8px !important;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal__privacy-note {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.modal__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.modal__consent input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
}

.modal__panel--privacy {
  max-height: 80vh;
  overflow-y: auto;
}

.modal__privacy-body h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 16px 0 4px;
}

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

.modal__privacy-body a {
  color: var(--accent);
}

.calculator-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: var(--type-display);
  line-height: 1;
  letter-spacing: -0.065em;
  font-weight: 700;
}

h2 {
  margin-bottom: 14px;
  font-size: var(--type-h2);
  line-height: 1.08;
  letter-spacing: -0.048em;
  font-weight: 700;
}

.lead {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--type-body);
  line-height: 1.5;
}

.project-option,
.rate-summary,
.stage-stat,
.expense-chip {
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: var(--btn-height-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

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

.button--dark {
  background: var(--text);
  color: var(--bg);
}

.button--primary {
  background: var(--text);
  color: var(--bg);
}

.button--ghost,
.button--soft {
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  color: var(--text);
}

.button--wide {
  width: 100%;
}

/* Danger variant */
.button--danger {
  background: rgba(200, 77, 77, 0.12);
  border: 1px solid rgba(200, 77, 77, 0.22);
  color: #c84d4d;
}

.button--danger:hover {
  background: rgba(200, 77, 77, 0.18);
  border-color: rgba(200, 77, 77, 0.38);
}

/* Small modifier */
.button--sm {
  min-height: var(--btn-height-sm);
  padding: 0 14px;
  font-size: 12px;
}

.calculator-shell {
  padding-top: 12px;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.app[data-view="calculator"][data-estimate="empty"] .builder-grid {
  align-items: stretch;
}

.setup-card,
.estimate-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.setup-card {
  position: sticky;
  top: 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(22px, 3vw, 32px);
}

.estimate-card {
  min-height: 600px;
  padding: clamp(22px, 3vw, 34px);
}

.app[data-view="calculator"][data-estimate="empty"] .setup-card {
  position: static;
  height: 100%;
}

.app[data-view="calculator"][data-estimate="empty"] .estimate-card {
  min-height: unset;
  display: flex;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: var(--type-h2);
}

.section-heading .eyebrow {
  margin-bottom: 9px;
}

.section-heading--spaced {
  margin-top: 8px;
}

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

.project-option {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.project-option:hover,
.project-option.is-selected {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.project-option.is-selected {
  box-shadow: inset 0 0 0 1px var(--text);
}

.project-option strong {
  font-size: 14px;
  line-height: 1.15;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.segmented__item {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.segmented__item.is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
}

.market-grade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.market-grade {
  min-height: 62px;
  display: grid;
  gap: 4px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}

.market-grade span {
  color: var(--muted);
  font-size: 12px;
}

.market-grade strong {
  font-size: 15px;
  letter-spacing: -0.04em;
}

.market-grade.is-active {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--text);
}

.tax-settings {
  display: grid;
  gap: 10px;
}

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

.segmented--client {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tax-rate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
}

.tax-rate-line strong {
  color: var(--text);
}

.rate-panel {
  display: grid;
  gap: 14px;
}

.rate-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.rate-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
}

.sticky-summary span {
  color: var(--muted);
  font-size: 12px;
}

.rate-summary span {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.rate-summary strong {
  font-size: 18px;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.rate-input {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.055em;
}

.field,
.field-row {
  display: grid;
  gap: var(--field-gap);
}

.field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field span {
  color: var(--muted);
  font-size: var(--label-fs);
}

.field input,
.field textarea {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid var(--line);
  border-radius: var(--input-radius);
  background: var(--surface-strong);
  color: var(--text);
  padding: var(--input-padding);
  font-size: var(--input-fs);
}

.field textarea {
  min-height: 120px;
  padding: 11px 13px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.estimate-empty {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(18px, 3vw, 34px);
  border-radius: 26px;
  background:
    linear-gradient(135deg, var(--soft), transparent),
    var(--surface-muted);
}

.app[data-view="calculator"][data-estimate="empty"] .estimate-empty {
  min-height: unset;
  flex: 1;
}

.estimate-empty h2 {
  max-width: 520px;
}

.estimate-empty p:not(.eyebrow) {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.55;
}

.estimate-result {
  display: grid;
  gap: 20px;
}

.estimate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stage-list {
  display: grid;
  gap: 12px;
}

.stage-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 120px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  align-items: start;
  transition: opacity 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.stage-card.is-dragging {
  opacity: 0.44;
}

.stage-card.is-drop-target {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.stage-order {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.stage-order > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.drag-handle {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.stage-card__body {
  display: grid;
  gap: 6px;
}

.stage-card__side {
  display: grid;
  justify-items: end;
  gap: 9px;
}

.stage-stat {
  min-width: 124px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: right;
}

.stage-stat span {
  color: var(--muted);
  font-size: 12px;
}

.stage-stat strong {
  font-size: 15px;
}

.stage-tools {
  display: flex;
  gap: 5px;
}

.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button--remove {
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
}

.icon-button--move {
  font-size: 11px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.icon-button--move:hover:not(:disabled) { opacity: 1; }
.icon-button--move:disabled { opacity: 0.18; cursor: default; }

.stage-title-input,
.stage-description-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  outline: none;
}

.stage-title-input {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.stage-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--accent);
}

.field-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.7;
  margin-left: 4px;
}

.stage-description-input {
  min-height: 44px;
  resize: none;
  field-sizing: content;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.hours-field {
  width: 124px;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  padding: 0 11px;
}

.hours-field input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
  font-weight: 700;
}

.hours-field span {
  color: var(--muted);
  font-size: 12px;
}

.expense-box {
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 22px;
  background: var(--accent-soft);
}

.expense-box summary {
  cursor: pointer;
  padding: 18px;
  color: var(--text);
  font-weight: 600;
  list-style: none;
}

.expense-box summary::-webkit-details-marker {
  display: none;
}

.expense-box__title {
  display: block;
}

.expense-box__hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
}

.expense-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  gap: 10px;
  padding: 0 18px 18px;
  align-items: end;
}

.expense-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 18px;
}

.expense-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.expense-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.contract-workspace {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 8px 0 120px;
}

.contract-layout {
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.contract-outline {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 18px 52px rgba(42, 35, 25, 0.08);
  backdrop-filter: blur(18px);
}

.contract-outline::-webkit-scrollbar {
  width: 4px;
}

.contract-outline::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--soft-strong);
}

.outline-group {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-muted);
}

.outline-title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.contract-data-panel,
.contract-signature-panel {
  padding-bottom: 12px;
}

.contract-data-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
}

.contract-progress {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 0 9px;
  font-size: 11px;
}

.contract-progress.is-complete {
  border-color: color-mix(in srgb, var(--positive) 42%, var(--line));
  color: var(--positive);
}

.contract-form,
.contract-form__group {
  display: grid;
  gap: var(--field-gap);
}

.contract-form__group {
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
}

.contract-form__group:first-child {
  border-top: 0;
}

.contract-form__group summary {
  list-style: none;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.contract-form__group summary::-webkit-details-marker {
  display: none;
}

.contract-control {
  display: grid;
  gap: 4px;
}
.contract-control--checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.contract-control--checkbox input[type="checkbox"] {
  width: 16px;
  min-height: unset;
  height: 16px;
  flex-shrink: 0;
  padding: 0;
}
.contract-control--checkbox span {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.contract-control span {
  color: var(--muted);
  font-size: var(--label-fs);
}

.contract-control input {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid var(--line);
  border-radius: var(--input-radius);
  background: var(--surface-strong);
  color: var(--text);
  padding: var(--input-padding);
  font-size: var(--input-fs);
}

.contract-control input:focus {
  outline: none;
  border-color: var(--accent);
}

.contract-control input.is-invalid {
  border-color: #c84d4d;
  background: rgba(200, 77, 77, 0.1);
}

.signature-preview {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 8px;
  font-size: 11px;
}

.signature-preview img {
  max-width: 148px;
  max-height: 42px;
  object-fit: contain;
  mix-blend-mode: normal;
}

.signature-preview span:not(.signature-empty) {
  margin-top: 4px;
}

.signature-actions {
  display: grid;
  grid-template-columns: 1fr 0.62fr;
  gap: 7px;
}

.signature-actions .button {
  min-height: var(--btn-height-sm);
  border-radius: 999px;
  font-size: 11px;
}

.contract-outline nav,
.optional-list {
  display: grid;
  gap: 5px;
}

.outline-link,
.optional-toggle {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  padding: 0 10px;
  font-size: 12px;
}

.outline-link {
  min-height: 34px;
}

.optional-toggle {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.optional-toggle span {
  color: inherit;
  font-size: 12px;
  line-height: 1.24;
}

.optional-toggle small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.32;
}

.outline-link.is-active,
.outline-link:hover,
.optional-toggle:hover {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.optional-toggle.is-off {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  color: var(--text);
  opacity: 0.76;
}

.outline-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 4px;
  margin-top: 4px;
}

.vacation-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.vacation-date-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.vacation-date-field span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cv-muted);
  flex-shrink: 0;
}

.vacation-date-input {
  border: 1px solid var(--cv-line, var(--line));
  background: var(--cv-surface, var(--surface));
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--cv-text, var(--text));
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.vacation-date-input:focus {
  border-color: var(--accent);
}

.vacation-date-input::-webkit-calendar-picker-indicator {
  opacity: 0.4;
  cursor: pointer;
  width: 12px;
  height: 12px;
}

[data-theme="dark"] .vacation-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.optional-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.optional-switch input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.document-canvas {
  width: min(860px, 100%);
  min-height: 980px;
  margin: 0 auto 94px;
  padding: clamp(38px, 5vw, 68px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.document-coverline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.document-title {
  max-width: 660px;
  margin: 0 auto 18px;
  font-size: clamp(27px, 3vw, 39px);
  line-height: 1.08;
  letter-spacing: -0.055em;
  text-align: center;
}

.document-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 13px;
}

.document-note {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface-strong));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.document-note strong {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.document-section {
  scroll-margin-top: 40px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.document-section:first-of-type {
  border-top: 0;
}

.document-section h2 {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.section-num {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0;
}

.contract-clause {
  position: relative;
  padding: 0 42px 18px 0;
}

.contract-clause-delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  opacity: 0;
  transition: opacity 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.contract-clause:hover .contract-clause-delete,
.contract-clause:focus-within .contract-clause-delete {
  opacity: 0.74;
}

.contract-clause + .contract-clause .contract-clause-delete {
  top: 18px;
}

.contract-clause-delete:hover,
.contract-clause-delete:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
}

.contract-clause + .contract-clause {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.clause-title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.clause-title span {
  min-width: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.document-section p,
.document-section li {
  color: var(--text);
  font-size: 15px;
  line-height: 1.72;
}

.document-section p {
  margin: 0 0 12px;
}

.document-section ol {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 22px;
}

.inline-field {
  display: inline;
  min-width: 44px;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 4px;
  padding: 0 3px;
  background: color-mix(in srgb, var(--accent-soft) 42%, transparent);
  cursor: text;
}

.inline-field:focus {
  outline: none;
  background: var(--accent-soft);
  border-bottom-color: var(--accent);
}

.inline-field.is-invalid {
  border-bottom-color: #c84d4d;
  background: rgba(200, 77, 77, 0.12);
}

.optional-section__actions {
  position: absolute;
  top: 14px;
  right: 38px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.contract-clause:hover .optional-section__actions,
.contract-clause:focus-within .optional-section__actions {
  opacity: 1;
}

.optional-section__actions button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  padding: 0 9px;
  font-size: 11px;
}

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

.requisite-card {
  min-height: 178px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-muted);
}

.sign-line {
  display: block;
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}

.signature-slot {
  margin-top: 14px;
}

.contract-clause__body {
  border-radius: 12px;
  outline: 0;
}

.contract-clause__body:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--surface-warm) 54%, transparent);
}

.signature-image {
  display: block;
  max-width: 168px;
  max-height: 64px;
  object-fit: contain;
  margin-bottom: -8px;
  mix-blend-mode: normal;
}

.document-toolbar {
  position: sticky;
  bottom: 18px;
  z-index: 18;
  width: min(860px, 100%);
  margin: -66px 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 12px 12px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 18px 52px rgba(42, 35, 25, 0.08);
  backdrop-filter: blur(18px);
}

.document-toolbar > span {
  color: var(--muted);
  font-size: 12px;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
}

.document-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.estimate-breakdown {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-muted);
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.breakdown-row strong {
  color: var(--text);
}

.breakdown-row--total {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.sticky-summary {
  position: fixed;
  right: clamp(18px, 4vw, 48px);
  bottom: 22px;
  z-index: 18;
  width: min(560px, calc(100vw - 120px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 12px 12px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.sticky-summary strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.055em;
}

.sticky-summary__actions {
  display: flex;
  gap: 8px;
}

.modal {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(18, 17, 14, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal__panel {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: 0 32px 80px rgba(31, 22, 16, 0.22), 0 2px 10px rgba(31, 22, 16, 0.08);
}

[data-theme="dark"] .modal__panel {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}

.modal[open] .modal__panel {
  animation: ddoc-modal-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal[open]::backdrop {
  animation: ddoc-fade-in 0.28s ease both;
}

@keyframes ddoc-modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open] .modal__panel,
  .modal[open]::backdrop {
    animation: none;
  }
}

.modal__panel--small {
  max-width: 440px;
}

.modal__panel h2 {
  margin-bottom: 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease;
}

.modal__close:hover {
  background: var(--soft-strong);
  color: var(--text);
}

.modal__lead {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal__section-label {
  margin: 20px 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--mono);
}

/* Brief AI modal typography */
[data-brief-ai-modal] .modal__lead {
  font-size: 12.5px;
  line-height: 1.5;
}

[data-brief-ai-modal] .field textarea {
  font-size: 14px;
  line-height: 1.5;
}

[data-brief-ai-modal] .client-reply-status {
  font-size: 12px;
}

.export-options {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.export-options__title {
  color: var(--muted);
  font-size: 12px;
}

.export-toggle {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  text-align: left;
}

.export-toggle strong {
  color: var(--accent);
  font-size: 12px;
}

.export-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.legal-note {
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.48;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.print-sheet {
  display: none;
}

.print-sheet .pdf-page {
  width: 794px;
  min-height: 1123px;
  padding: 68px 74px;
  background: #fff;
  color: #111;
  font-family: var(--font);
  letter-spacing: -0.01em;
}

.print-sheet .pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  padding-bottom: 14px;
  border-bottom: 2px solid #111;
}

.print-sheet .pdf-logo {
  color: #111;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.print-sheet .pdf-date {
  color: #888;
  font-size: 11px;
  line-height: 1.2;
}

.print-sheet .pdf-title {
  margin-bottom: 28px;
}

.print-sheet .pdf-doc-label,
.print-sheet .pdf-meta-label {
  color: #aaa;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.print-sheet .pdf-doc-label {
  margin-bottom: 7px;
}

.print-sheet .pdf-proj-name {
  max-width: 620px;
  color: #111;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.print-sheet .pdf-page--contract .pdf-proj-name {
  font-size: 26px;
}

.print-sheet .pdf-meta {
  display: flex;
  gap: 0;
  margin-bottom: 26px;
  border: 1px solid #e2e2e2;
  border-radius: 5px;
  overflow: hidden;
}

.print-sheet .pdf-meta-item {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid #e2e2e2;
}

.print-sheet .pdf-meta-item:last-child {
  border-right: 0;
}

.print-sheet .pdf-meta-value {
  margin-top: 5px;
  color: #111;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
}

.print-sheet .pdf-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 22px;
}

.print-sheet .pdf-mod-tag {
  border: 1px solid #ddd;
  border-radius: 999px;
  padding: 5px 11px;
  color: #666;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.print-sheet .pdf-table {
  width: 100%;
  margin-bottom: 20px;
  border-collapse: collapse;
}

.print-sheet .pdf-table thead tr {
  background: #111;
}

.print-sheet .pdf-table th {
  padding: 10px 12px;
  color: #fff;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
}

.print-sheet .pdf-table th:last-child,
.print-sheet .pdf-table th.pdf-th-hours {
  text-align: right;
}

.print-sheet .pdf-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.print-sheet .pdf-stage-name {
  margin-bottom: 3px;
  color: #111;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.28;
}

.print-sheet .pdf-stage-desc {
  max-width: 410px;
  color: #888;
  font-size: 10.5px;
  line-height: 1.42;
}

.print-sheet .pdf-hours,
.print-sheet .pdf-cost {
  color: #111;
  font-size: 13px;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

.print-sheet .pdf-cost {
  font-weight: 400;
}

.print-sheet .pdf-summary-row td {
  background: #fafafa;
}

.print-sheet .pdf-total-row td {
  padding: 14px 12px;
  border-top: 2px solid #111;
  border-bottom: 0;
  background: #f5f5f5;
}

.print-sheet .pdf-total-label {
  color: #777;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.print-sheet .pdf-total-hours {
  color: #111;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: right;
}

.print-sheet .pdf-total-cost {
  color: #111;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: right;
  white-space: nowrap;
}

.print-sheet .pdf-footer {
  display: block;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid #eee;
  color: #999;
  font-size: 10px;
  line-height: 1.45;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .builder-grid,
  .contract-layout {
    grid-template-columns: 1fr;
  }

  .setup-card {
    position: static;
  }

  .contract-outline {
    position: static;
  }

  .contract-outline nav,
  .optional-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .document-toolbar {
    margin-top: -72px;
  }

  .deedoc-home {
    min-height: 100svh;
    height: 100svh;
  }
}

@media (max-width: 760px) {
  .app {
    padding-left: 0;
  }

  .rail {
    display: none;
  }

  .workspace {
    padding: 16px 14px 134px;
  }

  .topbar {
    position: sticky;
    top: 10px;
    z-index: 19;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
    padding: 8px 8px 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
  }

  .topbar__nav {
    display: flex;
    gap: 4px;
  }

  .topbar__link,
  .topbar__theme {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
  }

  .topbar__link.is-active {
    background: var(--soft);
    color: var(--text);
  }

  .topbar__theme {
    background: var(--surface-strong);
  }

  h1 {
    font-size: clamp(32px, 11vw, 48px);
  }

  .project-options,
  .field-row,
  .expense-form {
    grid-template-columns: 1fr;
  }

  .stage-card {
    grid-template-columns: 1fr;
  }

  .stage-card__side {
    align-items: stretch;
    justify-items: stretch;
  }

  .stage-stat {
    width: 100%;
    text-align: left;
  }

  .hours-field {
    width: 100%;
  }

  .sticky-summary {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
    border-radius: 26px;
    align-items: stretch;
    flex-direction: column;
  }

  .sticky-summary__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal__panel {
    padding: 24px;
  }

  .contract-outline {
    padding: 12px;
    border-radius: 22px;
    max-height: none;
  }

  .contract-outline nav,
  .optional-list {
    grid-template-columns: 1fr 1fr;
  }

  .outline-link,
  .optional-toggle {
    min-height: 34px;
    font-size: 12px;
  }

  .document-canvas {
    min-height: auto;
    margin-bottom: 26px;
    padding: 24px 18px;
    border-radius: 24px;
  }

  .document-title {
    font-size: 30px;
  }

  .document-meta,
  .requisites-grid {
    grid-template-columns: 1fr;
  }

  .document-meta {
    display: grid;
  }

  .document-section h2 {
    font-size: 20px;
  }

  .document-section p,
  .document-section li {
    font-size: 14px;
  }

  .document-toolbar {
    position: static;
    width: 100%;
    margin: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .document-toolbar__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  /* Mobile home — Figma iPhone 16/17 Pro Max layout */
  .deedoc-home {
    min-height: 100svh;
    height: auto;
    grid-template-rows: auto 1fr auto;
    padding: 33px 10px;
    background-position: 48% center;
  }

  /* ── Header compact on mobile ─────────────── */
  .deedoc-home__top--global {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .deedoc-home__top--global .deedoc-user,
  .deedoc-home__top--global .deedoc-home__tools {
    gap: 8px;
  }

  .tab-label {
    display: none;
  }

  .deedoc-pill {
    height: 44px;
    padding: 0 14px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
  }

  .deedoc-user__avatar {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .deedoc-section-nav {
    height: 44px;
    padding: 3px;
  }

  .deedoc-section-tab {
    height: 38px;
    padding: 0 11px;
  }

  .deedoc-home__tools {
    gap: 8px;
  }

  .deedoc-toggle {
    width: 68px;
    height: 44px;
    border-radius: 22px;
  }

  .deedoc-toggle::before {
    left: 10px;
    top: 9px;
    width: 48px;
    height: 26px;
    border-radius: 13px;
  }

  .deedoc-toggle__knob {
    width: 20px;
    height: 20px;
    top: 12px;
    left: 35px; /* light: track right 58 - knob 20 - gap 3 = 35 */
  }

  [data-theme="dark"] .deedoc-toggle__knob {
    left: 13px; /* dark: track left 10 + gap 3 = 13 */
  }

  .deedoc-toggle__moon {
    left: 15px;
  }

  .deedoc-toggle__sun {
    right: 14px;
  }

  .deedoc-hero {
    align-self: center;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .deedoc-hero__inner {
    width: 100%;
  }

  .deedoc-hero h1 {
    font-size: 30px;
    padding: 0 11px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Mobile card layout: СМЕТА spans both columns, satellites side by side */
  .deedoc-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0;
  }

  .deedoc-card {
    width: auto;
    min-height: 220px;
    max-width: none;
    flex: unset;
    border-radius: var(--ddoc-radius-card);
  }

  /* СМЕТА card — spans both columns */
  .deedoc-card--quick {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 200px;
  }

  /* Satellite cards */
  .deedoc-card--paper {
    min-height: 250px;
    padding: 27px 24px 28px 27px;
  }

  .deedoc-card__button {
    width: 100%;
    min-height: 44px;
    height: 44px;
    border-radius: var(--ddoc-radius-button-mobile);
    font-size: 13px;
  }

  .deedoc-card h2 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .deedoc-card p {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 16px;
  }

  .deedoc-home__footer {
    gap: 2px;
    padding: 0 11px;
  }

  .deedoc-home__footer strong {
    font-size: 26px;
    height: 34px;
    line-height: 34px;
  }

  .deedoc-home__footer p {
    font-size: 16px;
    padding-left: 60px;
    white-space: normal;
    max-width: calc(100vw - 42px);
  }

  /* ── iOS auto-zoom fix: все инпуты ≥ 16px на мобиле ────────── */
  --input-fs: 16px;

  .field input,
  .field textarea,
  .field select,
  [data-brief-ai-modal] .field textarea,
  .contract-control input,
  .contract-control textarea,
  .stage-title-input,
  .stage-description-input,
  .client-reply-textarea {
    font-size: 16px;
  }

  /* ── Touch targets: минимум 44px (Apple HIG) ────────────────── */
  .modal__close {
    width: 44px;
    height: 44px;
    top: 6px;
    right: 6px;
  }

  .drag-handle,
  .icon-button {
    width: 44px;
    height: 44px;
  }

  .outline-link,
  .optional-toggle {
    min-height: 44px;
  }

  .topbar__link,
  .topbar__theme {
    min-height: 44px;
  }

  /* ── document-toolbar: тумблер сверху, кнопки во всю ширину ── */
  .document-toolbar__actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .document-toolbar__actions .expl-toggle {
    justify-content: flex-start;
    min-height: 44px;
  }

  .document-toolbar__actions .button {
    width: 100%;
    min-height: 50px;
    border-radius: 999px;
    justify-content: center;
    font-size: 15px;
  }

  /* ── sticky-summary: отступ для home indicator iPhone X+ ────── */
  .sticky-summary {
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

}

@media print {
  @page {
    size: A4;
    margin: 18mm 20mm;
  }

  body {
    background: #fff;
    color: #171612;
  }

  .app,
  .modal {
    display: none !important;
  }

  .print-sheet {
    display: block;
    width: 100%;
    padding: 0;
    color: #171612;
    font-family: "Onest", Arial, sans-serif;
  }

  .pdf-page {
    width: 100%;
    min-height: auto;
    padding: 0;
  }

  .pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24pt;
    padding-bottom: 10pt;
    border-bottom: 1.5pt solid #111;
  }

  .pdf-logo {
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #111;
  }

  .pdf-date {
    color: #888;
    font-size: 8pt;
  }

  .pdf-title {
    margin-bottom: 20pt;
  }

  .pdf-doc-label,
  .pdf-meta-label {
    color: #aaa;
    font-size: 7pt;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .pdf-doc-label {
    margin-bottom: 4pt;
  }

  .pdf-proj-name {
    color: #111;
    font-size: 22pt;
    font-weight: 400;
    line-height: 1.16;
  }

  .pdf-page--contract .pdf-proj-name {
    font-size: 18pt;
  }

  .pdf-meta {
    display: flex;
    margin-bottom: 20pt;
    border: 1pt solid #e8e8e8;
    border-radius: 4pt;
    overflow: hidden;
  }

  .pdf-meta-item {
    flex: 1;
    padding: 8pt 12pt;
    border-right: 1pt solid #e8e8e8;
  }

  .pdf-meta-item:last-child {
    border-right: 0;
  }

  .pdf-meta-value {
    margin-top: 3pt;
    color: #111;
    font-size: 10pt;
  }

  .pdf-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18pt;
  }

  .pdf-table thead tr {
    background: #111;
  }

  .pdf-table th {
    padding: 7pt 10pt;
    color: #fff;
    font-size: 7pt;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
  }

  .pdf-table th:last-child,
  .pdf-table th.pdf-th-hours {
    text-align: right;
  }

  .pdf-table td {
    padding: 8pt 10pt;
    border-bottom: 0.5pt solid #f0f0f0;
    vertical-align: top;
  }

  .pdf-stage-name {
    color: #111;
    font-size: 10pt;
    font-weight: 400;
  }

  .pdf-stage-desc {
    margin-top: 2pt;
    color: #888;
    font-size: 8pt;
    line-height: 1.4;
  }

  .pdf-hours,
  .pdf-cost {
    color: #111;
    font-size: 10pt;
    text-align: right;
    white-space: nowrap;
  }

  .pdf-summary-row td {
    background: #fafafa;
  }

  .pdf-total-row td {
    padding: 10pt;
    border-top: 1.5pt solid #111;
    border-bottom: 0;
  }

  .pdf-total-label,
  .pdf-total-hours,
  .pdf-total-cost {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .pdf-total-hours {
    text-align: right;
    font-size: 9pt;
  }

  .pdf-total-cost {
    text-align: right;
    font-size: 14pt;
  }

  .pdf-footer {
    display: flex;
    justify-content: space-between;
    gap: 20pt;
    padding-top: 10pt;
    border-top: 0.5pt solid #e8e8e8;
    color: #888;
    font-size: 8pt;
  }

  .pdf-contract-body {
    color: #111;
    font-size: 10pt;
    line-height: 1.65;
  }

  .print-sheet h1 {
    margin: 0 0 10px;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: -0.04em;
  }

  .print-sheet p {
    margin: 0 0 16px;
    color: #555;
    line-height: 1.45;
  }

  .print-sheet .pdf-contract-body p {
    margin: 0 0 8pt;
    color: #111;
    line-height: 1.65;
  }

  .print-sheet .pdf-contract-body .optional-section p {
    margin-bottom: 6pt;
  }

  .print-sheet .document-title {
    margin-bottom: 18px;
    text-align: center;
  }

  .print-sheet .document-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    color: #555;
  }

  .print-sheet .document-section {
    padding: 18px 0;
    border-top: 1px solid #ddd;
    break-inside: avoid;
  }

  .print-sheet .document-section h2 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.2;
  }

  .print-sheet .section-num {
    color: #777;
    font-size: 10px;
    margin-right: 8px;
  }

  .print-sheet .document-section li {
    margin-bottom: 6px;
    color: #333;
    line-height: 1.45;
  }

  .print-sheet .inline-field {
    border: 0;
    border-bottom: 1px solid #aaa;
    background: transparent;
    padding: 0 2px;
  }

  .print-sheet .optional-section,
  .print-sheet .requisite-card {
    margin: 12px 0;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 12px;
    background: #fff;
  }

  .print-sheet .requisites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .print-sheet .sign-line {
    display: block;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #aaa;
    color: #555;
  }

  .print-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 24px 0;
  }

  .print-meta div,
  .print-total,
  .print-note {
    border: 1px solid #ddd;
    border-radius: 14px;
    padding: 14px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
  }

  .print-table thead tr {
    background: #111;
  }

  .print-table th,
  .print-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    color: #fff;
    font-size: 8pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .print-table th:last-child,
  .print-table td:last-child {
    text-align: right;
  }

  .print-total {
    margin-top: 22px;
    text-align: right;
    font-size: 24px;
    font-weight: 700;
  }

  .print-row-muted td {
    color: #666;
    background: #fafafa;
  }

  .print-row-total td {
    border-top: 2px solid #111;
    font-weight: 700;
  }

  .print-note {
    margin-top: 22px;
    color: #555;
    font-size: 12px;
    line-height: 1.45;
  }
}

/* ============================================================
   CALCULATOR VIEW — Immersive landscape redesign v2
   ============================================================ */

/* ── Background ──────────────────────────────────────────── */

body[data-view="calculator"] {
  background: none;
  position: relative;
}

/* Day landscape */
body[data-view="calculator"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    url("../assets/deedoc-landscape.png") center / cover no-repeat,
    #d8b1a3;
}

/* Night landscape — crossfade */
body[data-view="calculator"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(2, 2, 1, 0.22), rgba(2, 2, 1, 0.68)),
    url("../assets/backgrounds/deedoc-landscape-night.png") center / cover no-repeat,
    #08070f;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] body[data-view="calculator"]::after {
  opacity: 1;
}

/* ── Layout shell ─────────────────────────────────────────── */

.app[data-view="calculator"] {
  padding-left: 0;
  background: none;
}

.app[data-view="calculator"] .rail,
.app[data-view="calculator"] .topbar {
  display: none;
}

.app[data-view="calculator"] .workspace {
  padding: 0;
}

/* ── Design tokens ────────────────────────────────────────── */

.view--calculator {
  /* White-card palette (light mode) — как фон заметки в iOS Notes */
  --cv-glass:       #ffffff;
  --cv-text:        var(--text);
  --cv-muted:       var(--muted);
  --cv-line:        var(--line);
  --cv-surface:     rgba(31, 29, 24, 0.05);
  --cv-hover-bg:    rgba(31, 29, 24, 0.06);
  --cv-selected-bg: rgba(31, 29, 24, 0.10);
  --cv-active-tab:  rgba(31, 29, 24, 0.08);
  --cv-eyebrow:     rgba(31, 29, 24, 0.38);
  --cv-step-num-color: rgba(31, 29, 24, 0.28);
  --cv-empty-fig:   rgba(31, 29, 24, 0.08);
  --cv-radius: 40px;
  padding: 158px clamp(24px, 4vw, 56px) 120px;
}

[data-theme="dark"] .view--calculator {
  --cv-glass:          rgba(255, 255, 255, 0.07);
  --cv-text:           rgba(255, 255, 255, 0.90);
  --cv-muted:          rgba(255, 255, 255, 0.48);
  --cv-line:           rgba(255, 255, 255, 0.12);
  --cv-surface:        rgba(255, 255, 255, 0.06);
  --cv-hover-bg:       rgba(255, 255, 255, 0.10);
  --cv-selected-bg:    rgba(255, 255, 255, 0.15);
  --cv-active-tab:     rgba(255, 255, 255, 0.16);
  --cv-eyebrow:        rgba(255, 255, 255, 0.38);
  --cv-step-num-color: rgba(255, 255, 255, 0.28);
  --cv-empty-fig:      rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .view--calculator .setup-card,
[data-theme="dark"] .view--calculator .estimate-card {
  backdrop-filter: blur(var(--ddoc-blur-glass)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass)) saturate(1.3);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.30), 0 1px 4px rgba(0, 0, 0, 0.20);
}

.view--calculator .calculator-shell {
  padding-top: 0;
}

/* ── White panels (light) / glass panels (dark) ──────────── */

.view--calculator .setup-card,
.view--calculator .estimate-card {
  background: var(--cv-glass);
  border: 1px solid var(--cv-line);
  border-radius: var(--cv-radius);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  color: var(--cv-text);
}

/* ── Setup card internals ────────────────────────────────── */

.view--calculator .setup-card {
  gap: 0;
  padding: clamp(20px, 2.4vw, 28px);
  display: flex;
  flex-direction: column;
}

/* Step blocks */
.cv-step-block {
  display: grid;
  gap: 14px;
  padding: 4px 0 20px;
}

.cv-step-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.cv-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}

.cv-step-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--cv-text);
}

/* Divider between steps */
.cv-divider {
  height: 1px;
  background: var(--cv-line);
  margin: 0 0 20px;
  flex-shrink: 0;
}

/* ── Typography inside calculator ───────────────────────── */

.view--calculator h2 {
  color: var(--cv-text);
}

.view--calculator .setup-card .eyebrow,
.view--calculator .estimate-card .eyebrow {
  color: var(--cv-eyebrow);
}

/* ── Project option pills ────────────────────────────────── */

.view--calculator .project-option {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
  border-radius: 16px;
  min-height: 52px;
}

.view--calculator .project-option strong {
  color: var(--cv-text);
  font-size: 13px;
}

.view--calculator .project-option:hover,
.view--calculator .project-option.is-selected {
  border-color: var(--line-strong);
  background: var(--cv-hover-bg);
  transform: translateY(-1px);
}

.view--calculator .project-option.is-selected {
  background: var(--cv-selected-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ── Segmented controls (glass tab bar) ──────────────────── */

.view--calculator .segmented {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .segmented__item {
  color: var(--cv-muted);
  font-size: 13px;
  font-weight: 500;
}

.view--calculator .segmented__item.is-active {
  background: var(--cv-active-tab);
  color: var(--cv-text);
  box-shadow: none;
}

/* ── Market grade buttons ────────────────────────────────── */

.view--calculator .market-grade {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
  border-radius: 14px;
  min-height: 58px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.view--calculator .market-grade span {
  color: var(--cv-muted);
  font-size: 11px;
}

.view--calculator .market-grade strong {
  color: var(--cv-text);
  font-size: 13px;
}

.view--calculator .market-grade:hover {
  border-color: var(--line-strong);
  background: var(--cv-hover-bg);
  transform: translateY(-1px);
}

.view--calculator .market-grade.is-active {
  border-color: var(--line-strong);
  background: var(--cv-selected-bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ── Rate summary & total pill ───────────────────────────── */

.view--calculator .rate-summary {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .rate-summary span {
  color: var(--cv-muted);
}

.view--calculator .rate-summary strong {
  color: var(--cv-text);
}

.view--calculator .rate-input {
  color: var(--cv-text);
}

/* ── Form fields ─────────────────────────────────────────── */

.view--calculator .field span {
  color: var(--cv-muted);
}

.view--calculator .field input {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
}

.view--calculator .field input:focus {
  border-color: var(--accent);
  outline: none;
}

/* ── Tax line ────────────────────────────────────────────── */

.view--calculator .tax-rate-line {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--calculator .tax-rate-line strong {
  color: var(--cv-text);
}

/* ── Primary CTA ─────────────────────────────────────────── */

.cv-cta-btn {
  width: 100%;
  height: var(--btn-height-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--btn-radius);
  background: var(--ddoc-color-button-bg);
  color: var(--ddoc-color-button-label);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: var(--ddoc-shadow-button);
  transition: opacity 180ms ease, transform 180ms ease;
}

.cv-cta-btn:hover {
  opacity: 0.90;
  transform: translateY(-1px);
}

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

/* ── Buttons inside estimate card ────────────────────────── */

.view--calculator .button--dark {
  background: var(--ddoc-color-button-bg);
  color: var(--ddoc-color-button-label);
  box-shadow: var(--ddoc-shadow-button);
}

.view--calculator .button--ghost,
.view--calculator .button--soft {
  border-color: transparent;
  background: color-mix(in srgb, var(--cv-text) 9%, transparent);
  color: var(--cv-text);
}

/* Add stage button — subtle dashed feel */
.view--calculator .cv-add-stage-btn {
  margin-top: 4px;
  border-style: dashed;
  border-color: var(--cv-line);
  color: var(--cv-muted);
  font-size: 13px;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.view--calculator .cv-add-stage-btn:hover {
  border-color: var(--line-strong);
  color: var(--cv-text);
  background: var(--cv-hover-bg);
  transform: none;
}

/* ── Estimate card: empty state ──────────────────────────── */

.view--calculator .estimate-card .estimate-empty {
  background: transparent;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0;
  padding: clamp(28px, 3vw, 44px);
  border-radius: calc(var(--cv-radius) - 1px);
}

.cv-empty-icon {
  position: relative;
  font-size: clamp(72px, 10vw, 108px);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--cv-empty-fig);
  margin-bottom: 28px;
  user-select: none;
  animation: emptyFloat 4s ease-in-out infinite;
}

.cv-empty-icon::before {
  content: '';
  position: absolute;
  inset: -32px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.cv-empty-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cv-empty-text h2 {
  color: var(--cv-text);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  max-width: 280px;
}

.cv-empty-text p {
  color: var(--cv-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  transition: opacity 0.3s;
  white-space: pre-line;
}

/* ── Estimate card: result state ─────────────────────────── */

.estimate-result {
  display: grid;
  gap: 18px;
}

/* Result header — meta + total amount hero */
.cv-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--cv-line);
}

.cv-result-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.estimate-inline-field {
  display: grid;
  gap: 8px;
}

.estimate-inline-caption {
  color: var(--cv-muted);
  font-size: 12px;
  line-height: 1.35;
}

.estimate-inline-input {
  width: 100%;
  font: inherit;
  outline: none;
}

.estimate-inline-input--title {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cv-text);
  padding: 0;
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.04;
  box-shadow: none;
  transition: opacity 180ms ease;
}

.estimate-inline-input--title:hover {
  opacity: 0.78;
}

.estimate-inline-input--title:focus {
  opacity: 1;
}

.estimate-inline-input--title::placeholder {
  color: color-mix(in srgb, var(--cv-text) 70%, transparent);
}

.cv-total-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  min-width: 0;
}

.cv-total-label {
  color: var(--cv-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cv-total-amount {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 400;
  letter-spacing: -0.06em;
  color: var(--cv-text);
  line-height: 1;
  white-space: nowrap;
}

/* Actions row */
.cv-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Stage cards ─────────────────────────────────────────── */

.view--calculator .stage-card {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .stage-order > span {
  color: var(--cv-muted);
}

.view--calculator .drag-handle {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--calculator .stage-title-input {
  color: var(--cv-text);
  background: transparent;
}

.view--calculator .stage-description-input {
  color: var(--cv-muted);
  background: transparent;
}

.view--calculator .stage-stat {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .stage-stat span {
  color: var(--cv-muted);
}

.view--calculator .stage-stat strong {
  color: var(--cv-text);
}

.view--calculator .icon-button {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--calculator .hours-field {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .hours-field input {
  color: var(--cv-text);
  background: transparent;
}

.view--calculator .hours-field span {
  color: var(--cv-muted);
}

.mobile-calc-controls,
.mobile-calc-sheet {
  display: none;
}

body.mobile-calc-sheet-open {
  overflow: hidden;
}

.mobile-contract-flow,
.mobile-contract-sheet,
.mobile-contract-cta,
.mobile-contract-back,
.mobile-contract-actions {
  display: none !important;
}

body.mobile-contract-sheet-open {
  overflow: hidden;
}

/* ── Calculator compact working density ───────────────────── */

.view--calculator {
  padding-top: 118px;
  padding-bottom: 78px;
}

.view--calculator .builder-grid {
  grid-template-columns: minmax(300px, 368px) minmax(0, 1fr);
  gap: 18px;
}

.view--calculator .setup-card {
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  gap: 0;
  padding: 18px;
  scrollbar-width: thin;
}

.view--calculator .setup-card::-webkit-scrollbar {
  width: 4px;
}

.view--calculator .setup-card::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--cv-line);
}

.view--calculator .cv-step-block {
  gap: 9px;
  padding: 0 0 12px;
}

.view--calculator .cv-step-label {
  gap: 8px;
}

.view--calculator .cv-step-title {
  font-size: 13px;
}

.view--calculator .cv-divider {
  margin: 0 0 12px;
}

.view--calculator .project-options {
  gap: 7px;
}

.view--calculator .project-option {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 14px;
}

.view--calculator .project-option strong {
  font-size: 12px;
  line-height: 1.08;
}

.view--calculator .segmented {
  gap: 3px;
  padding: 3px;
}

.view--calculator .segmented__item {
  min-height: 32px;
  font-size: 12px;
}

.view--calculator .rate-panel {
  gap: 8px;
}

.view--calculator .market-grade-grid {
  gap: 6px;
}

.view--calculator .market-grade {
  min-height: 44px;
  border-radius: 13px;
}

.view--calculator .market-grade span {
  font-size: 11px;
}

.view--calculator .market-grade strong {
  font-size: 13px;
}

.view--calculator .rate-summary {
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 14px;
}

.view--calculator .rate-input {
  font-size: 15px;
}

.view--calculator .field {
  gap: var(--field-gap);
}

.view--calculator .field span {
  font-size: var(--label-fs);
}

.view--calculator .field input {
  min-height: var(--input-height);
  padding: var(--input-padding);
  border-radius: var(--input-radius);
  font-size: var(--input-fs);
}

.view--calculator .tax-settings {
  gap: 7px;
}

.view--calculator .tax-custom {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--cv-line);
  border-radius: 13px;
  background: var(--cv-surface);
}

.view--calculator .tax-custom .rate-input {
  width: 72px;
  min-height: 20px;
  padding: 0;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.view--calculator .tax-custom span {
  color: var(--cv-muted);
  font-size: 13px;
}

.view--calculator .tax-rate-line {
  padding: 8px 10px;
  border-radius: 13px;
  font-size: 12px;
}

.view--calculator .cv-cta-btn {
  position: sticky;
  bottom: 6px;
  z-index: 2;
  height: var(--btn-height-md);
  flex-shrink: 0;
  margin-top: 0;
  font-size: 14px;
  box-shadow: var(--ddoc-shadow-button), 0 0 0 6px var(--cv-glass);
}

.view--calculator .estimate-card {
  padding: 22px;
}

.view--calculator .estimate-card .estimate-empty {
  min-height: 430px;
  padding: 28px;
}

.view--calculator .cv-empty-text h2 {
  max-width: 300px;
  font-size: clamp(20px, 2vw, 26px);
}

.view--calculator .cv-empty-text p:not(.eyebrow) {
  max-width: 260px;
  font-size: 13px;
  line-height: 1.4;
}

.view--calculator .estimate-result {
  gap: 12px;
}

.view--calculator .cv-result-header {
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
}

.view--calculator .estimate-inline-input--title {
  font-size: clamp(22px, 2.1vw, 28px);
}

.view--calculator .cv-total-amount {
  font-size: clamp(30px, 3.2vw, 42px);
}

.view--calculator .cv-result-actions {
  gap: 8px;
}

.view--calculator .cv-result-actions .button {
  min-height: var(--btn-height-md);
  padding: 0 14px;
  font-size: 14px;
}

.view--calculator .stage-list {
  gap: 6px;
}

.view--calculator .stage-card {
  grid-template-columns: 36px minmax(0, 1fr) 54px 86px 22px;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 13px;
}

.view--calculator .stage-order {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.view--calculator .stage-order > span {
  font-size: 9px;
  letter-spacing: 0.04em;
}

.view--calculator .drag-handle {
  width: 18px;
  height: 24px;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.view--calculator .stage-card__body {
  gap: 2px;
  min-width: 0;
}

.view--calculator .stage-card__side {
  display: contents;
}

.view--calculator .stage-title-input {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.view--calculator .stage-description-input {
  min-height: 17px;
  max-height: 48px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.28;
}

.view--calculator .hours-field {
  width: 54px;
  min-height: 30px;
  gap: 3px;
  padding: 0 7px;
  border-radius: 10px;
}

.view--calculator .hours-field input {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.view--calculator .hours-field span {
  font-size: 11px;
}

.view--calculator .stage-stat {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: right;
}

.view--calculator .stage-stat strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.view--calculator .icon-button {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  font-size: 14px;
}

.view--calculator .cv-add-stage-btn {
  min-height: var(--btn-height-sm);
  margin-top: 2px;
  font-size: 12px;
}

/* ── Expense box ─────────────────────────────────────────── */

.view--calculator .expense-box {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}

.view--calculator .expense-box summary {
  color: var(--cv-text);
}

.view--calculator .expense-box__hint {
  color: var(--cv-muted);
}

.view--calculator .expense-chip {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--calculator .expense-chip button {
  color: var(--cv-muted);
}

/* ── Breakdown ───────────────────────────────────────────── */

.view--calculator .estimate-breakdown {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.view--calculator .breakdown-row {
  color: var(--cv-muted);
}

.view--calculator .breakdown-row strong {
  color: var(--cv-text);
}

.view--calculator .breakdown-row--total {
  border-top-color: var(--cv-line);
  color: var(--cv-text);
}

/* ── AI: сборка сметы из брифа ───────────────────────────── */

.brief-ai-card {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 18px;
  background: var(--accent-soft);
}

.brief-ai-card[hidden] {
  display: none;
}

.brief-ai-card p {
  margin: 0;
  color: var(--cv-muted, var(--muted));
  font-size: 12px;
  line-height: 1.4;
}

.brief-ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(199, 109, 77, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.brief-ai-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(199, 109, 77, 0.4);
}

.brief-ai-button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.ai-estimate-insights {
  display: grid;
  gap: 10px;
}

.ai-estimate-insights[hidden] {
  display: none;
}

.ai-insight-card {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-muted);
}

.view--calculator .ai-insight-card {
  border-color: var(--cv-line);
  background: var(--cv-surface);
}

.ai-insight-card h3 {
  margin: 0;
  color: var(--cv-text, var(--text));
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ai-insight-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.ai-insight-card li {
  color: var(--cv-muted, var(--muted));
  font-size: 13px;
  line-height: 1.4;
}

.ai-insight-card p {
  margin: 0;
  color: var(--cv-muted, var(--muted));
  font-size: 12.5px;
  line-height: 1.45;
}

.ai-insight-card--warning {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.view--calculator .ai-insight-card--warning {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.ai-stages-note {
  margin: 0;
  padding: 0 6px;
  color: var(--cv-muted, var(--muted));
  font-size: 12.5px;
  line-height: 1.45;
}

.ai-stages-note[hidden] {
  display: none;
}

.brief-ai-field textarea {
  resize: vertical;
}

/* ── Sticky summary ──────────────────────────────────────── */

.app[data-view="calculator"] .sticky-summary {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(22.75px);
  -webkit-backdrop-filter: blur(22.75px);
}

.app[data-view="calculator"] .sticky-summary span {
  color: rgba(255, 255, 255, 0.52);
}

.app[data-view="calculator"] .sticky-summary strong {
  color: rgba(255, 255, 255, 0.90);
}

.app[data-view="calculator"] .sticky-summary .button--soft {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.85);
}

.app[data-view="calculator"] .sticky-summary .button--dark {
  background: var(--ddoc-color-button-bg);
  color: var(--ddoc-color-button-label);
}

/* ── Calculator view entrance animation ──────────────────── */

.view--calculator .setup-card {
  animation: ddoc-scale-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.view--calculator .estimate-card {
  animation: ddoc-scale-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

@media (prefers-reduced-motion: reduce) {
  .view--calculator .setup-card,
  .view--calculator .estimate-card {
    animation: none;
  }
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1080px) {
  .cv-total-amount {
    font-size: clamp(28px, 7vw, 44px);
  }
}

@media (max-width: 760px) {
  .view--calculator {
    padding: 88px 16px 100px;
  }

  /* Desktop form hidden — mobile chips take over */
  .view--calculator .setup-card {
    display: none !important;
  }

  .view--calculator .builder-grid {
    display: block;
  }

  .view--calculator .estimate-card {
    width: 100%;
    min-height: clamp(430px, calc(100svh - 268px), 560px);
    margin-top: 10px;
    padding: 16px;
    border-radius: 30px;
  }

  .app[data-view="calculator"][data-estimate="empty"] .view--calculator .estimate-card {
    min-height: clamp(430px, calc(100svh - 268px), 560px);
  }

  .view--calculator .estimate-card .estimate-empty {
    min-height: calc(100% - 0px);
    height: 100%;
    padding: 42px 20px;
    border-radius: 26px;
    gap: 14px;
  }

  .view--calculator .cv-empty-icon {
    margin-bottom: 10px;
    font-size: clamp(82px, 20vw, 112px);
  }

  .view--calculator .cv-empty-icon::before {
    inset: -28px;
  }

  .view--calculator .cv-empty-text h2 {
    max-width: 310px;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.04;
  }

  .view--calculator .cv-empty-text p:not(.eyebrow) {
    max-width: 300px;
    font-size: 16px;
    line-height: 1.32;
  }

  .mobile-calc-sheet[hidden],
  .mobile-calc-sheet__section[hidden] {
    display: none;
  }

  .mobile-calc-controls {
    position: sticky;
    top: 80px;
    z-index: 45;
    display: grid;
    gap: 10px;
    margin-bottom: 0;
  }

  .mobile-calc-controls__rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-calc-chip {
    min-height: 56px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--cv-line) 88%, white);
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--cv-text);
    box-shadow: 0 14px 36px rgba(87, 52, 36, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    text-align: left;
  }

  .mobile-calc-chip__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
  }

  .mobile-calc-chip span {
    color: var(--cv-muted);
    font-size: 10px;
    line-height: 1;
  }

  .mobile-calc-chip strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--cv-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-calc-chip__chevron {
    display: block;
    margin-top: 0;
    color: var(--cv-muted);
    flex-shrink: 0;
  }

  .mobile-calc-chip.is-active {
    border-color: rgba(199, 109, 77, 0.42);
    box-shadow: 0 16px 38px rgba(94, 56, 39, 0.18);
    transform: translateY(-1px);
  }

  .mobile-calc-chip.is-active .mobile-calc-chip__chevron {
    transform: rotate(180deg);
    color: var(--accent);
  }

  .mobile-calc-controls__cta {
    min-height: 52px;
    border: 0;
    border-radius: 999px;
    background: var(--ddoc-color-button-bg);
    color: var(--ddoc-color-button-label);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    box-shadow: var(--ddoc-shadow-button);
    margin-top: 4px;
  }

  .mobile-calc-sheet {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: block;
  }

  .mobile-calc-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(18, 14, 12, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .mobile-calc-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(76svh, 680px);
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border: 1px solid color-mix(in srgb, var(--cv-line) 76%, white);
    border-radius: 28px 28px 0 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -22px 44px rgba(37, 23, 18, 0.18);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
  }

  .mobile-calc-sheet__handle {
    width: 56px;
    height: 18px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    appearance: none;
  }

  .mobile-calc-sheet__handle::after {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    margin: 7px auto 0;
    border-radius: 999px;
    background: rgba(31, 29, 24, 0.16);
  }

  .mobile-calc-sheet__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-calc-sheet__eyebrow {
    margin: 0 0 4px;
    color: var(--cv-muted);
    font-size: 11px;
    line-height: 1.1;
  }

  .mobile-calc-sheet__title {
    margin: 0;
    color: var(--cv-text);
    font-size: 24px;
    line-height: 1.02;
    letter-spacing: -0.04em;
  }

  .mobile-calc-sheet__close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: rgba(31, 29, 24, 0.06);
    color: var(--cv-text);
    font-size: 22px;
    line-height: 1;
  }

  .mobile-calc-sheet__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    padding-right: 2px;
  }

  .mobile-calc-sheet__section {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .view--calculator .mobile-calc-sheet__project-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mobile-calc-sheet__section .project-option {
    min-height: 50px;
    padding: 12px 14px;
  }

  .mobile-calc-sheet__section .project-option strong {
    font-size: 15px;
  }

  .mobile-calc-sheet__section .segmented {
    gap: 4px;
    padding: 4px;
  }

  .mobile-calc-sheet__section .segmented__item {
    min-height: 38px;
    font-size: 13px;
  }

  .mobile-calc-sheet__section .market-grade-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-calc-sheet__section .market-grade {
    min-height: 62px;
    padding: 10px 8px;
  }

  .mobile-calc-sheet__section .rate-summary,
  .mobile-calc-sheet__section .tax-custom,
  .mobile-calc-sheet__section .tax-rate-line {
    min-height: 46px;
    padding: 11px 14px;
    border-radius: 16px;
  }

  .mobile-calc-sheet__section .field-row {
    grid-template-columns: 1fr;
  }

  .mobile-calc-sheet__section .field input {
    min-height: 46px;
  }

  .mobile-calc-sheet__apply {
    min-height: 50px;
    border: 0;
    border-radius: 999px;
    background: var(--ddoc-color-button-bg);
    color: var(--ddoc-color-button-label);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    box-shadow: var(--ddoc-shadow-button);
  }

  .view--calculator .builder-grid {
    grid-template-columns: 1fr;
  }

  .view--calculator .project-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ── Sticky summary hidden on mobile — scroll to bottom actions ── */
  .sticky-summary {
    display: none !important;
  }

  /* ── Estimate result: name left, price right — keep row layout ── */
  .cv-result-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .cv-result-meta {
    flex: 1 1 auto;
    min-width: 0;
  }

  .estimate-inline-input--title {
    font-size: 18px;
    letter-spacing: -0.03em;
  }

  .cv-total-block {
    align-items: flex-end;
    flex-shrink: 0;
  }

  .cv-total-amount {
    font-size: 28px;
  }

  .cv-total-label {
    font-size: 10px;
  }

  /* ── Stage cards: text wraps, no overflow ── */
  .stage-card {
    grid-template-columns: 36px minmax(0, 1fr) 96px;
    gap: 8px;
    padding: 10px;
  }

  .stage-title-input {
    font-size: 14px;
    white-space: normal;
    word-break: break-word;
  }

  .stage-description-input {
    font-size: 12px;
  }

  /* ── Bottom actions block on mobile ── */
  .cv-result-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--cv-line);
  }

  .cv-result-actions .button {
    width: 100%;
    min-height: 50px;
    border-radius: 999px;
    justify-content: center;
    font-size: 15px;
  }

  /* ── AI-бриф: кнопка во всю ширину, карточки чуть крупнее ── */
  .brief-ai-button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }

  .brief-ai-card p {
    font-size: 13px;
  }

  .ai-insight-card h3 {
    font-size: 15px;
  }

  .ai-insight-card li,
  .ai-insight-card p {
    font-size: 13px;
  }

  /* ── После расчёта убираем CTA из sticky — кнопка «Пересчитать» уже внизу сметы ── */
  [data-estimate="ready"] .mobile-calc-controls__cta {
    display: none;
  }

  /* ── После расчёта чипы не sticky — иначе перекрывают контент сметы ── */
  [data-estimate="ready"] .mobile-calc-controls {
    position: static;
  }
}

/* ============================================================
   ANIMATIONS — DesiDoc Home entrance & ambient
   ============================================================ */

@keyframes ddoc-fade-down {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ddoc-fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ddoc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ddoc-scale-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes ddoc-glow-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
  50%       { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
}

@keyframes ddoc-overlay-drift {
  0%   { opacity: 0.55; transform: scale(1); }
  50%  { opacity: 0.45; transform: scale(1.012); }
  100% { opacity: 0.55; transform: scale(1); }
}

/* Subtle overlay ambient drift on the pseudo-element */
.deedoc-home::before {
  animation: ddoc-overlay-drift 14s ease-in-out infinite;
}

/* Header entrance */
.deedoc-home__top {
  animation: ddoc-fade-down 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Card entrance — staggered */
.deedoc-card:nth-child(1) {
  animation: ddoc-scale-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

.deedoc-card:nth-child(2) {
  animation: ddoc-scale-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.deedoc-card:nth-child(3) {
  animation: ddoc-scale-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.42s both;
}

/* Glass card ambient inner glow pulse */
.deedoc-card--quick {
  animation:
    ddoc-scale-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both,
    ddoc-glow-pulse 3.6s ease-in-out 1.2s infinite;
}

/* Brand footer entrance */
.deedoc-home__footer {
  animation: ddoc-fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .deedoc-home::before,
  .deedoc-home__top,
  .deedoc-card,
  .deedoc-card--quick,
  .deedoc-home__footer {
    animation: none;
  }
}

/* ============================================================
   CONTRACT VIEW — DesiDoc visual system alignment
   ============================================================ */

body[data-view="contract"] {
  background: none;
  position: relative;
}

body[data-view="contract"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    url("../assets/deedoc-landscape.png") center / cover no-repeat,
    #d8b1a3;
}

body[data-view="contract"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(2, 2, 1, 0.22), rgba(2, 2, 1, 0.70)),
    url("../assets/backgrounds/deedoc-landscape-night.png") center / cover no-repeat,
    #08070f;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] body[data-view="contract"]::after {
  opacity: 1;
}

.app[data-view="contract"] {
  padding-left: 0;
  background: none;
}

.app[data-view="contract"] .rail,
.app[data-view="contract"] .topbar {
  display: none;
}

.app[data-view="contract"] .workspace {
  padding: 0;
}

.view--contract {
  --cv-glass: #ffffff;
  --cv-text: var(--text);
  --cv-muted: var(--muted);
  --cv-line: var(--line);
  --cv-surface: rgba(31, 29, 24, 0.05);
  --cv-hover-bg: rgba(31, 29, 24, 0.06);
  --cv-selected-bg: rgba(31, 29, 24, 0.10);
  --cv-active-tab: rgba(31, 29, 24, 0.08);
  --cv-eyebrow: rgba(255, 255, 255, 0.44);
  --cv-radius: 40px;
  padding: 118px clamp(24px, 4vw, 56px) 28px;
}

/* Sidebar has white background — eyebrow must be dark in light mode */
.view--contract .contract-outline {
  --cv-eyebrow: rgba(31, 29, 24, 0.38);
}

[data-theme="dark"] .view--contract {
  --cv-glass: rgba(255, 255, 255, 0.07);
  --cv-text: rgba(255, 255, 255, 0.90);
  --cv-muted: rgba(255, 255, 255, 0.50);
  --cv-line: rgba(255, 255, 255, 0.12);
  --cv-surface: rgba(255, 255, 255, 0.06);
  --cv-hover-bg: rgba(255, 255, 255, 0.10);
  --cv-selected-bg: rgba(255, 255, 255, 0.15);
  --cv-active-tab: rgba(255, 255, 255, 0.16);
  --cv-eyebrow: rgba(255, 255, 255, 0.44);
  --ddoc-color-card-solid: rgba(255, 255, 255, 0.09);
  --ddoc-color-glass-card: rgba(255, 255, 255, 0.09);
  --ddoc-color-card-border: rgba(255, 255, 255, 0.12);
  --ddoc-color-title: rgba(255, 255, 255, 0.92);
  --ddoc-color-body-muted: rgba(255, 255, 255, 0.48);
  --ddoc-color-button-bg: rgba(255, 255, 255, 0.13);
  --ddoc-color-button-label: rgba(255, 255, 255, 0.80);
}

/* Restore white eyebrow for dark glass sidebar */
[data-theme="dark"] .view--contract .contract-outline {
  --cv-eyebrow: rgba(255, 255, 255, 0.44);
}

.view--contract .contract-workspace {
  width: min(1200px, 100%);
  padding: 0;
}

.view--contract .contract-hero {
  display: none;
}

.view--contract .autosave-status {
  min-height: 38px;
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--contract .button--dark {
  background: var(--ddoc-color-button-bg);
  color: var(--ddoc-color-button-label);
  box-shadow: var(--ddoc-shadow-button);
}

.view--contract .button--ghost,
.view--contract .button--soft {
  border-color: transparent;
  background: color-mix(in srgb, var(--cv-text) 9%, transparent);
  color: var(--cv-text);
}

/* Lighter weight for sidebar utility buttons */
.view--contract .contract-outline .button {
  min-height: 38px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.view--contract .contract-layout {
  display: grid;
  grid-template-columns: minmax(300px, 368px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

/* Схлопываем sidebar договора на планшете/мобиле (перебивает глобальный 1080px из-за специфичности) */
@media (max-width: 1080px) {
  .view--contract .contract-layout {
    grid-template-columns: 1fr;
  }
}

.view--contract .contract-outline,
.view--contract .document-canvas,
.view--contract .document-toolbar {
  border: 1px solid var(--cv-line);
  background: var(--cv-glass);
  color: var(--cv-text);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .view--contract .contract-outline,
[data-theme="dark"] .view--contract .document-canvas,
[data-theme="dark"] .view--contract .document-toolbar {
  backdrop-filter: blur(var(--ddoc-blur-glass)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass)) saturate(1.3);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.30), 0 1px 4px rgba(0, 0, 0, 0.20);
}

.view--contract .contract-outline {
  top: 20px;
  position: sticky;
  max-height: calc(100vh - 40px);
  align-self: start;
  gap: 0;
  overflow: auto;
  padding: 18px;
  border-radius: var(--cv-radius);
  scrollbar-width: thin;
}

.view--contract .outline-group {
  gap: 9px;
  padding: 0 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.view--contract .outline-group + .outline-group {
  padding-top: 16px;
  border-top: 1px solid var(--cv-line);
}

.view--contract .outline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cv-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
}

/* Step number badges */
.view--contract .step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

/* Utility groups (nav, clauses, explanations) are visually lighter */
.view--contract .outline-group--utility .outline-title {
  opacity: 0.7;
}

/* Contract canvas area with template bar */
.view--contract .contract-canvas-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Top bar with doc-type toggle — inside canvas column */
.view--contract .contract-top-bar {
  padding: 0 0 14px;
}

/* Strip: toggle слева по центру, reset справа */
.view--contract .contract-top-bar .contract-template-strip {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  gap: 12px;
}

/* Doc type toggle (Договор / Допсоглашение) */
.doc-type-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(0,0,0,0.07);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  height: 37px;
  box-sizing: border-box;
}
[data-theme="dark"] .doc-type-toggle {
  background: rgba(255,255,255,0.10);
}

.doc-type-toggle__btn {
  padding: 0 18px;
  height: 31px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}
.doc-type-toggle__step {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.5;
  letter-spacing: 0.04em;
}
.doc-type-toggle__btn.is-active .doc-type-toggle__step {
  opacity: 0.7;
}

.doc-type-toggle__btn:hover {
  color: var(--text);
}

.doc-type-toggle__btn.is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
[data-theme="dark"] .doc-type-toggle__btn.is-active {
  background: rgba(255,255,255,0.15);
  box-shadow: 0 1px 4px rgba(0,0,0,0.30);
}

.reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 37px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cv-muted);
  background: rgba(0,0,0,0.07);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0;
}
[data-theme="dark"] .reset-btn {
  background: rgba(255,255,255,0.10);
}
.reset-btn:hover {
  color: #c84d4d;
  background: rgba(200, 77, 77, 0.10);
}

/* Collapsible outline group (details/summary) */
.view--contract .outline-group--collapsible {
  border: none;
  padding: 0 0 6px;
}

.view--contract .outline-group--collapsible + .outline-group--collapsible {
  padding-top: 6px;
}

.view--contract .outline-group--collapsible[open] {
  padding-bottom: 12px;
}

.view--contract .outline-group-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  padding-bottom: 4px;
}

.view--contract .outline-title--toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 6px 0;
}

/* Only right arrow, no left marker */
.view--contract .outline-title--toggle::-webkit-details-marker { display: none; }
.view--contract .outline-title--toggle::marker { display: none; }

.view--contract .outline-title--toggle::after {
  content: "›";
  margin-left: auto;
  font-size: 16px;
  opacity: 0.4;
  transform: rotate(0deg);
  transition: transform 0.15s;
  line-height: 1;
}

.view--contract .outline-group--collapsible[open] .outline-title--toggle::after {
  transform: rotate(90deg);
}

/* Client request text */
.view--contract .client-request-preview {
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--cv-muted);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.6;
  font-weight: 500;
  position: relative;
}
.view--contract .client-request-preview::before {
  content: "«";
  display: block;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 4px;
  font-family: Georgia, serif;
}
.view--contract .client-request-preview::after {
  content: "»";
  display: block;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  margin-top: 4px;
  font-family: Georgia, serif;
  text-align: right;
}

/* Client reply textarea */
.view--contract .client-reply-textarea {
  width: 100%;
  border: 1px solid var(--cv-line, var(--line));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  background: var(--cv-surface, var(--surface));
  color: var(--text);
  box-sizing: border-box;
}

.view--contract .client-reply-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Section link numbering */
.view--contract .outline-link__num {
  font-size: 11px;
  margin-right: 3px;
  font-variant-numeric: tabular-nums;
  color: inherit;
  opacity: 1;
}

/* Addendum hint block */
.view--contract .outline-group--addendum-hint {
  border-top: 1px solid var(--cv-line);
  padding-top: 16px;
}

.view--contract .addendum-hint-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--cv-muted, var(--text));
  margin-bottom: 8px;
}

/* ── Sidebar typography: 3 levels ──────────────────────────
   S1 — 10px uppercase: section titles (outline-title, form group summary)
   S2 — 12px: all body text (hints, labels, chips, links)
   S3 — 13px: input values (contract-control input)
────────────────────────────────────────────────────────── */

.view--contract .contract-data-hint {
  color: var(--cv-muted);
  font-size: 12px;
  line-height: 1.45;
}

.view--contract .contract-required-summary {
  display: grid;
  gap: 8px;
}

.view--contract .contract-required-summary__title,
.view--contract .contract-required-summary__ok {
  margin: 0;
  color: var(--cv-muted);
  font-size: 12px;
  line-height: 1.4;
}

.view--contract .contract-required-summary__ok {
  color: var(--cv-text);
}

.view--contract .contract-required-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.view--contract .contract-required-chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--cv-line);
  border-radius: 999px;
  background: var(--cv-surface);
  color: var(--cv-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.view--contract .contract-required-chip:hover {
  border-color: var(--line-strong);
  background: var(--cv-hover-bg);
  transform: translateY(-1px);
}

.view--contract .addendum-steps {
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--cv-muted);
  font-size: 11px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.view--contract .addendum-steps li::marker {
  color: var(--cv-eyebrow);
  font-size: 9px;
  font-weight: 700;
}

.addendum-modal-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: step;
}

.addendum-modal-steps li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  counter-increment: step;
}

.addendum-modal-steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--soft-strong);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.view--contract .client-reply-status {
  margin: 2px 0 8px;
  color: var(--cv-muted);
  font-size: 11px;
  line-height: 1.35;
}

.view--contract .client-reply-status.is-error {
  color: #c84d4d;
}

.view--contract .contract-progress,
.view--contract .contract-control input,
.view--contract .signature-preview {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
}

.view--contract .contract-progress {
  min-height: 28px;
  padding: 0 10px;
}

.view--contract .contract-form__group {
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--cv-line);
}

.view--contract .contract-form__group summary {
  color: var(--cv-eyebrow);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.view--contract .contract-control span,
.view--contract .signature-preview,
.view--contract .optional-toggle small,
.view--contract .outline-link,
.view--contract .optional-toggle {
  color: var(--cv-muted);
}

.view--contract .contract-control input {
  min-height: var(--input-height);
  border-radius: var(--input-radius);
  font-size: var(--input-fs);
}

.view--contract .contract-control input:focus {
  border-color: var(--accent);
}

.view--contract .outline-link,
.view--contract .optional-toggle {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.view--contract .outline-link:hover,
.view--contract .outline-link.is-active,
.view--contract .optional-toggle:hover,
.view--contract .optional-toggle.is-off {
  border-color: var(--line-strong);
  background: var(--cv-selected-bg);
  transform: translateY(-1px);
}

.view--contract .signature-actions .button,
.view--contract .outline-link {
  min-height: 30px;
  border-radius: 999px;
  font-size: 11px;
  padding: 0 10px;
  text-align: center;
  justify-content: center;
}

.view--contract .signature-preview {
  min-height: 54px;
  border-style: dashed;
  border-radius: 16px;
}

.view--contract .signature-actions {
  display: grid;
  grid-template-columns: 1fr 0.62fr;
  gap: 7px;
}

.view--contract .optional-list {
  gap: 6px;
}

.view--contract .optional-toggle {
  padding: 9px 10px;
  border-radius: 14px;
}

.view--contract .optional-toggle span {
  color: var(--cv-text);
  font-size: 12px;
}

.view--contract .document-canvas {
  width: 100%;
  min-height: 760px;
  margin: 0 0 76px;
  padding: clamp(28px, 3.4vw, 48px);
  border-radius: var(--cv-radius);
}

.view--contract .document-coverline {
  color: var(--cv-muted);
}

.view--contract .document-title {
  color: var(--cv-text);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 400;
  letter-spacing: -0.04em;
}

.view--contract .document-meta {
  color: var(--cv-muted);
}

.view--contract .document-note {
  grid-template-columns: 80px minmax(0, 1fr);
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-muted);
}

.view--contract .document-note strong {
  color: var(--cv-muted);
}

.view--contract .document-section {
  border-top-color: var(--cv-line);
}

.view--contract .document-section h2 {
  color: var(--cv-text);
  font-size: 22px;
  font-weight: 500;
}

.view--contract .section-num,
.view--contract .clause-title span {
  color: var(--cv-muted);
}

.view--contract .clause-title,
.view--contract .document-section p,
.view--contract .document-section li {
  color: var(--cv-text);
}

.view--contract .contract-clause + .contract-clause {
  border-top-color: var(--cv-line);
}

.view--contract .inline-field {
  background: var(--cv-surface);
  border-bottom-color: var(--line-strong);
}

.view--contract .inline-field:focus {
  background: var(--cv-selected-bg);
  border-bottom-color: var(--accent);
}

.view--contract .optional-section__actions button,
.view--contract .requisite-card {
  border-color: var(--cv-line);
  background: var(--cv-surface);
  color: var(--cv-text);
}

.view--contract .sign-line {
  border-top-color: var(--line-strong);
  color: var(--cv-muted);
}

.view--contract .document-toolbar {
  width: min(794px, calc(100% - 386px));
  margin: -54px 0 0 auto;
  border-radius: 28px;
  background: color-mix(in srgb, var(--cv-glass) 88%, transparent);
  backdrop-filter: blur(var(--ddoc-blur-glass));
  -webkit-backdrop-filter: blur(var(--ddoc-blur-glass));
}

.view--contract .document-toolbar > span {
  color: var(--cv-muted);
}

/* Explanation toggle — copyright-style label */
/* Explanations toggle — real pill switch */
.expl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.expl-toggle input { display: none; }
.expl-toggle__track {
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s;
}
[data-theme="dark"] .expl-toggle__track {
  background: rgba(255,255,255,0.18);
}
.expl-toggle__thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.expl-toggle input:checked ~ .expl-toggle__track {
  background: var(--accent);
}
.expl-toggle input:checked ~ .expl-toggle__track .expl-toggle__thumb {
  transform: translateX(13px);
}
.expl-toggle__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s;
}
.expl-toggle:has(input:checked) .expl-toggle__label {
  color: var(--accent);
}

@media (max-width: 1080px) {
  .view--contract {
    padding: 96px 22px 72px;
  }

  .view--contract .contract-layout {
    grid-template-columns: 1fr;
  }

  .view--contract .contract-outline {
    position: static;
    max-height: none;
  }

  .view--contract .document-toolbar {
    width: 100%;
    margin: -54px 0 0;
  }
}

@media (max-width: 760px) {
  .view--contract {
    padding: 94px 14px 44px;
  }

  .view--contract .contract-hero,
  .view--contract .contract-outline,
  .view--contract .document-toolbar {
    display: none;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="steps"] .mobile-contract-flow {
    display: block !important;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="doc"] .mobile-contract-back,
  .contract-workspace[data-mode="fill"][data-mobile-doc="steps"] .mobile-contract-cta {
    display: flex !important;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="doc"] .mobile-contract-actions {
    display: grid !important;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="steps"] .contract-canvas-area {
    display: none;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="doc"] .contract-canvas-area {
    display: flex;
  }

  .mobile-contract-flow {
    margin-top: 8px;
  }

  .mobile-contract-card {
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--cv-line) 78%, white);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 40px rgba(47, 29, 22, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .mobile-contract-template-strip {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
  }

  .mobile-contract-template-strip .doc-type-toggle {
    width: 100%;
  }

  .mobile-contract-template-strip .doc-type-toggle__btn {
    flex: 1;
    justify-content: center;
    padding: 0 10px;
  }

  .mobile-contract-template-strip .reset-btn {
    display: none;
  }

  .mobile-contract-card__head {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
  }

  .mobile-contract-card__title {
    margin: 0;
    color: var(--cv-text);
    font-size: 28px;
    line-height: 1.04;
    letter-spacing: 0;
  }

  .mobile-contract-progressline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .mobile-contract-progressline__track {
    height: 8px;
    border-radius: 999px;
    background: rgba(31, 29, 24, 0.1);
    overflow: hidden;
  }

  .mobile-contract-progressline__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 180ms ease;
  }

  .mobile-contract-progressline__value {
    color: var(--cv-text);
    font-size: 14px;
    font-weight: 600;
  }

  .mobile-contract-steps {
    display: grid;
    gap: 10px;
  }

  .mobile-contract-step {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 12px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--cv-line) 82%, white);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--cv-text);
    text-align: left;
  }

  .mobile-contract-step.is-active {
    border-color: color-mix(in srgb, var(--accent) 62%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
  }

  .mobile-contract-step.is-complete .mobile-contract-step__icon {
    color: var(--positive);
  }

  .mobile-contract-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
  }

  .mobile-contract-step__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .mobile-contract-step__copy strong {
    color: var(--cv-text);
    font-size: 15px;
    line-height: 1.2;
  }

  .mobile-contract-step__copy small {
    color: var(--cv-muted);
    font-size: 13px;
    line-height: 1.2;
  }

  .mobile-contract-step__arrow {
    color: var(--cv-muted);
    font-size: 22px;
    line-height: 1;
  }

  .mobile-contract-cta {
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin-top: 18px;
    border: 0;
    border-radius: 999px;
    background: var(--ddoc-color-button-bg);
    color: var(--ddoc-color-button-label);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: var(--ddoc-shadow-button);
  }

  .mobile-contract-cta:disabled {
    background: rgba(31, 29, 24, 0.08);
    color: rgba(31, 29, 24, 0.42);
    box-shadow: none;
  }

  .mobile-contract-sheet[hidden] {
    display: none !important;
  }

  .mobile-contract-sheet {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: block !important;
  }

  .mobile-contract-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(18, 14, 12, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .mobile-contract-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(78svh, 760px);
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border: 1px solid color-mix(in srgb, var(--cv-line) 76%, white);
    border-radius: 28px 28px 0 0;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -22px 44px rgba(37, 23, 18, 0.18);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
  }

  .mobile-contract-sheet__handle {
    width: 56px;
    height: 18px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
  }

  .mobile-contract-sheet__handle::after {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    margin: 7px auto 0;
    border-radius: 999px;
    background: rgba(31, 29, 24, 0.16);
  }

  .mobile-contract-sheet__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-contract-sheet__eyebrow {
    margin: 0 0 4px;
    color: var(--cv-muted);
    font-size: 11px;
    line-height: 1.1;
  }

  .mobile-contract-sheet__title {
    margin: 0;
    color: var(--cv-text);
    font-size: 24px;
    line-height: 1.02;
    letter-spacing: 0;
  }

  .mobile-contract-sheet__close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: rgba(31, 29, 24, 0.06);
    color: var(--cv-text);
    font-size: 22px;
    line-height: 1;
  }

  .mobile-contract-sheet__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    padding-right: 2px;
  }

  .mobile-contract-sheet__section {
    display: grid;
    gap: 12px;
  }

  .mobile-contract-sheet__hint {
    margin: 0;
    color: var(--cv-muted);
    font-size: 13px;
    line-height: 1.35;
  }

  .mobile-contract-sheet__field {
    display: grid;
    gap: 6px;
  }

  .mobile-contract-sheet__field span {
    color: var(--cv-text);
    font-size: 13px;
    font-weight: 500;
  }

  .mobile-contract-sheet__field input,
  .mobile-contract-sheet__field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--cv-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--cv-text);
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
  }

  .mobile-contract-sheet__field textarea {
    min-height: 132px;
    resize: vertical;
  }

  .mobile-contract-sheet__import-toggle,
  .mobile-contract-sheet__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 13%, white);
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    box-sizing: border-box;
  }

  .mobile-contract-sheet__toggle {
    border-color: var(--cv-line);
    background: rgba(31, 29, 24, 0.04);
    color: var(--cv-text);
  }

  .mobile-contract-sheet__toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
  }

  .mobile-contract-sheet__import-box {
    display: grid;
    gap: 10px;
  }

  .mobile-contract-sheet__dates {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
  }

  .mobile-contract-sheet .client-request-preview,
  .mobile-contract-sheet .client-reply-textarea,
  .mobile-contract-sheet .signature-preview {
    border-radius: 18px;
  }

  .mobile-contract-sheet__apply {
    min-height: 52px;
    border: 0;
    border-radius: 999px;
    background: var(--ddoc-color-button-bg);
    color: var(--ddoc-color-button-label);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: var(--ddoc-shadow-button);
  }

  .mobile-contract-back {
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--cv-text);
    font-size: 15px;
    font-weight: 500;
  }

  .mobile-contract-actions {
    display: grid;
    gap: 10px;
    position: fixed;
    right: 14px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 14px;
    z-index: 80;
    margin-top: 0;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--cv-line) 76%, white);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -18px 44px rgba(37, 23, 18, 0.16);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
  }

  .mobile-contract-actions__top,
  .mobile-contract-actions__main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
  }

  .mobile-contract-undo,
  .mobile-contract-expl-toggle {
    min-height: 42px;
    border: 1px solid var(--cv-line);
    border-radius: 999px;
    background: rgba(31, 29, 24, 0.04);
    color: var(--cv-text);
    justify-content: center;
  }

  .mobile-contract-undo {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-contract-undo:disabled {
    cursor: default;
    color: rgba(31, 29, 24, 0.34);
    opacity: 0.66;
  }

  .mobile-contract-expl-toggle {
    padding: 0 12px;
    font-size: 13px;
  }

  .mobile-contract-actions .button {
    width: 100%;
    min-height: 50px;
    border-radius: 999px;
  }

  .view--contract .document-toolbar,
  .view--contract .document-toolbar__actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .view--contract .document-canvas {
    border-radius: 30px;
  }

  .view--contract .contract-outline nav,
  .view--contract .optional-list {
    grid-template-columns: 1fr;
  }

  .view--contract .document-note,
  .view--contract .requisites-grid,
  .view--contract .document-meta {
    grid-template-columns: 1fr;
  }

  .view--contract .contract-canvas-area {
    gap: 10px;
  }

  .contract-workspace[data-mode="fill"][data-mobile-doc="doc"] .contract-canvas-area {
    padding-bottom: 150px;
  }

  .view--contract .contract-top-bar {
    padding-bottom: 10px;
  }

  .view--contract .document-canvas {
    padding: 20px 16px 22px;
  }

  .view--contract .contract-clause {
    padding-right: 38px;
  }

  .view--contract .contract-clause-delete {
    width: 30px;
    height: 30px;
    opacity: 1;
  }
}

/* ============================================================
   CONTRACT CHOOSER — document type selection screen
   ============================================================ */

/* Show chooser / hide editor based on mode */
.contract-workspace[data-mode="pick"] .contract-chooser { display: flex; }
.contract-workspace[data-mode="pick"] .contract-layout,
.contract-workspace[data-mode="pick"] .document-toolbar { display: none; }

.contract-workspace[data-mode="fill"] .contract-chooser { display: none; }

/* Addendum sidebar vs contract sidebar visibility */
[data-addendum-sidebar]:empty { display: none; }

.contract-workspace[data-doc-type="addendum"] [data-step] { display: none; }
.contract-workspace[data-doc-type="addendum"] .outline-group--addendum-hint { display: none; }
.contract-workspace[data-doc-type="contract"] [data-addendum-sidebar] > * { display: none; }

/* Addendum ТЗ textarea */
.addendum-tz-textarea {
  width: 100%;
  min-height: 100px;
  padding: 8px 10px;
  border: 1px solid var(--cv-line, var(--line));
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.addendum-tz-textarea:focus {
  border-color: var(--accent);
}

/* ── Addendum document — typography ── */
.addendum-doc {
  font-size: 14px;
  line-height: 1.6;
}
/* addendum-doc .document-title inherits from .document-title global — no override needed */
.document-title__sub {
  display: block;
  font-size: 1em;
  font-weight: inherit;
  letter-spacing: inherit;
  opacity: 1;
  margin-top: 0;
  line-height: inherit;
}
/* Addendum section headings are smaller than contract (8 sections vs 5) */
.addendum-doc .document-section h2 {
  font-size: 15px !important;
  letter-spacing: -0.01em !important;
  margin-bottom: 10px !important;
  font-weight: 700;
}
.addendum-doc .contract-section-title {
  font-size: 14px !important;
  font-weight: 700;
  margin: 0 0 10px;
}
.addendum-doc .contract-meta {
  font-size: 13px;
  text-align: left;
  margin-bottom: 12px;
}
.addendum-doc .contract-parties {
  margin: 16px 0 8px;
  font-size: 14px;
}
.addendum-doc .contract-party {
  margin: 4px 0;
}
.addendum-doc .contract-party-and {
  color: var(--cv-muted, #999);
  margin: 2px 16px;
  font-style: italic;
}
.addendum-doc .contract-preamble {
  margin: 8px 0 0;
  font-style: italic;
  font-size: 13px;
  color: var(--cv-muted);
}
.addendum-doc .contract-subtitle {
  font-size: 13px;
  color: var(--cv-muted);
  margin: 2px 0;
  text-align: center;
}
.addendum-tz-block {
  margin-top: 6px;
}
.addendum-section-note {
  font-size: 12px;
  color: var(--cv-muted);
  line-height: 1.5;
  margin: 6px 0 0;
  font-style: italic;
}
.addendum-parties-table {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.addendum-party-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  align-items: baseline;
}
.addendum-party-label {
  color: var(--cv-muted);
  flex-shrink: 0;
  min-width: 90px;
}
.addendum-party-value {
  font-weight: 500;
}
.addendum-preamble {
  font-size: 13px;
  margin: 12px 0 0;
  font-style: italic;
  color: var(--cv-text);
}
.inline-field--block {
  display: block;
  min-height: 60px;
  padding: 6px 8px;
  border: 1px dashed var(--cv-line, var(--line));
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.inline-field--block:focus {
  outline: none;
  border-color: var(--accent);
  border-style: solid;
}

/* Chooser layout — centered */
.contract-chooser {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.contract-chooser__inner {
  width: 100%;
  max-width: 950px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.contract-chooser__title {
  max-width: 680px;
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 40px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
}

.contract-chooser__title span {
  display: block;
  white-space: nowrap;
}

/* ── Chooser (two-card mechanic) ─────────────────────────── */
.contract-chooser__cards {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 680px;
  margin-bottom: 28px;
}

.chooser-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 22px 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  font: inherit;
}

.chooser-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
}

.chooser-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.chooser-card__badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px 10px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 99px;
}

.chooser-card__badge--muted {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.45);
}

.chooser-card__icon {
  font-size: 28px;
  line-height: 1;
}

.chooser-card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.chooser-card__desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.chooser-card__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  transition: all 0.15s;
  margin-top: 4px;
}

.chooser-card.is-selected .chooser-card__check {
  background: var(--accent);
  border-color: var(--accent);
}

.chooser-cta {
  min-height: var(--btn-height-lg);
  padding: 0 40px;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1007;
  border: none;
  border-radius: var(--btn-radius);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.chooser-cta:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.chooser-cta:not(:disabled):hover {
  transform: scale(1.02);
}

/* Chooser — планшет/мобила */
@media (max-width: 1080px) {
  .contract-chooser__inner {
    max-width: 780px;
  }
}

@media (max-width: 760px) {
  .contract-chooser__title {
    margin-bottom: 24px;
    font-size: 34px;
    line-height: 1.12;
  }

  .contract-chooser__title span {
    display: inline;
    white-space: normal;
  }

  .contract-chooser__title span + span::before {
    content: " ";
  }

  .contract-chooser__cards {
    flex-direction: column;
    max-width: none;
    margin-bottom: 22px;
  }

  .chooser-card {
    padding: 24px 22px 20px;
  }

  .chooser-cta {
    width: 100%;
    min-height: 50px;
  }
}

/* ── Press feedback (scale on active) ────────────────────── */
.deedoc-card:active          { transform: scale(0.97); }
.deedoc-card__button:active  { transform: scale(0.95); }
.project-option:active,
.market-grade:active,
.segmented__item:active      { transform: scale(0.96); }
.button:active               { transform: scale(0.97); }

/* ============================================================
   DARK THEME — мобильные шторки, чипы и панели
   ============================================================ */

@media (max-width: 760px) {
  [data-theme="dark"] .mobile-calc-chip,
  [data-theme="dark"] .mobile-calc-sheet__panel,
  [data-theme="dark"] .mobile-contract-card,
  [data-theme="dark"] .mobile-contract-step,
  [data-theme="dark"] .mobile-contract-sheet__panel,
  [data-theme="dark"] .mobile-contract-actions {
    border-color: var(--line);
    background: var(--surface-strong);
  }

  [data-theme="dark"] .mobile-calc-chip,
  [data-theme="dark"] .mobile-contract-step {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
  }

  [data-theme="dark"] .mobile-calc-sheet__panel,
  [data-theme="dark"] .mobile-contract-sheet__panel {
    box-shadow: 0 -22px 44px rgba(0, 0, 0, 0.5);
  }

  [data-theme="dark"] .mobile-contract-actions {
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.45);
  }

  [data-theme="dark"] .mobile-calc-sheet__handle::after,
  [data-theme="dark"] .mobile-contract-sheet__handle::after {
    background: rgba(255, 255, 255, 0.24);
  }

  [data-theme="dark"] .mobile-calc-sheet__close,
  [data-theme="dark"] .mobile-contract-sheet__close {
    background: rgba(255, 255, 255, 0.1);
  }

  [data-theme="dark"] .mobile-contract-progressline__track {
    background: rgba(255, 255, 255, 0.14);
  }

  [data-theme="dark"] .mobile-contract-sheet__field input,
  [data-theme="dark"] .mobile-contract-sheet__field textarea {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.07);
  }

  [data-theme="dark"] .mobile-contract-sheet__toggle,
  [data-theme="dark"] .mobile-contract-undo,
  [data-theme="dark"] .mobile-contract-expl-toggle {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.07);
  }

  [data-theme="dark"] .mobile-contract-undo:disabled {
    color: rgba(255, 255, 255, 0.32);
  }

  [data-theme="dark"] .mobile-contract-cta:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.38);
  }
}
