/* Часть стилей ЗамерПро. Исходный public/css/app.css разбит для надёжной загрузки через туннель. */
.status-select button:hover { color: var(--ink-2); }
.status-select button.is-active { background: var(--surface-3); color: var(--ink); }
.status-select button[data-status="measured"].is-active { color: var(--accent-hi); background: rgba(59, 130, 246, .15); }
.status-select button[data-status="approved"].is-active { color: var(--ok); background: rgba(52, 211, 153, .13); }
.status-select button[data-status="rework"].is-active { color: var(--warn); background: rgba(251, 191, 36, .13); }

/* комментарии */
.comment-list { display: flex; flex-direction: column; gap: 9px; }
.comment { display: flex; gap: 9px; }
.comment .avatar { width: 26px; height: 26px; font-size: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted-2); flex-wrap: wrap; }
.comment-head b { color: var(--ink-2); font-size: 12px; }
.comment-text { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.comment-param { font-family: var(--mono); font-size: 10px; background: rgba(139, 92, 246, .16); color: #c4b5fd; border-radius: 5px; padding: 0 5px; border: 1px solid rgba(139, 92, 246, .28); }
.comment-actions { display: flex; gap: 3px; margin-left: auto; opacity: 0; }
.comment:hover .comment-actions { opacity: 1; }
.comment-form { display: flex; gap: 7px; margin-top: 10px; }
.comment-form textarea { flex: 1; min-height: 38px; height: 38px; }
.comment-form .btn { align-self: flex-end; }

/* панель сохранения */
.save-bar {
  position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 11px;
  margin: 14px -18px -18px; padding: 11px 18px;
  background: rgba(8, 13, 21, .92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: max(11px, env(safe-area-inset-bottom));
}
.save-bar .state { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.save-bar .state b { color: var(--warn); font-weight: 650; }
.save-bar .state.ok b { color: var(--ok); }
.save-bar .spacer { flex: 1; }
.dot-dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, .15); }
.dot-clean { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .14); }

/* модалки */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(4, 7, 12, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; animation: fade .14s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3); width: min(520px, 100%); max-height: 88vh; display: flex; flex-direction: column; animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6; } }
.modal-head { display: flex; align-items: center; gap: 9px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; }
.modal-head .btn-icon { margin-left: auto; }
.modal-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; gap: 7px; justify-content: flex-end; padding: 13px 16px; border-top: 1px solid var(--line); }

