:root {
  --bg: #FFFFFF;
  --ink: #0C0C0D;
  --ink-2: rgba(12, 12, 13, .6);
  --ink-3: rgba(12, 12, 13, .07);
  --ink-4: rgba(12, 12, 13, .04);
  --line: rgba(12, 12, 13, .09);
  --on: #FFFFFF;
  --on-2: rgba(255, 255, 255, .56);
  --on-3: rgba(255, 255, 255, .11);
  --on-line: rgba(255, 255, 255, .11);
  --ok: #2DD56B;
  --warn: #FFB13B;
  --shadow: 0 28px 56px -18px rgba(12, 12, 13, .34), 0 6px 16px -6px rgba(12, 12, 13, .16);
  --font: Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1 { font-size: 34px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
h2 { font-size: 22px; font-weight: 640; letter-spacing: -.015em; margin: 0; }
h3 { font-size: 16px; font-weight: 620; margin: 0; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Каркас кабинета */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex-shrink: 0; padding: 28px 18px; border-right: 1px solid var(--ink-3); display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: var(--on); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 720; }
.logo-word { font-size: 19px; font-weight: 680; letter-spacing: -.01em; }
.company-box { border-radius: 16px; background: var(--ink-4); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.company-box .muted { font-size: 12px; font-weight: 520; }
.company-box b { font-size: 15px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { height: 44px; border-radius: 22px; padding: 0 16px; display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-weight: 540; text-decoration: none; }
.nav a:hover { background: var(--ink-4); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--on); font-weight: 560; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.badge { margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px; background: var(--ink); color: var(--on); font-size: 12px; font-weight: 640; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.nav a.on .badge { background: var(--on); color: var(--ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.me { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.avatar { width: 38px; height: 38px; border-radius: 19px; background: var(--ink-3); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 640; flex-shrink: 0; }
.linkbtn { background: none; border: 0; padding: 0 6px; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.linkbtn:hover { color: var(--ink); }
.main { flex: 1; min-width: 0; max-width: 100%; padding: 32px 40px 40px; display: flex; flex-direction: column; gap: 22px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head .cap { font-size: 15px; font-weight: 520; color: var(--ink-2); margin-bottom: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Кнопки */
.btn, .btn-ghost, .btn-on, .btn-on-ghost { height: 48px; border: 0; border-radius: 999px; padding: 0 22px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn { background: var(--ink); color: var(--on); }
.btn:hover { background: #2a2a2d; }
.btn-ghost { background: var(--ink-3); color: var(--ink); }
.btn-ghost:hover { background: rgba(12, 12, 13, .12); }
.btn-on { background: var(--on); color: var(--ink); }
.btn-on-ghost { background: var(--on-3); color: var(--on); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Чипы, статусы */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { height: 38px; border-radius: 19px; padding: 0 16px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 560; background: var(--ink-3); color: var(--ink); text-decoration: none; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--on); }
.chip-s { height: 28px; border-radius: 14px; padding: 0 12px; font-size: 13px; }
.chip-dashed { background: none; border: 1.5px dashed rgba(12, 12, 13, .24); }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.muted { background: rgba(12, 12, 13, .24); }
.dot.white { background: var(--on); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; }
.t-warn { color: var(--warn); }
.t-ok { color: var(--ok); }

/* Карточки */
.card { border-radius: 24px; border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.card-title { font-size: 15px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.shape { background: var(--ink); color: var(--on); border-radius: 28px; padding: 26px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.shape .cap { font-size: 13px; font-weight: 500; color: var(--on-2); }
.shape .muted { color: var(--on-2); }
.big { font-size: 42px; font-weight: 680; letter-spacing: -.03em; line-height: 1; }
.big small { font-size: 17px; font-weight: 560; color: var(--on-2); letter-spacing: 0; }
.card .big small { color: var(--ink-2); }
.note { border-radius: 14px; background: var(--ink-4); padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.shape .note { background: var(--on-3); color: rgba(255, 255, 255, .82); }
.grid { display: flex; gap: 24px; align-items: flex-start; }
.grid > .wide { flex: 1; min-width: 0; }
.grid > .aside { width: 360px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Таблицы */
.t { width: 100%; border-collapse: collapse; }
.t th { font-size: 12px; font-weight: 560; color: var(--ink-2); text-align: left; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--ink-3); white-space: nowrap; }
.t td { padding: 13px 10px 13px 0; border-bottom: 1px solid var(--ink-3); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .sub { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.shape .t th { color: var(--on-2); border-bottom-color: var(--on-line); }
.shape .t td { border-bottom-color: var(--on-line); }
.shape .t .sub { color: var(--on-2); }
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--ink-3); font-size: 14px; }
.shape .kv > div { border-top-color: var(--on-line); }
.pill-who { display: inline-flex; align-items: center; height: 28px; border-radius: 14px; padding: 0 12px; font-size: 13px; font-weight: 560; white-space: nowrap; }
.who-contractor { background: var(--on-3); }
.who-customer { background: var(--on); color: var(--ink); }
.who-both { border: 1px solid rgba(255, 255, 255, .24); }

/* Таймлайн */
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 12px; }
.tl-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--on); margin-top: 5px; flex-shrink: 0; }
.tl-dot.open { background: none; border: 2px solid var(--ok); }
.tl-dot.late { background: none; border: 2px solid var(--warn); }
.tl-dot.idle { background: var(--on-3); }
.tl-line { flex: 1; width: 1px; background: rgba(255, 255, 255, .24); margin: 4px 0; }
.tl-body { flex: 1; display: flex; justify-content: space-between; gap: 10px; padding-bottom: 14px; }

/* Шкалы */
.bar { height: 6px; border-radius: 3px; background: var(--ink-3); overflow: hidden; display: flex; flex: 1; }
.bar > span { display: block; height: 100%; background: var(--ink); }
.shape .bar { background: var(--on-3); }
.shape .bar > span { background: var(--on); }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 3px; }
.split > span { display: block; height: 100%; }
.meter { display: inline-flex; gap: 3px; }
.meter > span { width: 26px; height: 6px; border-radius: 3px; background: var(--ink-3); }
.meter.l3 > span { background: var(--ok); }
.meter.l2 > span:nth-child(-n+2) { background: var(--warn); }
.meter.l1 > span:first-child { background: rgba(12, 12, 13, .4); }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 560; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; background: var(--bg); color: var(--ink); width: 100%; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); }
input[type=file] { font: inherit; font-size: 14px; }
.shape input[type=text], .shape input[type=number], .shape input[type=date], .shape textarea, .shape select { background: var(--on-3); color: var(--on); border-color: rgba(255, 255, 255, .16); }
.shape input:focus, .shape textarea:focus, .shape select:focus { outline-color: var(--on); }
.shape .field > span { color: var(--on-2); }
details.drop > summary { list-style: none; cursor: pointer; }
details.drop > summary::-webkit-details-marker { display: none; }
details.drop[open] > summary { margin-bottom: 12px; }

/* Сообщения */
.flash { border-radius: 16px; padding: 12px 16px; font-size: 14px; font-weight: 540; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: rgba(45, 213, 107, .12); }
.flash.err { background: rgba(255, 177, 59, .18); }
.hint { font-size: 14px; color: var(--ink-2); line-height: 1.4; }

/* Табы-сегменты */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--ink-3); }
.seg a { height: 40px; padding: 0 18px; border-radius: 20px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 560; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--ink); color: var(--on); font-weight: 600; }

/* Фото */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumbs a { display: block; border-radius: 12px; overflow: hidden; background: var(--ink-3); aspect-ratio: 1; position: relative; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.t .thumbs { grid-template-columns: repeat(auto-fill, 64px); margin-top: 8px; }
.t .thumbs .cap { font-size: 10px; left: 4px; bottom: 4px; }
.thumbs .cap { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(12, 12, 13, .7); color: var(--on); border-radius: 6px; padding: 1px 6px; }
.filechip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 10px; background: var(--ink-3); text-decoration: none; }

/* Бумажный предпросмотр */
.paper { border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 18px 40px -22px rgba(12, 12, 13, .28); padding: 34px 48px; font-family: "Times New Roman", Times, serif; font-size: 14px; line-height: 1.45; }

/* Публичные страницы */
.pub { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 64px; }
.pub-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 52px; letter-spacing: -.03em; }
.hero .lead { font-size: 19px; color: var(--ink-2); margin-top: 18px; max-width: 520px; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.step { border-radius: 24px; border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.step b { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.auth { max-width: 440px; margin: 64px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 14px; }
.legal h2 { margin-top: 18px; font-size: 18px; }
.foot { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--ink-3); padding-top: 20px; }

@media (max-width: 1100px) {
  .grid { flex-direction: column; }
  .grid > .aside { width: 100%; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--ink-3); }
  .company-box, .side-foot .me { display: none; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; }
  .nav a { height: 38px; flex-shrink: 0; }
  .side-foot { margin-top: 0; margin-left: auto; }
  .main { padding: 20px 16px 32px; }
  h1 { font-size: 28px; }
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: 38px; }
  .cols-3, .cols-2, .form-grid { grid-template-columns: 1fr; }
  .shape { padding: 20px; }
  .table-scroll { overflow-x: auto; max-width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .nav, .seg { scrollbar-width: none; }
  .nav::-webkit-scrollbar, .seg::-webkit-scrollbar { display: none; }
  .seg { max-width: 100%; overflow-x: auto; }
  .page-head .seg { width: 100%; }
  .btn, .btn-ghost, .btn-on, .btn-on-ghost { white-space: normal; height: auto; min-height: 44px; padding: 10px 18px; text-align: center; }
  .btn-sm { min-height: 34px; padding: 6px 12px; }
  .card, .shape, .grid > .wide { max-width: 100%; min-width: 0; }
  .grid > section[style*="width:420px"] { width: 100% !important; }
  .big { font-size: 34px; }
  .paper { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
