:root {
  --graphite: #2a3441; --ink: #111827; --paper: #f5f1e9; --white: #fff; --clay: #c1703f; --clay-light: #d18452;
  --muted: #6b7280; --line: rgba(42,52,65,.14); --ok: #2f8f5b; --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; padding-bottom: calc(76px + var(--safe-bottom)); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 10; background: var(--graphite); color: var(--white); padding: calc(12px + var(--safe-top)) 18px 12px; display: flex; align-items: center; gap: 12px; }
.topbar .logo { width: 34px; height: 34px; border-radius: 8px; }
.topbar .brand { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; line-height: 1.15; }
.topbar .title { flex: 1; font-size: 16px; font-weight: 600; }
.topbar .back { background: none; border: 0; color: var(--white); font-size: 22px; padding: 4px 8px 4px 0; }

.screen { padding: 18px 16px 24px; max-width: 640px; margin: 0 auto; }
h1 { font-size: 26px; line-height: 1.15; margin: 8px 0 14px; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
p { line-height: 1.5; }
.muted { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: var(--radius); padding: 15px 18px; font-size: 15px; font-weight: 700; background: var(--clay); color: var(--white); cursor: pointer; }
.btn:active { background: var(--clay-light); }
.btn.secondary { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.btn.tg { background: #2aabee; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.link { display: flex; gap: 14px; align-items: center; }
.card .thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #e7e2d8; flex: none; }
.card .body { flex: 1; min-width: 0; }
.card .name { font-weight: 700; font-size: 16px; margin-bottom: 3px; }
.card .sub { font-size: 13px; color: var(--muted); }
.progress { height: 6px; background: #ebe6dc; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--clay); }

.stages { list-style: none; margin: 0; padding: 0; }
.stages li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stages li:last-child { border-bottom: 0; }
.stages .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfc7bb; flex: none; display: grid; place-items: center; font-size: 12px; color: var(--white); margin-top: 1px; }
.stages .done .dot { background: var(--ok); border-color: var(--ok); }
.stages .active .dot { border-color: var(--clay); background: var(--clay); }
.stages .t { flex: 1; }
.stages .t b { display: block; font-weight: 600; }
.stages .t small { color: var(--muted); }
.stages .active .t b { color: var(--clay); }

.day { margin-bottom: 18px; }
.day h3 { font-size: 15px; margin: 0 0 8px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #e7e2d8; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--white); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tabs a.on { color: var(--clay); }
.tabs svg { width: 24px; height: 24px; }

.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 80px; }
.msg { max-width: 82%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg.client { align-self: flex-end; background: var(--clay); color: var(--white); border-bottom-right-radius: 4px; }
.msg.staff { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg small { display: block; font-size: 11px; opacity: .65; margin-top: 4px; }
.chat-form { position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-bottom)); display: flex; gap: 8px; padding: 10px 12px; background: var(--paper); border-top: 1px solid var(--line); }
.chat-form input { flex: 1; border: 1px solid #cfc7bb; border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 15px; background: var(--white); }
.chat-form button { border: 0; background: var(--clay); color: var(--white); border-radius: 12px; padding: 0 18px; font-weight: 700; }

.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer .x { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; color: #fff; font-size: 30px; background: none; border: 0; }
.viewer .cap { position: absolute; left: 0; right: 0; bottom: calc(20px + var(--safe-bottom)); color: #fff; text-align: center; padding: 0 20px; font-size: 14px; }

.calc-frame { width: 100%; height: calc(100dvh - 70px - 62px - var(--safe-top) - var(--safe-bottom)); border: 0; display: block; background: var(--white); }
.login { padding-top: 40px; text-align: center; }
.login .logo { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 18px; }
.login .steps { text-align: left; margin: 20px 0; }
.login .steps li { margin: 8px 0; line-height: 1.45; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; line-height: 1.5; }
.install-tip { background: #fff7ed; border: 1px solid #f3d5b5; border-radius: var(--radius); padding: 12px 14px; font-size: 13px; line-height: 1.45; margin: 14px 0; }
