:root {
  --bg: #F5F6F8; --card: #FFFFFF; --line: #E2E5EA; --line-2: #D3D8DF;
  --text: #18212B; --muted: #55606C; --soft: #3A4450;
  --accent: #1D5FD1; --accent-dark: #123B80; --accent-soft: #EAF1FD;
  --info-bg: #E8EEF8; --info-text: #1F3558;
  --warn-bg: #FFF6E3; --warn-line: #F1D597; --warn-text: #7A4A00;
  --danger-bg: #FCE4E1; --danger-text: #7A1E14; --danger: #A3261A;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 16px/1.45 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: #1A4FA8; text-decoration: none; }
a:hover { color: var(--accent-dark); }
h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.pre { white-space: pre-line; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.page { flex: 1 1 auto; padding: 28px 20px 110px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow-top { padding-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.topbar { position: sticky; top: 0; z-index: 5; height: 60px; padding: 0 12px; display: flex; align-items: center; gap: 8px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 18px; line-height: 24px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--text); background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: #EEF1F5; color: var(--text); }

.eyebrow { font-size: 14px; font-weight: 500; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
a.card { color: var(--text); display: block; }
a.card:hover { border-color: var(--line-2); }

.hero-btn { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 18px; background: var(--accent); color: #fff; }
.hero-btn:hover { color: #fff; background: #1952B8; }
.hero-btn .plus { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; flex: none; }
.hero-btn strong { font-size: 20px; display: block; }
.hero-btn span.sub { font-size: 14px; color: #E3ECFB; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: 14px; line-height: 20px; }
.banner svg { flex: none; margin-top: 1px; }
.banner.danger { background: var(--danger-bg); color: var(--danger-text); }
.banner.info { background: var(--info-bg); color: var(--info-text); }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
a.banner.danger:hover { color: var(--danger-text); }

.issue-row { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--text); }
.issue-row:hover { color: var(--text); border-color: var(--line-2); }
.issue-icon { width: 40px; height: 40px; border-radius: 12px; background: #EEF1F5; display: flex; align-items: center; justify-content: center; flex: none; color: var(--soft); }
.issue-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.issue-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.issue-meta { font-size: 13px; color: var(--muted); }
.issue-card { display: flex; flex-direction: column; gap: 10px; }
.facts { display: flex; gap: 16px; font-size: 13px; color: var(--soft); font-weight: 500; flex-wrap: wrap; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }

.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex: none; display: inline-block; }
.pill.lg { font-size: 13px; padding: 5px 12px; }
.st-new { background: #E6E8EB; color: #3A4450; }
.st-sent { background: #DCE8FB; color: #1A4FA8; }
.st-acknowledged { background: #E5E0FA; color: #46309A; }
.st-in_progress { background: #FDEBC8; color: #7A4A00; }
.st-resolved { background: #D9F0E3; color: #1D6B42; }
.st-closed { background: #ECEDEF; color: #4A525C; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 40px; padding: 0 16px; border-radius: 999px; font: 600 14px Figtree, system-ui, sans-serif; display: inline-flex; align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line-2); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip:hover { color: var(--text); border-color: var(--soft); }
.chip.on:hover { color: #fff; }

/* forms */
label.lbl, .lbl { font-size: 16px; font-weight: 700; display: block; }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #C9CFD7; background: #fff;
  font: 400 16px Figtree, system-ui, sans-serif; color: var(--text);
}
select, input[type=text], input[type=email], input[type=number] { height: 48px; padding: 0 12px; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9DBDF3; outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

.btn { height: 48px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; font: 700 16px Figtree, system-ui, sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-align: center; }
.btn:hover { background: #1952B8; color: #fff; }
.btn.block { width: 100%; }
.btn.lg { height: 52px; font-size: 17px; border-radius: 14px; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line-2); font-weight: 600; }
.btn.secondary:hover { background: #F0F2F5; color: var(--text); }
.btn.ghost { background: transparent; color: var(--soft); border: 1.5px dashed #9AA3AE; font-weight: 600; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8A1F15; }
.btn.joined { background: #D9F0E3; color: #1D6B42; border: 1px solid #A9D9BE; }
.btn.sm { height: 40px; font-size: 14px; padding: 0 14px; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile span { height: 72px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 0 4px; }
.tile input:checked + span { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.tile input:focus-visible + span { outline: 3px solid #9DBDF3; outline-offset: 1px; }

.dupes { display: none; }
.dupes.show { display: flex; }
.dupe { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--warn-line); }
.dupe:first-of-type { border-top: 0; padding-top: 0; }
.photo-pick input { display: none; }
.photo-name { font-size: 13px; color: var(--muted); }

.flash { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.flash.info { background: #D9F0E3; color: #1D6B42; }
.flash.error { background: var(--danger-bg); color: var(--danger-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }

.photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: 16px; background: #E3E7EC; display: block; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 16px; flex: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex: none; }
.tl-dot.todo { background: #fff; border: 2px solid #9AA3AE; }
.tl-dot.private { background: #9AA3AE; }
.tl-line { width: 2px; flex: 1 1 auto; min-height: 16px; background: var(--line-2); }
.tl-body { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; min-width: 0; }
.tl-label { font-size: 15px; font-weight: 600; }
.tl-label.todo { color: var(--muted); font-weight: 500; }
.tl-note { font-size: 14px; color: var(--soft); white-space: pre-line; overflow-wrap: anywhere; }

.mod-panel { border: 2px solid #C7D7F5; background: #F7FAFF; }
.mod-panel h2 { font-size: 16px; }
details.mod summary { cursor: pointer; font-weight: 600; padding: 6px 0; list-style: none; }
details.mod summary::-webkit-details-marker { display: none; }
details.mod summary::before { content: "▸ "; color: var(--muted); }
details.mod[open] summary::before { content: "▾ "; }
.badge { display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 13px; }

table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users td, table.users th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.users th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }

.contacts .contact { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #EEF0F3; }
.contacts .contact:last-child { border-bottom: 0; }
.contacts { padding: 0; }
.date-cap { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
.bottom-nav .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.bottom-nav a { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.bottom-nav a.on { color: var(--accent); font-weight: 700; }
.bottom-nav a:hover { background: #F2F4F7; }

.sticky-foot { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); z-index: 10; }
.sticky-foot .inner { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; font-size: 15px; }
.auth { padding-top: 48px; }
.brand-mark { width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
