/* Домовой: one adaptive web design system. Navigation follows the platform;
   information about this house supplies the character. */
:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-synthesis: none;
  --canvas: #f2f2f7;
  --surface: #ffffff;
  --subtle: #e9e9ee;
  --ink: #1d1d1f;
  --muted: #555a64;
  --line: #d1d1d8;
  --accent: #0063cc;
  --action: #005fc9;
  --selected: #e7f0ff;
  --danger: #a62920;
  --danger-action: #a62920;
  --danger-bg: #fff0ed;
  --success: #146b3a;
  --success-bg: #e8f6ec;
  --warning: #805000;
  --warning-bg: #fff4dd;
  --glass-fill: rgba(249,251,255,.68);
  --glass-strong: rgba(248,250,254,.82);
  --glass-stroke: rgba(255,255,255,.78);
  --glass-highlight: rgba(255,255,255,.82);
  --glass-lens: rgba(255,255,255,.63);
  --glass-lens-stroke: rgba(255,255,255,.88);
  --glass-shadow: 0 18px 48px rgba(34,47,71,.18), inset 0 1px 0 rgba(255,255,255,.78);
  --shadow: 0 12px 40px rgba(20,20,30,.13);
  --body-size: 1.0625rem;
  --secondary-size: .9375rem;
  --footnote-size: .8125rem;
  --title-size: clamp(2rem, 5vw, 2.65rem);
  --section-size: 1.25rem;
  --radius-group: 14px;
}

* { box-sizing: border-box; }
html { font-size: 100%; background: var(--canvas); overscroll-behavior-y: contain; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-size: var(--body-size); line-height: 1.45; }
button, input, textarea, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .56; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
svg.icon { display: inline-block; width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; }
small, .muted, .subtitle { color: var(--muted); }
small { font-size: var(--footnote-size); line-height: 1.4; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--accent) !important; outline-offset: 3px; }
::selection { background: var(--selected); }

/* Type roles are shared across resident, admin, and dialog screens. */
.eyebrow, .hero-kicker { color: var(--muted); font-size: var(--footnote-size); font-weight: 600; letter-spacing: normal; text-transform: none; }
.view-title h1, .view-title h2 { margin: 0; font-size: var(--title-size); font-weight: 700; letter-spacing: -.012em; }
.view-title p { margin: 7px 0 0; color: var(--muted); font-size: var(--secondary-size); }
.section-head h2, .section-head h3 { margin: 0; font-size: var(--section-size); font-weight: 700; letter-spacing: normal; }
.meta-row, .detail-status > b, .contact-info > span { color: var(--muted); font-size: var(--footnote-size); }
.health-pill, .source-pill, .source-status, .legal-state { font-size: var(--footnote-size); font-weight: 600; }
.stat-card b, .engine-score b { font-variant-numeric: tabular-nums; }

/* Controls */
.primary, .report-btn, .call-primary, .floating-report { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 11px 18px; border: 0; border-radius: 999px; background: linear-gradient(180deg,rgba(255,255,255,.08),transparent 48%),var(--action); color: #fff; box-shadow: 0 5px 15px rgba(0,83,180,.2), inset 0 1px 0 rgba(255,255,255,.26); font-size: var(--secondary-size); font-weight: 600; line-height: 1.25; text-decoration: none; text-align: center; transition: transform .18s ease, filter .18s ease, box-shadow .18s ease; }
.primary:hover, .report-btn:hover, .call-primary:hover, .floating-report:hover { filter: brightness(1.06); box-shadow: 0 8px 20px rgba(0,83,180,.25), inset 0 1px 0 rgba(255,255,255,.3); }
.primary:active, .report-btn:active, .call-primary:active, .floating-report:active { transform: scale(.97); }
.primary.full, .secondary.full { width: 100%; }
.secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 15px; border: 0; border-radius: 999px; background: var(--subtle); color: var(--accent); font-size: var(--secondary-size); font-weight: 600; text-decoration: none; transition: background .18s ease, transform .18s ease; }
.secondary:hover { background: var(--selected); }
.secondary:active, .icon-btn:active { transform: scale(.94); }
.secondary.danger { color: var(--danger); }
.text-btn { min-height: 40px; padding: 7px 2px; border: 0; background: none; color: var(--accent); font-size: var(--secondary-size); font-weight: 600; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent); transition: background .18s ease, transform .18s ease; }
.icon-btn:hover { background: rgba(128,156,189,.13); }
.row { display: flex; flex-wrap: wrap; gap: 9px; }

label { display: block; margin-bottom: 8px; color: var(--ink); font-size: var(--secondary-size); font-weight: 600; }
input, textarea, select { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: var(--body-size); line-height: 1.4; outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--selected); }
.form-message, .engine-error { margin: 12px 0; padding: 12px 14px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: var(--secondary-size); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.toast { position: fixed; z-index: 60; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); max-width: min(440px,calc(100% - 32px)); padding: 12px 16px; border-radius: 11px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: var(--secondary-size); font-weight: 500; }
.toast-error { display: flex; align-items: center; gap: 12px; border: 1px solid var(--danger); background: var(--danger-bg); color: var(--danger); }
.toast-error button { min-height: 44px; padding: 8px 4px; border: 0; background: none; color: inherit; font-size: var(--footnote-size); font-weight: 700; }

