@font-face {
  font-family: "PT Sans";
  src: url("../fonts/PTSans-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "PT Sans";
  src: url("../fonts/PTSans-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "PT Serif";
  src: url("../fonts/PTSerif-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "PT Serif";
  src: url("../fonts/PTSerif-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "PT Serif";
  src: url("../fonts/PTSerif-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
}

:root {
  /* Ink — a deep indigo-black, not flat #000, reads warmer and more considered */
  --ink: #14172b;
  --ink-soft: #52546b;
  --ink-faint: #8688a0;

  /* Paper — a warm off-white page bg, cards sit on true white above it */
  --paper: #faf9f6;
  --surface: #ffffff;
  --line: #e8e6df;
  --line-soft: #f0efe9;

  /* Petas's own product accent — distinct from a customer's КП brand color below */
  --brand: #4f46e5;
  --brand-dark: #342fa0;
  --brand-tint: #eeedfd;
  --on-brand: #ffffff;

  --success: #0f766e;
  --success-tint: #e3f6f1;
  --warning: #b45309;
  --warning-tint: #fdf1de;
  --danger: #b42318;
  --danger-tint: #fdecec;

  --font-display: "PT Serif", Georgia, "Times New Roman", serif;
  --font-body: "PT Sans", -apple-system, system-ui, sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 43, 0.06), 0 1px 1px rgba(20, 23, 43, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 23, 43, 0.08), 0 2px 6px rgba(20, 23, 43, 0.04);
  --shadow-lg: 0 24px 64px rgba(20, 23, 43, 0.14), 0 4px 12px rgba(20, 23, 43, 0.06);

  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }

/* ---------- App shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
}
.sidebar__brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--brand);
  display: inline-block;
  transform: rotate(45deg);
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav a {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.sidebar__nav a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.sidebar__logout { margin-top: auto; }
.sidebar__logout button {
  width: 100%;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  color: var(--ink-faint);
  font: inherit;
  font-size: 13px;
}
.sidebar__logout button:hover { border-color: var(--ink-faint); color: var(--ink-soft); }

.content { flex: 1; padding: 40px 48px 64px; max-width: 1040px; }

h1 { font-size: 28px; margin: 0 0 4px; color: var(--ink); }
h2 { font-size: 19px; margin: 0 0 14px; color: var(--ink); }
.muted { color: var(--ink-soft); font-size: 14px; }

/* ---------- Trial banner ---------- */
.trial-banner {
  background: var(--warning-tint);
  color: var(--warning);
  border: 1px solid #f6dcb0;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  margin-bottom: 24px;
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.stat-row { display: flex; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  flex: 1;
  min-width: 120px;
  box-shadow: var(--shadow-sm);
}
.stat__value { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat__label { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; letter-spacing: .01em; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
th { color: var(--ink-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--line-soft); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.badge--draft { background: var(--line-soft); color: var(--ink-faint); }
.badge--sent { background: var(--brand-tint); color: var(--brand-dark); }
.badge--opened { background: var(--warning-tint); color: var(--warning); }
.badge--accepted { background: var(--success-tint); color: var(--success); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; margin-top: 16px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=color], input[type=date], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
textarea { resize: vertical; min-height: 70px; }
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }

button, .btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
button:hover, .btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
button:active, .btn:active { transform: scale(.98); }
button.btn--secondary, .btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
button.btn--secondary:hover, .btn--secondary:hover { background: var(--line-soft); border-color: var(--ink-faint); }
button:disabled { opacity: .55; cursor: default; transform: none; }

.form-error {
  background: var(--danger-tint);
  color: var(--danger);
  border: 1px solid #f3c6c6;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}
.form-success {
  background: var(--success-tint);
  color: var(--success);
  border: 1px solid #b9e2d8;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}
.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(640px circle at 15% 20%, rgba(79,70,229,.35), transparent 55%),
    radial-gradient(520px circle at 85% 80%, rgba(79,70,229,.25), transparent 55%);
}
.auth-screen__panel {
  position: relative;
  flex: 1;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  color: #fff;
}
.auth-screen__panel-brand { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-bottom: 28px; display: flex; align-items: center; gap: 10px; }
.auth-screen__panel-brand::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: #818cf8; transform: rotate(45deg); }
.auth-screen__panel-quote { font-family: var(--font-display); font-size: 28px; line-height: 1.45; max-width: 480px; color: #eef0ff; }
.auth-screen__panel-caption { margin-top: 20px; color: #a5aae0; font-size: 14px; }
@media (min-width: 880px) {
  .auth-screen__panel { display: flex; }
}
.auth-screen__form {
  position: relative;
  flex: 0 0 440px;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 30px; }
.auth-card .brand { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-bottom: 4px; }

/* ---------- Block editor ---------- */
.block-list { display: flex; flex-direction: column; gap: 12px; }
.block-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}
.block-item__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.block-item__type { font-size: 11.5px; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; letter-spacing: .04em; }
.drag-handle { cursor: grab; color: var(--ink-faint); font-size: 16px; }

.line-items-table input { padding: 7px 9px; font-size: 13px; }
.line-items-table td { vertical-align: top; }

.copy-link-row { display: flex; gap: 8px; align-items: center; }
.copy-link-row input { flex: 1; background: var(--line-soft); font-size: 13px; color: var(--ink-soft); }

/* =====================================================================
   Public proposal page — this is what a customer's customer actually
   sees, so it carries its own richer visual system layered on top of
   the brand color computed server-side (palette.primary / primary_dark /
   primary_tint / on_primary — see services/color_utils.py). Variables
   below are set inline per-proposal in the template.
   ===================================================================== */

.pp-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--pp-primary, #4f46e5);
  z-index: 50;
  transition: width .1s linear;
}

.proposal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 80px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

.proposal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.proposal-header img { max-height: 40px; border-radius: 6px; }
.proposal-header__name { font-weight: 700; font-size: 15px; }
.proposal-header__meta { font-size: 12.5px; color: var(--ink-faint); }

.proposal-hero {
  margin: 0 -24px 8px;
  padding: 72px 24px 56px;
  background: var(--pp-tint, #eef0ff);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  text-align: left;
}
.proposal-hero__eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pp-primary-dark, #342fa0);
  margin-bottom: 14px;
}
.proposal-hero h1 {
  font-size: 40px;
  line-height: 1.18;
  margin: 0 0 16px;
  max-width: 620px;
  color: var(--ink);
}
.proposal-hero .subtitle {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 540px;
  line-height: 1.5;
}

.proposal-section { padding: 48px 0; border-bottom: 1px solid var(--line); }
.proposal-section:last-of-type { border-bottom: none; }
.proposal-section__eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pp-primary-dark, #342fa0);
  margin-bottom: 10px;
}
.proposal-section h2 {
  font-size: 26px;
  margin: 0 0 18px;
  color: var(--ink);
}
.proposal-section p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.proposal-section p:last-child { margin-bottom: 0; }

.proposal-items table { margin-top: 6px; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.proposal-items th { background: var(--line-soft); }
.proposal-items td, .proposal-items th { padding: 14px 16px; }
.proposal-items .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.proposal-total {
  text-align: right;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-top: 16px;
  color: var(--ink);
}
.proposal-total span { color: var(--pp-primary-dark, #342fa0); }

.proposal-accept { text-align: center; padding: 56px 0; }
.proposal-accept button {
  background: var(--pp-primary, #4f46e5);
  border-color: var(--pp-primary, #4f46e5);
  color: var(--pp-on-primary, #fff);
  font-size: 16px;
  padding: 15px 36px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.proposal-accept button:hover { filter: brightness(0.92); }
.proposal-accept__accepted {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-tint);
  color: var(--success);
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
}

.proposal-footer {
  padding: 32px 0 48px;
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.6;
}

/* Content is visible at rest, always — a page that loads with text parked at
   opacity:0 waiting on IntersectionObserver reads as broken/empty the instant
   JS is slow, blocked, or the reader doesn't scroll. The reveal is a quiet
   finishing touch (a few px of rise + a brief fade-in from 0.75, never 0),
   applied only once per element and only via JS adding .is-visible — without
   JS (or in PDF, which never gets the class) every section already renders
   at full opacity through the base .proposal-section rule below. */
.js-reveal { opacity: .75; transform: translateY(6px); transition: opacity .45s ease, transform .45s ease; }
.js-reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Numbered steps (genuine sequence — "как это работает") ---------- */
.pp-steps { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.pp-step { display: flex; gap: 18px; padding-bottom: 28px; position: relative; }
.pp-step:last-child { padding-bottom: 0; }
.pp-step__badge {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--pp-tint, #eef0ff);
  color: var(--pp-primary-dark, #342fa0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  position: relative; z-index: 1;
}
.pp-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px; top: 34px; bottom: 0;
  width: 1px;
  background: var(--line);
}
.pp-step__title { font-weight: 700; font-size: 16px; margin: 4px 0 4px; color: var(--ink); }
.pp-step__desc { font-size: 15px; line-height: 1.6; color: var(--ink-soft); }

/* ---------- Feature cards ("почему именно так") ---------- */
.pp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 8px; }
.pp-feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.pp-feature__icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--pp-tint, #eef0ff);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.pp-feature__icon svg { width: 16px; height: 16px; stroke: var(--pp-primary-dark, #342fa0); }
.pp-feature__title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.pp-feature__desc { font-size: 14px; line-height: 1.55; color: var(--ink-soft); }

/* ---------- Pricing cards ("сколько это стоит") ---------- */
.pp-pricing-intro { font-size: 16px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 20px; }
.pp-pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.pp-price-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; position: relative;
}
.pp-price-card--highlight { border: 2px solid var(--pp-primary, #4f46e5); box-shadow: var(--shadow-md); }
.pp-price-card__badge {
  position: absolute; top: -11px; left: 20px;
  background: var(--pp-primary, #4f46e5); color: var(--pp-on-primary, #fff);
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 12px; border-radius: 999px;
}
.pp-price-card__name { font-weight: 700; font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; }
.pp-price-card__price { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.pp-price-card__period { font-size: 13px; color: var(--ink-faint); margin: 2px 0 16px; }
.pp-price-card__features { list-style: none; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.pp-price-card__features li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.pp-price-card__features svg { flex-shrink: 0; width: 15px; height: 15px; margin-top: 2px; stroke: var(--pp-primary-dark, #342fa0); }

/* ---------- FAQ cards ("вопросы, которые обычно задают") ---------- */
.pp-faq { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.pp-faq__item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.pp-faq__q { font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 6px; display: flex; gap: 8px; }
.pp-faq__q::before { content: "?"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--pp-tint, #eef0ff); color: var(--pp-primary-dark, #342fa0); font-size: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); }
.pp-faq__a { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); padding-left: 28px; }

/* ---------- Contact card ---------- */
.pp-contact { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin-top: 8px; }
.pp-contact__avatar {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%;
  background: var(--pp-tint, #eef0ff); color: var(--pp-primary-dark, #342fa0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
}
.pp-contact__name { font-weight: 700; font-size: 16px; color: var(--ink); }
.pp-contact__role { font-size: 13px; color: var(--ink-faint); margin-bottom: 6px; }
.pp-contact__links { display: flex; gap: 14px; flex-wrap: wrap; }
.pp-contact__links a { font-size: 14px; display: inline-flex; align-items: center; gap: 5px; color: var(--pp-primary-dark, #342fa0); font-weight: 600; }
.pp-contact__links svg { width: 14px; height: 14px; stroke: currentColor; }

/* ---------- Generation job status ---------- */
.job-status__row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand);
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.source-doc-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.source-doc-list li { font-size: 13.5px; color: var(--ink-soft); }

.section-review { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.section-review__item { margin-bottom: 0; }
.section-review__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 18px; gap: 14px; }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar__logout { margin-top: 0; }
  .content { padding: 24px 20px; }
  .proposal-hero { padding: 48px 20px 40px; }
  .proposal-hero h1 { font-size: 30px; }
}
