/* ---------- Фирменные цвета InLife (по логотипу: бирюзовый #003333 и зелёный крест) ---------- */
:root, html[data-theme="light"] {
  --inlife-teal: #003333;
  --inlife-teal-2: #0a4a45;
  --inlife-green: #6fa105;
  --inlife-page: #f2f6f4;            /* мягкий мятный фон страниц */
  --inlife-card: #ffffff;
  --primary: #0e5f59;                /* заголовки разделов */
  --secondary: #0e5f59;
  --accent: #9ccc3d;
  --primary-fg: #ffffff;
  --header-bg: var(--inlife-teal);
  --header-color: #cfe5e0;
  --header-branding-color: #ffffff;
  --header-link-color: #ffffff;
  --breadcrumbs-bg: var(--inlife-teal-2);
  --breadcrumbs-fg: #cfe5e0;
  --breadcrumbs-link-fg: #ffffff;
  --link-fg: #0b6158;
  --link-hover-color: #003333;
  --link-selected-fg: #0e5f59;
  --button-bg: #0e5f59;
  --button-hover-bg: #003333;
  --default-button-bg: #3d7a0c;      /* «Сохранить» — фирменный зелёный */
  --default-button-hover-bg: #2f6008;
  --selected-row: #eef6dd;
  --body-bg: var(--inlife-page);
  --darkened-bg: #e8efec;
  --selected-bg: #dde8e4;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --inlife-page: #0f1a19;
    --inlife-card: #152321;
    --primary: #155e58;
    --secondary: #155e58;
    --accent: #9ccc3d;
    --breadcrumbs-bg: #0a3a36;
    --link-fg: #9fd25a;
    --link-hover-color: #c4e88f;
    --link-selected-fg: #9fd25a;
    --button-bg: #1a6d66;
    --button-hover-bg: #0e5f59;
    --default-button-bg: #4c8f12;
    --default-button-hover-bg: #3d7a0c;
    --selected-row: #22361f;
    --body-bg: var(--inlife-page);
    --darkened-bg: #182a28;
    --selected-bg: #203633;
  }
}
html[data-theme="dark"] {
  --inlife-page: #0f1a19;
  --inlife-card: #152321;
  --primary: #155e58;
  --secondary: #155e58;
  --accent: #9ccc3d;
  --breadcrumbs-bg: #0a3a36;
  --link-fg: #9fd25a;
  --link-hover-color: #c4e88f;
  --link-selected-fg: #9fd25a;
  --button-bg: #1a6d66;
  --button-hover-bg: #0e5f59;
  --default-button-bg: #4c8f12;
  --default-button-hover-bg: #3d7a0c;
  --selected-row: #22361f;
  --body-bg: var(--inlife-page);
  --darkened-bg: #182a28;
  --selected-bg: #203633;
}

/* ---------- Шапка с логотипом ---------- */
#header { background: var(--inlife-teal); padding-top: 8px; padding-bottom: 8px; }
#header::after {  /* тонкая зелёная полоса, как градиент креста */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #356905, var(--inlife-green), #9ccc3d);
}
#header { position: relative; }
div.breadcrumbs { background: var(--inlife-teal-2); }
.inlife-brand { display: flex; align-items: center; gap: 14px; text-decoration: none !important; }
.inlife-logo-wide { height: 52px; width: auto; display: block; }
.inlife-logo-stacked { display: none; }
.inlife-brand-text {
  color: var(--header-color); font-size: 1rem; font-weight: 400; letter-spacing: 0.02em;
  padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.25);
}
@media (max-width: 767px) {
  .inlife-logo-wide { height: 32px; }
  .inlife-brand-text { display: none; }
}

/* Страница входа: вертикальный логотип крупно */
.login #header { justify-content: center; padding: 22px 16px 26px; }
.login #site-name { margin: 0 auto; }
.login .inlife-logo-wide, .login .inlife-brand-text { display: none; }
.login .inlife-logo-stacked { display: block; height: 120px; width: auto; margin: 0 auto; }
.login #header { position: relative; }
.login #header .theme-toggle { position: absolute; top: 12px; right: 12px; }
.login #container { border-radius: 8px; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 51, 51, 0.15); }