/* Sign in */
.app { min-width: 0; }
.login-shell { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,.82fr); align-items: center; gap: clamp(32px,7vw,90px); width: min(100% - 48px, 980px); min-height: 100vh; margin: auto; padding: 52px 0; }
.brand-mark { width: 64px; height: 64px; margin: 0 0 24px; border-radius: 16px; }
.login-shell h1 { margin: 0 0 12px; font-size: clamp(2.75rem,6vw,4rem); font-weight: 700; letter-spacing: -.015em; }
.login-shell .lead { max-width: 24ch; margin-bottom: 13px; font-size: clamp(1.375rem,2.5vw,1.75rem); line-height: 1.27; font-weight: 500; }
.login-address { margin-bottom: 28px; color: var(--muted); font-size: var(--secondary-size); }
.login-image { width: 100%; aspect-ratio: 1.55; object-fit: cover; border-radius: 16px; }
.login-card { padding: 28px; border-radius: 18px; background: var(--surface); }
.login-card h2 { margin-bottom: 7px; font-size: 1.5rem; }
.login-card p { margin-bottom: 20px; color: var(--muted); font-size: var(--secondary-size); }
.login-card label { margin: 16px 0 8px; }
.login-card .primary { width: 100%; margin: 14px 0 5px; }
.login-card .text-btn { display: block; width: 100%; }
.login-card small { display: block; margin-top: 9px; }

/* Shell, toolbar, navigation */
#home { isolation: isolate; width: min(100%, 1480px); margin: auto; padding: 0 16px calc(100px + env(safe-area-inset-bottom)); }
#home::before { position: fixed; z-index: -1; inset: -12%; background: radial-gradient(ellipse 38% 42% at 3% 12%,rgba(87,151,204,.27),transparent 100%),radial-gradient(ellipse 35% 38% at 98% 79%,rgba(160,193,217,.19),transparent 100%); content: ""; pointer-events: none; }
.topbar { position: sticky; top: 0; z-index: 14; display: flex; align-items: center; justify-content: space-between; min-height: 60px; margin: 0 -16px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; border-bottom: 1px solid var(--glass-stroke); border-radius: 0 0 18px 18px; background: var(--glass-fill); box-shadow: 0 10px 28px rgba(36,55,83,.08), inset 0 -1px 0 rgba(120,145,174,.10); backdrop-filter: saturate(1.5) blur(28px); -webkit-backdrop-filter: saturate(1.5) blur(28px); }
.topbar::after { position: absolute; right: 18px; bottom: 0; left: 18px; height: 1px; background: linear-gradient(90deg,transparent,var(--glass-highlight),transparent); content: ""; pointer-events: none; }
.pull-refresh { position: fixed; z-index: 13; top: calc(65px + env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 20px); min-height: 40px; padding: 8px 14px; border: 1px solid var(--glass-stroke); border-radius: 999px; background: var(--glass-strong); color: var(--ink); box-shadow: var(--glass-shadow); backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px); font-size: var(--footnote-size); font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%,var(--pull-y,-44px)); transition: transform .22s ease, opacity .18s ease; }
.pull-refresh span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pull-refresh.is-visible { opacity: 1; }
.pull-refresh.is-pulling { transition: opacity .12s ease; }
.pull-refresh .icon { width: 18px; height: 18px; color: var(--accent); transform: rotate(var(--pull-turn,0deg)); transition: transform .12s ease; }
.pull-refresh.is-pulling .icon { transition: none; }
.pull-refresh.is-loading .icon, .refresh-btn[aria-busy="true"] .icon { animation: refresh-spin .85s linear infinite; }
.pull-refresh.is-complete .icon { color: var(--success); }
.pull-refresh.is-error .icon { color: var(--danger); }
.brand-row { display: flex; align-items: center; gap: 8px; font-size: var(--secondary-size); font-weight: 600; }
.brand-row .mini-mark, .brand-row > b { display: none; }
.brand-row .mini-mark { width: 26px; height: 26px; border-radius: 7px; }
.version { color: var(--ink); font-size: var(--secondary-size); font-weight: 600; }
.topbar .subtitle { display: none; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.top-actions .account-btn, .top-actions .logout-btn { display: none; }
.notify-btn { position: relative; }
.notify-count { position: absolute; top: 1px; right: 0; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .6875rem; font-weight: 700; }
.view { max-width: 960px; margin: 0 auto; padding-top: 26px; }
.view:not(.hidden) { animation: view-enter .3s cubic-bezier(.2,.7,.2,1) both; }
.view-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 31px 0 11px; }
.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom)); display: flex; width: min(calc(100% - 20px), 620px); padding: 5px; border: 1px solid var(--glass-stroke); border-radius: 24px; background: var(--glass-fill); box-shadow: var(--glass-shadow); backdrop-filter: saturate(1.55) blur(32px); -webkit-backdrop-filter: saturate(1.55) blur(32px); transform: translateX(-50%); isolation: isolate; }
.bottom-nav::after { position: absolute; top: 1px; right: 22px; left: 22px; height: 1px; background: linear-gradient(90deg,transparent,var(--glass-highlight),transparent); content: ""; pointer-events: none; }
.nav-lens { position: absolute; z-index: 1; top: 0; left: 0; width: var(--lens-width,0px); height: var(--lens-height,0px); border: 1px solid var(--glass-lens-stroke); border-radius: 18px; background: linear-gradient(145deg,var(--glass-highlight),transparent 48%),var(--glass-lens); box-shadow: 0 4px 16px rgba(38,69,105,.14), inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 rgba(106,144,182,.12); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); opacity: 0; pointer-events: none; transform: translate3d(var(--lens-x,0px),var(--lens-y,0px),0); }
.nav-lens.ready { opacity: 1; transition: transform .4s cubic-bezier(.2,.8,.2,1), width .4s cubic-bezier(.2,.8,.2,1), height .4s cubic-bezier(.2,.8,.2,1), opacity .18s ease; }
.nav-brand { display: none; }
.bottom-nav .nav-btn { position: relative; z-index: 2; flex: 1; min-width: 0; min-height: 58px; padding: 5px 1px; border: 0; border-radius: 18px; background: transparent; color: var(--muted); text-align: center; transition: color .2s ease, transform .18s ease; }
.bottom-nav .nav-btn:hover { color: var(--ink); }
.bottom-nav .nav-btn:active { transform: scale(.94); }
.bottom-nav .nav-btn .icon { display: block; width: 22px; height: 22px; margin: 0 auto 2px; }
.bottom-nav .nav-btn small { display: block; color: inherit; font-size: .75rem; line-height: 1.12; font-weight: 500; }
.bottom-nav .nav-btn .nav-label-desktop { display: none; }
.bottom-nav .nav-btn.active { color: var(--ink); }
.bottom-nav .nav-btn.active .icon { color: var(--accent); stroke-width: 2.35; }
.bottom-nav .nav-btn.nav-extra[data-view="profile"] { display: block; }
.bottom-nav .nav-btn[data-view="admin"] { display: none; }
.floating-report { display: none; }

