/* ============================================
   СМЕНА — Design System
   Mobile First, min-width: 375px
   Шрифты: Unbounded (заголовки) + Golos Text (текст)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@600;700&family=Golos+Text:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand */
  --color-brand:        #1A1A2E;
  --color-accent:       #E94560;
  --color-accent-dim:   rgba(233,69,96,0.12);

  /* Backgrounds — тёплые, как у твоих презентаций */
  --color-bg:           #F5F4F1;
  --color-surface:      #FFFFFF;
  --color-surface-2:    #EEECEA;

  /* Text */
  --color-text:         #1A1917;
  --color-text-secondary: #888;
  --color-text-inverse: #FFFFFF;

  /* Status */
  --color-ok:           #1D9E75;
  --color-ok-dim:       #E8F5F1;
  --color-warn:         #D97706;
  --color-warn-dim:     #FEF3E2;
  --color-danger:       #E94560;
  --color-danger-dim:   #FDEDEF;

  /* Borders */
  --color-border:       #E3E0D8;
  --color-border-focus: #1A1917;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Typography */
  --font-display: 'Unbounded', sans-serif;
  --font-base:    'Golos Text', system-ui, sans-serif;
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 16px;
  --text-md:   18px;
  --text-lg:   20px;
  --text-xl:   24px;

  /* Layout */
  --nav-height:    60px;
  --header-height: 52px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  --transition-fast: 140ms ease;
  --transition-base: 240ms ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--text-base); -webkit-text-size-adjust: 100%; height: 100%; }
body { font-family: var(--font-base); font-size: var(--text-base); line-height: 1.55; color: var(--color-text); background: var(--color-bg); min-height: 100%; min-width: 375px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: var(--text-base); }
img, svg { display: block; max-width: 100%; }

/* ── App Layout ── */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-md); gap: var(--space-md);
}

.app-header__title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.2px;
  flex: 1;
}

.app-main {
  flex: 1;
  padding: var(--space-md);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--space-md));
}

