/* =====================================================================
   ЦифроАссистент · Самострой-Контроль
   Дневная стройплощадка: небо, земля, краны, экскаватор, конусы
   ===================================================================== */

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

:root {
  /* небо */
  --sky-top: #bfe4fb;
  --sky-mid: #dff1fc;
  --sky-low: #f6f1e3;    /* песочный отблеск у горизонта */

  /* земля — песок / бетон */
  --ground-1: #e4d4a7;
  --ground-2: #c9b27a;

  /* «бумага» для карточек */
  --paper: #ffffff;
  --paper-2: #f8f4e9;
  --paper-line: #e4dcc4;

  /* текст */
  --ink: #1a1a1f;
  --ink-2: #3a3a42;
  --ink-muted: #6c6c76;

  /* сигнальные цвета (стройка) */
  --caution-yellow: #f5c518;   /* сигнальный жёлтый */
  --caution-yellow-dark: #d89e00;
  --caution-black: #1a1a1f;

  --cone-orange: #ff7a2b;
  --safety-red: #e23a3a;
  --brick: #a35330;

  /* акценты плиток */
  --accent-blue:   #2a6fdb;
  --accent-green:  #2e9b5b;
  --accent-purple: #7b4fc7;
  --accent-rose:   #d6365c;

  --shadow-sm: 0 2px 6px rgba(60, 50, 20, 0.08);
  --shadow-md: 0 10px 30px -10px rgba(60, 50, 20, 0.2);
  --shadow-lg: 0 24px 60px -20px rgba(40, 30, 10, 0.3);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;

  --font-display: 'Unbounded', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
}

/* ========================= reset ========================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sky-top);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================= живой фон ========================= */

/* Слой 1 — дневное небо */
.bg-sky {
  position: fixed; inset: 0; z-index: -10;
  background:
    linear-gradient(180deg,
      var(--sky-top) 0%,
      var(--sky-mid) 45%,
      var(--sky-low) 75%,
      var(--ground-1) 75%,
      var(--ground-2) 100%);
  pointer-events: none;
}

/* Солнце */
.bg-sky::before {
  content: '';
  position: absolute;
  top: 80px; right: 12%;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff7c8 0%, #ffd873 45%, rgba(255,216,115,0) 75%);
  filter: blur(2px);
  animation: sun-pulse 6s ease-in-out infinite;
}
@keyframes sun-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.95; }
  50%      { transform: scale(1.08); opacity: 1; }
}

/* Слой 2 — плывущие облака */
.bg-clouds {
  position: fixed; inset: 0; z-index: -9;
  pointer-events: none;
}
.cloud {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.9;
  filter: blur(0.4px);
  box-shadow:
    40px 10px 0 -4px white,
    80px  5px 0 -8px white,
    -30px 12px 0 -6px white,
    20px -8px 0 -10px white;
  animation: cloud-pass linear infinite;
}
.cloud.c1 { top: 8%;  left: -20%; width: 70px; height: 30px; animation-duration: 90s; }
.cloud.c2 { top: 18%; left: -20%; width: 50px; height: 22px; animation-duration: 120s; animation-delay: -30s; }
.cloud.c3 { top: 14%; left: -20%; width: 90px; height: 36px; animation-duration: 150s; animation-delay: -80s; opacity: 0.75; }
@keyframes cloud-pass {
  from { transform: translateX(0); }
  to   { transform: translateX(140vw); }
}

/* Слой 3 — дальний силуэт зданий на горизонте */
.bg-horizon {
  position: fixed; left: 0; right: 0; bottom: 18%;
  height: 120px; z-index: -8;
  pointer-events: none;
  opacity: 0.55;
}
.bg-horizon svg { width: 100%; height: 100%; display: block; }

/* Слой 4 — стройплощадка */
.bg-site {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 38vh;  min-height: 260px; max-height: 380px;
  z-index: -7;
  pointer-events: none;
  overflow: hidden;
}