/* Home: one illustration, then grouped practical information. */
.hero { position: relative; display: flex; align-items: flex-end; min-height: 345px; margin-bottom: 18px; padding: clamp(25px,4vw,40px); overflow: hidden; isolation: isolate; border-radius: 26px; background: #263b50; box-shadow: 0 14px 34px rgba(29,47,71,.16); }
.hero::after { position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg,rgba(7,22,39,.80) 0%,rgba(9,31,51,.57) 52%,rgba(9,31,51,.05) 100%),linear-gradient(0deg,rgba(9,21,34,.24),transparent 65%); content: ""; }
.hero-copy { min-width: 0; max-width: 540px; }
.hero-kicker { display: block; margin-bottom: 6px; color: rgba(255,255,255,.82); }
.hero h1 { margin: 0 0 8px; color: #fff; font-size: clamp(2.4rem,6vw,3.2rem); font-weight: 700; line-height: 1.12; letter-spacing: -.015em; }
.hero p { margin: 0 0 21px; color: rgba(255,255,255,.92); font-size: var(--body-size); }
.hero-image { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.art-caption { display: none; }
.report-btn .icon { width: 20px; height: 20px; }
.urgent-link, .house-profile-teaser { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; margin: 0 0 8px; padding: 15px 17px; border: 0; border-radius: var(--radius-group); background: var(--surface); color: var(--ink); text-align: left; text-decoration: none; transition: background .18s ease, transform .18s ease; }
.urgent-link:hover, .house-profile-teaser:hover { background: var(--selected); }
.urgent-link:active, .house-profile-teaser:active { transform: scale(.995); }
.urgent-link .urgent-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: 1.2rem; font-weight: 700; }
.urgent-link span:nth-child(2), .house-profile-teaser > div { min-width: 0; flex: 1; }
.urgent-link b, .urgent-link small, .house-profile-teaser b, .house-profile-teaser small { display: block; }
.urgent-link b, .house-profile-teaser b { font-size: 1rem; font-weight: 600; }
.urgent-link small, .house-profile-teaser small { margin-top: 2px; font-size: var(--footnote-size); }
.urgent-link strong { color: var(--accent); font-size: var(--secondary-size); font-weight: 600; }
.teaser-arrow { color: var(--muted); width: 18px !important; }
.quick-grid, .stats, #homeIssues, #issues, #systemicIssues, #rules, .grouped-list { overflow: hidden; border-radius: var(--radius-group); background: var(--surface); }
.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.quick { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 72px; padding: 12px 16px; border: 0; background: transparent; color: var(--ink); text-align: left; transition: background .18s ease; }
.quick:nth-child(n+3) { border-top: 1px solid var(--line); }
.quick:nth-child(even) { border-left: 1px solid var(--line); }
.quick:hover, .issue:hover { background: var(--selected); }
.quick b { font-size: var(--secondary-size); font-weight: 500; line-height: 1.3; }
.quick-icon, .issue-icon, .rule-icon, .contact-icon, .systemic-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: var(--subtle); color: var(--muted); }
.quick-icon .icon { width: 21px; height: 21px; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.stat-card { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 94px; padding: 15px 18px; }
.stat-card + .stat-card { border-left: 1px solid var(--line); }
.stat-card b { font-size: 1.875rem; line-height: 1.1; font-weight: 700; }
.stat-card span { margin-top: 4px; color: var(--muted); font-size: var(--footnote-size); line-height: 1.3; }
.stat-card.danger-stat b { color: var(--danger); }
.health-pill { color: var(--muted); text-align: right; }
.issue { display: flex; align-items: flex-start; gap: 13px; width: 100%; margin: 0; padding: 16px; border: 0; background: transparent; color: var(--ink); text-align: left; transition: background .18s ease; }
.issue + .issue, .systemic-card + .systemic-card, .rule-card + .rule-card, .contact-card + .contact-card, .doc-row + .doc-row, .notice-row + .notice-row { border-top: 1px solid var(--line); }
.issue-main { min-width: 0; flex: 1; }
.issue-top { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.status, .deadline { display: inline-block; padding: 4px 8px; border-radius: 7px; font-size: var(--footnote-size); font-weight: 600; line-height: 1.25; }
.status.ok, .deadline.ok { background: var(--success-bg); color: var(--success); }
.status.warn, .deadline.warn { background: var(--warning-bg); color: var(--warning); }
.status.bad, .deadline.bad { background: var(--danger-bg); color: var(--danger); }
.status.info, .deadline.info { background: var(--selected); color: var(--accent); }
.issue-title { display: block; margin: 7px 0 2px; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.issue-description { display: block; color: var(--muted); font-size: var(--secondary-size); line-height: 1.45; }
.meta-row { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 8px; line-height: 1.3; }
.systemic-card { display: flex; gap: 13px; padding: 17px; }
.systemic-card > div:last-child { min-width: 0; }
.systemic-card h3 { margin: 2px 0 5px; font-size: 1rem; }
.systemic-card p { margin-bottom: 5px; color: var(--muted); font-size: var(--secondary-size); }
.systemic-card details { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: var(--secondary-size); }
.systemic-card summary { color: var(--accent); cursor: pointer; font-weight: 600; }
.empty { margin: 0; padding: 25px 20px; border-radius: var(--radius-group); background: var(--surface); color: var(--muted); font-size: var(--secondary-size); line-height: 1.45; text-align: center; }

/* Secondary illustrations remain small and content never sits on top of them. */
.section-visual { display: grid; grid-template-columns: 1fr 180px; min-height: 128px; margin: 0 0 24px; overflow: hidden; border-radius: var(--radius-group); background: var(--surface); }
.section-visual > div { align-self: center; padding: 18px 20px; }
.section-visual h2 { margin: 0 0 5px; font-size: 1.125rem; font-weight: 600; }
.section-visual p { margin: 0; color: var(--muted); font-size: var(--secondary-size); line-height: 1.4; }
.section-visual img { width: 100%; height: 100%; max-height: 160px; object-fit: cover; }
.profile-visual { display: block; height: 164px; }
.profile-visual img { height: 164px; max-height: none; }

/* Issues, search, segmented filters */
.issue-search-label { color: var(--muted); font-size: var(--footnote-size); }
.issue-search-label input { margin-top: 7px; border: 0; background: var(--subtle); }
.filter-row { display: inline-flex; gap: 3px; max-width: 100%; margin: 11px 0 18px; padding: 3px; overflow-x: auto; border-radius: 11px; background: var(--subtle); }
.filter { min-height: 39px; padding: 7px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: var(--footnote-size); font-weight: 600; white-space: nowrap; transition: background .18s ease, box-shadow .18s ease; }
.filter.active { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.13); }
.search-wrap { display: flex; align-items: center; gap: 8px; min-height: 50px; margin: 0 0 13px; padding: 0 14px; border-radius: 11px; background: var(--subtle); color: var(--muted); }
.search-wrap input { min-height: 48px; padding-left: 0; border: 0; background: transparent; box-shadow: none; }
.help-chips { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.help-chips button { min-height: 41px; padding: 8px 13px; border: 0; border-radius: 999px; background: var(--subtle); color: var(--ink); font-size: var(--footnote-size); font-weight: 500; white-space: nowrap; }
.help-chips button:hover { background: var(--selected); }
.rule-card { margin: 0; background: transparent; }
.rule-card > summary, .doc-row > summary, .notice-row > summary, .mail-settings > summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; color: var(--ink); cursor: pointer; list-style: none; }
.rule-card > summary::-webkit-details-marker, .doc-row > summary::-webkit-details-marker, .notice-row > summary::-webkit-details-marker, .mail-settings > summary::-webkit-details-marker { display: none; }
.rule-card > summary > .icon:last-child, .doc-row > summary > .icon:last-child, .notice-row > summary > .icon:last-child, .mail-settings > summary > .icon:last-child { width: 17px; margin-left: auto; color: var(--muted); transition: transform .16s ease; }
.rule-card[open] > summary > .icon:last-child, .doc-row[open] > summary > .icon:last-child, .notice-row[open] > summary > .icon:last-child, .mail-settings[open] > summary > .icon:last-child { transform: rotate(90deg); }
.rule-name { display: flex; flex-direction: column; min-width: 0; }
.rule-name b { font-size: 1rem; font-weight: 500; }
.rule-name small { color: var(--danger); }
.rule-body { padding: 0 18px 17px 68px; }
.rule-line { padding: 10px 0; border-top: 1px solid var(--line); }
.rule-line small { color: var(--muted); font-size: var(--footnote-size); }
.rule-line p { margin: 3px 0 0; font-size: var(--secondary-size); }
.rule-legal { padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--footnote-size); }
.rule-legal p { margin: 4px 0; }
.legal-note, .admin-hint { margin-top: 15px; color: var(--muted); font-size: var(--footnote-size); line-height: 1.5; }

/* Contacts */
.contact-group { margin: 26px 0; }
.contact-group h2 { margin: 0 0 10px; font-size: var(--section-size); }
.contact-list { overflow: hidden; border-radius: var(--radius-group); background: var(--surface); }
.emergency-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 96px; margin-bottom: 18px; padding: 18px; border-radius: var(--radius-group); background: var(--danger-bg); }
.emergency-card b { color: var(--danger); font-size: 1rem; }
.emergency-card p { margin: 5px 0 0; color: var(--ink); font-size: var(--footnote-size); }
.pulse { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--danger); }
.call-primary { flex: none; background: var(--danger-action); color: #fff; }
.contact-card { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 13px; padding: 17px; }
.contact-card.emergency .contact-icon { color: var(--danger); background: var(--danger-bg); }
.contact-info h3 { margin: 3px 0 3px; font-size: 1rem; font-weight: 600; }
.contact-info > small { display: block; color: var(--muted); }
.contact-info p { margin: 8px 0 0; color: var(--muted); font-size: var(--secondary-size); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.contact-actions a { display: inline-flex; align-items: center; min-height: 40px; color: var(--accent); font-size: var(--secondary-size); font-weight: 600; text-decoration: none; }

/* Home and management profile */
#view-profile { max-width: 850px; }
.passport-card, .company-card, .mail-settings { overflow: hidden; border-radius: var(--radius-group); background: var(--surface); }
.passport-head { padding: 19px 20px 15px; }
.passport-head h2 { margin: 0 0 4px; font-size: 1.375rem; font-weight: 700; }
.passport-head p { margin: 0; color: var(--muted); font-size: var(--secondary-size); }
.passport-grid { margin: 0 20px; }
.passport-grid > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; min-height: 52px; padding: 13px 0; border-top: 1px solid var(--line); }
.passport-grid small, .passport-grid b { font-size: var(--secondary-size); }
.passport-grid small { min-width: 0; }
.passport-grid b { max-width: 62%; text-align: right; overflow-wrap: anywhere; font-weight: 600; }
.profile-section { margin: 29px 0; }
.profile-section .section-head { margin: 0 0 10px; }
.company-card { padding: 17px 20px; }
.company-card > h3 { margin: 0 0 12px; font-size: 1.0625rem; font-weight: 600; }
.company-card > p { color: var(--muted); font-size: var(--secondary-size); }
.company-kv { display: grid; grid-template-columns: minmax(104px,32%) 1fr; }
.company-kv span, .company-kv b { padding: 11px 0; border-top: 1px solid var(--line); font-size: var(--secondary-size); line-height: 1.4; overflow-wrap: anywhere; }
.company-kv span { color: var(--muted); font-weight: 400; }
.company-kv b { font-weight: 500; }
.company-actions { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.company-actions a { display: inline-flex; align-items: center; min-height: 40px; color: var(--accent); font-size: var(--secondary-size); font-weight: 600; text-decoration: none; }
.doc-row, .notice-row { display: block; }
.doc-icon { display: grid; place-items: center; width: 29px; height: 29px; color: var(--accent); }
.doc-label { min-width: 0; flex: 1; }
.doc-label b, .notice-row summary b { display: block; font-size: var(--secondary-size); font-weight: 500; }
.doc-label small, .notice-row summary small { display: block; margin-top: 3px; }
.doc-detail, .notice-row > p { margin: 0; padding: 0 18px 18px 57px; color: var(--muted); font-size: var(--secondary-size); line-height: 1.5; }
.doc-detail p { margin: 0 0 8px; }
.notice-dot { display: block; width: 9px; height: 9px; flex: 0 0 9px; margin: 0 12px 0 9px; border-radius: 50%; background: var(--accent); }
.notice-dot.cleaning { background: var(--success); }
.notice-row > p { padding-left: 50px; }
.mail-settings > summary { min-height: 65px; font-size: 1rem; font-weight: 500; }
.mail-settings > summary span { flex: 1; }
.mail-settings > summary small { display: block; margin-top: 2px; font-weight: 400; }
.mail-settings .company-card { margin: 0 18px 18px; padding: 16px 0 0; border-top: 1px solid var(--line); border-radius: 0; }
.mail-settings .field-label { margin-top: 13px; }
.account-logout { margin-top: 12px; }

/* Optional installation path; the browser supplies the final confirmation. */
.install-entry { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-group); background: var(--surface); }
.install-entry > img { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 11px; }
.install-entry-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.install-entry-copy strong { color: var(--ink); font-size: var(--secondary-size); font-weight: 650; line-height: 1.25; }
.install-entry-copy span { color: var(--muted); font-size: var(--footnote-size); line-height: 1.35; }
.install-entry .install-action { flex: 0 0 auto; min-height: 44px; }
.install-entry-login { margin-top: 21px; padding: 17px 0 0; border-width: 1px 0 0; border-radius: 0; }
.login-card .install-entry-login { margin-bottom: 0; }
.install-entry-home { margin: 13px 0 0; }
.install-entry-profile { margin-bottom: 12px; }
.install-guide-brand { display: flex; align-items: center; gap: 14px; margin: 3px 0 22px; }
.install-guide-brand img { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 14px; }
.install-guide-brand p { margin: 0; color: var(--muted); font-size: var(--secondary-size); line-height: 1.4; }
.install-steps { margin: 0; padding-left: 25px; }
.install-steps li { margin: 0 0 14px; padding-left: 6px; font-size: var(--secondary-size); line-height: 1.45; }
.install-steps li::marker { color: var(--accent); font-weight: 700; }
.install-note { margin: 4px 0 0; color: var(--muted); font-size: var(--footnote-size); line-height: 1.45; }

/* Dialogs and issue details */
.sheet { width: min(94vw,650px); max-height: min(90dvh,900px); padding: 22px; overflow: auto; border: 1px solid var(--glass-stroke); border-radius: 24px; background: var(--glass-strong); color: var(--ink); box-shadow: 0 28px 80px rgba(15,29,47,.28), inset 0 1px 0 var(--glass-highlight); backdrop-filter: saturate(1.45) blur(36px); -webkit-backdrop-filter: saturate(1.45) blur(36px); }
.sheet[open] { animation: sheet-enter .33s cubic-bezier(.2,.8,.2,1) both; }
.sheet::backdrop { background: rgba(10,18,31,.42); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: scrim-enter .24s ease both; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 13px; }
.sheet-head h2 { margin: 5px 0 17px; font-size: 1.625rem; font-weight: 700; line-height: 1.2; }
.close-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: var(--subtle); color: var(--ink); font-size: 1.55rem; line-height: 1; }
.detail-back-mobile { display: none; }
.sheet-cancel { min-height: 44px; padding: 8px 2px 8px 10px; border: 0; background: transparent; color: var(--accent); font-size: var(--secondary-size); font-weight: 600; }
.sheet textarea { min-height: 132px; margin: 5px 0 12px; resize: vertical; }
.field-label { margin-top: 10px; }
.upload-box { display: grid; grid-template-columns: 30px 1fr; column-gap: 11px; align-items: center; min-height: 70px; margin: 13px 0; padding: 12px 15px; border: 1px dashed var(--line); border-radius: 12px; cursor: pointer; }
.upload-box { position: relative; }
.upload-box:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.upload-box .icon { grid-row: 1/3; width: 25px; height: 25px; color: var(--accent); }
.upload-box b { font-size: var(--secondary-size); font-weight: 600; }
.upload-box small { font-size: var(--footnote-size); }
.sheet .row { margin-bottom: 12px; }
.detail-sheet { width: min(94vw,780px); }
.detail-status { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
.detail-desc { font-size: var(--body-size); line-height: 1.5; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 17px 0; }
.detail-actions .button-link { display: inline-flex; }
.route-box, .complaint-box, .cluster-box, .escalation-box, .legal-engine-box, .responsible-box, .admin-box { margin: 14px 0; padding: 17px; border-radius: var(--radius-group); background: var(--canvas); }
.route-box b, .responsible-box b { display: block; margin: 5px 0; font-size: 1rem; }
.route-box p, .complaint-box p, .cluster-box p, .escalation-box p, .legal-engine-box p { margin: 7px 0; font-size: var(--secondary-size); line-height: 1.5; }
.route-warning { margin-top: 10px; padding: 11px 12px; border-radius: 9px; background: var(--warning-bg); color: var(--warning); font-size: var(--footnote-size); }
.box-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.mini-copy { min-height: 39px; padding: 8px 11px; border: 0; border-radius: 9px; background: var(--subtle); color: var(--accent); font-size: var(--footnote-size); font-weight: 600; }
.cluster-box h3, .escalation-box h3, .legal-engine-box h3 { margin: 7px 0; font-size: 1rem; }
.cluster-box small { display: block; margin-top: 8px; }
.legal-state { padding: 4px 8px; border-radius: 7px; background: var(--selected); color: var(--accent); }
.legal-kv { display: grid; grid-template-columns: minmax(110px,35%) 1fr; gap: 0 12px; margin: 10px 0; }
.legal-kv span, .legal-kv b { padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--footnote-size); line-height: 1.45; overflow-wrap: anywhere; }
.legal-kv span { color: var(--muted); font-weight: 400; }
.legal-kv b { font-weight: 600; }
.legal-engine-box details { padding-top: 9px; border-top: 1px solid var(--line); }
.legal-engine-box summary { color: var(--accent); font-size: var(--secondary-size); font-weight: 600; cursor: pointer; }
.legal-engine-box li { margin: 6px 0; font-size: var(--footnote-size); }
.responsible-box small { font-size: var(--footnote-size); }
.responsible-box a { font-size: var(--secondary-size); text-decoration: none; }
.admin-box > b { display: block; margin-bottom: 9px; font-size: 1rem; }
.admin-box button { min-height: 42px; padding: 8px 12px; border: 0; border-radius: 9px; background: var(--subtle); color: var(--accent); font-size: var(--footnote-size); font-weight: 600; }
.timeline-title { margin: 25px 0 12px; font-size: var(--section-size); }
.timeline-item { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 11px; padding-bottom: 17px; }
.timeline-item > span { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.timeline-item::after { position: absolute; top: 20px; bottom: 0; left: 4px; width: 1px; background: var(--line); content: ""; }
.timeline-item:last-child::after { display: none; }
.timeline-item b { font-size: var(--secondary-size); font-weight: 600; }
.timeline-item p { margin: 3px 0; color: var(--muted); font-size: var(--footnote-size); }
.timeline-item small { font-size: var(--footnote-size); }
.notification-list { overflow: hidden; border-radius: var(--radius-group); background: var(--canvas); }
.notification-item { display: grid; grid-template-columns: 9px 1fr; gap: 12px; width: 100%; padding: 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { background: var(--selected); }
.notification-item b { font-size: 1rem; }
.notification-item p { margin: 4px 0; color: var(--muted); font-size: var(--secondary-size); }
.notification-dot { width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--line); }
.notification-item.unread .notification-dot { background: var(--accent); }
.unread-label { display: block; margin-bottom: 3px; color: var(--accent); font-weight: 600; }

/* Admin: ordinary reading size, clear source and verification hierarchy. */
.pilot-card, .data-engine-card { margin: 0 0 20px; padding: 20px; border-radius: var(--radius-group); background: var(--surface); }
.admin-back { display: block; margin: 0 0 10px; }
.pilot-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; }
.pilot-card h2, .data-engine-card h3 { margin: 0 0 6px; font-size: 1.25rem; }
.pilot-card p, .data-engine-card > p { margin: 0 0 10px; color: var(--muted); font-size: var(--secondary-size); }
.pilot-invite { display: flex; align-items: center; gap: 14px; }
.pilot-qr { width: 104px; height: 104px; padding: 5px; border-radius: 10px; background: #fff; }
.pilot-link { display: flex; flex-direction: column; gap: 5px; max-width: 230px; overflow-wrap: anywhere; }
.pilot-link b { font-size: var(--secondary-size); }
.pilot-link small { font-size: var(--footnote-size); }
.engine-search { display: flex; align-items: end; gap: 9px; }
.engine-search .import-address-label { min-width: 0; flex: 1; margin: 0; }
.engine-search input { min-width: 0; margin-top: 5px; }
.engine-loading { margin: 16px 0; padding: 15px; border-radius: 10px; background: var(--canvas); font-size: var(--secondary-size); }
.engine-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 23px; }
.engine-summary h3 { margin: 4px 0; font-size: 1.125rem; }
.engine-summary p { margin: 0; color: var(--muted); font-size: var(--secondary-size); }
.engine-score { min-width: 92px; padding: 11px; border-radius: 11px; background: var(--success-bg); text-align: center; }
.engine-score b { display: block; color: var(--success); font-size: 1.6rem; }
.engine-score small { color: var(--success); }
.engine-bar { height: 8px; margin: 15px 0; overflow: hidden; border-radius: 5px; background: var(--subtle); }
.engine-bar span { display: block; height: 100%; background: var(--success); }
.engine-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 18px; color: var(--muted); font-size: var(--footnote-size); }
.dot, .fact-state { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; margin-right: 5px; border-radius: 50%; }
.dot.verified, .fact-state.verified { background: var(--success); }
.dot.review, .fact-state.review { background: var(--warning); }
.dot.missing, .fact-state.missing { background: var(--muted); }
.provider-list h4, .fact-group h4 { margin: 20px 0 7px; font-size: 1rem; font-weight: 700; }
.admin-entities > h2 { margin: 27px 0 8px; font-size: var(--section-size); }
.provider-row, .fact-row, .entity-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.provider-row b, .fact-row b, .entity-row b { font-size: var(--secondary-size); font-weight: 600; }
.provider-row small, .fact-row small, .entity-row small { display: block; margin-top: 3px; font-size: var(--footnote-size); }
.fact-main { display: flex; gap: 10px; min-width: 0; }
.fact-main .fact-state { margin-top: 6px; }
.fact-row p { margin: 3px 0; font-size: var(--secondary-size); }
.fact-row a, .entity-row a { color: var(--accent); font-size: var(--footnote-size); }
.source-status { flex: none; padding: 5px 7px; border-radius: 7px; background: var(--subtle); color: var(--muted); }
.source-status.ok { background: var(--success-bg); color: var(--success); }
.source-status.review { background: var(--warning-bg); color: var(--warning); }
.source-status.bad { background: var(--danger-bg); color: var(--danger); }
.admin-subtitle { margin-top: 26px; }

