/* ── Google Fonts: Inter ────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design tokens (light mode) ─────────────────────────────────────────────── */
:root {
  --background:        245 245 243;   /* #F5F5F3 */
  --foreground:         26  25  23;   /* #1A1917 */
  --muted:             240 239 235;   /* #F0EFEB */
  --muted-fg:          107 106 102;   /* #6B6A66 */
  --border:            214 213 208;   /* #D6D5D0 */
  --surface:           255 255 255;   /* #FFFFFF */
  --surface-2:         250 250 248;   /* #FAFAF8 */
  --primary:             1 105 111;   /* #01696F */
  --primary-fg:        255 255 255;
  --success:            67 122  34;   /* #437A22 */
  --danger:            192  57  43;   /* #C0392B */
  --warning:           150  66  25;   /* #964219 */

  /* Layout sizes — change here to adjust globally */
  --topbar-h:   52px;
  --bottomnav-h: 58px;
}

/* Dark mode */
.dark {
  --background:       19  19  18;
  --foreground:      212 211 208;
  --muted:            37  36  33;
  --muted-fg:        122 121 118;
  --border:           51  50  48;
  --surface:          28  27  25;
  --surface-2:        32  31  29;
  --primary:          79 152 163;
  --primary-fg:      255 255 255;
  --success:         109 170  69;
  --danger:          224  82  82;
  --warning:         187 101  59;
}

/* ── Reset & Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;                                /* fallback for old browsers */
  height: 100dvh;                              /* dynamic viewport */
  height: var(--app-h, 100dvh);                /* JS-managed visual-viewport height (most reliable) */
  overflow: hidden;                            /* scroll lives inside the panels, not the page */
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: rgb(var(--background));
  color: rgb(var(--foreground));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  border: none; cursor: pointer;
  transition: filter .18s, background-color .18s, color .18s;
  width: 100%; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: rgb(var(--primary));  color: rgb(var(--primary-fg)); }
.btn-primary:hover:not(:disabled) { filter: brightness(.93); }

.btn-danger {
  background: rgb(var(--danger) / .08);
  color: rgb(var(--danger));
  border: 1px solid rgb(var(--danger) / .25);
}
.btn-danger:hover:not(:disabled) { background: rgb(var(--danger) / .14); }

.btn-success {
  background: rgb(var(--success) / .08);
  color: rgb(var(--success));
  border: 1px solid rgb(var(--success) / .25);
}
.btn-success:hover:not(:disabled) { background: rgb(var(--success) / .14); }

.btn-ghost {
  background: rgb(var(--surface));
  color: rgb(var(--foreground));
  border: 1px solid rgb(var(--border));
}
.btn-ghost:hover:not(:disabled) { background: rgb(var(--muted) / .6); }

.btn-sm {
  height: 32px; padding: 0 12px; font-size: 12px;
  border-radius: 6px; width: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Topbar ──────────────────────────────────────────────────────────────────── */
/* Height grows by safe-area-inset-top so content never hides under status bar  */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: space-between;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 10px;
  background: rgb(var(--background) / .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgb(var(--border));
  min-width: 0;
}
.topbar-title {
  font-size: 15px; font-weight: 600; color: rgb(var(--foreground));
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 10px;
}
.topbar-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.topbar-user {
  font-size: 13px; font-weight: 500; color: rgb(var(--muted-fg));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 200px;
}

/* ── Login Page ──────────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
  padding-top: calc(32px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  padding-left: 16px;
  padding-right: 16px;
  background: rgb(var(--background));
  overflow-y: auto;
}
.login-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
}
.login-logo { font-size: 44px; text-align: center; margin-bottom: 16px; }
.login-card h1 { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.login-hint {
  text-align: center; color: rgb(var(--muted-fg)); font-size: 14px;
  margin-bottom: 28px; line-height: 1.65;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 500; color: rgb(var(--foreground)); }
.field input {
  height: 42px; padding: 0 14px;
  border: 1px solid rgb(var(--border)); border-radius: 8px;
  background: rgb(var(--surface)); color: rgb(var(--foreground));
  font: inherit; font-size: 16px; outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .2s, box-shadow .2s;
  touch-action: manipulation;    /* ≥16px prevents iOS zoom */
}
.field input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgb(var(--primary) / .10);
}
.field-hint { font-size: 11px; color: rgb(var(--muted-fg)); }