/* ── Bottom Nav ── */
.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex; align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 48px; cursor: pointer;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
  border: none; background: none; text-decoration: none;
}
.nav-item.active, .nav-item:active { color: var(--color-accent); }
.nav-item__icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.nav-item__label { font-size: 11px; font-weight: 600; line-height: 1; }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.card + .card { margin-top: var(--space-sm); }
.card--interactive { cursor: pointer; transition: transform var(--transition-fast); }
.card--interactive:active { transform: scale(0.985); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: 48px; min-width: 48px; padding: 0 var(--space-lg);
  font-family: var(--font-base); font-size: var(--text-base); font-weight: 600;
  border-radius: var(--radius-md); border: none; cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.96); opacity: 0.85; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-primary   { background: var(--color-accent); color: #fff; }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); }
.btn-outline   { background: transparent; color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-danger    { background: var(--color-danger-dim); color: var(--color-danger); }
.btn-success   { background: var(--color-ok-dim); color: var(--color-ok); }
.btn-full      { width: 100%; }
.btn-icon      { padding: 0; border-radius: var(--radius-md); background: var(--color-surface-2); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.form-group + .form-group { margin-top: var(--space-md); }
.form-label {
  font-family: var(--font-display);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-secondary);
}
.form-input {
  height: 52px; padding: 0 var(--space-md);
  background: var(--color-surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base); color: var(--color-text);
  outline: none; transition: border-color var(--transition-fast); width: 100%;
}
.form-input:focus { border-color: var(--color-border-focus); background: var(--color-surface); }
.form-input::placeholder { color: var(--color-text-secondary); }
.form-error { font-size: var(--text-sm); color: var(--color-danger); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  line-height: 1.5; text-transform: uppercase;
}
.badge-todo     { background: var(--color-surface-2); color: var(--color-text-secondary); }
.badge-done     { background: var(--color-ok-dim);    color: var(--color-ok); }
.badge-overdue  { background: var(--color-danger-dim); color: var(--color-danger); }
.badge-rework   { background: var(--color-warn-dim);  color: var(--color-warn); }
.badge-critical { background: var(--color-danger);    color: #fff; }

/* ── Section Headers ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }
.section-title {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-secondary);
}

/* ── Empty State ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-2xl) var(--space-lg); text-align: center; gap: var(--space-md); }
.empty-state__icon { font-size: 44px; line-height: 1; }
.empty-state__title { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.empty-state__text { font-size: var(--text-base); color: var(--color-text-secondary); }

/* ── Skeleton ── */
.skeleton { background: linear-gradient(90deg,var(--color-surface-2) 25%,var(--color-border) 50%,var(--color-surface-2) 75%); background-size: 200% 100%; animation: skel 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Page Loader ── */
.page-loader { position: fixed; inset: 0; background: var(--color-bg); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity 400ms ease; }
.page-loader.hidden { opacity: 0; pointer-events: none; }
.loader-spinner { width: 36px; height: 36px; border: 2.5px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toasts ── */
#toast-container { position: fixed; top: calc(var(--header-height) + 8px); left: var(--space-md); right: var(--space-md); z-index: 9000; display: flex; flex-direction: column; gap: var(--space-sm); pointer-events: none; }
.toast { background: var(--color-brand); color: #fff; padding: var(--space-md); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; box-shadow: var(--shadow-lg); animation: tin .3s ease, tout .3s ease 2.7s forwards; pointer-events: auto; }
.toast.toast-success { background: var(--color-ok); }
.toast.toast-error   { background: var(--color-danger); }
.toast.toast-warn    { background: var(--color-warn); color: var(--color-text); }
@keyframes tin  { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes tout { to   { transform: translateY(-12px); opacity: 0; } }

/* ── Auth Page ── */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-brand); padding: var(--space-xl) var(--space-lg); }
.auth-logo { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.auth-logo__icon { width: 52px; height: 52px; background: var(--color-accent); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: var(--space-lg); }
.auth-logo__name { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -.5px; line-height: 1.2; }
.auth-logo__tagline { font-size: var(--text-base); color: rgba(255,255,255,.45); margin-top: var(--space-sm); }
.auth-form { background: var(--color-surface); border-radius: var(--radius-xl); padding: var(--space-xl) var(--space-lg); box-shadow: var(--shadow-lg); }
.auth-form__title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: var(--space-lg); }

/* ── Task Item ── */
.task-item { display: flex; align-items: flex-start; gap: var(--space-md); padding: var(--space-md); background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color var(--transition-fast); }
.task-item:active { border-color: var(--color-text); }
.task-item--critical { border-left: 3px solid var(--color-danger); }
.task-item--done { opacity: 0.5; }
.task-item--overdue { border-color: var(--color-danger); background: var(--color-danger-dim); }
.task-item--rework  { border-color: var(--color-warn); background: var(--color-warn-dim); }
.task-item__time { flex-shrink: 0; text-align: center; width: 40px; }
.task-item__time-val { font-family: var(--font-display); font-size: 11px; font-weight: 700; line-height: 1.1; }
.task-item__time-label { font-size: 10px; color: var(--color-text-secondary); }
.task-item__body { flex: 1; min-width: 0; }
.task-item__name { font-size: var(--text-base); font-weight: 600; line-height: 1.3; margin-bottom: 5px; }
.task-item__meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.task-item__arrow { flex-shrink: 0; color: var(--color-text-secondary); display: flex; align-items: center; }

/* ── Alert Item ── */
.alert-item { display: flex; gap: var(--space-md); padding: var(--space-md); background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); cursor: pointer; }
.alert-item--danger { border-left: 3px solid var(--color-danger); }
.alert-item--warn   { border-left: 3px solid var(--color-warn); }
.alert-item__dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.alert-item__dot--danger { background: var(--color-danger); }
.alert-item__dot--warn   { background: var(--color-warn); }

/* ── Utility ── */
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm          { gap: var(--space-sm); }
.gap-md          { gap: var(--space-md); }
.mt-sm           { margin-top: var(--space-sm); }
.mt-md           { margin-top: var(--space-md); }
.mt-lg           { margin-top: var(--space-lg); }
.text-secondary  { color: var(--color-text-secondary); }
.text-danger     { color: var(--color-danger); }
.text-success    { color: var(--color-ok); }
.text-warn       { color: var(--color-warn); }
.text-sm         { font-size: var(--text-sm); }
.text-xs         { font-size: var(--text-xs); }
.text-bold       { font-weight: 700; }
.text-center     { text-align: center; }
.divider         { height: 1px; background: var(--color-border); margin: var(--space-md) 0; }

/* ── Settings ── */
.settings-section { margin-bottom: var(--space-xl); }
.settings-section__title { font-family: var(--font-display); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-secondary); margin-bottom: var(--space-sm); padding-left: var(--space-xs); }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--space-md); background: var(--color-surface); gap: var(--space-md); cursor: pointer; transition: background var(--transition-fast); }
.settings-row:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.settings-row:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.settings-row:only-child  { border-radius: var(--radius-md); }
.settings-row + .settings-row { border-top: 1px solid var(--color-border); }
.settings-row:active { background: var(--color-surface-2); }
.settings-row__label { font-size: var(--text-base); font-weight: 500; }
.settings-row__value { font-size: var(--text-sm); color: var(--color-text-secondary); display: flex; align-items: center; gap: 6px; }