/* Строительные краны — занимают всю высоту, крупные */
.crane {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
}
.crane-left  { left: 4%;  width: 200px; height: 280px; animation: crane-sway 16s ease-in-out infinite; }
.crane-right { right: 8%; width: 180px; height: 260px; animation: crane-sway 20s ease-in-out infinite reverse; transform: scaleX(-1); }
@keyframes crane-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50%      { transform: rotate(1.2deg); }
}
.crane-right { animation-name: crane-sway-r; }
@keyframes crane-sway-r {
  0%, 100% { transform: scaleX(-1) rotate(-1.2deg); }
  50%      { transform: scaleX(-1) rotate(1.2deg); }
}

/* Груз на тросе — качается */
.crane .load {
  transform-origin: top center;
  animation: load-swing 4s ease-in-out infinite;
}
@keyframes load-swing {
  0%, 100% { transform: translateX(-3px); }
  50%      { transform: translateX(3px); }
}

/* Экскаватор — едет по стройплощадке */
.excavator {
  position: absolute;
  bottom: 12%;
  width: 170px; height: 90px;
  left: -200px;
  animation: excavator-drive 45s linear infinite;
}
@keyframes excavator-drive {
  0%   { left: -200px; }
  100% { left: 105%; }
}

/* Ковш экскаватора — поднимается и опускается */
.excavator .boom {
  transform-origin: 60px 55px;
  animation: boom-dig 6s ease-in-out infinite;
}
@keyframes boom-dig {
  0%, 100% { transform: rotate(-5deg); }
  40%      { transform: rotate(18deg); }
  60%      { transform: rotate(18deg); }
}

/* Дорожные конусы */
.cones {
  position: absolute;
  bottom: 8%; left: 0; right: 0;
  height: 60px;
  display: flex;
  justify-content: space-around;
  padding: 0 8%;
  pointer-events: none;
}
.cones svg { width: 38px; height: 50px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25)); }

/* Ограждение — редкие столбики с красно-белыми полосами */
.bg-site::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 7%;
  height: 4px;
  background:
    repeating-linear-gradient(90deg,
      var(--safety-red) 0 18px,
      white 18px 36px);
  opacity: 0.75;
}

/* Чертёжная сетка сверху — слабая */
.bg-grid {
  position: fixed; inset: 0; z-index: -6;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(26, 26, 31, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 26, 31, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, black 0%, rgba(0,0,0,0.4) 40%, transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, black 0%, rgba(0,0,0,0.4) 40%, transparent 70%);
}

/* ========================= layout ========================= */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 22px 80px;
  position: relative;
}

/* ========================= шашечная лента (caution tape) ========================= */
.caution-tape {
  height: 18px;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--caution-yellow) 0 22px,
      var(--caution-black) 22px 36px);
  border-radius: 3px;
  margin: 22px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  position: relative;
}

/* ========================= топбар ========================= */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 22px;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
/* Каска-логотип */
.logo-helmet {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
}
.logo-helmet svg { width: 100%; height: 100%; display: block; }
.logo-text small {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}

.topbar-spacer { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  background: rgba(46, 155, 91, 0.12);
  border: 1px solid rgba(46, 155, 91, 0.3);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1d7a45;
  letter-spacing: 0.01em;
}
.status-pill.warn {
  background: rgba(245, 197, 24, 0.18);
  border-color: rgba(217, 158, 0, 0.4);
  color: #8a6200;
}
.status-pill.err {
  background: rgba(226, 58, 58, 0.12);
  border-color: rgba(226, 58, 58, 0.35);
  color: #a01818;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  animation: dot-pulse 2s ease-out infinite;
}
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; }
  70%  { box-shadow: 0 0 0 7px rgba(46, 155, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 155, 91, 0); }
}