.error-box {
  background: rgb(var(--danger) / .08);
  border: 1px solid rgb(var(--danger) / .25);
  color: rgb(var(--danger));
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 14px; line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════════════════
   App Shell  —  Fixed header + fixed footer + positioned content layer
   The key rule: .tab-panel is position:fixed with explicit top/bottom bounds.
   This ensures the scrollable area NEVER spills under the topbar or bottom-nav,
   on any screen size.
   ══════════════════════════════════════════════════════════════════════════════ */

.app-body {
  /* No height/overflow needed — everything inside is fixed/positioned */
  background: rgb(var(--background));
}

/* ── Tab panel: fills exactly the gap between fixed topbar and fixed bottom-nav */
.tab-panel {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Bottom navigation ───────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;      /* кнопки прижаты к верху, ниже — safe zone */
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  background: rgb(var(--surface));
  border-top: 1px solid rgb(var(--border));
}
.bottom-nav::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: 0; right: 0;
  height: 100px;
  background: rgb(var(--surface));
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: rgb(var(--muted-fg)); transition: color .18s;
  padding: 6px 4px; font-family: inherit;
  min-height: 44px;                  /* accessible touch target */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: rgb(var(--primary)); }
.nav-icon  { font-size: 20px; line-height: 1; }
.nav-label { font-size: 11px; font-weight: 500; }

/* ── Chat ────────────────────────────────────────────────────────────────────── */
.chat-messages {
  flex: 1;                     /* fills tab-panel vertically */
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  /* Center content on wide screens */
  max-width: 720px; width: 100%; margin: 0 auto;
  /* Prevent rubber-band from clipping last message */
  overscroll-behavior-y: contain;
}

.msg { display: flex; max-width: 80%; }
.msg-bot  { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }

.msg-bot .bubble {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  color: rgb(var(--foreground));
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.msg-user .bubble {
  background: rgb(var(--primary));
  color: rgb(var(--primary-fg));
  border-radius: 14px 4px 14px 14px;
}

.bubble {
  padding: 10px 14px; font-size: 14px; line-height: 1.6;
  word-break: break-word; overflow-wrap: anywhere;
}
.bubble a { color: inherit; }
.msg-bot .bubble a { color: rgb(var(--primary)); }

.chat-actions {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 520px; width: 100%;
  align-self: flex-start; padding: 2px 0;
}

/* ── Project list (chat) ─────────────────────────────────────────────────────── */
.proj-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.proj-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 14px; padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.proj-card:hover {
  border-color: rgb(var(--primary) / .5);
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.proj-card:active { transform: scale(.99); }
.proj-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.proj-addr { font-size: 13px; color: rgb(var(--muted-fg)); word-break: break-word; }
.proj-meta { font-size: 12px; color: rgb(var(--muted-fg)); margin-top: 6px; font-weight: 500; }

/* ── Textarea (chat) ─────────────────────────────────────────────────────────── */
.chat-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid rgb(var(--border)); border-radius: 8px;
  background: rgb(var(--surface)); color: rgb(var(--foreground));
  font: inherit; font-size: 16px; resize: vertical; outline: none;
  min-height: 100px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .2s, box-shadow .2s;
}
.chat-textarea:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgb(var(--primary) / .10);
}
.chat-textarea.input-error { border-color: rgb(var(--danger)); }