/* тосты */
.toasts { position: fixed; z-index: 200; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 7px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--field-bg-3); border: 1px solid var(--line-2); color: var(--ink); font-size: 12.5px; font-weight: 550; padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow-3); animation: toastIn .2s ease-out; max-width: 92vw; }
.toast.ok { border-color: rgba(52, 211, 153, .45); background: #0c2a22; }
.toast.err { border-color: rgba(248, 113, 113, .45); background: #2a0f14; }
.toast.warn { border-color: rgba(251, 191, 36, .45); background: #2a2008; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* логин */
.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 18px;
  background: radial-gradient(900px 520px at 14% -10%, #16294a 0%, transparent 58%),
              radial-gradient(760px 460px at 108% 108%, #1a2350 0%, transparent 55%), #060910;
}
.login-card { width: min(392px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-3); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-card h1 { font-size: 17px; margin-bottom: 3px; }
.login-card .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.login-card .field { margin-bottom: 11px; }
.login-err { background: var(--danger-soft); color: #fca5a5; font-size: 12px; padding: 8px 10px; border-radius: 8px; margin-bottom: 9px; border: 1px solid rgba(248, 113, 113, .3); }
.demo-accounts { margin-top: 16px; border-top: 1px dashed var(--line-2); padding-top: 12px; }
.demo-accounts .t { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; margin-bottom: 7px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.demo-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; text-align: left; }
.demo-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-btn b { font-weight: 650; font-size: 11.5px; color: var(--ink-2); }
.demo-btn span { color: var(--muted-2); font-size: 10px; }

/* админ */
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); padding: 8px 11px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table td { padding: 9px 11px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }

/* тип узла */
.type-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.type-row:last-child { border-bottom: 0; }
.type-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); color: var(--accent-hi); display: grid; place-items: center; flex: none; }
.type-params { display: flex; gap: 4px; flex-wrap: wrap; }
.type-params span { font-family: var(--mono); font-size: 10px; background: var(--field-bg-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--muted); }

/* мобильное */
.bottom-nav { display: none; }

/* =========================================================
   Адаптив
   ========================================================= */
@media (max-width: 1240px) {
  .node-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 1020px) {
  .node-layout { grid-template-columns: minmax(0, 1fr); }
  .mp-body { max-height: none; }
}

@media (max-width: 860px) {
  .hide-m { display: none !important; }
  .crumbs .crumb-mid { display: none; }
  .viewer-badge { display: none; }
  .viewer-stage svg { max-height: 42vh; }
  .tool-btn { height: 30px; padding: 0 9px; font-size: 11.5px; }
  .page-actions .btn { flex: 0 1 auto; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .panel-title { font-size: 13px; }
  .node-thumb svg { max-height: 210px; }
  .mp-head .t { font-size: 11px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 292px; max-width: 86vw; transform: translateX(-102%); transition: transform .22s ease; height: 100vh; height: 100dvh; box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
  .app-shell.nav-open .sidebar { transform: none; }
  .app-shell.nav-open .drawer-veil { display: block; position: fixed; inset: 0; background: rgba(4, 7, 12, .6); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 11px; height: 52px; gap: 7px; }
  .content { padding: 12px 12px 78px; }
  .save-bar { margin: 12px -12px -78px; padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 19px; }
  .page-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .page-actions .btn-primary { flex: 1; }
  .crumbs .hide-m { display: none; }

  .bottom-nav { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(8, 13, 21, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav .inner { display: flex; }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; color: var(--muted-2); font-size: 10px; font-weight: 600; text-decoration: none; }
  .bn-item svg { width: 20px; height: 20px; }
  .bn-item.is-active { color: var(--accent-hi); }
  .toasts { bottom: 72px; }

  .param-card { grid-template-columns: 26px minmax(0, 1fr) 118px; gap: 8px; padding: 8px 9px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
  .kpi-value { font-size: 17px; }
  .cards, .node-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { width: 100%; max-height: 92vh; }
  .viewer-stage { padding: 52px 8px 32px; min-height: 300px; }
  .viewer-hint { display: none; }
  .viewer { min-height: 320px; }
}

@media (max-width: 420px) {
  .demo-grid { grid-template-columns: 1fr; }
  .panel-body { padding: 12px; }
  .panel-head { padding: 11px 13px; }
  .param-card { grid-template-columns: 24px minmax(0, 1fr) 104px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .save-bar, .page-actions, .viewer-toolbar { display: none !important; }
  .app-shell { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}

.scene-svg, .room-svg { display: block; width: 100%; height: auto; }
.elevation-scroll { overflow-x: auto; overflow-y: hidden; }
.elevation-scroll .room-svg { min-width: 720px; }
.dims text { pointer-events: none; }

/* ---------- сводка по погонным метрам ---------- */
.summary-strip {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(180deg, #121d2e, #0b121b);
  border: 1px solid var(--line-2); border-radius: 14px;
  padding: 11px 18px; margin-bottom: 16px; box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.summary-strip::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, #3b82f6, #22d3ee);
}
.ss-main { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.ss-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; }
.ss-value { font-size: 27px; font-weight: 750; letter-spacing: -.03em; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.ss-value small { font-size: 12px; color: var(--accent-hi); margin-left: 5px; font-weight: 650; letter-spacing: 0; }
.ss-divider { width: 1px; height: 32px; background: var(--line-2); }
.ss-cells { display: flex; gap: 20px; flex-wrap: wrap; }
.ss-cell { display: flex; flex-direction: column; gap: 1px; }
.ss-cell span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; }
.ss-cell b { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 650; }
.ss-spacer { flex: 1; min-width: 8px; }
.ss-note { font-size: 11px; color: var(--muted-2); }

@media (max-width: 860px) {
  .summary-strip { gap: 10px; padding: 9px 12px 9px 15px; border-radius: 12px; }
  .ss-value { font-size: 22px; }
  .ss-cells { gap: 14px; }
  .ss-note { display: none; }
  .ss-divider { display: none; }
}

/* ---------- печать замерного листа ---------- */
@media print {
  body { background: #fff !important; color: #111; }
  .summary-strip, .save-bar, .bottom-nav, .topbar-actions, .panel-head .btn { display: none !important; }
  .content { padding: 0 !important; }
  .panel { break-inside: avoid; box-shadow: none; border-color: #ccc; }
  .elevation-scroll .room-svg { min-width: 0; }
  .node-card { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.ss-accent span { color: var(--accent-hi); }
.ss-accent b { color: #dbeafe; }

/* ---------- вкладка «Чертёж» ---------- */
.drawing-svg {
  display: block; width: 100%; height: auto; border-radius: 8px;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .9);
}
