/* public/css/base.css
   База приложения: CSS-переменные, reset, типографика, общий фон,
   прогресс-бар сверху, базовый <header>, скроллбар.

   Всё остальное вынесено в отдельные файлы:
     - shell.css        — titlebar, tabs, space-switch, user-zone, FAB
     - toast.css        — тост-уведомления
     - pwa-hint.css     — install-кнопка и iOS-инструкция
     - notifications.css — колокольчик и модалка member-tasks
*/

:root{
  --bg:           #fafafa;
  --bg-elev-1:    #ffffff;
  --bg-elev-2:    #ffffff;
  --bg-elev-3:    #ffffff;
  --bg-elev-4:    #f5f5f7;

  --text:         #1d1d1f;
  --text-muted:   #6e6e73;
  --text-dim:     #8e8e93;

  --border:       #e5e5e7;
  --border-soft:  #ededf0;

  --green:        #2d8659;
  --green-hover:  #246e48;
  --green-bg:     #e8f5ee;

  --blue:         #1c6dd0;
  --blue-bg:      #e7f0fb;

  --orange:       #b5651d;
  --orange-bg:    #fbf1e4;

  --red:          #b83a3a;
  --red-bg:       #fbebeb;

  --purple:       #8e44ad;
  --purple-bg:    #f4ebfa;

  --gray-badge:   #ededf0;

  --shadow-sm:    0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.02);
  --shadow-md:    0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:    0 12px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

*{box-sizing:border-box}

html,body{
  height:100%;
  /* C.2c-fix-3: запрещаем только горизонтальные жесты навигации.
     Вертикальный overscroll оставляем — нужен для pull-to-refresh. */
  overscroll-behavior-x: none;
}

html{
  /* Обрезаем по ширине, чтобы браузер не показывал
     «предпросмотр предыдущей страницы» */
  overflow-x: hidden;
}

body{
  font:15px system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;
  margin:0;
  background:var(--bg);
  color:var(--text);
  padding-bottom: calc(120px + var(--safe-bottom));
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  scroll-padding-bottom: calc(120px + var(--safe-bottom));
  width: 100%;
  overflow-x: hidden;
}

#bar{
  height:3px;
  background:linear-gradient(90deg,var(--green-hover),var(--green));
  width:0;
  transition:width .3s;
  position:fixed;
  top:0;left:0;
  z-index:100;
}

/* Базовый <header> главного приложения (index.html).
   НЕ применяется к:
     - .admin-header (админка, своя шапка)
     - .toolbar      (report.html, свой тулбар)
   Это нужно, чтобы base.css не «протекал» в чужие layout'ы. */
header:not(.admin-header):not(.toolbar){
  padding: calc(14px + var(--safe-top)) 20px 0;
  background:var(--bg-elev-1);
  position:sticky;top:0;z-index:10;
  border-bottom:1px solid var(--border-soft);
  backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
}

@media (max-width:640px){
  body{
    padding-bottom: calc(140px + var(--safe-bottom));
    scroll-padding-bottom: calc(140px + var(--safe-bottom));
  }
  header:not(.admin-header):not(.toolbar){
    padding: calc(10px + var(--safe-top)) 12px 0;
    /* C.2b-fix: убираем backdrop-filter на мобильном,
       чтобы position:fixed у .mobile-space-bar работал относительно окна,
       а не header (backdrop-filter создаёт containing block). */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-elev-1);
  }
}

::-webkit-scrollbar{width:12px;height:12px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{
  background:#d0d0d4;
  border-radius:6px;
  border:3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover{background:#b8b8bd}

@media (prefers-reduced-motion: reduce){
  *{transition:none !important;animation:none !important}
}

/* 7.at-fix: прячем ленивые вкладки до загрузки их специфичных CSS */
#calendar,
#analytics {
  display: none;
}