/* Responsive layouts. Browser zoom reduces the CSS viewport and follows these rules. */
@media (min-width: 360px) and (max-width: 979px) {
  .brand-row .mini-mark { display: block; }
}
@media (min-width: 980px) {
  :root { --body-size: 1rem; }
  #home { max-width: none; padding: 0 48px 90px 292px; }
  .topbar, .view { max-width: 1080px; margin-left: auto; margin-right: auto; }
  .topbar { padding-top: 8px; padding-bottom: 8px; }
  .view { padding-top: 34px; }
  .top-actions .create-shortcut, .top-actions #adminShortcut { display: none !important; }
  .bottom-nav { top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 3px; width: 242px; height: 100dvh; padding: 22px 12px; overflow-y: auto; border: 0; border-right: 1px solid var(--glass-stroke); border-radius: 0; background: var(--glass-strong); box-shadow: 12px 0 34px rgba(37,65,92,.10), inset -1px 0 0 rgba(126,155,181,.13); transform: none; }
  .bottom-nav::after { top: 0; right: 0; bottom: 0; left: auto; width: 1px; height: auto; background: linear-gradient(180deg,transparent,var(--glass-highlight) 15%,transparent 95%); }
  .nav-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; margin-bottom: 73px; padding: 0 10px 16px; border-bottom: 1px solid var(--glass-stroke); }
  .nav-brand .mini-mark { width: 39px; height: 39px; border-radius: 10px; }
  .nav-brand span, .nav-brand b, .nav-brand small { display: block; }
  .nav-brand b { font-size: 1rem; line-height: 1.2; }
  .nav-brand small { font-size: var(--footnote-size); }
  .bottom-nav .nav-btn, .bottom-nav .nav-btn.nav-extra[data-view="profile"] { display: flex; align-items: center; flex: none; gap: 12px; width: 100%; min-height: 47px; padding: 9px 12px; text-align: left; }
  .bottom-nav .nav-btn .icon { width: 21px; height: 21px; margin: 0; }
  .bottom-nav .nav-btn small { font-size: var(--secondary-size); }
  .bottom-nav .nav-btn .nav-label-mobile { display: none; }
  .bottom-nav .nav-btn .nav-label-desktop { display: block; }
  .bottom-nav .nav-btn[data-view="admin"]:not(.hidden) { display: flex; }
  .floating-report { position: fixed; z-index: 21; top: 99px; left: 20px; display: inline-flex; width: 202px; min-height: 48px; padding: 9px 10px; font-size: var(--footnote-size); }
  .floating-report .icon { width: 18px; height: 18px; }
  .hero .report-btn { display: none; }
  .admin-back { display: none; }
  .toast { bottom: 18px; }
  #view-home { max-width: 960px; }
  #view-home .hero { margin-bottom: 23px; }
  .quick-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .quick:nth-child(n) { border-left: 0; border-top: 0; }
  .quick:nth-child(3n+2), .quick:nth-child(3n+3) { border-left: 1px solid var(--line); }
  .quick:nth-child(n+4) { border-top: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .login-shell { display: block; width: min(100% - 32px, 460px); min-height: 0; padding: 28px 0 50px; }
  .login-shell h1 { font-size: 2.75rem; }
  .login-image { aspect-ratio: 2.1; margin-bottom: 21px; }
  .login-card { padding: 21px; }
  .view-title h1, .view-title h2 { font-size: 2rem; }
  .hero { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 0; min-height: 390px; padding: 22px; }
  .hero::after { background: linear-gradient(0deg,rgba(6,21,37,.86) 0%,rgba(7,25,43,.58) 48%,rgba(7,25,43,.08) 100%); }
  .hero p { margin-bottom: 18px; }
  .hero .report-btn { width: 100%; }
  .hero-image { height: 100%; margin-top: 0; }
  .section-visual { grid-template-columns: minmax(0,1fr) 125px; min-height: 125px; }
  .section-visual > div { padding: 15px; }
  .section-visual h2 { font-size: 1rem; }
  .section-visual p { font-size: var(--footnote-size); }
  .section-visual img { max-height: 160px; }
  .profile-visual, .profile-visual img { height: 160px; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick:nth-child(n) { border-left: 0; }
  .quick:nth-child(n+2) { border-top: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .stat-card { min-height: 97px; padding: 12px 10px; }
  .stat-card b { font-size: 1.625rem; }
  .stat-card span { font-size: var(--footnote-size); }
  .emergency-card { align-items: stretch; flex-direction: column; }
  .emergency-card .call-primary { width: 100%; }
  .sheet { position: fixed; top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%; max-height: min(90dvh,900px); margin: auto 0 0; padding: 21px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .sheet[open] { animation-name: mobile-sheet-enter; }
  #createDialog .sheet-head, #adminActionDialog .sheet-head { flex-direction: column; gap: 4px; }
  #createDialog .sheet-cancel, #adminActionDialog .sheet-cancel { order: -1; align-self: flex-start; padding-left: 0; }
  #createDialog .sheet-head h2, #adminActionDialog .sheet-head h2 { margin: 0 0 12px; }
  .detail-sheet { top: 0; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .detail-sheet .close-btn { order: -1; background: transparent; color: var(--accent); }
  .detail-back-mobile { display: inline; }
  .detail-close-desktop { display: none; }
  .notification-sheet { max-height: 78dvh; }
  .pilot-card { grid-template-columns: 1fr; }
  .pilot-invite { align-items: flex-start; }
  .engine-search { flex-direction: column; }
  .engine-search .primary { width: 100%; }
}

@media (max-width: 390px) {
  .install-entry { flex-wrap: wrap; }
  .install-entry .install-action { width: 100%; }
  .view-title { align-items: flex-start; }
  .view-title .secondary { padding: 9px 11px; }
  .passport-grid > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .passport-grid b { max-width: 100%; text-align: left; }
  .legal-kv { grid-template-columns: 1fr; }
  .legal-kv b { padding-top: 0; border-top: 0; }
}

@media (max-width: 320px) {
  .topbar { padding-right: 10px; padding-left: 10px; }
  .top-actions { gap: 0; }
  .version { font-size: .8125rem; }
  .section-visual { grid-template-columns: 1fr; }
  .section-visual:not(.profile-visual) img { height: 128px; max-height: 128px; }
  .stats { grid-template-columns: 1fr; }
  .stat-card { min-height: 72px; padding: 12px 16px; }
  .stat-card + .stat-card { border-top: 1px solid var(--line); border-left: 0; }
  .stat-card span { font-size: var(--footnote-size); }
  .company-kv { grid-template-columns: 1fr; }
  .company-kv span { padding-bottom: 0; }
  .company-kv b { padding-top: 0; border-top: 0; }
  .pilot-invite, .engine-summary, .provider-row, .fact-row, .entity-row { flex-direction: column; align-items: flex-start; }
  .engine-score { min-width: 0; }
  .fact-main { width: 100%; }
}

@media (max-width: 280px) {
  #home { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 2px; }
  .bottom-nav .nav-btn, .bottom-nav .nav-btn.nav-extra[data-view="profile"] { display: flex; flex-direction: column; align-items: center; justify-content: center; grid-column: span 2; min-height: 68px; }
  .bottom-nav .nav-btn[data-view="contacts"], .bottom-nav .nav-btn.nav-extra[data-view="profile"] { grid-column: span 3; }
  .bottom-nav .nav-btn small { width: 100%; overflow-wrap: anywhere; }
  .toast { bottom: calc(168px + env(safe-area-inset-bottom)); }
}

@media (max-width: 979px) {
  .filter, .help-chips button, .contact-actions a, .text-btn, .admin-box button, .mini-copy { min-height: 44px; }
  .company-actions a, .entity-row a, .fact-row a, .responsible-box a, .doc-detail a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1c1c1e;
    --surface: #2c2c2e;
    --subtle: #3a3a3c;
    --ink: #f5f5f7;
    --muted: #c3c3cc;
    --line: #48484e;
    --accent: #71b7ff;
    --action: #0068d7;
    --selected: #263f59;
    --danger: #ffb2a8;
    --danger-action: #a62920;
    --danger-bg: #4b2928;
    --success: #92dfa9;
    --success-bg: #234631;
    --warning: #ffd28c;
    --warning-bg: #4d3920;
    --glass-fill: rgba(42,46,53,.66);
    --glass-strong: rgba(38,42,49,.82);
    --glass-stroke: rgba(220,235,255,.17);
    --glass-highlight: rgba(225,239,255,.25);
    --glass-lens: rgba(123,174,224,.21);
    --glass-lens-stroke: rgba(199,225,255,.25);
    --glass-shadow: 0 20px 48px rgba(0,0,0,.46), inset 0 1px 0 rgba(225,239,255,.17);
    --shadow: 0 12px 40px rgba(0,0,0,.35);
  }
  #home::before { background: radial-gradient(ellipse 40% 44% at 0% 10%,rgba(40,97,148,.28),transparent 100%),radial-gradient(ellipse 38% 38% at 100% 85%,rgba(74,102,132,.18),transparent 100%); }
  .filter.active { box-shadow: 0 1px 5px rgba(0,0,0,.35); }
  .pilot-qr { background: #fff; }
}

@media (prefers-contrast: more) {
  :root { --muted: #36393f; --line: #888892; --glass-fill: #fff; --glass-strong: #fff; --glass-lens: var(--selected); --glass-lens-stroke: var(--accent); }
  .bottom-nav .nav-btn.active { outline: 2px solid var(--accent); outline-offset: -2px; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --muted: #e0e0e6; --line: #a3a3ae; --glass-fill: #1c1c1e; --glass-strong: #1c1c1e; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .bottom-nav, .sheet, .nav-lens, .pull-refresh { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar, .bottom-nav, .sheet, .pull-refresh { background: var(--surface); }
  .nav-lens { background: var(--selected); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .bottom-nav, .sheet, .pull-refresh { background: var(--surface); }
  .nav-lens { background: var(--selected); }
}
@keyframes view-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheet-enter { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes mobile-sheet-enter { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scrim-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .pull-refresh .icon { transform: none !important; }
  .pull-refresh.is-loading .icon, .refresh-btn[aria-busy="true"] .icon { animation: none !important; }
}