/* ========================= hero ========================= */
.hero {
  position: relative;
  padding: 36px 34px 34px;
  margin-bottom: 0;
  border-radius: var(--r-lg);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/* «Штамп» чертежа */
.hero::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--paper-line);
  border-radius: calc(var(--r-lg) - 6px);
  pointer-events: none;
}
/* Жёлтая диагональная полоса-лычка в углу */
.hero::after {
  content: 'СТРОЙНАДЗОР';
  position: absolute;
  top: 20px; right: -52px;
  width: 200px;
  padding: 6px 0;
  background: var(--caution-yellow);
  color: var(--caution-black);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
  transform: rotate(34deg);
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 8px;
  background: var(--caution-yellow);
  color: var(--caution-black);
  border-radius: 4px;
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}
.hero-kicker::before {
  content: '';
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid var(--caution-black);
  margin-right: 2px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 4.8vw, 56px);
  line-height: 1.03;
  margin: 0 0 14px;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.hero h1 .underline {
  position: relative;
  display: inline-block;
  color: var(--ink);
}
.hero h1 .underline::after {
  content: '';
  position: absolute;
  left: -2px; right: -2px; bottom: 2px;
  height: 14px;
  background: var(--caution-yellow);
  z-index: -1;
  border-radius: 2px;
}
.hero p.lead {
  margin: 0 0 22px;
  font-size: 16.5px;
  color: var(--ink-2);
  max-width: 720px;
}
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 30px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--paper-line);
}
.hero-stat { min-width: 110px; }
.hero-stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}
.hero-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-muted);
  font-weight: 700;
}

/* ========================= tile grid ========================= */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 20px;
  min-height: 170px;
  border-radius: var(--r-md);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  cursor: pointer;
  color: inherit;
  text-align: left;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition:
    transform .3s cubic-bezier(.2,.8,.2,1),
    border-color .2s,
    box-shadow .3s;
  opacity: 0;
  animation: tile-enter .5s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: calc(var(--i, 0) * 60ms + 150ms);
}
@keyframes tile-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Цветная полоса слева — как метка на папке */
.tile::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--tile-accent, var(--caution-yellow));
}
/* Штамп «угол» в правом верхнем */
.tile::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 38px; height: 38px;
  background: linear-gradient(225deg, var(--tile-accent-soft, rgba(245,197,24,0.22)) 50%, transparent 50%);
  pointer-events: none;
  opacity: 0.7;
}
.tile:hover {
  transform: translateY(-3px);
  border-color: var(--tile-accent, var(--caution-yellow));
  box-shadow: var(--shadow-md);
}
.tile:active { transform: translateY(-1px); }

.tile-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--tile-accent-soft, rgba(245,197,24,0.18));
  color: var(--tile-accent, var(--caution-yellow-dark));
  flex-shrink: 0;
  position: relative; z-index: 1;
}
.tile-icon svg { width: 26px; height: 26px; }

.tile h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tile p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}
.tile-meta {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  padding-top: 8px;
}
.tile-arrow {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
  transition: transform .3s, background .3s, color .3s;
  font-size: 14px;
}
.tile:hover .tile-arrow {
  background: var(--tile-accent, var(--caution-yellow));
  color: var(--ink);
  transform: translateX(3px);
}

/* Акценты плиток */
.tile[data-accent="yellow"] { --tile-accent: var(--caution-yellow-dark); --tile-accent-soft: rgba(245,197,24,0.22); }
.tile[data-accent="blue"]   { --tile-accent: var(--accent-blue);   --tile-accent-soft: rgba(42,111,219,0.12); }
.tile[data-accent="purple"] { --tile-accent: var(--accent-purple); --tile-accent-soft: rgba(123,79,199,0.14); }
.tile[data-accent="green"]  { --tile-accent: var(--accent-green);  --tile-accent-soft: rgba(46,155,91,0.14); }
.tile[data-accent="rose"]   { --tile-accent: var(--accent-rose);   --tile-accent-soft: rgba(214,54,92,0.12); }
.tile[data-accent="orange"] { --tile-accent: var(--cone-orange);   --tile-accent-soft: rgba(255,122,43,0.15); }

/* ========================= секции (экраны) ========================= */
.section {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-md);
  animation: section-enter .45s cubic-bezier(.2,.8,.2,1);
}
@keyframes section-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section.hidden { display: none; }

.section-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--paper-line);
  position: relative;
}
.section-head::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 80px; height: 2px;
  background: var(--caution-yellow);
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.section-head .sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 2px;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.back-btn:hover {
  background: var(--caution-yellow);
  color: var(--ink);
  transform: translateX(-2px);
}