/* ---------- Подтверждение входа кодом ---------- */
.inlife-2fa { max-width: 460px; }
.inlife-2fa form { margin: 0 0 14px; }
.inlife-code-input { display: block; width: 100%; max-width: 240px; margin: 6px 0 12px; padding: 10px 12px;
  font-size: 1.5rem; letter-spacing: 0.35em; text-align: center; }
.inlife-trust { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.inlife-2fa-resend { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.inlife-2fa-logout { margin-top: 24px; }

/* ---------- Баннер на главной ---------- */
.inlife-hero {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 18px 24px; border-radius: 8px; color: #e6f2ef;
  background: linear-gradient(120deg, var(--inlife-teal) 0%, var(--inlife-teal-2) 70%, #1d5d3a 100%);
}
.inlife-hero img { height: 96px; width: auto; display: block; }
.inlife-hero h2 { margin: 0 0 4px; font-size: 1.25rem; color: #ffffff; font-weight: 600; }
.inlife-hero p { margin: 0; color: #cfe5e0; }
@media (max-width: 767px) { .inlife-hero img { height: 72px; } .inlife-hero { padding: 16px; } }

/* ---------- Телефон: крупные кнопки под палец, меньше отступов ---------- */
@media (max-width: 767px) {
  #content { padding: 12px; }
  .inlife-card { padding: 12px; }
  .inlife-actions .inlife-btn { flex: 1 1 100%; text-align: center; padding: 13px 14px; font-size: 1rem; }
  .inlife-alert { padding: 10px; }
  .inlife-links li { padding: 6px 0; }
  .inlife-filter label { flex: 1 1 45%; }
  .inlife-filter .button { flex: 1 1 auto; text-align: center; }
  .submit-row input, .submit-row a.button { padding: 12px 16px; font-size: 1rem; }
}
/* Приложение с главного экрана телефона: учитываем «чёлку» и полоску снизу */
@media (display-mode: standalone) {
  #header { padding-top: max(8px, env(safe-area-inset-top)); }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

.inlife-dash { display: grid; gap: 16px; margin-bottom: 24px; }
.inlife-card {
  border: 1px solid var(--hairline-color);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--inlife-card);
}
.inlife-card h2 { margin: 0 0 10px; font-size: 1rem; color: var(--body-loud-color); }
.inlife-ok { background: var(--message-success-bg); }

.inlife-alerts { list-style: none; margin: 0; padding: 0; }
.inlife-alert { padding: 7px 10px; margin: 0 0 6px; border-radius: 4px; border-left: 4px solid; list-style: none; }
.inlife-alert a { color: var(--body-fg); }
.inlife-danger { background: var(--message-error-bg); border-color: var(--error-fg); }
.inlife-warning { background: var(--message-warning-bg); border-color: #d4a106; }

.inlife-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inlife-btn {
  display: inline-block; padding: 8px 14px; border-radius: 4px;
  background: var(--button-bg); color: var(--button-fg) !important; font-weight: 600;
}
.inlife-btn:hover { background: var(--button-hover-bg); }

.inlife-telegram { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

.inlife-links { margin: 0; padding-left: 18px; }
.inlife-links li { list-style: disc; padding: 3px 0; }

.inlife-filter { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 12px; }
.inlife-filter label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.8125rem; }
.inlife-filter label:has(input[type=checkbox]) { flex-direction: row; align-items: center; }
.inlife-filter .button { padding: 8px 14px; }
.inlife-excel { background: #15803d !important; }
.inlife-note { color: var(--body-quiet-color); }

.inlife-scroll { overflow-x: auto; }
.inlife-table { width: 100%; border-collapse: collapse; }
.inlife-table td, .inlife-table th { padding: 6px 8px; border-bottom: 1px solid var(--hairline-color); text-align: left; }
.inlife-report tbody tr:hover { background: var(--darkened-bg); }
.inlife-row-danger td { background: var(--message-error-bg); }
.inlife-row-warning td { background: var(--message-warning-bg); }

/* Документооборот: статусы, панель действий в карточке */
.inlife-badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.inlife-badge-ok { background: var(--message-success-bg); color: var(--body-fg); }
.inlife-badge-warning { background: var(--message-warning-bg); color: var(--body-fg); }
.inlife-badge-danger { background: var(--message-error-bg); color: var(--error-fg); }
.inlife-badge-muted { background: var(--darkened-bg); color: var(--body-quiet-color); }
.inlife-overdue { color: var(--error-fg); }

.inlife-panel { clear: both; margin-bottom: 16px; }
.inlife-panel-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 6px; }
.inlife-panel-note { margin: 6px 0; }
.inlife-panel-actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin-top: 10px; }
.inlife-panel-form { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.inlife-panel-form textarea { width: 300px; max-width: 100%; }
.inlife-panel-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.inlife-submit { justify-content: flex-start; align-items: center; gap: 12px; }
/* В таблицах карточки не повторяем название каждой строки над ней */
.inlife-card-inline td.original p { display: none; }

.inlife-today p { margin: 0 0 8px; }
.inlife-progress { height: 8px; border-radius: 4px; background: var(--darkened-bg); overflow: hidden; }
.inlife-progress span { display: block; height: 100%; background: linear-gradient(90deg, #356905, var(--inlife-green)); }

/* Отчёт «Заполнение журналов»: цветные клетки по дням */
.inlife-section-title { font-size: 1rem; margin: 18px 0 8px; }
.inlife-fill th, .inlife-fill td { text-align: center; padding: 4px; white-space: nowrap; }
.inlife-fill th.weekend { color: var(--error-fg); }
.inlife-fill .inlife-fill-name { text-align: left; white-space: normal; min-width: 180px; }
.inlife-cell { display: inline-block; min-width: 34px; padding: 3px 6px; border-radius: 4px; font-weight: 600; font-size: 0.8125rem; }
.inlife-cell.ok { background: var(--message-success-bg); color: var(--body-fg); }
.inlife-cell.part { background: var(--message-warning-bg); color: var(--body-fg); }
.inlife-cell.bad { background: var(--message-error-bg); color: var(--error-fg); }
.inlife-cell.today { border: 1px dashed var(--border-color); color: var(--body-quiet-color); }
.inlife-cell.skip { color: var(--body-quiet-color); font-weight: normal; }
.inlife-pct.ok { color: #2e7d0b; font-weight: 700; }
.inlife-pct.part { color: #b07a00; font-weight: 700; }
.inlife-pct.bad { color: var(--error-fg); font-weight: 700; }

/* Шапка бланка и номера колонок в журналах по утверждённым формам */
.inlife-form-header { text-align: right; font-size: 0.75rem; color: var(--body-quiet-color); margin-bottom: 4px; }
.inlife-form-title { text-align: center; margin: 4px 0 10px; }
.inlife-colnums th { text-align: center; font-weight: normal; font-size: 0.6875rem; color: var(--body-quiet-color); }

/* Печать отчётов и журналов: только заголовок и таблица */
@page { size: A4 landscape; margin: 10mm; }
@media print {
  .inlife-report td, .inlife-report th { font-size: 8pt; padding: 2px 4px; }
  .inlife-form-header { color: #000; }
  #content:has(.inlife-form-title) > h1 { display: none; }  /* у бланка заголовок свой, по центру */
  #header, .breadcrumbs, #nav-sidebar, #toggle-nav-sidebar, .inlife-filter, #footer { display: none !important; }
  .main > #content-start, .main { display: block; }
  body, .inlife-row-danger td, .inlife-row-warning td { background: #fff !important; color: #000 !important; }
  .inlife-row-danger td { font-weight: bold; }
  .inlife-table td, .inlife-table th { border: 1px solid #000; }
}
