/* LiftAI design system — из reference/liftai_demo_elma.html + страницы проектов */

:root {
  --ink: #1a2129;
  --sub: #5b6672;
  --bg: #eef1f4;
  --surface: #ffffff;
  --line: #dbe1e8;
  --line2: #eef1f5;
  --accent: #2b59c3;
  --accent-soft: #e7edfa;
  --ok: #1f7a4d;
  --ok-soft: #e3f2ea;
  --warn: #a05a08;
  --warn-soft: #fbf0dd;
  --risk: #c2372e;
  --risk-soft: #fbe7e5;
  --gold: #f4b843;
  --mono: 'IBM Plex Mono', monospace;
  --ui: 'Manrope', sans-serif;
  --radius: 5px;
  --radius-sm: 3px;
  --shadow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }

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

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px 80px; }

/* ── Шапка ── */
header { background: var(--ink); color: #fff; }
.topbar {
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.logo { font-weight: 800; font-size: 15px; letter-spacing: .02em; color: #fff; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo span { color: #7ea1ef; }
.topbar .crumb { color: #8b95a3; font-size: 12.5px; }
.topbar .crumb b { color: #fff; font-weight: 600; }
.topbar .spacer { margin-left: auto; }
.topbar .user-meta {
  font-family: var(--mono); font-size: 11.5px; color: #8b95a3;
  display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap;
}
.topbar .user-meta .nav-link {
  color: inherit; text-decoration: none; opacity: .85; margin-right: 4px;
}
.topbar .user-meta .nav-link:hover { opacity: 1; text-decoration: underline; }
.topbar .user-meta .nav-logout { display: inline; margin: 0; }
.topbar .user-meta button, .btn-ghost {
  appearance: none; border: 1px solid rgba(255,255,255,.18);
  background: transparent; color: #d6dce4; font-family: var(--ui);
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.topbar .user-meta button:hover, .btn-ghost:hover { background: rgba(255,255,255,.08); }

.nav-toggle {
  display: none;
  appearance: none; border: 1px solid rgba(255,255,255,.2);
  background: transparent; width: 40px; height: 36px; border-radius: var(--radius);
  cursor: pointer; padding: 8px 9px; flex-direction: column;
  justify-content: space-between; align-items: stretch; gap: 5px;
}
.nav-toggle span {
  display: block; height: 2px; background: #d6dce4; border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.project {
  max-width: 1180px; margin: 0 auto; padding: 26px 24px 22px;
  display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end;
}
.project h1 {
  font-size: 22px; font-weight: 800; letter-spacing: -.01em;
  line-height: 1.25; max-width: 640px;
}
.project .addr { color: #a7b0bd; font-size: 13px; margin-top: 6px; }
.project .addr .kad { font-family: var(--mono); font-size: 12px; }
.pstats { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.pstat {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius); padding: 8px 14px; min-width: 96px;
}
.pstat b { display: block; font-family: var(--mono); font-size: 16px; font-weight: 600; }
.pstat i { font-style: normal; font-size: 11px; color: #8b95a3; }

/* ── Вкладки ── */
nav.tabs { background: var(--ink); position: sticky; top: 0; z-index: 40; }
.tabs-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: flex; gap: 4px; overflow-x: auto;
}
.tab {
  appearance: none; border: 0; background: none; color: #98a2b0;
  font-family: var(--ui); font-size: 13.5px; font-weight: 600;
  padding: 13px 16px 11px; cursor: pointer;
  border-bottom: 2.5px solid transparent; white-space: nowrap;
  display: flex; gap: 8px; align-items: center;
}
.tab .n { font-family: var(--mono); font-size: 11px; opacity: .6; }
.tab:hover { color: #d6dce4; }
.tab.active { color: #fff; border-bottom-color: var(--gold); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.ok { background: #3fae77; }
.dot.warn { background: var(--gold); }
.dot.risk { background: #ef6a5f; }
.tab:disabled { opacity: .45; cursor: not-allowed; }

/* ── Общие блоки ── */
main { padding-top: 28px; }
section.panel { display: none; }
section.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px; font-weight: 800; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card h2 .hint { font-weight: 500; font-size: 12px; color: var(--sub); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* статусы */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: var(--radius-sm); letter-spacing: .01em;
  border: 1px solid transparent;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e2d3; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #edd9b0; }
.chip.risk { background: var(--risk-soft); color: var(--risk); border-color: #ebc4c0; }
.chip.info { background: var(--accent-soft); color: var(--accent); border-color: #c9d5ef; }

/* источник-чип */
.src {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 1px 4px;
  border-radius: 4px; vertical-align: baseline;
  border-bottom: 1px dotted var(--accent);
}
.src:hover { background: var(--accent-soft); }

#pop {
  position: absolute; z-index: 90; max-width: 380px;
  background: #131a22; color: #e8edf3; border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid rgba(255,255,255,.08);
  display: none; font-size: 12.5px;
}
#pop .pfile { font-family: var(--mono); font-size: 11px; color: #8fb2f5; margin-bottom: 6px; }
#pop .pq { border-left: 2px solid var(--gold); padding-left: 10px; color: #cfd6de; line-height: 1.5; }
#pop .pnote { margin-top: 8px; font-size: 11px; color: #8b95a3; }
#pop::after {
  content: ''; position: absolute; top: -6px; left: 24px;
  width: 12px; height: 12px; background: #131a22; transform: rotate(45deg);
}

/* таблицы */
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--sub); text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--line); font-weight: 700;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.val { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.fld { font-weight: 600; }
tr.hl-warn td { background: #fdf8ee; }
tr.hl-risk td { background: #fdf1f0; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.file {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  display: flex; gap: 12px; align-items: flex-start; background: #fbfcfd;
}
.file .ext {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  background: var(--ink); color: #fff; border-radius: 5px;
  padding: 4px 6px; min-width: 40px; text-align: center;
}
.file .fn { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.file .role { font-size: 11px; color: var(--sub); margin-top: 2px; }
.file .st { margin-top: 6px; }
.file-body { min-width: 0; flex: 1; }
.role-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px; font-size: 11px; color: var(--sub);
}
.role-prefix { font-weight: 600; }
.role-select {
  font-family: var(--ui); font-size: 12px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 3px 8px; background: #fff; max-width: 100%;
}
.upload-form .form-group input[type=file] {
  padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: #fbfcfd;
}

.summary p { margin-bottom: 10px; max-width: 840px; }
.summary .lead { font-size: 15px; }

footer { margin-top: 34px; font-size: 11.5px; color: var(--sub); text-align: center; }
footer b { font-family: var(--mono); }

/* ── Кнопки ── */
.btn {
  appearance: none; border: none; font-family: var(--ui); font-weight: 600;
  font-size: 13.5px; padding: 9px 16px; border-radius: var(--radius); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #234aa8; }
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--line2); }
.btn-danger { background: var(--risk); color: #fff; }
.btn-danger:hover { background: #a52e26; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { position: relative; }
.form-group input:disabled, .form-group textarea:disabled {
  background: var(--line2); color: var(--sub); cursor: not-allowed;
}
.form-group input.is-error, .form-group textarea.is-error {
  border-color: var(--risk); box-shadow: 0 0 0 3px var(--risk-soft);
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Формы ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--sub); margin-bottom: 6px; text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input, .form-group textarea {
  width: 100%; font-family: var(--ui); font-size: 14px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-error {
  background: var(--risk-soft); color: var(--risk); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 13px; font-weight: 600;
}

/* ── Логин ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.login-box {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px;
}
.login-box .brand {
  font-weight: 800; font-size: 20px; margin-bottom: 4px; letter-spacing: -.01em;
}
.login-box .brand span { color: #7ea1ef; }
.login-box .sub { color: var(--sub); font-size: 13px; margin-bottom: 22px; line-height: 1.4; }

/* ── Список проектов ── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { color: var(--sub); font-size: 13px; margin-top: 4px; }

.project-grid {
  display: flex; flex-direction: column; gap: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.project-card {
  background: var(--surface); border: 0; border-bottom: 1px solid var(--line2);
  border-radius: 0; padding: 12px 14px 12px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto;
  gap: 8px 16px; align-items: center;
  position: relative; transition: background .12s;
}
.project-card:last-child { border-bottom: none; }
.project-card:hover { background: #f7f9fb; box-shadow: none; border-color: transparent; }
.project-card .card-x {
  appearance: none; position: static; order: 4; justify-self: end;
  width: 30px; height: 30px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--sub); font-size: 20px; line-height: 1;
  cursor: pointer; opacity: .4; z-index: 2; grid-row: 1 / span 2;
}
.project-card .card-x:hover {
  opacity: 1; color: var(--risk); background: var(--risk-soft);
}
.project-card .title { padding-right: 0; grid-column: 1; }
.project-card a.title {
  font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none;
  line-height: 1.3;
}
.project-card a.title:hover { color: var(--accent); }
.project-card .obj {
  font-size: 12.5px; color: var(--sub); grid-column: 1; margin-top: -4px;
}
.project-card .counters {
  display: flex; gap: 8px; flex-wrap: wrap; grid-column: 2; grid-row: 1 / span 2;
  align-items: center;
}
.project-card .counters span {
  font-family: var(--mono); font-size: 11px; color: var(--sub);
  background: transparent; padding: 0; border-radius: 0;
}
.project-card .meta {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 0; padding-top: 0; border-top: none;
  font-size: 12px; color: var(--sub);
  grid-column: 3; grid-row: 1 / span 2; justify-self: end;
}
.project-card .meta .date { font-family: var(--mono); font-size: 11.5px; }

.empty {
  text-align: center; padding: 48px 24px; color: var(--sub);
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fbfcfd;
}
.empty p { margin-bottom: 16px; }

/* ── Прогресс анализа ── */
.progress-wrap {
  background: var(--line2); border-radius: var(--radius); height: 8px; overflow: hidden;
  margin: 10px 0 6px;
}
.progress-bar {
  height: 100%; background: var(--accent); border-radius: var(--radius);
  transition: width .4s ease; width: 0%;
}
.progress-label {
  font-family: var(--mono); font-size: 12px; color: var(--sub);
  display: flex; justify-content: space-between; gap: 12px;
}
.analysis-box.running { border-left: 4px solid var(--accent); }
.analysis-box.done { border-left: 4px solid var(--ok); }
.analysis-box.failed { border-left: 4px solid var(--risk); }

.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(10,16,24,.45);
  z-index: 100; align-items: center; justify-content: center; padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  max-width: 420px; width: 100%; border: 1px solid var(--line);
}
.modal h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--sub); font-size: 13px; margin-bottom: 18px; }
.modal .actions { justify-content: flex-end; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }

.editable-val {
  cursor: text; border-radius: 4px; outline: none;
}
.editable-val:hover { background: var(--accent-soft); }
.editable-val:focus {
  background: #fff; box-shadow: 0 0 0 2px var(--accent-soft);
  padding: 2px 4px;
}
.tab:disabled { opacity: .45; cursor: not-allowed; }
#params-table-wrap { overflow-x: auto; }

/* финансы */
.fin-total { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.fin-box {
  flex: 1; min-width: 200px; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; background: #fbfcfd;
}
.fin-box.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.fin-box b {
  display: block; font-family: var(--mono); font-size: 21px;
  font-weight: 600; margin-top: 4px;
}
.fin-box i { font-style: normal; font-size: 11.5px; color: var(--sub); }
.fin-box.accent i { color: #9aa4b2; }
.disclaimer {
  font-size: 12px; color: var(--warn); background: var(--warn-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 14px; line-height: 1.5;
}
.mono { font-family: var(--mono); font-size: 12.5px; }

/* подбор */
.models { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.model {
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px;
  background: var(--surface); position: relative;
}
.model.best { border-color: var(--accent); }
.model .tag {
  display: inline-flex; font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); padding: 2px 7px;
  border-radius: var(--radius-sm); border: 1px solid #c9d5ef; margin-bottom: 8px;
}
.model h3 { font-size: 15px; font-weight: 800; }
.model .mfr { font-size: 12px; color: var(--sub); margin-bottom: 10px; }
.spec {
  display: flex; justify-content: space-between; font-size: 12.5px;
  padding: 5px 0; border-bottom: 1px dashed var(--line2);
}
.spec span:last-child { font-family: var(--mono); font-weight: 500; }
.spec .bad { color: var(--risk); }
.spec .good { color: var(--ok); }
.model .verdict { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--sub); }

/* риски */
.risk-item {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; background: var(--surface);
}
.risk-item.r-high { border-left-color: var(--risk); }
.risk-item.r-mid { border-left-color: #e0a028; }
.risk-item.r-low { border-left-color: var(--ok); }
.risk-item h3 {
  font-size: 14px; font-weight: 800; display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap;
}
.risk-item p { margin-top: 6px; color: #3d4650; font-size: 13px; max-width: 860px; }
.risk-item .rec {
  margin-top: 8px; font-size: 12.5px; padding: 8px 12px;
  background: var(--line2); border-radius: var(--radius);
}
.risk-item .rec b { color: var(--accent); }

.klist { margin: 8px 0 0 18px; font-size: 13.5px; line-height: 1.55; }
.klist li { margin-bottom: 8px; }
.report-lead p { margin-bottom: 10px; font-size: 14px; line-height: 1.55; max-width: 920px; }
.card.summary .lead { font-size: 14.5px; line-height: 1.55; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table-scroll table { min-width: 520px; }

/* ── Адаптив (телефон / узкий экран) ── */
@media (max-width: 860px) {
  .wrap { padding: 0 14px 56px; }
  .topbar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; position: relative; }
  .topbar .crumb {
    order: 3; width: 100%; font-size: 11.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .nav-toggle { display: flex; margin-left: auto; }
  .topbar .spacer { display: none; }
  .topbar .user-meta {
    display: flex;
    position: absolute; top: calc(100% - 1px); left: 0; right: 0;
    z-index: 50; flex-direction: column; align-items: stretch;
    gap: 0; padding: 0; max-height: 0; overflow: hidden;
    background: #131a22; border-bottom: 1px solid transparent;
    font-size: 13px;
    opacity: 0; transform: translateY(-6px); pointer-events: none;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, max-height .22s ease,
      visibility .18s, border-color .18s, padding .18s;
  }
  .topbar .user-meta.open {
    opacity: 1; transform: none; pointer-events: auto; visibility: visible;
    max-height: 320px; padding: 8px 0 12px;
    border-bottom-color: rgba(255,255,255,.1);
  }
  .topbar .user-meta .nav-link,
  .topbar .user-meta .nav-user {
    display: block; padding: 12px 18px; margin: 0;
    color: #e8edf3; opacity: 1; text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .topbar .user-meta .nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; }
  .topbar .user-meta .nav-user { color: #8b95a3; font-size: 12px; }
  .topbar .user-meta .nav-logout { padding: 10px 18px 4px; }
  .topbar .user-meta .nav-logout button {
    width: 100%; justify-content: center; padding: 10px 14px;
  }

  .project { padding: 18px 14px 16px; gap: 14px; }
  .project h1 { font-size: 18px; max-width: none; }
  .pstats { margin-left: 0; width: 100%; }
  .pstat { flex: 1; min-width: 0; }

  .tabs-inner {
    padding: 0 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs-inner::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 12px 10px; font-size: 12.5px; gap: 6px; }
  .tab .n { font-size: 10px; }

  main { padding-top: 16px; }
  .card { padding: 16px 14px; margin-bottom: 14px; border-radius: var(--radius); }
  .card h2 { font-size: 14.5px; margin-bottom: 12px; }
  .card h2 .hint { width: 100%; }

  .files { grid-template-columns: 1fr; }
  .file { padding: 12px; }
  .project-grid { grid-template-columns: 1fr; }
  .models { grid-template-columns: 1fr; }
  .fin-box { min-width: 0; flex: 1 1 100%; }
  .fin-box b { font-size: 18px; }

  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-head h1 { font-size: 19px; }
  .page-head .btn { width: 100%; justify-content: center; }

  .actions { gap: 8px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; min-height: 42px; }
  .btn { min-height: 40px; padding: 10px 14px; }
  .btn-sm { min-height: 36px; }

  /* iOS: не зумить поля при фокусе */
  .form-group input,
  .form-group textarea,
  .form-group select,
  .role-select,
  input, select, textarea {
    font-size: 16px !important;
  }

  th, td { padding: 8px 8px; }
  td.num, th.num, .val { font-size: 12px; }

  #pop {
    position: fixed; left: 12px !important; right: 12px; top: auto !important;
    bottom: 16px; max-width: none; width: auto;
    z-index: 120;
  }
  #pop::after { display: none; }

  .modal-backdrop { padding: 16px; align-items: flex-end; }
  .modal { max-width: none; border-radius: var(--radius) var(--radius) 0 0; padding: 20px 16px; }
  .modal .actions { flex-direction: column-reverse; }
  .modal .actions .btn { width: 100%; justify-content: center; }

  .login-page { padding: 16px; align-items: flex-start; padding-top: max(24px, env(safe-area-inset-top)); }
  .login-box { padding: 24px 18px; border-radius: var(--radius); }

  .inline-form .form-group { min-width: 100%; }
  .spec { gap: 10px; flex-wrap: wrap; }
  .spec span:last-child { text-align: left; width: 100%; }

  .risk-item { padding: 14px; }
  .risk-item h3 { font-size: 13.5px; }

  footer { margin-top: 24px; padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 420px) {
  .tab { padding: 11px 9px 9px; font-size: 12px; }
  .project h1 { font-size: 16.5px; }
  .pstat { padding: 8px 10px; min-width: 0; }
  .pstat b { font-size: 14px; }
}




/* skeleton */
.skeleton-lines { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.skeleton-line {
  height: 10px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--line2) 0%, #e4e9ef 45%, var(--line2) 90%);
  background-size: 200% 100%;
  animation: sk 1.1s ease-in-out infinite;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }
@keyframes sk {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 860px) {
  .project-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
  }
  .project-card .title { grid-column: 1; grid-row: 1; }
  .project-card .obj { grid-column: 1; grid-row: 2; }
  .project-card .counters { grid-column: 1; grid-row: 3; }
  .project-card .meta { grid-column: 1; grid-row: 4; justify-self: start; }
  .project-card .card-x { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
}