/* ========================= формы ========================= */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field label .req { color: var(--safety-red); margin-left: 2px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="search"], input[type="number"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1.5px solid var(--paper-line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 96px; font-family: inherit; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--caution-yellow-dark);
  background: white;
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.25);
}
input.invalid, textarea.invalid, select.invalid {
  border-color: var(--safety-red);
  box-shadow: 0 0 0 3px rgba(226, 58, 58, 0.15);
}
.field .err-msg {
  margin-top: 6px;
  font-size: 12px;
  color: var(--safety-red);
  min-height: 16px;
  font-weight: 600;
}

/* загрузка фото */
.photo-drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 26px 20px;
  background: var(--paper-2);
  border: 2px dashed var(--paper-line);
  border-radius: var(--r-md);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.photo-drop:hover, .photo-drop.drag {
  border-color: var(--caution-yellow-dark);
  background: #fff9e0;
  color: var(--ink);
}
.photo-drop input[type="file"] { display: none; }
.photo-drop svg { width: 32px; height: 32px; color: var(--caution-yellow-dark); }
.photo-drop b { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.photo-drop small { font-size: 12px; color: var(--ink-muted); }

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.photo-preview:empty { display: none; }
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--paper-line);
  background: var(--paper-2);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .rm {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: rgba(26, 26, 31, 0.75);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 16px; line-height: 1;
  transition: background .2s;
}
.photo-item .rm:hover { background: var(--safety-red); }

/* ========================= кнопки ========================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--caution-yellow);
  color: var(--ink);
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform .15s, box-shadow .3s, background .2s;
  box-shadow: 0 4px 14px -4px rgba(217, 158, 0, 0.5);
  position: relative;
}
.btn:hover {
  transform: translateY(-2px);
  background: #fcd23f;
  box-shadow: 0 8px 22px -4px rgba(217, 158, 0, 0.65);
}
.btn:active { transform: translateY(0); }
.btn:disabled { filter: grayscale(.5) opacity(.7); cursor: not-allowed; transform: none; }

.btn.ghost {
  background: var(--paper-2);
  border: 1.5px solid var(--paper-line);
  color: var(--ink-2);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--paper-line); color: var(--ink); box-shadow: none; }

.btn.success {
  background: var(--accent-green);
  color: white;
  box-shadow: 0 4px 14px -4px rgba(46, 155, 91, 0.5);
}
.btn.success:hover { background: #36b36a; box-shadow: 0 8px 22px -4px rgba(46, 155, 91, 0.65); }

.actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 20px;
}

/* ========================= чаты / ответы ========================= */
.ask-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}
.answer {
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  padding: 16px;
  min-height: 90px;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.55;
  font-size: 14.5px;
}
.answer.loading { color: var(--ink-muted); font-style: italic; }
.answer.loading::after {
  content: ' ▊';
  animation: caret 1s steps(2) infinite;
  color: var(--caution-yellow-dark);
}
@keyframes caret { 50% { opacity: 0; } }

/* ========================= таблица графика ========================= */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  max-height: 540px;
  background: var(--paper);
}
.table-wrap table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13.5px;
}
.table-wrap th, .table-wrap td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--paper-line);
  color: var(--ink);
}
.table-wrap th {
  position: sticky; top: 0; z-index: 1;
  background: var(--paper-2);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 2px solid var(--caution-yellow);
}
.table-wrap tr:hover td { background: var(--paper-2); }
.today-row td {
  background: rgba(245, 197, 24, 0.18) !important;
  font-weight: 600;
}
.link-btn {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(42, 111, 219, 0.1);
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}
.link-btn:hover { background: rgba(42, 111, 219, 0.2); text-decoration: none; }

/* ========================= листбокс ========================= */
.listbox {
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  color: var(--ink-2);
  font-size: 14px;
  border-left: 4px solid var(--caution-yellow);
}
.listbox b { color: var(--ink); font-weight: 700; }
.listbox .item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--paper-line);
}
.listbox .item:last-child { border-bottom: none; }