/* ── Upload (chat) ───────────────────────────────────────────────────────────── */
.chat-upload-area {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1.5px dashed rgb(var(--border)); border-radius: 12px;
  padding: 24px 16px; cursor: pointer; text-align: center;
  background: rgb(var(--muted) / .4); color: rgb(var(--muted-fg));
  font-size: 14px; transition: border-color .2s, background .2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.chat-upload-area:hover {
  border-color: rgb(var(--primary) / .5);
  background: rgb(var(--primary) / .04);
}
.upload-icon { font-size: 28px; }

.upload-list { display: flex; flex-direction: column; gap: 6px; }
.upload-item {
  display: flex; align-items: center; gap: 9px;
  background: rgb(var(--muted) / .5); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-weight: 500;
  border: 1px solid rgb(var(--border));
  min-width: 0;
}
.upload-item span:first-child {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-item .u-status { margin-left: auto; flex-shrink: 0; }
.upload-item.loading  { animation: uploadPulse 1.4s ease-in-out infinite; }
.upload-item.loading .u-status::after { content: '⏳'; }
.upload-item.done    .u-status::after { content: '✅'; }
.upload-item.error   .u-status::after { content: '❌'; }

.btn-uploading {
  background: rgb(var(--muted));
  color: rgb(var(--muted-fg));
  cursor: not-allowed; opacity: 1;
  animation: uploadPulse 1.4s ease-in-out infinite;
}

/* ── Geo ─────────────────────────────────────────────────────────────────────── */
.geo-status-msg {
  text-align: center; font-size: 14px; color: rgb(var(--muted-fg));
  padding: 10px 4px; line-height: 1.6; word-break: break-word;
}
.geo-result {
  padding: 10px 14px; border-radius: 8px;
  font-size: 14px; line-height: 1.55; word-break: break-word;
}
.geo-result.ok  { background: rgb(var(--success)/.09); border: 1px solid rgb(var(--success)/.25); color: rgb(var(--success)); }
.geo-result.err { background: rgb(var(--danger)/.08);  border: 1px solid rgb(var(--danger)/.25);  color: rgb(var(--danger)); }
.geo-inline-result { margin-bottom: 8px; }

/* ── Timer ───────────────────────────────────────────────────────────────────── */
.timer-display {
  font-family: 'Inter', monospace; font-weight: 700; font-size: 18px;
  color: rgb(var(--primary));
}

/* ── Chat link ───────────────────────────────────────────────────────────────── */
.chat-link { color: rgb(var(--primary)); text-decoration: underline; word-break: break-all; }

/* ── Stub screen ─────────────────────────────────────────────────────────────── */
.stub-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; color: rgb(var(--muted-fg));
  padding: 40px 20px; text-align: center;
}
.stub-icon { font-size: 48px; }
.stub-screen h2 { font-size: 18px; font-weight: 600; color: rgb(var(--foreground)); }
.stub-screen p  { font-size: 14px; }

/* ── Reports list ────────────────────────────────────────────────────────────── */
.reports-list {
  flex: 1; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 720px; width: 100%; margin: 0 auto;
  overscroll-behavior-y: contain;
}
.report-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.report-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.09);
  border-color: rgb(var(--primary) / .35);
}

/* ── Report detail ───────────────────────────────────────────────────────────── */
.report-detail {
  flex: 1; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 720px; width: 100%; margin: 0 auto;
  animation: fadeIn .18s ease;
  overscroll-behavior-y: contain;
}
.report-detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: rgb(var(--primary));
  background: none; border: none; cursor: pointer; padding: 4px 0;
  min-height: 36px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.report-detail-back:hover { text-decoration: underline; }
.report-detail-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.detail-row { display: flex; flex-direction: column; gap: 3px; }
.detail-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: rgb(var(--muted-fg));
}
.detail-value {
  font-size: 14px; color: rgb(var(--foreground)); line-height: 1.6;
  word-break: break-word; overflow-wrap: anywhere;
}