/* ========================= профиль ========================= */
.profile-row {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.profile-row .who {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 220px;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--caution-yellow);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
  border: 2px solid var(--caution-black);
}
.who-text b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--ink); }
.who-text span { display: block; font-size: 12px; color: var(--ink-muted); font-weight: 600; }

/* ========================= footer ========================= */
.foot {
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ========================= helpers ========================= */
.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.spacer { height: 14px; }

/* ========================= responsive ========================= */
@media (max-width: 720px) {
  .wrap { padding: 14px 12px 60px; }
  .topbar { padding: 10px 14px; }
  .logo { font-size: 14px; }
  .logo-helmet { width: 40px; height: 40px; }
  .hero { padding: 26px 22px 22px; }
  .hero::after { display: none; }
  .section { padding: 20px 18px; }
  .ask-row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .bg-site { height: 24vh; min-height: 180px; }
  .crane-left  { width: 140px; height: 200px; }
  .crane-right { width: 130px; height: 190px; }
  .excavator { width: 130px; height: 72px; bottom: 14%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =====================================================================
   Экран регистрации
   ===================================================================== */
.admin-gate {
  margin-top: 18px;
  padding: 16px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(245, 197, 24, 0.08) 0 10px,
    rgba(245, 197, 24, 0.15) 10px 20px);
  border: 1.5px dashed var(--caution-yellow-dark);
  border-radius: var(--r-sm);
}
.admin-gate-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 800;
  color: var(--caution-black);
  background: var(--caution-yellow);
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.admin-gate-label svg { color: var(--caution-black); }

/* =====================================================================
   Bell (колокольчик)
   ===================================================================== */
.bell-btn {
  position: relative;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.bell-btn:hover {
  background: var(--caution-yellow);
  color: var(--ink);
  transform: translateY(-1px);
}
.bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  display: grid; place-items: center;
  background: var(--safety-red);
  color: white;
  border: 2px solid var(--paper);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.bell-badge.hidden { display: none; }

/* =====================================================================
   Команда
   ===================================================================== */
.team-toolbar {
  display: grid;
  grid-template-columns: 1fr 160px 200px;
  gap: 10px;
  margin: 4px 0 16px;
}
.team-toolbar-search {
  position: relative;
}
.team-toolbar-search input[type="search"] {
  padding-left: 38px;
  padding-right: 36px;
  /* подавляем дефолтный «крестик» Safari/Chrome — у нас свой */
  -webkit-appearance: none;
  appearance: none;
}
.team-toolbar-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.team-toolbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}
.team-toolbar-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.team-toolbar-clear:hover { background: var(--paper-line); color: var(--ink); }
.team-toolbar-select {
  /* перебиваем width:100% от базового стиля select */
  width: 100% !important;
}
@media (max-width: 640px) {
  .team-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .team-toolbar-search {
    grid-column: 1 / -1;
  }
}

.group-head {
  margin: 18px 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.group-head:first-child { margin-top: 0; }

.person-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-sm);
  border-left: 4px solid var(--paper-line);
}
.person-row.is-pending {
  border-left-color: var(--caution-yellow-dark);
  background: #fff9e7;
}
.person-row.is-rejected {
  border-left-color: var(--safety-red);
  opacity: 0.6;
}
.person-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--caution-yellow);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
  font-size: 13px;
  border: 1.5px solid var(--caution-black);
}
.person-info { flex: 1; min-width: 0; }
.person-info b {
  display: block;
  font-family: var(--font-display);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
}
.person-info span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 600;
}
.person-actions {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.person-actions select {
  width: auto;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 140px;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
}
.pill-mini {
  display: inline-block;
  padding: 4px 10px;
  background: var(--caution-yellow);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
}

@media (max-width: 560px) {
  .person-row {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .person-actions {
    width: 100%;
    margin-left: 52px; /* выровнять с info под аватаром */
  }
  .person-actions select { min-width: 0; flex: 1; }
}

/* =====================================================================
   Уведомления
   ===================================================================== */
.notif-row {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-sm);
  border-left: 4px solid var(--paper-line);
}
.notif-row.unread {
  border-left-color: var(--caution-yellow-dark);
  background: #fffdf3;
}
.notif-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 4px;
}
.notif-msg {
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.notif-meta {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =====================================================================
   Согласование
   ===================================================================== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-badge.st-draft     { background: var(--paper-line); color: var(--ink-2); }
.status-badge.st-submitted { background: #fff3cf; color: #8a6200; }
.status-badge.st-approved  { background: #dcf3e6; color: #1d7a45; }
.status-badge.st-rework    { background: #ffe1e3; color: #a01818; }

.approver-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}
.approver-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  padding: 4px 2px 2px;
}
.approver-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1.5px solid var(--paper-line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.approver-row:hover { border-color: var(--caution-yellow-dark); background: #fff9e0; }
.approver-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--caution-yellow-dark);
  margin: 0;
  flex-shrink: 0;
}
.approver-row input { width: auto; padding: 0; background: none; border: none; }
.approver-row b {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
}
.approver-row span {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
}

/* =====================================================================
   Заблокированный график
   ===================================================================== */
.locked-cell {
  text-align: center;
  padding: 40px 20px !important;
  background: var(--paper-2) !important;
}
.locked-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.locked-cell b {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}

/* =====================================================================
   Искры (мелкая анимация на стройплощадке)
   ===================================================================== */
.spark {
  position: absolute;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--caution-yellow);
  box-shadow: 0 0 6px 1px rgba(245, 197, 24, 0.8);
  opacity: 0;
  animation: spark-fly 1.8s ease-out forwards;
}
@keyframes spark-fly {
  0% { transform: translate(0,0) scale(0.7); opacity: 1; }
  80% { opacity: 0.7; }
  100% { transform: translate(var(--dx, 0), var(--dy, -40px)) scale(0); opacity: 0; }
}

/* =====================================================================
   Экран приветствия (первый шаг регистрации — только кнопка)
   ===================================================================== */
.welcome-card {
  text-align: center;
  padding: 44px 32px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
}
.welcome-card::before {
  /* декоративная рамка-чертёж */
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--paper-line);
  border-radius: calc(var(--r-md) - 4px);
  pointer-events: none;
}
.welcome-icon {
  width: 96px; height: 96px;
  margin: 0 auto 18px;
  position: relative; z-index: 1;
  filter: drop-shadow(0 6px 14px rgba(217, 158, 0, 0.35));
  animation: helmet-bob 4s ease-in-out infinite;
}
.welcome-icon svg { width: 100%; height: 100%; display: block; }
@keyframes helmet-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}
.welcome-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--ink);
  position: relative; z-index: 1;
}
.welcome-lead {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 520px;
  margin: 0 auto 28px;
  position: relative; z-index: 1;
}
.btn-lg {
  padding: 16px 38px;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* =====================================================================
   Форма выезда
   ===================================================================== */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
}
.onzs-hint {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.onzs-hint.ok {
  background: var(--caution-yellow);
  border-color: var(--caution-yellow-dark);
  color: var(--caution-black);
}

/* =====================================================================
   Модалки (согласование, подпись за других, отправка)
   ===================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 18, 40, 0.5);
  display: grid; place-items: center;
  padding: 16px;
  animation: fade-in .2s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: pop-in .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
}

/* статус записи выезда в Google Sheets */
.sheets-ok {
  display: inline-block;
  padding: 6px 14px;
  background: #dcf3e6;
  color: #1d7a45;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}
.sheets-err {
  display: inline-block;
  padding: 8px 14px;
  background: #ffe1e3;
  color: #a01818;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 12.5px;
  max-width: 420px;
  text-align: left;
}

/* mini/danger buttons (используются и в Команде) */
.btn.mini{padding:8px 12px;font-size:13px;border-radius:12px}
.btn.danger{background:#fff;color:#c62828;border:1px solid #ffb4b4;box-shadow:none}
.btn.danger:hover{background:#fff5f5}

/* Кто добавил выезды */
.trips-role-block{margin-bottom:18px}
.trips-person{margin:8px 0;padding:10px 12px;border:1px solid rgba(20,30,55,.08);border-radius:14px;background:#fff}
.trips-person>summary{cursor:pointer;list-style:none;padding:4px 2px}
.trips-person>summary::-webkit-details-marker{display:none}