.report-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 6px; margin-bottom: 4px;
  flex-wrap: wrap;
}
.report-proj   { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; word-break: break-word; }
.report-hours  {
  font-size: 12px; font-weight: 600; color: rgb(var(--primary));
  background: rgb(var(--primary) / .09);
  padding: 2px 8px; border-radius: 6px;
  flex-shrink: 0; white-space: nowrap;
}
.report-dates  { font-size: 12px; color: rgb(var(--muted-fg)); margin-bottom: 6px; font-weight: 500; word-break: break-word; }
.report-text   { font-size: 13px; color: rgb(var(--foreground)); line-height: 1.55; word-break: break-word; }
.report-link   {
  display: inline-block; margin-top: 8px;
  font-size: 13px; font-weight: 500;
  color: rgb(var(--primary)); text-decoration: none; word-break: break-all;
}
.report-link:hover { text-decoration: underline; }

/* ── Empty / Spinner ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: rgb(var(--muted-fg)); line-height: 1.7; font-size: 14px;
}
.screen-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; min-height: 200px; flex: 1;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid rgb(var(--border));
  border-top-color: rgb(var(--primary));
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Animations ──────────────────────────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes uploadPulse {
  0%, 100% { background: rgb(var(--muted) / .5); }
  50%      { background: rgb(var(--primary) / .10); border-color: rgb(var(--primary) / .25); }
}
.msg { animation: fadeIn .18s ease; }

/* ── Login-page divider ──────────────────────────────────────────────────────── */
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0; color: rgb(var(--muted-fg)); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: rgb(var(--border));
}
.login-alt-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── Registration overlay ────────────────────────────────────────────────────── */
.reg-overlay {
  position: fixed; inset: 0;
  background: rgb(var(--background));
  display: flex; flex-direction: column;
  z-index: 50;
}
.reg-topbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgb(var(--background) / .92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgb(var(--border));
}
.reg-topbar-back {
  background: none; border: none; cursor: pointer;
  color: rgb(var(--primary)); font-size: 14px; font-weight: 500;
  font-family: inherit; padding: 6px 0; min-width: 50px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.reg-topbar-title {
  font-size: 15px; font-weight: 600; color: rgb(var(--foreground));
}
.reg-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior-y: contain;
}
.reg-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgb(var(--border));
  background: rgb(var(--surface));
}
.reg-input-row {
  display: flex; gap: 8px; align-items: center;
}
.reg-text-input {
  flex: 1; height: 42px; padding: 0 14px;
  border: 1px solid rgb(var(--border)); border-radius: 8px;
  background: rgb(var(--surface)); color: rgb(var(--foreground));
  font: inherit; font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
  touch-action: manipulation;
}
.reg-text-input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgb(var(--primary) / .10);
}
.reg-send-btn { flex-shrink: 0; width: auto; padding: 0 18px; }
.reg-file-area { display: flex; flex-direction: column; gap: 8px; }
.reg-file-label {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1.5px dashed rgb(var(--border)); border-radius: 12px;
  padding: 20px 16px; cursor: pointer; text-align: center;
  background: rgb(var(--muted) / .4); color: rgb(var(--muted-fg));
  font-size: 14px; transition: border-color .2s, background .2s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.reg-file-label:hover {
  border-color: rgb(var(--primary) / .5);
  background: rgb(var(--primary) / .04);
}
.reg-file-input { display: none; }
.uin-badge {
  display: inline-block;
  background: rgb(var(--primary) / .10);
  color: rgb(var(--primary));
  border: 1px solid rgb(var(--primary) / .30);
  border-radius: 10px;
  padding: 6px 16px;
  font-size: 24px; font-weight: 700;
  letter-spacing: 4px; margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TABLET  768px – 1279px
   Shell stays full-width; inner content areas get wider padding/max-width.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .chat-messages, .reports-list, .report-detail {
    max-width: 800px;
    padding-left: 24px;
    padding-right: 24px;
  }
  .chat-actions { max-width: 560px; }
  .login-card   { padding: 48px 44px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   DESKTOP  ≥ 1280px
   Shell (topbar / tab-panel / bottom-nav) stays full-width — same as every
   desktop messenger (Telegram, WhatsApp Web). Content areas are centered via
   max-width + margin:auto, so text doesn't stretch across a 27" monitor.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
  .chat-messages, .reports-list, .report-detail {
    max-width: 900px;
    padding-left: 32px;
    padding-right: 32px;
  }
  .chat-actions       { max-width: 640px; }
  .report-detail-card { padding: 24px; }
  .stub-icon          { font-size: 56px; }
  .stub-screen h2     { font-size: 20px; }
  .stub-screen p      { font-size: 15px; }
  /* Slightly larger topbar padding on wide screens */
  .topbar { padding-left: 28px; padding-right: 28px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE  ≤ 480px
   Only override what needs to shrink — everything else inherits from base.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ── Login ─────────────────────────────────────────────────────────────────── */
  .login-page  { padding-left: 12px; padding-right: 12px; }
  .login-card  { padding: 24px 18px; border-radius: 14px; }
  .login-logo  { font-size: 36px; margin-bottom: 10px; }
  .login-card h1 { font-size: 17px; }
  .login-hint  { font-size: 12px; margin-bottom: 18px; }

  /* ── Buttons: bigger tap targets ────────────────────────────────────────────── */
  .btn    { height: 46px; font-size: 15px; }
  .btn-sm { height: 36px; padding: 0 12px; font-size: 12px; }

  /* ── Topbar ────────────────────────────────────────────────────────────────── */
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar-title { font-size: 13px; }
  /* Hide username — saves space so "Выйти" / "Статистика" are always visible */
  .topbar-user { display: none; }

  /* ── Chat ──────────────────────────────────────────────────────────────────── */
  .chat-messages { padding: 12px 10px 8px; gap: 8px; }
  .msg    { max-width: 92%; }
  .bubble { font-size: 13px; padding: 8px 12px; }
  .chat-actions { max-width: 100%; }

  /* ── Project cards ─────────────────────────────────────────────────────────── */
  .proj-card { padding: 12px 13px; }
  .proj-name { font-size: 13px; }
  .proj-addr { font-size: 12px; }
  .proj-meta { font-size: 11px; margin-top: 4px; }

  /* ── Geo / Timer ───────────────────────────────────────────────────────────── */
  .geo-status-msg { font-size: 13px; padding: 12px 2px; }
  .geo-result     { font-size: 13px; }
  .timer-display  { font-size: 20px; }

  /* ── Textarea ──────────────────────────────────────────────────────────────── */
  .chat-textarea { min-height: 88px; padding: 10px 12px; }

  /* ── Upload ────────────────────────────────────────────────────────────────── */
  .chat-upload-area { padding: 20px 12px; }
  .upload-icon { font-size: 24px; }
  .upload-item { font-size: 12px; }

  /* ── Reports ───────────────────────────────────────────────────────────────── */
  .reports-list, .report-detail { padding: 10px; gap: 8px; }
  .report-card  { padding: 12px 13px; }
  .report-proj  { font-size: 13px; }
  .report-dates { font-size: 11px; }
  .report-text  { font-size: 12px; }
  .report-detail-back { font-size: 13px; min-height: 44px; padding: 8px 0; }
  .report-detail-card { padding: 14px; gap: 10px; }
  .detail-label { font-size: 10px; }
  .detail-value { font-size: 13px; }

  /* ── Stub ──────────────────────────────────────────────────────────────────── */
  .stub-icon  { font-size: 40px; }
  .stub-screen h2 { font-size: 16px; }

  /* ── Bottom nav ────────────────────────────────────────────────────────────── */
  .nav-icon  { font-size: 20px; }
  .nav-label { font-size: 10px; }
}
