.hidden { display: none !important; }

:root {
  --office-topbar-height: calc(112px + env(safe-area-inset-top));
  --keyboard-inset: 0px;
  --visible-height: var(--app-height);
  --viewport-offset-top: 0px;
}

.status-brand {
  top: calc(env(safe-area-inset-top) + 4px);
  height: 24px;
  padding: 0 7px;
  gap: 6px;
  color: rgba(239, 246, 255, .92);
  font-size: 10px;
  font-weight: 780;
}
.status-brand img { width: 17px; height: 17px; border-radius: 5px; }
.topbar {
  height: var(--office-topbar-height);
  padding: calc(env(safe-area-inset-top) + 36px) 18px 12px;
}
.content { height: calc(var(--app-size) - var(--office-topbar-height) - 96px); }

.app[data-loading="true"] .content,
.app[data-loading="true"] .topbar,
.app[data-loading="true"] .bottom-nav { visibility: hidden; opacity: 0; }
.app[data-boot-ready="true"] .content,
.app[data-boot-ready="true"] .topbar,
.app[data-boot-ready="true"] .bottom-nav { transition: opacity .28s ease; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(85% 58% at 50% 42%, rgba(39, 178, 175, .15), transparent 62%),
    radial-gradient(72% 52% at 78% 20%, rgba(122, 105, 255, .13), transparent 66%),
    linear-gradient(155deg, #07131f 0%, #0c1729 55%, #12162b 100%);
  transition: opacity .45s ease, visibility .45s ease;
}

.boot-screen.done { opacity: 0; visibility: hidden; }

.boot-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 100% 52px;
  mask-image: linear-gradient(to bottom, transparent 4%, #000 38%, transparent 86%);
}
.boot-lockup {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.boot-mark {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(85, 242, 211, .13);
  border-radius: 16px;
  background: rgba(4, 25, 35, .48);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .24), 0 0 34px rgba(43, 190, 184, .1);
  animation: boot-mark-breathe 3.2s ease-in-out infinite;
}
.boot-mark svg { width: 84px; height: 84px; overflow: visible; }
.office-logo-dot {
  filter: drop-shadow(0 0 5px rgba(85, 242, 211, .5));
}
.boot-kicker {
  margin: 0;
  color: #55f2d3;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.boot-wordmark {
  margin: 0;
  color: #f8fbff;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.04;
  font-weight: 810;
  letter-spacing: 0;
}
.boot-copy {
  max-width: 310px;
  margin: 1px 0 8px;
  color: #9eabc0;
  font-size: 13px;
  line-height: 1.5;
}
.boot-line { width: 152px; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.08); }
.boot-line::after { content: ""; display: block; width: 42%; height: 100%; background: #55f2d3; animation: boot-line 1.25s ease-in-out infinite; }
.boot-retry {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(85, 242, 211, .34);
  border-radius: 7px;
  color: #dffcf5;
  background: rgba(85, 242, 211, .08);
  font: 760 10px/1 inherit;
  cursor: pointer;
}
.boot-retry:active { transform: translateY(1px); }

@keyframes boot-mark-breathe {
  50% {
    transform: translateY(-4px) scale(1.015);
    box-shadow: 0 22px 46px rgba(0, 0, 0, .26), 0 0 42px rgba(43, 190, 184, .16);
  }
}
@keyframes boot-line { from { transform: translateX(-120%); } to { transform: translateX(340%); } }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 980;
  display: grid;
  place-items: center;
  min-height: var(--visible-height);
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  background: #09111f;
}
.auth-panel { width: min(100%, 390px); margin: auto; }
.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 0 18px;
  filter: drop-shadow(0 14px 28px rgba(85, 242, 211, .13));
}
.auth-logo svg { display: block; width: 100%; height: 100%; }
.auth-kicker { margin: 0 0 10px; color: #55f2d3; font-size: 10px; font-weight: 830; text-transform: uppercase; letter-spacing: 1px; }
.auth-panel h1 { margin: 0 0 9px; color: white; font-size: 31px; line-height: 1.03; }
.auth-panel > p { margin: 0 0 26px; color: #9aa8bf; font-size: 13px; line-height: 1.5; }
.auth-panel > .auth-legal {
  margin: 20px 0 0;
  color: #718099;
  font-size: 10px;
  line-height: 1.55;
}
.auth-legal a { color: #9fb2cb; text-underline-offset: 2px; }

.office-form { display: grid; gap: 13px; }
.office-auth-step { animation: office-auth-enter .24s ease both; }
.office-auth-step[hidden] { display: none !important; }
.auth-phone-preview {
  margin: 0;
  padding: 11px 13px;
  border-left: 2px solid #55f2d3;
  color: #c8d4e7;
  background: rgba(85, 242, 211, .055);
  font-size: 12px;
  line-height: 1.4;
}
.auth-status {
  padding: 10px 12px;
  border: 1px solid rgba(176, 200, 239, .15);
  border-radius: 7px;
  color: #b9c7da;
  background: rgba(255,255,255,.03);
  font-size: 11px;
  line-height: 1.45;
}
.auth-status.error { border-color: rgba(255,125,142,.3); color: #ffb1be; background: rgba(255,125,142,.07); }
.auth-status.success { border-color: rgba(85,242,211,.28); color: #bffbed; background: rgba(85,242,211,.06); }
.office-otp { display: grid; gap: 15px; }
.office-otp-head h2 { margin: -2px 0 7px; color: #f5f8ff; font-size: 23px; line-height: 1.15; }
.office-otp-head > p:last-child { margin: 0; color: #8998ae; font-size: 12px; line-height: 1.4; }
.office-otp-digits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.office-otp-digit {
  width: 100%;
  height: 54px;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(176, 200, 239, .2);
  border-radius: 7px;
  outline: none;
  color: #f5f8ff;
  background: #151f32;
  text-align: center;
  font-size: 25px;
  font-weight: 820;
  caret-color: #55f2d3;
}
.office-otp-digit:focus { border-color: rgba(85,242,211,.72); box-shadow: 0 0 0 3px rgba(85,242,211,.08); }
.office-otp-digit:disabled { opacity: .6; }
.office-otp-progress { height: 3px; overflow: hidden; background: rgba(255,255,255,.07); }
.office-otp-progress span { display: block; width: 0; height: 100%; background: #55f2d3; transition: width .18s ease; }
.office-otp.verifying .office-otp-progress span { width: 100% !important; animation: office-otp-pulse .75s ease-in-out infinite alternate; }
.office-otp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.office-otp-alternative { grid-column: 1 / -1; }
@keyframes office-auth-enter { from { opacity: 0; transform: translateY(5px); } }
@keyframes office-otp-pulse { from { opacity: .45; } to { opacity: 1; } }
.field { display: grid; gap: 7px; }
.field > span { color: #aeb9cc; font-size: 10px; font-weight: 720; }
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid rgba(176, 200, 239, .18);
  border-radius: 7px;
  outline: none;
  color: #f5f8ff;
  background: #151f32;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: rgba(85,242,211,.6); box-shadow: 0 0 0 3px rgba(85,242,211,.08); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row > * { min-width: 0; }
/* Срок/Приоритет в карточке задачи: локализованная дата+время (datetime-local) в узкой
   колонке половинной ширины обрезалась («4 авг. 2026 г., 18:1…») — под них нужна вся
   ширина модалки, а не половина, поэтому этот ряд всегда в один столбец, а не только
   на совсем узких экранах. */
.field-row.task-detail-row { grid-template-columns: 1fr; }

.event-time-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(176, 200, 239, .16);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.event-time-card > strong {
  display: block;
  margin-bottom: 9px;
  color: #f1f5fc;
  font-size: 14px;
}
.event-time-row { grid-template-columns: 1fr; gap: 10px; }
.event-time-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(104px, .42fr); gap: 8px; }
.event-time-fields .field { min-width: 0; }
.event-time-fields .field > span { font-size: 12px; }
.event-time-fields input {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 8px 11px;
  color-scheme: dark;
  text-align: left;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 760;
  letter-spacing: 0;
  transition: transform .18s cubic-bezier(.22,.75,.25,1), border-color .18s ease, background-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-button { color: #071721; background: #55f2d3; }
.secondary-button { color: #eaf0fa; border-color: rgba(176,200,239,.18); background: rgba(255,255,255,.04); }
.danger-button { color: #ff9aaa; border-color: rgba(255,125,142,.24); background: rgba(255,125,142,.08); }
.primary-button:disabled,
.secondary-button:disabled { cursor: wait; opacity: .55; }
.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.danger-button:not(:disabled):active { transform: scale(.975); }

@media (max-width: 360px) {
  .auth-screen { padding-inline: 18px; }
  .office-otp-digits { gap: 5px; }
  .office-otp-digit { height: 48px; font-size: 22px; }
  .office-otp-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .office-logo-dot-motion { display: none; }
}

.calendar-voice-quick {
  min-height: 78px;
  margin: 18px 0 16px;
  padding: 12px 12px 12px 15px;
  border: 1px solid rgba(85,242,211,.32);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 50px;
  align-items: center;
  gap: 11px;
  color: #f7fbff;
  background: #1b3046;
  box-shadow: 0 12px 30px rgba(2,9,20,.18), inset 3px 0 #55f2d3;
  transition: min-height .24s cubic-bezier(.2,.82,.24,1), padding .24s cubic-bezier(.2,.82,.24,1), border-color .18s ease;
}
.calendar-voice-copy { min-width: 0; display: grid; gap: 3px; }
.calendar-voice-copy strong { font-size: 16px; line-height: 1.25; }
.calendar-voice-copy > span { color: #c4d0e1; font-size: 13px; line-height: 1.4; }
.calendar-voice-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.calendar-voice-quick .voice-action {
  grid-column: 2;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  color: #09212a;
  background: #55f2d3;
  transform-origin: center;
}
.calendar-voice-quick .voice-action-icon svg { width: 23px; height: 23px; }
.calendar-voice-quick .voice-recording-strip { grid-column: 1; grid-row: 1; min-height: 50px; border-radius: 7px; }
.calendar-voice-quick.voice-recording {
  min-height: 150px;
  padding-top: 78px;
  grid-template-columns: minmax(0, 1fr) var(--voice-control-size);
  align-items: end;
  overflow: visible;
}
.calendar-voice-quick.voice-recording .calendar-voice-copy { display: none; }
.calendar-voice-quick.voice-recording .voice-action {
  grid-column: 2;
  grid-row: 1;
  width: var(--voice-control-size);
  height: var(--voice-control-size);
  transform: translate(var(--voice-drag-x, 0), var(--voice-lift-y, 0)) scale(var(--voice-lift-scale, 1));
  box-shadow: 0 9px 24px rgba(47,140,255,.38);
}
.calendar-voice-quick.voice-recording .voice-action.recording-mode.locked {
  transform: translateY(0) scale(1);
}
.calendar-voice-quick.voice-recording,
.calendar-voice-quick.voice-recording * { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.calendar-voice-quick.voice-processing .calendar-voice-copy strong::after { content: "..."; }

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
}
.segmented {
  display: grid;
  /* Колонок ровно столько, сколько кнопок. Раньше стояло repeat(3, 1fr), и переключатель
     из двух кнопок («Документы» / «Бухгалтерия») занимал две трети ширины, а треть
     оставалась пустой — контрол выглядел сдвинутым влево. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: min(100%, 254px);
  /* Ширина ограничена, а выравнивания не было — блок прижимался к левому краю, и
     «Личная/Бизнес» и «Сегодня/Неделя/Месяц/Год» стояли не по центру экрана. */
  margin-inline: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.segment {
  min-height: 31px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 740;
}
.segment.active { color: white; background: rgba(110,182,255,.16); }
.calendar-nav { display: flex; align-items: center; gap: 5px; }
.calendar-nav button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-strong);
  background: rgba(255,255,255,.035);
  cursor: pointer;
}
.calendar-nav svg { width: 15px; height: 15px; }
.calendar-period { margin: 0 0 14px; font-size: 17px; font-weight: 780; }
.home-week-scope { color: var(--muted); font-size: 8px; font-weight: 720; text-transform: uppercase; }
.home-day { cursor: pointer; }
.home-day.today:not(.selected) { border-color: rgba(85,242,211,.28); }
.home-day.has-event::after { width: 5px; height: 5px; bottom: 3px; box-shadow: 0 0 8px rgba(110,182,255,.52); }
.home-day.selected.has-event::after { box-shadow: none; }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month-weekday { min-height: 29px; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8px; font-weight: 770; text-transform: uppercase; }
.month-day {
  min-height: 62px;
  padding: 7px 5px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted-strong);
  background: rgba(16,25,43,.42);
  text-align: left;
  cursor: pointer;
}
.month-day.outside { color: #58667c; background: rgba(8,15,27,.38); }
.month-day.selected { color: white; background: rgba(85,242,211,.09); box-shadow: inset 0 0 0 1px rgba(85,242,211,.32); }
.month-day.today .month-number { color: #071721; background: var(--mint); }
.month-number { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 780; }
.month-dots { display: flex; gap: 2px; margin: 6px 0 0 2px; }
.month-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); }
.month-dots i:nth-child(2) { background: var(--amber); }
.month-dots i:nth-child(3) { background: var(--mint); }

.week-surface { touch-action: pan-y; }
.week-strip.dynamic { margin-bottom: 16px; }
.week-strip.dynamic .day { min-width: 0; }
.week-strip.dynamic .day span:nth-child(2) { font-size: 15px; font-weight: 780; }
.week-strip.dynamic .day i {
  width: 4px;
  height: 4px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(110,182,255,.44);
}
.week-strip.dynamic .day.active i { background: #10202a; box-shadow: none; }
.week-strip.dynamic.swipe-left { animation: week-left .22s ease; }
.week-strip.dynamic.swipe-right { animation: week-right .22s ease; }
@keyframes week-left { from { opacity: .45; transform: translateX(16px); } }
@keyframes week-right { from { opacity: .45; transform: translateX(-16px); } }

.agenda-date { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 11px; }
.agenda-date h3 { margin: 0; font-size: 14px; }
.agenda-list { display: grid; gap: 8px; }
.agenda-day-group { min-width: 0; display: grid; gap: 7px; }
.agenda-day-group + .agenda-day-group { margin-top: 9px; }
.agenda-day-divider {
  min-height: 34px;
  padding: 0 4px 6px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(176,200,239,.14);
}
.agenda-day-divider > span { color: var(--mint); font-size: 11px; font-weight: 820; text-transform: uppercase; }
.agenda-day-divider > strong { color: #eaf1fb; font-size: 13px; }
.agenda-day-divider > small { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #9db0c7; background: rgba(255,255,255,.05); font-size: 10px; }
.agenda-day-events { min-width: 0; display: grid; gap: 6px; }
/* Событие и кнопки звонка держатся вместе: номер встречающего относится
   к этому событию, а не просто стоит рядом в списке. */
.agenda-event-block { display: grid; gap: 6px; min-width: 0; }

/* Телефоны из письма и из описания — нажимаемые ссылки: по прилёте номер набирают
   с телефона, а не переписывают руками. */
.call-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.call-chips .call-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px 8px 10px;
  border: 1px solid rgba(121,230,214,.34);
  border-radius: 999px;
  background: rgba(121,230,214,.1);
  color: #79e6d6;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease, border-color .16s ease, transform .14s ease;
}
.call-chips .call-chip:active { transform: scale(.97); }
/* Место встречи отличаем цветом от телефонов: это разное действие. */
.call-chips .call-chip.place-chip { border-color: rgba(110,182,255,.34); background: rgba(110,182,255,.1); color: #8dcbff; }
.call-chips .call-chip.place-chip:hover { background: rgba(110,182,255,.17); border-color: rgba(110,182,255,.55); }
.call-chips .call-chip.place-chip small { color: #a8cdf0; }
.call-chips .call-chip:hover { background: rgba(121,230,214,.17); border-color: rgba(121,230,214,.55); }
.call-chips .call-chip svg { flex: 0 0 auto; width: 16px; height: 16px; }
.call-chips .call-chip span { display: grid; min-width: 0; }
.call-chips .call-chip b { font-size: 13.5px; font-weight: 780; letter-spacing: .01em; white-space: nowrap; }
.call-chips .call-chip small { color: #a7d8d0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-ai-result .call-chips { margin-top: 10px; }
.agenda-event-calls { padding-left: 65px; }
@media (max-width: 480px) { .agenda-event-calls { padding-left: 0; } }

.agenda-event-swipe {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
  touch-action: pan-y;
}
.agenda-event-delete-reveal {
  position: absolute;
  inset: 0 0 0 auto;
  width: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff4f6;
  background: #9b3547;
  font-size: 13px;
  font-weight: 780;
  opacity: 0;
  visibility: hidden;
  transform: translateX(14px);
  transition: opacity .16s ease, transform .2s cubic-bezier(.22,.75,.25,1), visibility 0s linear .2s;
  pointer-events: none;
}
.agenda-event-delete-reveal svg { width: 19px; height: 19px; }
.agenda-event {
  display: grid;
  grid-template-columns: 54px 3px minmax(0, 1fr);
  gap: 11px;
  min-height: 64px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(24,34,55,.66);
}
.agenda-event-swipe .agenda-event {
  position: relative;
  z-index: 1;
  margin: 0;
  background: #192944;
  transition: transform .2s cubic-bezier(.22,.75,.25,1), opacity .18s ease;
  will-change: transform;
}
.agenda-event-swipe.swiping .agenda-event { transition: none; }
.agenda-event-swipe.swiping .agenda-event-delete-reveal,
.agenda-event-swipe.ready-to-delete .agenda-event-delete-reveal,
.agenda-event-swipe.deleting .agenda-event-delete-reveal {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}
.agenda-event-swipe.ready-to-delete .agenda-event-delete-reveal { background: #b33d51; }
.agenda-event-swipe.deleting .agenda-event { opacity: .38; pointer-events: none; }
.agenda-event-time { min-width: 0; display: grid; align-content: center; gap: 3px; color: var(--muted-strong); font-size: 9px; font-weight: 740; }
.agenda-event-time b { color: #dce8f7; font-size: 10px; line-height: 1.15; }
.agenda-event-time span { line-height: 1.25; }
.agenda-event-mark { border-radius: 2px; background: var(--blue); }
.agenda-event:nth-child(3n+2) .agenda-event-mark { background: var(--amber); }
.agenda-event:nth-child(3n+3) .agenda-event-mark { background: var(--mint); }
.agenda-event.tone-1 .agenda-event-mark { background: var(--amber); }
.agenda-event.tone-2 .agenda-event-mark { background: var(--mint); }
.agenda-event h4 { margin: 0 0 4px; font-size: 12px; }
.agenda-event p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.agenda-event.completed {
  opacity: 1;
  border-color: rgba(166,194,230,.1);
  background: #17253c;
}
.agenda-event.completed > * { opacity: .58; }
.agenda-event.completed .agenda-event-open { opacity: .4; }
.agenda-event.past {
  border-color: rgba(166,194,230,.09);
  background: #16243a;
}
.agenda-event.past > * { opacity: .5; }
.agenda-event.past h4 { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.agenda-event.past .agenda-event-open { opacity: .32; }

.office-behavior-form { margin-top: 14px; }
.office-setting-group {
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  background: rgba(15,28,48,.62);
}
.office-setting-group + .office-setting-group { margin-top: 10px; }
.office-setting-kicker {
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.office-setting-group > strong { color: #f4f8fd; font-size: 15px; line-height: 1.35; }
.office-choice-grid { display: grid; gap: 7px; }
.office-choice-grid label { display: block; cursor: pointer; }
.office-choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.office-choice-grid label > span {
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 7px;
  background: rgba(7,17,31,.5);
}
.office-choice-grid label > span strong { color: #edf4fd; font-size: 14px; }
.office-choice-grid label > span small { color: #8f9db2; font-size: 12px; }
.office-choice-grid input:checked + span {
  border-color: rgba(85,242,211,.55);
  background: rgba(85,242,211,.1);
  box-shadow: inset 3px 0 0 var(--mint);
}
.office-language-field { margin: 0; }
.office-language-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(176,200,239,.18);
  border-radius: 7px;
  color: #edf4fd;
  background: rgba(7,17,31,.55);
}
.office-setting-hint { margin: 0; color: #8f9db2; font-size: 12px; line-height: 1.45; }

.list-swipe {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  isolation: isolate;
  contain: paint;
  background: transparent;
  touch-action: pan-y;
  transition: max-height .3s cubic-bezier(.4,0,.2,1), opacity .26s ease, margin .3s cubic-bezier(.4,0,.2,1);
}
.list-swipe.collapsing {
  margin-top: 0;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
}
.list-swipe-delete-reveal {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 0;
  width: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff4f6;
  background: #71313f;
  font-size: 13px;
  font-weight: 780;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(12px);
  transition:
    opacity .14s ease,
    transform .18s cubic-bezier(.22,.75,.25,1),
    visibility 0s linear .18s,
    background-color .16s ease;
}
.mail-list-swipe .list-swipe-delete-reveal { width: 120px; }
.list-swipe-delete-reveal svg { width: 20px; height: 20px; flex: 0 0 auto; }
.list-swipe-card {
  position: relative;
  z-index: 1;
  margin: 0;
  transition: transform .2s cubic-bezier(.22,.75,.25,1), opacity .18s ease;
  will-change: transform;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.list-swipe.swiping .list-swipe-card { transition: none; }
.list-swipe.swiping > .mail-row,
.list-swipe.swiping > .chat-row,
.list-swipe.ready-to-delete > .mail-row,
.list-swipe.ready-to-delete > .chat-row,
.list-swipe.deleting > .mail-row,
.list-swipe.deleting > .chat-row {
  /* rise-in keeps control of transform after it finishes (fill-mode: both).
     Disable it while the user drags so the mail card follows the finger. */
  animation: none !important;
}
.list-swipe.swiping .list-swipe-delete-reveal,
.list-swipe.ready-to-delete .list-swipe-delete-reveal,
.list-swipe.deleting .list-swipe-delete-reveal {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}
.list-swipe.ready-to-delete .list-swipe-delete-reveal { background: #a33d50; }
.list-swipe.deleting .list-swipe-card { opacity: .38; pointer-events: none; }
.list-swipe.chat-list-swipe > .chat-row {
  background: #1e2d45;
}
.list-swipe.chat-list-swipe .list-swipe-delete-reveal {
  width: 112px;
}
.list-swipe.chat-list-swipe > .chat-row.pinned {
  background: #1d3442;
}
.list-swipe.mail-list-swipe > .mail-row {
  background: #1e2d45;
}
.list-swipe.mail-list-swipe > .mail-row.unread-mail {
  background: #243955;
}

/* ── Мультивыбор писем (long-press) ──
   Раньше панель стояла в потоке страницы над карточкой «Сводка Adjutant» — стоило
   прокрутить список писем вниз, чтобы что-то выбрать, и панель оставалась выше видимой
   области (position: sticky тут не спасал: список из тысяч писем скроллится глубоко, и
   искать «прилипшую» панель всё равно приходилось наверху). Теперь панель зафиксирована
   относительно экрана сразу под топбаром — видна на любой глубине скролла списка. */
.mail-selection-bar {
  position: fixed;
  top: var(--office-topbar-height);
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px 20px;
  border-radius: 0;
  background: #12233c;
  border-bottom: 1px solid rgba(85,242,211,.28);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.mail-selection-bar.busy { opacity: .6; pointer-events: none; }
.mail-selection-count { font-size: 13px; font-weight: 760; color: #d9e8ff; white-space: nowrap; }
.mail-selection-actions { min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.mail-selection-actions::-webkit-scrollbar { display: none; }
.mail-selection-actions button {
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: #eaf3ff;
  font-size: 12.5px;
  font-weight: 720;
}
.mail-selection-actions button.danger { background: #71313f; border-color: #a33d50; color: #ffe9ee; }
.mail-selection-actions button.ghost { min-width: 36px; }
.mail-row.selected-mail {
  outline: 2px solid #55f2d3;
  outline-offset: -2px;
  background: #1c3a52 !important;
}
.mail-row .mail-check { transition: background .15s ease; }
.mail-row.selected-mail .mail-check { background: #55f2d3; color: #06281f; }

.mail-flag-rail,
.mail-flag-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 11px;
  scrollbar-width: none;
}
.mail-flag-rail::-webkit-scrollbar,
.mail-flag-picker::-webkit-scrollbar { display: none; }
.mail-flag-chip {
  min-height: 32px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(128,171,225,.2);
  border-radius: 8px;
  color: #dbe7f6;
  background: rgba(51,72,106,.48);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}
.mail-flag-chip > span,
.mail-row-flags > span::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: #72d4bc;
}
.mail-flag-chip small { color: #8fa1ba; font-size: 10px; }
.mail-flag-chip.active { color: #071721; border-color: var(--mint); background: var(--mint); }
.mail-flag-chip.active small { color: #153c42; }
.mail-flag-chip input { position: absolute; opacity: 0; pointer-events: none; }
.mail-flag-chip:has(input:checked) { border-color: rgba(85,242,211,.7); background: rgba(85,242,211,.13); }
.mail-flag-chip.tone-1 > span,
.mail-row-flags > .tone-1::before { background: #8fcaff; }
.mail-flag-chip.tone-2 > span,
.mail-row-flags > .tone-2::before { background: #f2c46f; }
.mail-flag-chip.tone-3 > span,
.mail-row-flags > .tone-3::before { background: #d39cff; }
.mail-flag-chip.tone-4 > span,
.mail-row-flags > .tone-4::before { background: #ff9aaa; }
.mail-flag-chip.tone-5 > span,
.mail-row-flags > .tone-5::before { background: #a4df79; }
.mail-row-pin {
  margin-left: 6px;
  color: #86d7ff;
  font-size: 9px;
  font-weight: 760;
}
.mail-row.pinned-mail { box-shadow: inset 3px 0 rgba(85,242,211,.48); }
.mail-row-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mail-row-flags > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  color: #cbd9eb;
  background: rgba(121,156,205,.1);
  font-size: 9px;
  font-weight: 700;
}
.mail-row-flags > span::before { width: 5px; height: 5px; }

/* ── Сводка: скрыть неважное + отметка календаря ── */
.digest-item-side { display: inline-flex; align-items: center; gap: 8px; }
.digest-item { cursor: pointer; }
.digest-dismiss {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #c4d3ea;
  font-size: 13px;
  line-height: 1;
}
.digest-calendar { display: block; margin-top: 6px; font-size: 12px; color: #7de6c8; font-weight: 700; }
.digest-mark-read { width: 100%; margin-top: 12px; }

/* ── ИИ-черновик ответа на письмо ── */
.mail-ai-compose {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(85,242,211,.06);
  border: 1px solid rgba(85,242,211,.2);
}
.mail-ai-compose-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.ai-lang-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: #cfe0f6; }
.ai-lang-toggle input { width: 16px; height: 16px; accent-color: #55f2d3; }

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text); font-size: 13px; }
.empty-state p { max-width: 270px; margin: 0; font-size: 10px; line-height: 1.5; }
.empty-state .primary-button { margin-top: 7px; }

.page-heading h2 { display: none; }
.page-heading { margin-bottom: 14px !important; }

.integration-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin: 0 0 13px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.018);
}
.integration-strip-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.integration-strip-icon { width: 34px; height: 34px; flex: 0 0 auto; object-fit: contain; }
.integration-copy { min-width: 0; }
.integration-copy strong { display: block; overflow: hidden; color: white; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.integration-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.integration-action { min-height: 32px; flex: 0 0 auto; padding: 0 11px; border: 1px solid rgba(85,242,211,.24); border-radius: 6px; color: var(--mint); background: rgba(85,242,211,.07); cursor: pointer; font-size: 9px; font-weight: 760; }
.integration-action.connected { color: #071721; background: var(--mint); }
.push-strip { border-color: rgba(85,242,211,.16); background: rgba(85,242,211,.035); }
.push-strip .integration-copy strong { color: var(--mint); }

.mail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 13px; overflow: visible; scrollbar-width: none; }
.mail-actions::-webkit-scrollbar { display: none; }
/* Полоса «прочитать всё»: операция на сотни писем идёт десятками секунд, и без неё
   единственным признаком работы была надпись на кнопке — читалось как зависание. */
.mail-read-progress { display: grid; gap: 6px; margin: -6px 0 13px; }
.mail-read-progress-label {
  font-family: inherit;
  font-size: 10px;
  font-weight: 720;
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
}
.mail-read-progress-track {
  display: block;
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(176,200,239,.14);
  overflow: hidden;
}
.mail-read-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
  transition: width .25s ease;
}
@media (prefers-reduced-motion: reduce) { .mail-read-progress-track i { transition: none; } }
.mail-action { min-height: 35px; flex: 0 0 auto; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted-strong); background: rgba(255,255,255,.03); cursor: pointer; font-size: 9px; font-weight: 720; }
.mail-action.primary { border-color: rgba(85,242,211,.2); color: var(--mint); }
.mail-row-priority { margin-left: 6px; color: #f4cb73; font-size: 7px; font-weight: 800; text-transform: uppercase; }

.digest { border-left: 0; border: 1px solid rgba(129,120,255,.2); border-radius: 8px; background: rgba(18,29,51,.72); }
.digest-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.digest-head > span:first-child { min-width: 0; display: grid; gap: 3px; }
.digest-head strong { color: #f2f5fb; font-size: 13px; }
.digest-label { margin: 0; }
.digest-count { min-width: 28px; height: 28px; padding: 0 7px; border-radius: 6px; display: grid; place-items: center; color: #d9d6ff; background: rgba(129,120,255,.12); font-size: 10px; font-weight: 800; }
.digest-overview { margin: 10px 0 0 !important; color: #b7c2d3 !important; font-size: 10px !important; line-height: 1.5 !important; }
/* Разбор входящих сгруппирован по важности: срочное сверху и с красной меткой,
   реклама в список не попадает вовсе — только счётчиком внизу. */
.digest-periods { margin-top: 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.digest-periods::-webkit-scrollbar { display: none; }
.digest-period {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(176, 200, 239, .16);
  border-radius: 999px;
  color: #a9b6ca;
  background: rgba(255, 255, 255, .03);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.digest-period.active { color: #06131c; background: var(--accent, #55f2d3); border-color: transparent; }
.digest-group { margin-top: 12px; display: grid; gap: 7px; }
.digest-group h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #cdd7e6;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.digest-group-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(176, 200, 239, .4); }
.digest-group-very_important .digest-group-dot { background: #ff7d8e; }
.digest-group-important .digest-group-dot { background: var(--accent, #55f2d3); }
.digest-group-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: #a9b6ca;
  background: rgba(255, 255, 255, .07);
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}
.digest-group-very_important .digest-item { border-color: rgba(255, 125, 142, .3); background: rgba(255, 125, 142, .055); }
.digest-group-very_important .digest-kind { color: #ff9dab; }
.digest-group-important .digest-item { border-color: rgba(85, 242, 211, .24); }
.digest-group-important .digest-kind { color: #7ce8d2; }
.digest-muted { margin: 12px 0 0 !important; color: #7f8ca0 !important; font-size: 10px !important; }
.digest-empty { margin: 12px 0 0 !important; color: #8b98ac !important; font-size: 11px !important; }
.digest-items { margin-top: 12px; display: grid; gap: 7px; }
.digest-item { width: 100%; padding: 11px 12px; border: 1px solid rgba(176,200,239,.14); border-radius: 7px; display: grid; gap: 4px; color: #eef4fd; background: rgba(255,255,255,.025); text-align: left; cursor: pointer; }
.digest-item.urgent { border-color: rgba(255,125,142,.3); background: rgba(255,125,142,.055); }
.digest-item.reply { border-color: rgba(110,182,255,.25); }
.digest-item.task { border-color: rgba(244,203,115,.25); }
.digest-item-top { display: flex; justify-content: space-between; gap: 10px; }
.digest-kind { color: #a9b6ca; font-size: 8px; font-weight: 820; text-transform: uppercase; }
.digest-item.urgent .digest-kind { color: #ff9dab; }
.digest-item.reply .digest-kind { color: #8dcbff; }
.digest-item.task .digest-kind { color: #f4cb73; }
.digest-open { color: var(--mint); font-size: 8px; font-weight: 760; }
.digest-item > strong { margin-top: 1px; overflow-wrap: anywhere; font-size: 11px; line-height: 1.35; }
.digest-sender { color: #8795ac; font-size: 9px; }
.digest-date { display: block; color: #aebbd0; font-size: 10px; font-weight: 680; }
.digest-detail { margin-top: 3px; color: #c0cad8; font-size: 10px; line-height: 1.45; }
.digest-action { margin-top: 4px; padding-top: 7px; border-top: 1px solid rgba(176,200,239,.1); color: #dfe8f4; font-size: 9px; font-weight: 700; }

.modal-layer { position: fixed; inset: 0; z-index: 900; display: grid; align-items: end; visibility: hidden; }
html.keyboard-open .modal-layer { top: var(--viewport-offset-top); right: 0; bottom: auto; left: 0; height: var(--visible-height); }
.modal-layer.open { visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,8,15,.72); opacity: 0; transition: opacity .25s ease; }
.modal-layer.open .modal-backdrop { opacity: 1; }
.modal-panel {
  position: relative;
  width: min(100%, 520px);
  max-height: min(86vh, 760px);
  margin: 0 auto;
  overflow: auto;
  padding: 11px 20px calc(22px + env(safe-area-inset-bottom));
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #101a2b;
  box-shadow: 0 -20px 60px rgba(0,0,0,.35);
  transform: translateY(100%);
  transition: transform .34s cubic-bezier(.22,.75,.25,1);
}
.modal-layer.open .modal-panel { transform: translateY(0); }
.modal-layer.task-panel {
  background: #081321;
}
.modal-layer.task-panel .modal-backdrop {
  background: #081321;
}
.modal-layer.task-panel.open .modal-backdrop {
  opacity: 1;
}
html.task-comment-focused .app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 899;
  pointer-events: none;
  background: #0b1728;
}
.modal-handle { width: 42px; height: 4px; margin: 0 auto 17px; border-radius: 2px; background: rgba(255,255,255,.18); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head-copy { min-width: 0; flex: 1; }
.modal-head-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.modal-head h2 { margin: 0 0 5px; font-size: 18px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.modal-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: rgba(255,255,255,.03); cursor: pointer; }
.modal-close svg { width: 16px; height: 16px; }
.modal-head-action {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(176, 200, 239, .2);
  border-radius: 50%;
  color: #dbe7f7;
  background: rgba(255, 255, 255, .045);
}
.modal-head-action svg { width: 19px; height: 19px; }
.modal-head-action.confirm {
  border-color: rgba(85, 242, 211, .38);
  color: #082521;
  background: var(--mint);
  box-shadow: 0 8px 26px rgba(45, 221, 190, .16);
}
.modal-head-action.event-add-top {
  width: auto;
  min-width: 112px;
  padding: 0 15px 0 12px;
  border-color: rgba(85, 242, 211, .38);
  border-radius: 7px;
  display: inline-flex;
  gap: 7px;
  color: #082521;
  background: var(--mint);
  box-shadow: 0 10px 28px rgba(45, 221, 190, .18);
  font-size: 14px;
  font-weight: 800;
}
.modal-head-action.event-add-top svg { width: 17px; height: 17px; }
.modal-head-action.danger {
  border-color: rgba(255, 125, 142, .3);
  color: #ffabb7;
  background: rgba(255, 125, 142, .08);
}
.modal-head-action:disabled { opacity: .45; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions > * { flex: 1; }

.chat-pin-toggle {
  min-height: 54px;
  padding: 0 13px;
  border: 1px solid rgba(176,200,239,.18);
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.chat-pin-toggle > input { position: absolute; opacity: 0; pointer-events: none; }
.chat-pin-toggle strong { font-size: 11px; }
.toggle-track { width: 36px; height: 21px; padding: 2px; flex: 0 0 auto; border: 1px solid rgba(176,200,239,.2); border-radius: 11px; background: #111b2c; transition: background .2s ease, border-color .2s ease; }
.toggle-track span { width: 15px; height: 15px; display: block; border-radius: 50%; background: #8390a5; transition: transform .2s ease, background .2s ease; }
.chat-pin-toggle > input:checked + .toggle-track { border-color: rgba(85,242,211,.5); background: rgba(85,242,211,.16); }
.chat-pin-toggle > input:checked + .toggle-track span { transform: translateX(15px); background: #55f2d3; }
.chat-pin-toggle > input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgba(85,242,211,.1); }
.label-selector { display: flex; flex-wrap: wrap; gap: 7px; }
.label-option { cursor: pointer; }
.label-option input { position: absolute; opacity: 0; pointer-events: none; }
.label-option .chat-label { min-height: 27px; max-width: 150px; padding: 4px 9px; border: 1px solid transparent; opacity: .48; font-size: 9px; transition: opacity .18s ease, border-color .18s ease; }
.label-option input:checked + .chat-label { border-color: currentColor; opacity: 1; }
.label-option input:focus-visible + .chat-label { box-shadow: 0 0 0 3px rgba(85,242,211,.09); }

.integration-list { display: grid; gap: 1px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.integration-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 68px; border-bottom: 1px solid var(--line); }
.integration-row:last-child { border-bottom: 0; }
.integration-logo { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: #0c1421; background: rgba(255,255,255,.04); font-size: 11px; font-weight: 840; }
.integration-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.integration-row strong { display: block; font-size: 11px; }
.integration-row p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.35; }
.integration-status { color: var(--muted); font-size: 9px; }

.mail-provider-list {
  display: grid;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mail-provider-card {
  width: 100%;
  min-height: 76px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.mail-provider-card:last-child { border-bottom: 0; }
.mail-provider-card > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.mail-provider-card strong { font-size: 15px; }
.mail-provider-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.mail-provider-card > svg { width: 18px; color: var(--muted); }
.mail-provider-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #34445f;
  font-size: 16px;
  font-weight: 850;
}
.mail-provider-mark.mailru { background: #1677ff; }
.mail-provider-mark.yandex { color: #fff; background: #fc3f1d; }
.mail-provider-mark.custom { color: #dbe9ff; background: #32415c; font-size: 11px; }
.compact-mail-mark { width: 34px; height: 34px; font-size: 14px; background: #1677ff; }
.mail-security-note {
  margin-top: 16px;
  padding: 13px 14px;
  border-left: 3px solid var(--mint);
  color: #d9e5f5;
  background: rgba(85,242,211,.06);
}
.mail-security-note strong { font-size: 14px; }
.mail-security-note p { margin: 5px 0 0; color: var(--muted-strong); font-size: 13px; line-height: 1.5; }
.mail-disconnect-wide { width: 100%; margin-top: 14px; }
.mail-setup-steps {
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}
.mail-setup-steps li {
  min-height: 54px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.mail-setup-steps li > span {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(85,242,211,.36);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--mint);
  background: rgba(85,242,211,.06);
  font-size: 12px;
  font-weight: 800;
}
.mail-setup-steps p { margin: 3px 0 0; color: #dbe6f4; font-size: 14px; line-height: 1.48; }
.mail-instruction-link {
  min-height: 48px;
  margin-bottom: 16px;
  padding: 0 13px;
  border: 1px solid rgba(110,182,255,.24);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #9bd2ff;
  background: rgba(110,182,255,.07);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
}
.mail-instruction-link svg { width: 17px; flex: 0 0 auto; }
.mail-connect-form { padding-top: 15px; border-top: 1px solid var(--line); }
.mail-server-row { grid-template-columns: minmax(0, 1fr) 92px; }
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}
.password-field input { min-width: 0; border-radius: 7px 0 0 7px; }
.password-reveal {
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  color: var(--mint);
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 740;
}
.mail-password-warning { margin: -2px 0 0; color: #f2c77d; font-size: 12px; line-height: 1.4; }

.sheet-panel {
  width: min(100%, 600px);
  height: min(78vh, 680px);
  min-height: 0 !important;
  max-height: calc(var(--visible-height) - 8px) !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
html.keyboard-open .sheet-panel {
  bottom: var(--keyboard-inset);
  height: calc(var(--visible-height) - 8px);
  max-height: calc(var(--visible-height) - 8px) !important;
  padding-bottom: 10px;
  border-radius: 18px 18px 0 0;
  transition-duration: 180ms;
}
.conversation.live { min-height: 96px; max-height: none; flex: 1 1 auto; align-content: start; overflow-y: auto; padding-right: 3px; }
/* Карточка подтверждения бывает выше экрана (длинное письмо) — раньше она выдавливала
   композер за пределы панели, и строка ввода обрезалась внизу. Теперь карточка скроллится
   внутри себя и ужимается, а композер всегда остаётся видимым. */
/* Карточка подтверждения переехала в ленту переписки: отдельная панель над вводом
   отбирала высоту у ленты и композера и под нехваткой места схлопывалась в полоску. */
/* Long-press на бабле открывает меню действий — нативное выделение текста и
   callout при этом только мешали (серая подсветка «как для копирования»).
   Копирование доступно из самого меню, поэтому выделение выключено, как в тредах. */
.bubble {
  white-space: pre-wrap;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: filter .15s ease, transform .15s ease;
}
.bubble.pressing { filter: brightness(1.12); transform: scale(.985); }
/* Ссылки и поля внутри бабла остаются интерактивными. */
.bubble a, .bubble input, .bubble textarea { -webkit-user-select: auto; user-select: auto; }
.sheet-panel { background: #142238; }
.conversation.live { margin: 0 -5px; padding: 17px 5px 12px; }
.agent-history-more {
  min-height: 38px;
  justify-self: center;
  padding: 8px 13px;
  border: 1px solid rgba(166,194,230,.18);
  border-radius: 7px;
  color: #b8c7da;
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 730;
}
.bubble.agent { border-color: rgba(154,185,226,.12); background: #23334c; box-shadow: 0 5px 18px rgba(2,8,17,.14); }
.agent-message-content { display: block; min-width: 0; }
.agent-message-content code,
.thread-message-copy code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255,255,255,.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}
.agent-code-block {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(0,0,0,.22);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.agent-code-block code { padding: 0; background: none; }
.agent-message-list {
  margin: 4px 0;
  padding-left: 20px;
  list-style: disc;
}
.agent-message-list li + li { margin-top: 2px; }
.agent-message-meta {
  display: block;
  margin-top: 7px;
  color: rgba(226,236,250,.82);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}
.bubble.user .agent-message-meta { color: rgba(8,31,38,.7); }
.agent-date-separator {
  width: 100%;
  margin: 5px 0 1px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 9px;
  color: #aebed3;
  font-size: 11px;
  font-weight: 760;
  text-align: center;
}
.agent-date-separator::before,
.agent-date-separator::after { height: 1px; content: ''; background: rgba(174,198,230,.12); }
.agent-date-separator span { padding: 4px 8px; border: 1px solid rgba(174,198,230,.12); border-radius: 9px; background: rgba(13,25,42,.54); }
.agent-reply-quote {
  margin: 0 0 7px;
  padding: 6px 8px;
  border-left: 3px solid var(--mint);
  border-radius: 4px;
  display: grid;
  gap: 2px;
  color: #dce7f6;
  background: rgba(8,22,36,.25);
}
.bubble.user .agent-reply-quote { color: #17323a; background: rgba(255,255,255,.24); }
.agent-reply-quote strong { color: #76f1d9; font-size: 12px; line-height: 1.25; }
.bubble.user .agent-reply-quote strong { color: #17665b; }
.agent-reply-quote span { overflow: hidden; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.agent-reply-preview {
  min-height: 54px;
  margin: 5px 0 0;
  padding: 7px 5px 7px 11px;
  border-left: 3px solid var(--mint);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eaf2fc;
  background: #20354f;
  animation: thread-reply-in .18s ease both;
}
.agent-reply-preview-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.agent-reply-preview-copy strong { color: var(--mint); font-size: 13px; }
.agent-reply-preview-copy span { overflow: hidden; color: #d2dbea; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.agent-reply-preview button { width: 38px; height: 38px; border: 0; display: grid; place-items: center; color: #aab8cc; background: transparent; }
.agent-reply-preview button svg { width: 19px; height: 19px; }
.bubble.reply-swiping {
  position: relative;
  z-index: 2;
  animation: none !important;
  transform: translateX(var(--reply-swipe-x, 0));
  transition: none;
  will-change: transform;
}
.bubble.reply-swiping::before,
.thread-message.reply-swiping::before {
  content: "";
  position: absolute;
  left: -43px;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d3048;
  box-shadow: 0 5px 15px rgba(2,8,17,.2);
  opacity: max(.45, var(--reply-swipe-progress, .45));
  transform: translateY(-50%) scale(.88);
  transition: opacity .12s ease, background-color .14s ease, transform .14s ease;
}
.bubble.reply-swiping::after,
.thread-message.reply-swiping::after {
  content: "";
  position: absolute;
  left: -35px;
  top: 50%;
  width: 18px;
  height: 18px;
  z-index: 1;
  background: #dce8f7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7 4 12l5 5M4 12h9a7 7 0 0 1 7 7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7 4 12l5 5M4 12h9a7 7 0 0 1 7 7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: max(.58, var(--reply-swipe-progress, .58));
  transform: translateY(-50%) scale(.88);
  transition: opacity .12s ease, background-color .14s ease, transform .14s ease;
  pointer-events: none;
}
.bubble.reply-ready::before { color: #10283a; background: var(--mint); }
.bubble.reply-ready::before,
.thread-message.reply-ready::before,
.bubble.reply-ready::after,
.thread-message.reply-ready::after { transform: translateY(-50%) scale(1); }
.bubble.reply-ready::after,
.thread-message.reply-ready::after { background: #10283a; }
.bubble:not(.reply-swiping) { transition: transform .18s cubic-bezier(.22,.75,.25,1); }
.bubble.pending { border-color: rgba(244,203,115,.28); background: rgba(244,203,115,.07); }
.typing { display: inline-flex; gap: 4px; align-items: center; min-width: 46px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typing 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .13s; }
.typing i:nth-child(3) { animation-delay: .26s; }
.agent-request-progress {
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.35;
}
@keyframes typing { 50% { transform: translateY(-3px); opacity: .45; } }
.pending-card { align-self: flex-start; width: min(100%, 460px); margin: 4px 0 10px; padding: 13px 14px; border: 1px solid rgba(244,203,115,.32); border-radius: 16px; background: rgba(244,203,115,.08); }
.pending-card strong { display: block; margin-bottom: 6px; color: var(--amber); font-size: 10px; text-transform: uppercase; }
.pending-card p { margin: 4px 0; color: var(--muted-strong); font-size: 10px; line-height: 1.45; }
.pending-task-list { display: grid; gap: 7px; margin-top: 9px; }
.pending-task-list > span { color: var(--muted); font-size: 11px; font-weight: 760; }
.pending-task-list p { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 8px; align-items: center; margin: 0; padding: 9px; border: 1px solid rgba(100,232,216,.16); border-radius: 9px; background: rgba(100,232,216,.055); }
.pending-task-list p b { display: grid; grid-row: 1 / span 2; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #071925; background: var(--accent); font-size: 11px; }
.pending-task-list p strong { display: block; margin: 0; color: var(--text); font-size: 13px; letter-spacing: 0; text-transform: none; }
.pending-task-list p small { grid-column: 2; color: var(--muted); font-size: 10px; }
.pending-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.pending-actions button { min-height: 34px; padding: 0 11px; border-radius: 6px; cursor: pointer; font-size: 9px; font-weight: 760; }
.pending-edit {
  border: 1px solid rgba(110,182,255,.4);
  color: #9fd0ff;
  background: rgba(110,182,255,.12);
}
.pending-translate {
  min-height: 32px;
  margin-top: 9px;
  padding: 0 11px;
  border: 1px dashed rgba(166,194,230,.35);
  border-radius: 6px;
  color: #b8c7da;
  background: transparent;
  font-size: 11px;
  font-weight: 720;
}
.pending-translate[disabled] { opacity: .6; }
.pending-translation {
  margin-top: 9px;
  padding: 9px 10px;
  border-left: 2px solid var(--mint);
  border-radius: 0 6px 6px 0;
  background: rgba(85,242,211,.07);
}
.pending-translation-label {
  display: block;
  margin-bottom: 4px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.pending-translation p { margin: 0; color: #dbe6f4; }
.pending-confirm { border: 0; color: #071721; background: var(--mint); }
.pending-cancel { border: 1px solid rgba(255,125,142,.22); color: #ff9aaa; background: transparent; }
.attachment-tray {
  margin-top: 9px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  overflow-x: hidden;
  padding: 2px 1px 3px;
  scrollbar-width: none;
  /* Трей не сжимается: он флекс-элемент в колонке панели, и при нехватке места панель
     ужимала именно его, а собственный overflow обрезал карточку вложения — от превью
     оставалась видна только верхняя полоска. Ужиматься должна переписка выше. */
  flex: 0 0 auto;
}
.attachment-tray::-webkit-scrollbar { display: none; }
.attachment-chip {
  min-width: 0;
  max-width: 210px;
  height: 34px;
  padding: 0 6px 0 10px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(110,182,255,.2);
  border-radius: 7px;
  color: #dbe8f8;
  background: rgba(110,182,255,.08);
  font-size: 9px;
}
.attachment-chip.uploading { color: var(--muted); }
.attachment-chip.failed { border-color: rgba(255,125,142,.3); color: #ffc3cd; background: rgba(255,125,142,.08); }
.attachment-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip-state { color: var(--muted); font-size: 8px; }
.attachment-remove {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  display: grid;
  place-items: center;
  color: currentColor;
  background: transparent;
  cursor: pointer;
}
.attachment-remove svg { width: 13px; height: 13px; }
.message-attachments { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.message-attachment { padding: 4px 7px; border-radius: 5px; color: #cce4fa; background: rgba(110,182,255,.1); font-size: 8px; }

.composer.live { flex: 0 0 auto; grid-template-columns: auto minmax(0,1fr) 42px; align-items: end; gap: 7px; margin-top: 9px; padding-top: 10px; border-top: 1px solid rgba(176,200,239,.1); }
.composer-tools { display: flex; gap: 5px; align-items: flex-end; }
.composer.live .composer-button { width: 34px; height: 42px; border-radius: 17px; }
.writing-assist-button svg { width: 18px; height: 18px; }
.writing-assist-button.busy { animation: writing-assist-pulse .9s ease-in-out infinite alternate; }
.writing-assist-inline {
  width: max-content;
  min-height: 34px;
  margin: -1px 0 4px;
  padding: 7px 10px;
  border: 1px solid rgba(102,242,214,.24);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9ff9e8;
  background: rgba(85,242,211,.065);
  font-size: 12px;
  font-weight: 760;
}
.writing-assist-inline svg { width: 16px; height: 16px; }
.writing-assist-inline:disabled { opacity: .65; }
@keyframes writing-assist-pulse { to { color: #fff; box-shadow: 0 0 0 5px rgba(85,242,211,.08); } }
.writing-assistant-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease, visibility .18s ease;
}
.writing-assistant-layer.open { visibility: visible; opacity: 1; }
.writing-assistant-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(2,8,18,.62);
  backdrop-filter: blur(5px);
}
.writing-assistant-card {
  position: absolute;
  right: max(12px, calc((100vw - 600px) / 2));
  bottom: calc(var(--keyboard-inset) + max(12px, env(safe-area-inset-bottom)));
  left: max(12px, calc((100vw - 600px) / 2));
  max-height: min(520px, calc(var(--visible-height) - 24px));
  padding: 16px;
  border: 1px solid rgba(170,201,239,.25);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  color: #f7fbff;
  background: #182942;
  box-shadow: 0 24px 70px rgba(1,7,18,.58);
  transform: translateY(18px);
  transition: transform .22s ease;
}
.writing-assistant-layer.open .writing-assistant-card { transform: translateY(0); }
.writing-assistant-head { display: flex; align-items: center; gap: 10px; }
.writing-assistant-head > span { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: #09212a; background: var(--mint); }
.writing-assistant-head svg { width: 19px; height: 19px; }
.writing-assistant-head > div { min-width: 0; display: grid; gap: 2px; }
.writing-assistant-head strong { font-size: 17px; }
.writing-assistant-head small { color: #a9b8cc; font-size: 12px; }
.writing-assistant-preview {
  width: 100%;
  min-height: 120px;
  max-height: 250px;
  padding: 12px 13px;
  resize: vertical;
  overflow: auto;
  border: 1px solid rgba(186,209,242,.2);
  border-radius: 8px;
  color: #fff;
  background: #223650;
  font: 500 16px/1.45 inherit;
}
.writing-assistant-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.composer.live .composer-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 196px;
  height: 42px;
  padding: 10px 13px;
  resize: none;
  overflow-y: auto;
  line-height: 1.35;
  font-family: inherit;
  font-weight: 500;
  font-size: 16px;
  box-sizing: border-box;
  display: block;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.composer.live .send-button { flex: 0 0 auto; }
html.keyboard-open .composer.live .composer-input { max-height: 112px; }
.mic-button.recording { color: #071721; background: var(--coral); animation: record-pulse 1.1s ease-in-out infinite; }
@keyframes record-pulse { 50% { box-shadow: 0 0 0 7px rgba(255,125,142,.12); } }

.voice-composer {
  --voice-control-size: 64px;
  --voice-float-right: 12px;
  position: relative;
  overflow: visible;
}
.calendar-voice-quick { --voice-float-right: 19px; }
.voice-composer > .composer-tools,
.voice-composer > .attach-button { grid-column: 1; grid-row: 1; }
.voice-composer > .composer-input { grid-column: 2; grid-row: 1; }
.voice-action {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  z-index: 7;
  overflow: visible;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transform-origin: 50% 50%;
  transition: color .18s ease, background .18s ease, transform .22s cubic-bezier(.2,.82,.24,1.18), box-shadow .18s ease, width .22s cubic-bezier(.2,.82,.24,1.18), height .22s cubic-bezier(.2,.82,.24,1.18), opacity .16s ease;
}
.composer.live.voice-composer.voice-recording {
  grid-template-columns: minmax(0,1fr) var(--voice-control-size);
  align-items: center;
  gap: 8px;
}
.composer.live.voice-recording > .composer-tools,
.composer.live.voice-recording > .attach-button { display: none; }
.composer.live.voice-recording > .composer-input { display: none; }
.composer.live.voice-recording > .voice-recording-strip { grid-column: 1; }
.composer.live.voice-recording > .voice-action { grid-column: 2; }
.voice-action-icon { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; transition: opacity .16s ease, transform .2s cubic-bezier(.2,.82,.24,1.18); }
.voice-action-icon svg { width: 20px; height: 20px; pointer-events: none; transition: width .2s ease, height .2s ease; }
.composer.live .voice-action.recording-mode .voice-action-icon svg { width: 25px; height: 25px; }
.voice-action-mic { opacity: 1; transform: scale(1) rotate(0); }
.voice-action-send { opacity: 0; transform: scale(.58) rotate(-18deg); }
.voice-action.send-mode .voice-action-mic,
.voice-action.recording-mode.locked .voice-action-mic { opacity: 0; transform: scale(.58) rotate(18deg); }
.voice-action.send-mode .voice-action-send,
.voice-action.recording-mode.locked .voice-action-send { opacity: 1; transform: scale(1) rotate(0); }

/* The lock rail stays fixed while the microphone follows the finger into it. */
.voice-lock-hint {
  position: absolute;
  z-index: 8;
  right: var(--voice-float-right);
  bottom: calc(var(--voice-control-size) + 12px);
  width: 40px;
  height: 72px;
  padding: 7px 0 8px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(197,219,247,.62);
  border-radius: 22px;
  color: #2f86e8;
  background: rgba(247,251,255,.97);
  box-shadow: 0 12px 30px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.9);
  pointer-events: none;
  transform: translateY(8px) scale(.92);
  opacity: 0;
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.82,.24,1.18);
}
.voice-lock-hint svg { width: 17px; height: 17px; }
.voice-lock-hint .voice-lock-arrow { animation: voice-lock-bob .9s ease-in-out infinite; }
.voice-composer.voice-recording:not(.voice-locked) > .voice-lock-hint {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.voice-composer.voice-lifting > .voice-lock-hint .voice-lock-icon { transform: translateY(5px) scale(1.08); }
@keyframes voice-lock-bob { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-4px); } }

.voice-pause-toggle {
  position: absolute;
  z-index: 9;
  right: calc(var(--voice-float-right) - 2px);
  bottom: calc(var(--voice-control-size) + 14px);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(197,219,247,.62);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #247edc;
  background: rgba(248,252,255,.98);
  box-shadow: 0 12px 30px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.92);
  cursor: pointer;
  touch-action: manipulation;
  animation: voice-pause-arrive .28s cubic-bezier(.2,.82,.24,1.2) both;
}
.voice-pause-toggle span { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .16s ease, transform .18s ease; }
.voice-pause-toggle svg { width: 19px; height: 19px; }
.voice-pause-toggle .voice-resume-icon { opacity: 0; transform: scale(.68); }
.voice-pause-toggle.resume-mode .voice-pause-icon { opacity: 0; transform: scale(.68); }
.voice-pause-toggle.resume-mode .voice-resume-icon { opacity: 1; transform: scale(1); }
@keyframes voice-pause-arrive { from { opacity: 0; transform: translateY(15px) scale(.68); } }

.voice-action.recording-mode {
  color: #fff;
  background: #2f8cff;
  box-shadow: 0 9px 24px rgba(47,140,255,.38);
}
.voice-action.recording-mode::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -8px;
  border-radius: 50%;
  background: rgba(47,140,255,.18);
  box-shadow: 0 0 0 var(--voice-halo-ring, 6px) rgba(47,140,255,.1);
  transform: scale(var(--voice-halo-scale, 1.08));
  opacity: var(--voice-halo-opacity, .72);
  pointer-events: none;
  transition: transform .1s linear, opacity .1s linear, box-shadow .1s linear;
}
.composer.live .voice-action.recording-mode,
.calendar-voice-quick.voice-recording .voice-action.recording-mode {
  width: var(--voice-control-size);
  height: var(--voice-control-size);
  align-self: center;
  transform: translate(var(--voice-drag-x, 0), var(--voice-lift-y, 0)) scale(var(--voice-lift-scale, 1));
}
.composer.live.voice-lifting .voice-action.recording-mode,
.calendar-voice-quick.voice-lifting .voice-action.recording-mode {
  box-shadow: 0 0 0 var(--voice-lift-ring, 10px) rgba(47,140,255,.13), 0 14px 32px rgba(47,140,255,.42);
}
.voice-action.recording-mode.locked {
  color: #fff;
  background: #2f8cff;
  box-shadow: 0 10px 26px rgba(47,140,255,.36);
  transform: translate(0, 0) scale(1) !important;
}
.voice-action.recording-mode.locked::before { opacity: .25; transform: scale(1.04); box-shadow: none; }
.voice-action.recording-mode.locked.paused { background: #277bdc; }
.voice-action.mic-mode:active,
.voice-action.send-mode:active { transform: scale(.94); }
.voice-action:disabled { cursor: wait; opacity: .58; }
.voice-finishing .voice-action.recording-mode { transform: translate(0, 0) scale(.82) !important; opacity: .78; }

.voice-recording-strip {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-width: 0;
  min-height: 48px;
  padding: 0 11px;
  display: grid;
  grid-template-columns: 10px 64px minmax(0,1fr);
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,126,144,.24);
  border-radius: 24px;
  color: #f5f8ff;
  background: #223047;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: border-color .18s ease, background .18s ease, opacity .16s ease;
}
.voice-recording-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5c72; box-shadow: 0 0 0 5px rgba(255,92,114,.14); animation: voice-recording-dot 1.05s ease-in-out infinite; }
.voice-recording-strip time { color: #fff; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.2px; white-space: nowrap; }
.voice-recording-hint {
  min-width: 0;
  overflow: hidden;
  color: #c1ccdc;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(var(--voice-cancel-shift, 0));
  opacity: var(--voice-cancel-opacity, 1);
  transition: color .15s ease;
}
.voice-recording-strip button {
  display: none;
  min-height: 34px;
  padding: 0 5px;
  border: 0;
  color: #67aaff;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 790;
  cursor: pointer;
}
.voice-composer.voice-recording .composer-input { visibility: hidden; pointer-events: none; }
.voice-composer.voice-locked .voice-recording-strip { border-color: rgba(84,160,255,.34); }
.voice-composer.voice-locked .voice-recording-hint { display: none; }
.voice-composer.voice-locked .voice-recording-strip button { grid-column: 3; display: inline-flex; align-items: center; justify-self: center; }
.voice-composer.voice-paused .voice-recording-dot { animation: none; opacity: .38; box-shadow: none; }
.voice-composer.voice-paused .voice-recording-strip { background: #1d2a3d; }
.voice-composer.voice-processing .voice-action { opacity: 1; }
.voice-composer.voice-processing .voice-action-icon { opacity: 0; transform: scale(.6); }
.voice-composer.voice-processing .voice-action::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255,255,255,.24);
  border-top-color: #fff;
  border-radius: 50%;
  animation: voice-processing-spin .72s linear infinite;
}
.voice-gesture-active,
.voice-gesture-active body,
.voice-gesture-active body * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
@keyframes voice-recording-dot { 50% { opacity: .38; transform: scale(.72); } }
@keyframes voice-processing-spin { to { transform: rotate(360deg); } }

.thread-panel .modal-panel { min-height: 68vh; }
.thread-panel .modal-panel { height: min(78vh, 720px); overflow: hidden; background: #17253b; }
.thread-panel #modalContent { height: calc(100% - 21px); display: flex; flex-direction: column; min-height: 0; }
html.keyboard-open .thread-panel .modal-panel { width: 100%; height: 100%; min-height: 0; max-height: 100%; padding-bottom: 8px; }
html.keyboard-open .thread-panel #modalContent { height: calc(100% - 21px); }
.thread-messages { flex: 1; display: grid; align-content: start; gap: 8px; min-height: 0; margin: 0 -7px; overflow-y: auto; overscroll-behavior: contain; padding: 10px 9px 16px; border: 1px solid rgba(137,171,218,.09); border-radius: 8px; background: #101d31; }
.thread-message { max-width: 82%; padding: 9px 11px; border: 0; border-radius: 8px; display: grid; gap: 7px; color: #eef4fc; background: #263650; box-shadow: 0 5px 16px rgba(2,8,17,.14); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.thread-message.out { justify-self: end; color: #eafffa; background: #17605b; box-shadow: 0 5px 18px rgba(5,46,45,.18); }
.thread-message.reply-swiping {
  position: relative;
  z-index: 2;
  transform: translateX(var(--reply-swipe-x, 0));
  transition: none;
  will-change: transform;
}
.thread-message.reply-swiping::before {
  left: -43px;
}
.thread-message.reply-ready::before { color: #10283a; background: var(--mint); }
.thread-message:not(.reply-swiping) { transition: transform .18s cubic-bezier(.22,.75,.25,1); }
.thread-message-copy { white-space: pre-wrap; }
.thread-file-list { display: grid; gap: 5px; }
.thread-file {
  min-width: 170px;
  max-width: 260px;
  padding: 7px 8px;
  border: 1px solid rgba(110,182,255,.16);
  border-radius: 6px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 2px 7px;
  color: #dbe9f8;
  background: rgba(110,182,255,.07);
  text-decoration: none;
}
.thread-file-kind { grid-row: 1 / 3; align-self: center; color: #7fc5ff; font-size: 7px; font-weight: 820; }
.thread-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.thread-file-size { color: var(--muted); font-size: 7px; }
/* Карточка файла, сгенерированного агентом (PDF/Word/Excel/…), внутри чата с Adjutant. */
.agent-file-card {
  margin-top: 8px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(85,242,211,.22);
  border-radius: 9px;
  color: inherit;
  background: rgba(85,242,211,.06);
  cursor: pointer;
}
.agent-file-ic { font-size: 20px; line-height: 1; }
.agent-file-copy { min-width: 0; display: grid; gap: 2px; }
.agent-file-copy strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.agent-file-copy small { color: var(--mint); font-size: 10px; font-weight: 760; letter-spacing: .3px; }
.thread-media {
  min-width: 190px;
  max-width: min(290px, 72vw);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  display: block;
  color: #9fd3ff;
  background: transparent;
  text-decoration: none;
}
.thread-media img,
.thread-media video { width: 100%; max-height: 340px; display: block; object-fit: cover; background: #07101d; }
.thread-media > span,
.thread-media > a { padding: 0 8px 7px; overflow: hidden; color: #b9dfff; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; text-decoration: none; }
.thread-message.has-visual-media { padding: 0; border: 0; border-radius: 9px; gap: 0; overflow: hidden; box-shadow: 0 5px 18px rgba(0,0,0,.13); }
.thread-message.has-visual-media .thread-file-list { gap: 0; }
.thread-message.has-visual-media .thread-message-copy { padding: 8px 10px 2px; }
.thread-message.has-visual-media .thread-message-meta { padding: 4px 8px 7px; }
.thread-message.has-visual-media.media-only { position: relative; overflow: visible; border-radius: 0; background: transparent; box-shadow: none; }
.thread-message.has-visual-media.media-only .thread-file-list { overflow: hidden; border-radius: 9px; }
.thread-message.has-visual-media.media-only .thread-message-meta { position: absolute; right: 5px; bottom: 5px; min-height: 0; padding: 4px 6px; border-radius: 6px; color: rgba(255,255,255,.88); background: rgba(4,10,18,.66); backdrop-filter: blur(8px); }
.thread-message.has-visual-media.media-only .thread-read-state { color: rgba(255,255,255,.82); }
.thread-message.has-visual-media.media-only .thread-read-state.read { color: #68f4db; }
.thread-audio { padding: 8px; }
.thread-audio audio { width: 100%; height: 34px; }
.thread-audio > a { padding: 0; }
.thread-voice-player {
  width: min(286px, 70vw);
  min-width: 224px;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b9c9dc;
}
.thread-voice-player audio { display: none; }
.thread-voice-toggle {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #173a4a;
  background: #70ead6;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease;
}
.thread-voice-toggle:active { transform: scale(.93); }
.thread-voice-toggle svg { grid-area: 1 / 1; width: 23px; height: 23px; }
.thread-voice-pause { display: none; }
.thread-voice-player.playing .thread-voice-play { display: none; }
.thread-voice-player.playing .thread-voice-pause { display: block; }
.thread-voice-content { min-width: 0; flex: 1; display: grid; gap: 3px; }
.thread-voice-seek {
  width: 100%;
  height: 28px;
  padding: 0;
  border: 0;
  position: relative;
  display: block;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.thread-voice-wave {
  position: absolute;
  inset: 2px 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.thread-voice-wave i {
  width: 3px;
  height: var(--voice-bar);
  min-height: 4px;
  flex: 1 1 3px;
  border-radius: 2px;
  display: block;
  background: currentColor;
}
.thread-voice-wave-base { color: rgba(190, 210, 231, .48); }
.thread-voice-wave-played {
  color: #6cf0d8;
  clip-path: inset(0 calc(100% - var(--voice-progress)) 0 0);
  transition: clip-path .08s linear;
}
.thread-voice-duration { color: #aebdd0; font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }
.thread-message.out .thread-voice-toggle { color: #155047; background: #a8f5e7; }
.thread-message.out .thread-voice-wave-base { color: rgba(205, 245, 237, .44); }
.thread-message.out .thread-voice-wave-played { color: #d5fff7; }
.thread-message.out .thread-voice-duration { color: rgba(228, 255, 250, .76); }
.thread-voice-player.failed { opacity: .66; }
.thread-voice-player.failed .thread-voice-wave-played { color: #ff9aaa; }
.thread-message-meta { min-height: 13px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; color: #728197; font-size: 7px; line-height: 1; }
.thread-read-state { display: inline-flex; align-items: center; gap: 3px; color: #8f9eb2; }
.thread-read-state svg { width: 13px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.thread-read-state:not(.read) .second-check { display: none; }
.thread-read-state.read { color: var(--mint); }
.thread-attachment-tray {
  min-height: 0;
  margin: 4px 0 8px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  overflow-x: hidden;
  padding: 2px;
  scrollbar-width: none;
}
.thread-attachment-tray::-webkit-scrollbar { display: none; }
.thread-attachment-card {
  width: 190px;
  min-height: 46px;
  padding: 5px 4px 5px 5px;
  flex: 0 0 auto;
  border: 1px solid rgba(110,182,255,.18);
  border-radius: 7px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 24px;
  align-items: center;
  gap: 7px;
  color: #dbe9f8;
  background: rgba(110,182,255,.06);
}
.thread-attachment-card.uploading { opacity: .7; }
.thread-attachment-card.failed { border-color: rgba(255,125,142,.34); color: #ffcbd3; background: rgba(255,125,142,.07); }
.thread-attachment-preview,
.thread-attachment-icon { width: 36px; height: 36px; border-radius: 5px; }
.thread-attachment-preview { display: block; object-fit: cover; background: #0c1524; }
.thread-attachment-icon { display: grid; place-items: center; color: #8bcaff; background: rgba(110,182,255,.11); font-size: 7px; font-weight: 850; }
.thread-attachment-copy { min-width: 0; display: grid; gap: 3px; }
.thread-attachment-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.thread-attachment-copy small { color: var(--muted); font-size: 7px; }
.thread-composer { position: relative; z-index: 2; flex: 0 0 auto; background: #17253b; }
.thread-composer .composer-input { border-color: rgba(160,188,229,.18); background: #202f48; }
.thread-composer .composer-button { color: #79f5dc; background: #20314a; border-color: rgba(85,242,211,.22); }
/* var(--visible-height) — а не голый vh — потому что на iOS 88vh считается от «большого»
   viewport (за скрытой панелью инструментов), из-за чего лист на экране выглядел заметно
   меньше и переписки/письмо оказывались зажаты. --visible-height уже решает эту задачу
   для остальных шитов приложения (см. .thread-panel, html.keyboard-open .mail-panel). */
.mail-panel .modal-panel { width: min(100%, 640px); height: min(calc(var(--visible-height) * .94), 960px); min-height: 0; overflow: hidden; transition: transform .34s cubic-bezier(.22,.75,.25,1), width .22s ease, height .22s ease, border-radius .22s ease, max-width .22s ease; }
.mail-panel #modalContent { height: calc(100% - 21px); min-height: 0; }
.mail-panel.mail-fullscreen .modal-panel { width: 100%; max-width: 100%; height: var(--visible-height); max-height: var(--visible-height); border-radius: 0; }
.mail-fullscreen-toggle { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: rgba(255,255,255,.03); cursor: pointer; }
.mail-fullscreen-toggle svg { width: 16px; height: 16px; }
.mail-fullscreen-toggle .icon-collapse { display: none; }
.mail-fullscreen .mail-fullscreen-toggle .icon-expand { display: none; }
.mail-fullscreen .mail-fullscreen-toggle .icon-collapse { display: block; }
.mail-detail-shell { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.mail-detail-shell .modal-head { flex: 0 0 auto; margin-bottom: 13px; }
/* Тема письма схлопнута в одну строку — раньше 2 строки текста в шапке съедали место,
   которое нужнее содержимому письма. Тап по теме разворачивает её полностью (.expanded). */
.mail-detail-shell .modal-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; line-height: 1.22; cursor: pointer; }
.mail-detail-shell .modal-head h2.expanded { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.mail-detail-sender { flex: 0 0 auto; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.mail-detail-sender.compact { padding: 7px 0; }
.mail-sender-avatar { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: #071721; background: linear-gradient(145deg,var(--mint),#8fcaff); font-size: 11px; font-weight: 850; }
.mail-detail-sender > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.mail-detail-sender strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.mail-detail-sender > span:nth-child(2) > span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.mail-account-tag-inline { color: #6f84a1; }
.mail-priority { padding: 4px 7px; border-radius: 5px; color: #f4cb73; background: rgba(244,203,115,.1); font-size: 8px; font-weight: 780; }
.mail-detail-routing { flex: 0 0 auto; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.mail-detail-routing.compact { padding-bottom: 6px; }
.mail-detail-routing summary { cursor: pointer; list-style: none; }
.mail-detail-routing summary::-webkit-details-marker { display: none; }
.mail-detail-routing p { margin: 7px 0 0; overflow-wrap: anywhere; }
.mail-content-stage { flex: 1; min-height: 210px; display: flex; overflow: hidden; overscroll-behavior: contain; }
.mail-content-stage.html-view {
  position: relative;
  align-items: flex-start;
  overflow: hidden;
}
/* Прозрачный слой поверх письма: ловит жесты в родительском документе, потому что
   события из sandbox-iframe до нас не доходят. touch-action:none — чтобы браузер
   не забирал ни прокрутку, ни щипок; и то и другое обрабатываем сами. */
.mail-zoom-catcher {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background: transparent;
}
.mail-content-stage.text-view .mail-zoom-catcher { display: none; }
.mail-detail-body { flex: 1; min-height: 0; width: 100%; margin: 0 -4px; padding: 15px 4px 20px; overflow-y: auto; overscroll-behavior: contain; color: #d7deea; font-size: 12px; line-height: 1.62; overflow-wrap: anywhere; }
.mail-detail-body a { display: inline-flex; max-width: 100%; margin: 4px 0; padding: 5px 8px; border: 1px solid rgba(110,182,255,.22); border-radius: 5px; color: #8dcbff; background: rgba(110,182,255,.06); text-decoration: none; overflow-wrap: anywhere; }
.mail-html-frame { width: 100%; height: 100%; min-height: 260px; flex: 1 1 auto; border: 0; border-radius: 8px; background: #fff; }
.mail-content-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid rgba(166,194,230,.15);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.mail-content-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: #9eacc1;
  background: transparent;
  font-size: 12px;
  font-weight: 760;
}
.mail-content-tabs button.active { color: #071721; background: var(--mint); }
/* Масштаб «Оригинала»: −  100%  + */
.mail-zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 4px;
  border-left: 1px solid rgba(166,194,230,.16);
}
.mail-zoom-controls button {
  min-width: 30px;
  min-height: 30px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  color: #9eacc1;
  font-size: 10px;
  font-weight: 780;
}
.mail-zoom-controls button svg { width: 14px; height: 14px; }
.mail-zoom-controls #mailZoomLevel { min-width: 40px; font-variant-numeric: tabular-nums; }
.mail-zoom-controls.zoomed #mailZoomLevel { color: var(--mint); }
.mail-zoom-controls.inactive { opacity: .35; pointer-events: none; }
.mail-organize {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(112px, .9fr) 44px minmax(0, 1.8fr);
  gap: 7px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.mail-organize.compact { padding: 6px 0; }
.mail-organize > button,
.mail-flag-menu > summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid rgba(166,194,230,.17);
  border-radius: 7px;
  color: #dbe7f6;
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 720;
  list-style: none;
}
.mail-organize > button.active { color: #071721; border-color: var(--mint); background: var(--mint); }
.mail-flag-menu { position: relative; min-width: 0; }
.mail-flag-menu > summary { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.mail-flag-menu > summary::-webkit-details-marker { display: none; }
.mail-organize-icon {
  width: auto;
  min-width: 0;
  padding: 0 12px;
  gap: 7px;
  justify-content: center;
  overflow: hidden;
}
.mail-organize-icon svg { width: 17px; height: 17px; flex: 0 0 auto; }
.mail-organize-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-organize-icon.is-busy { opacity: .72; }
.mail-organize-icon.is-busy svg { animation: mail-pin-pulse .7s ease-in-out infinite alternate; }
@keyframes mail-pin-pulse { to { transform: translateY(-1px); opacity: .55; } }
.mail-flag-menu.compact { width: 44px; }
.mail-flag-menu.compact > summary { width: 44px; min-width: 34px; padding: 0 10px; gap: 6px; justify-content: center; }
.mail-flag-menu.compact > summary svg { width: 17px; height: 17px; flex: 0 0 auto; }
.mail-state-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
@media (max-width: 430px) {
  .mail-organize { grid-template-columns: minmax(0, 1fr) 44px; }
  .mail-state-actions { grid-column: 1 / -1; }
}
.mail-flag-menu[open] form {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  width: min(330px, calc(100vw - 56px));
  padding: 12px;
  border: 1px solid rgba(85,242,211,.25);
  border-radius: 10px;
  background: #192942;
  box-shadow: 0 18px 48px rgba(0,0,0,.45);
}
.mail-new-flag { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.mail-new-flag input {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #edf5ff;
  background: #22324d;
  font: inherit;
}
.mail-new-flag button {
  min-height: 40px;
  padding: 8px 11px;
  border: 0;
  border-radius: 7px;
  color: #071721;
  background: var(--mint);
  font-weight: 780;
}
.mail-empty-body { color: var(--muted); }
.mail-detail-actions { flex: 0 0 auto; margin-top: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.mail-detail-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 48px; }
.mail-detail-shell > .modal-head,
.mail-detail-shell > .mail-detail-sender,
.mail-detail-shell > .mail-detail-routing,
.mail-detail-shell > .mail-organize,
.mail-detail-shell > .mail-security-details,
.mail-detail-shell > .mail-attachments {
  max-height: 260px;
  opacity: 1;
  transition: max-height .24s ease, opacity .18s ease, margin .24s ease, padding .24s ease, transform .24s ease;
}
.mail-detail-shell.mail-reader-scrolled > .modal-head {
  min-height: 40px;
  margin-bottom: 3px;
}
.mail-detail-shell.mail-reader-scrolled > .modal-head h2 {
  font-size: 14px;
  color: #cdd8e8;
}
.mail-detail-shell.mail-reader-scrolled > .mail-detail-sender,
.mail-detail-shell.mail-reader-scrolled > .mail-detail-routing,
.mail-detail-shell.mail-reader-scrolled > .mail-organize,
.mail-detail-shell.mail-reader-scrolled > .mail-security-details,
/* Разбор лежит внутри контейнера #mailAiResult, а не прямым потомком оболочки —
   поэтому правило с `>` его не находило и блок оставался развёрнутым, съедая
   пол-экрана при чтении письма. Сворачиваем сам контейнер. */
.mail-detail-shell.mail-reader-scrolled > #mailAiResult,
.mail-detail-shell.mail-reader-scrolled > .mail-attachments {
  max-height: 0;
  min-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-7px);
}
.mail-delete-icon {
  width: 48px;
  min-height: 48px;
  border: 1px solid rgba(255,125,142,.28);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ff9aaa;
  background: rgba(255,125,142,.07);
}
.mail-delete-icon svg { width: 21px; height: 21px; }
.mail-detail-section {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(166,194,230,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.mail-detail-section > strong { display: block; color: #f3f7fc; font-size: 14px; }
.mail-attachments > strong { font-size: 11px; font-weight: 760; color: #b8c7da; }
.mail-attachments > div { max-height: 230px; margin-top: 7px; display: grid; gap: 6px; overflow-y: auto; overscroll-behavior: contain; }
.mail-attachment-row {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(110,182,255,.16);
  border-radius: 7px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  color: #eaf3fd;
  background: rgba(110,182,255,.05);
}
.mail-attachment-type {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  color: #8dcbff;
  background: rgba(110,182,255,.14);
  font-size: 9px;
  font-weight: 820;
}
.mail-attachment-meta { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.mail-attachment-meta strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 640; }
.mail-attachment-meta small { flex: 0 0 auto; color: #91a1b7; font-size: 11px; }
.mail-attachment-icons { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mail-attachment-icon-btn {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--mint);
  background: rgba(85,242,211,.08);
  text-decoration: none;
}
.mail-attachment-icon-btn svg { width: 15px; height: 15px; }
.mail-attachment-icon-btn:active { transform: scale(.94); }
.mail-attachment-icon-btn.busy { opacity: .6; }
.mail-attachment-icon-btn.busy svg { animation: mail-refresh-spin .8s linear infinite; }
.mail-security-facts { margin-top: 8px; display: grid; gap: 5px; }
.mail-security-facts span { font-size: 12px; line-height: 1.4; }
.mail-security-facts .safe { color: #84decf; }
.mail-security-facts .notice { color: #e8c979; }
.mail-security-facts .danger { color: #ff9aaa; }
.mail-unsubscribe { margin-top: 9px; display: inline-flex; color: #8dcbff; font-size: 12px; }
/* Свёрнутый по умолчанию чип вместо 3-строчной карточки «Безопасность письма» — тап
   раскрывает полные факты и ссылку отписки. См. .mail-detail-routing/.mail-organize.compact
   выше — вся шапка письма ужата ради контента (жалоба: текст письма был видимой третью sheet). */
.mail-security-details.mail-detail-section { padding: 0; }
.mail-security-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #dbe7f6;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
  list-style: none;
}
.mail-security-details > summary::-webkit-details-marker { display: none; }
.mail-security-details.warning > summary { color: #ffb4c0; }
.mail-security-chip-icon { flex: 0 0 auto; }
.mail-security-details[open] > summary { border-bottom: 1px solid rgba(166,194,230,.14); }
.mail-security-body { padding: 10px 12px 12px; }
.mail-security-body .mail-security-facts { margin-top: 0; }
.mail-ai-result {
  margin-top: 10px;
  padding: 13px;
  border-left: 3px solid var(--mint);
  border-radius: 5px;
  color: #dbe5f2;
  background: #1b3048;
}
.mail-ai-kicker { color: var(--mint); font-size: 11px; font-weight: 820; text-transform: uppercase; }
.mail-ai-result p { margin: 7px 0 0; font-size: 14px; line-height: 1.55; }
.mail-ai-facts { margin-top: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.mail-ai-facts > span { min-width: 0; padding: 8px; border: 1px solid rgba(166,194,230,.13); border-radius: 6px; display: grid; gap: 3px; }
.mail-ai-facts strong { color: #9ed1ff; font-size: 11px; }
.mail-ai-facts small { overflow-wrap: anywhere; color: #e4ebf4; font-size: 12px; }
.mail-ai-attachments { margin-top: 10px; display: grid; gap: 4px; }
.mail-ai-attachments strong { color: #9ed1ff; font-size: 12px; }
.mail-ai-attachments span { color: #d9e4f1; font-size: 12px; }
.agent-inline-link { color: #08756e; font-weight: 760; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.bubble.agent .agent-inline-link { color: #8dcbff; }
.bubble.agent .agent-inline-link.phone-link,
.bubble.agent .agent-inline-link.address-link {
  color: #79e6d6;
  text-decoration-color: color-mix(in srgb, currentColor 72%, transparent);
  cursor: pointer;
}
.mail-reply { flex: 0 0 auto; padding-top: 12px; border-top: 1px solid var(--line); }
.mail-reply textarea { min-height: 108px; max-height: 30vh; }
.mail-reply-actions { margin-top: 9px; display: flex; gap: 8px; }
.mail-reply-actions > * { flex: 1; }
html.keyboard-open .mail-panel .modal-panel { height: calc(var(--visible-height) - 8px); max-height: calc(var(--visible-height) - 8px); }

.toast-stack { position: fixed; z-index: 1200; top: max(18px, env(safe-area-inset-top)); left: 50%; width: min(calc(100% - 32px), 440px); transform: translateX(-50%); pointer-events: none; }
.toast { margin-bottom: 7px; padding: 11px 13px; border: 1px solid rgba(85,242,211,.22); border-radius: 7px; color: #eafaf6; background: rgba(14,28,43,.96); box-shadow: 0 14px 40px rgba(0,0,0,.3); font-size: 10px; animation: toast-in .25s ease both; }
.toast.error { border-color: rgba(255,125,142,.3); color: #ffd6dc; }
.toast.voice-progress,
.toast.voice-success { padding: 14px 16px; border-color: rgba(85,242,211,.42); color: #f5fffc; background: rgba(24,55,72,.98); font-size: 15px; font-weight: 690; }
.toast.voice-progress::before { content: ""; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%; display: inline-block; vertical-align: 1px; background: var(--mint); box-shadow: 0 0 0 5px rgba(85,242,211,.1); animation: voice-recording-dot 1.1s ease-in-out infinite; }
.owner-diagnostic {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,125,142,.2);
  color: #ffd9df;
  font-size: 9px;
}
.owner-diagnostic summary { cursor: pointer; font-weight: 780; }
.owner-diagnostic pre {
  max-height: 210px;
  margin: 8px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #f3cbd2;
  font: 9px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.skeleton { position: relative; overflow: hidden; color: transparent !important; background: rgba(255,255,255,.045) !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); transform: translateX(-100%); animation: skeleton 1.3s infinite; }
@keyframes skeleton { to { transform: translateX(100%); } }

@media (min-width: 760px) {
  .app { max-width: 1160px; }
  .content { padding-left: max(28px, calc((100% - 880px) / 2)); padding-right: max(28px, calc((100% - 880px) / 2)); }
  .bottom-nav { max-width: 620px; left: 50%; transform: translateX(-50%); }
  .sheet-panel, .modal-panel { max-width: 600px; border-radius: 8px 8px 0 0; }
  .month-day { min-height: 88px; }
}

@media (max-width: 520px) {
  .event-time-row { grid-template-columns: 1fr; }
  .bottom-nav {
    left: 12px;
    right: 12px;
    bottom: max(18px, env(safe-area-inset-bottom));
    height: 72px;
    padding: 5px 4px;
    grid-template-columns: 1fr 1fr 64px 1fr 1fr;
    border-radius: 24px;
    border-color: rgba(176,200,239,.14);
    background: rgba(8,17,31,.93);
    box-shadow: 0 16px 42px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.025);
  }
  .nav-item { gap: 4px; border-radius: 15px; }
  .nav-item.active { color: #eef5ff; background: transparent; }
  .nav-item.active::after {
    content: "";
    position: absolute;
    bottom: 2px;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: var(--mint);
    box-shadow: 0 0 12px rgba(85,242,211,.5);
  }
  .nav-icon svg { width: 20px; height: 20px; }
  .nav-label { font-size: 8px; font-weight: 700; }
  .bot-button {
    width: 62px;
    height: 62px;
    transform: translateY(-7px);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(72,215,208,.2), inset 0 1px rgba(255,255,255,.34);
  }
  .bot-button::before { inset: 8px; border-radius: 15px; }
  .bot-face { width: 31px; height: 31px; }
  .bot-face svg { width: 21px; height: 21px; }
  .modal-panel { max-height: calc(var(--visible-height) - 12px); padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 370px) {
  .field-row { grid-template-columns: 1fr; }
  .event-time-fields { grid-template-columns: minmax(0, 1fr) 96px; }
  .composer.live .composer-button { width: 31px; }
  .composer-tools { gap: 3px; }
  .voice-recording-strip { grid-template-columns: 9px 58px minmax(0,1fr); gap: 5px; padding-inline: 9px; }
  .voice-recording-strip time { font-size: 12.5px; }
  .voice-recording-hint { display: block; font-size: 9.5px; }
  .voice-composer.voice-locked .voice-recording-hint { display: none; }
  .segmented { width: 220px; }
  .month-day { min-height: 54px; padding: 5px 3px; }
}

/* Readable by default: Office is designed for long, repeated daily use. */
:root {
  --surface: rgba(34, 48, 73, .94);
  --surface-strong: #22324d;
  --surface-soft: rgba(255, 255, 255, .075);
  --line: rgba(190, 211, 242, .22);
  --line-strong: rgba(199, 218, 246, .34);
  --muted: #bac6d8;
  --muted-strong: #e0e8f3;
}

body {
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.status-brand { font-size: 11px; letter-spacing: 0; }
.eyebrow,
.date-line,
.auth-kicker { font-size: 12px; letter-spacing: 0; }
.page-heading h2 { font-size: 29px; }
.page-title { font-size: 27px; }
.welcome-title { max-width: 340px; font-size: 32px; line-height: 1.16; }
.day-subtitle,
.page-heading p,
.ai-note { font-size: 16px; line-height: 1.55; }
.primary-button,
.secondary-button,
.danger-button { min-height: 48px; font-size: 16px; }

.summary-value { font-size: 20px; }
.summary-label { font-size: 12px; line-height: 1.35; }
.section-title { font-size: 20px; }
.section-meta,
.source-tag { font-size: 14px; }

.agenda-row { min-height: 86px; }
.agenda-time { font-size: 14px; }
.agenda-title { font-size: 18px; line-height: 1.35; }
.agenda-detail { font-size: 15px; line-height: 1.45; }
.day-tag { min-height: 32px; font-size: 13px; }
.day-tag strong { font-size: 15px; }

.home-month,
.home-week-scope { font-size: 13px; letter-spacing: 0; }
.home-day { height: 56px; }
.home-day span:first-child,
.day span:first-child,
.month-weekday { font-size: 12px; letter-spacing: 0; }
.home-day strong,
.day span:last-child,
.week-strip.dynamic .day span:nth-child(2) { font-size: 19px; }
.calendar-period { font-size: 22px; }
.month-number { width: 28px; height: 28px; font-size: 15px; }
.agenda-date h3 { font-size: 20px; }
.agenda-event { min-height: 74px; grid-template-columns: 62px 3px minmax(0, 1fr); }
.agenda-event-time { font-size: 13px; }
.agenda-event h4 { font-size: 17px; line-height: 1.35; }
.agenda-event p { font-size: 15px; line-height: 1.45; }
.event-time { font-size: 12px; }
.event-title { font-size: 16px; }
.event-note { font-size: 13px; line-height: 1.45; }

.focus-status,
.focus-source { font-size: 11px; letter-spacing: 0; }
.focus-title { font-size: 23px; }
.focus-meta,
.focus-note { font-size: 15px; line-height: 1.5; }
.focus-progress-copy { font-size: 11px; }
.timeline-time { font-size: 12px; }
.timeline-title { font-size: 16px; }
.timeline-detail,
.timeline-state { font-size: 14px; }

.search-field input,
.field input,
.field textarea,
.field select,
.composer.live .composer-input { font-size: 17px; }
.field > span { font-size: 15px; }
.event-time-card > strong { font-size: 14px; }
.event-time-fields .field > span { font-size: 12px; }
.segment { min-height: 42px; font-size: 15px; }
.filter-chip { min-height: 40px; height: 40px; font-size: 15px; }

.chat-row,
.mail-row,
.chat-open { min-height: 82px; }
.chat-name,
.mail-sender { font-size: 17px; }
.chat-preview,
.mail-preview { font-size: 15px; line-height: 1.45; }
.chat-time,
.mail-time { font-size: 13px; }
.channel,
.chat-label,
.mail-row-priority { font-size: 10px; letter-spacing: 0; }
.chat-label { min-height: 22px; padding: 3px 7px; }
.unread { min-width: 22px; height: 22px; font-size: 11px; }

.integration-copy strong,
.integration-row strong,
.mail-account strong { font-size: 16px; }
.integration-copy span,
.integration-row p,
.mail-account span,
.integration-status,
.connected { font-size: 14px; line-height: 1.45; }
.integration-action,
.mail-action { min-height: 44px; font-size: 14px; }
.integration-row { min-height: 78px; }

.digest-head strong { font-size: 16px; }
.digest-label,
.digest-kind,
.digest-open { font-size: 11px; letter-spacing: 0; }
.digest-count { font-size: 12px; }
.digest-overview,
.digest p:last-child { font-size: 13px !important; line-height: 1.55 !important; }
.digest-item > strong { font-size: 14px; line-height: 1.4; }
.digest-sender { font-size: 12px; }
.digest-detail { font-size: 13px; line-height: 1.5; }
.digest-action { font-size: 12px; }
.mail-subject { font-size: 14px; line-height: 1.4; }

.modal-head h2,
.mail-detail-shell .modal-head h2 { font-size: 23px; line-height: 1.25; }
.modal-head p { font-size: 15px; line-height: 1.5; }
.chat-pin-toggle strong { font-size: 14px; }
.label-option .chat-label { min-height: 32px; font-size: 12px; }
.empty-state strong { font-size: 18px; }
.empty-state p { font-size: 15px; line-height: 1.55; }

.bot-head-copy p { font-size: 11px; letter-spacing: 0; }
.bot-head-copy h2 { font-size: 21px; }
.bubble { font-size: 17px; line-height: 1.55; }
.decision-title { font-size: 15px; }
.decision strong { font-size: 14px; }
.decision span { font-size: 12px; line-height: 1.4; }
.channel-option { min-height: 38px; font-size: 13px; }
.pending-card strong { font-size: 12px; letter-spacing: 0; }
.pending-card p { font-size: 16px; line-height: 1.5; }
.pending-actions button { min-height: 40px; font-size: 13px; }
.attachment-chip { height: 40px; font-size: 12px; }
.attachment-chip-state,
.message-attachment { font-size: 11px; }

.thread-message { font-size: 17px; line-height: 1.55; }
.thread-file-kind { font-size: 10px; }
.thread-file-name { font-size: 13px; }
.thread-file-size { font-size: 11px; }
.thread-media > span,
.thread-media > a { font-size: 12px; }
.thread-message-meta { min-height: 18px; font-size: 12px; }
.thread-attachment-icon { font-size: 10px; }
.thread-attachment-copy > span { font-size: 13px; }
.thread-attachment-copy small { font-size: 11px; }
.mail-detail-sender strong { font-size: 14px; }
.mail-detail-sender > span:nth-child(2) > span,
.mail-detail-routing { font-size: 12px; }
.mail-priority { font-size: 11px; }
.mail-detail-body { font-size: 18px; line-height: 1.7; }

.toast { font-size: 13px; line-height: 1.45; }
.owner-diagnostic pre { font-size: 11px; }
.nav-label { font-size: 12px; }
.nav-badge,
.top-badge { font-size: 10px; }

.chat-row,
.mail-row,
.integration-strip,
.mail-connect { border-color: rgba(196,214,241,.22); background: rgba(30,45,69,.82); }
.thread-panel .modal-panel { background: #1d2e48; }
.thread-messages { border-color: rgba(164,194,231,.16); background: #14263e; }
.thread-message { color: #ffffff; background: #344966; }
.thread-message.out { color: #f2fffc; background: #19746c; }
.thread-composer .composer-input,
.composer.live .composer-input { color: #ffffff; border-color: rgba(198,216,242,.26); background: #263851; }
.sheet-panel { background: #17273e; }
.bubble.agent { color: #f6f9ff; border-color: rgba(199,216,242,.22); background: #2d405d; }
.segment { color: #c8d3e4; }
.segment.active { color: #ffffff; background: #294568; }

.boot-copy { font-size: 14px; }
.boot-retry { font-size: 13px; }
.auth-kicker { font-size: 12px; }
.auth-panel > p { font-size: 15px; line-height: 1.6; }
.auth-panel > .auth-legal { font-size: 12px; line-height: 1.6; }
.auth-phone-preview { font-size: 14px; }
.auth-status { font-size: 14px; line-height: 1.5; }
.office-otp-head > p:last-child { font-size: 14px; line-height: 1.5; }

@media (max-width: 370px) {
  .welcome-title { font-size: 28px; }
  .nav-label { font-size: 10px; line-height: 1.1; }
  .summary-label { font-size: 11px; }
  .integration-copy span,
  .integration-row p { font-size: 11px; }
  .calendar-voice-copy strong { font-size: 15px; }
  .calendar-voice-copy > span { font-size: 12px; }
}

/* Refined readable scale: large content, quiet chrome, clear hierarchy. */
:root {
  --office-topbar-height: calc(104px + env(safe-area-inset-top));
  --surface: rgba(27, 40, 61, .9);
  --surface-strong: #22324a;
  --surface-soft: rgba(255, 255, 255, .055);
  --line: rgba(188, 207, 235, .16);
  --line-strong: rgba(195, 215, 243, .27);
  --muted: #aebbd0;
  --muted-strong: #d7e0ed;
}

body { font-size: 17px; line-height: 1.48; }
.topbar { padding: calc(env(safe-area-inset-top) + 29px) 18px 11px; }
.content {
  height: calc(var(--app-size) - var(--office-topbar-height) - 92px);
  padding: 2px 18px 26px;
}
.brand { gap: 10px; }
.brand-mark { width: 47px; height: 47px; }
.brand-mark svg { width: 38px; height: 38px; }
.eyebrow,
.date-line { font-size: 11px; line-height: 1.2; letter-spacing: 0; }
.page-title { font-size: 25px; line-height: 1.08; }
.top-actions { gap: 7px; }
.icon-button,
.avatar-button { height: 40px; }
.icon-button { width: 40px; }
.avatar { width: 32px; height: 32px; }

.day-hero { padding-bottom: 13px; }
.welcome-row { align-items: center; }
.welcome-title { max-width: 315px; font-size: 30px; line-height: 1.14; }
.day-subtitle,
.page-heading p,
.ai-note { font-size: 15px; line-height: 1.5; }
/* Итог дня под плитками: тихая строка, а не баннер — она поздравляет, но не кричит. */
.day-cheer {
  margin: 12px 0 0;
  padding: 9px 12px;
  border: 1px solid rgba(126, 231, 196, .22);
  border-radius: 12px;
  background: rgba(126, 231, 196, .08);
  color: #cdf3e5;
  font-size: 12.5px;
  line-height: 1.4;
}

.day-tags { margin-top: 11px; gap: 6px; }
.day-tag { min-height: 29px; padding: 0 10px; font-size: 11px; }
.day-tag strong { font-size: 13px; }

.summary-strip {
  margin: 17px -18px 0;
  padding: 13px 18px;
  background: rgba(9, 20, 35, .34);
}
.summary-item + .summary-item { padding-left: 11px; }
.summary-value { margin-bottom: 2px; font-size: 18px; }
.summary-label { font-size: 11px; line-height: 1.3; }
.ai-note { margin: 14px 0 20px; min-height: 46px; padding: 11px 12px; }
.section-head { margin-bottom: 9px; }
.section-title { font-size: 18px; }
.section-meta,
.source-tag { font-size: 12px; }

.home-calendar {
  margin: 0 -18px 17px;
  padding: 12px 18px 14px;
  background: rgba(9, 20, 35, .34);
}
.home-month,
.home-week-scope { font-size: 11px; }
.home-week { gap: 4px; }
.home-day { height: 52px; border-radius: 7px; }
.home-day span:first-child,
.day span:first-child,
.month-weekday { font-size: 10px; }
.home-day strong,
.day span:last-child,
.week-strip.dynamic .day span:nth-child(2) { font-size: 17px; }
.home-day.selected { box-shadow: 0 7px 20px rgba(85,242,211,.13); }

.focus-card {
  position: relative;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-color: rgba(85,242,211,.2);
  background: linear-gradient(145deg, rgba(31,51,67,.84), rgba(27,37,57,.9));
  box-shadow: 0 13px 30px rgba(0,0,0,.12);
}
.focus-status,
.focus-source { font-size: 10px; }
.focus-title {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0 4px;
  font-size: 17px;
  line-height: 1.22;
}
.focus-card.task-completing {
  overflow: hidden;
  pointer-events: none;
  animation: task-focus-complete-away .72s cubic-bezier(.22,.72,.24,1) forwards;
}
.focus-meta,
.focus-note { min-width: 0; max-width: 100%; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.focus-card.empty { padding-block: 10px; border-color: rgba(110,182,255,.14); background: rgba(25,39,61,.5); }
.focus-card.empty::before { background: rgba(110,182,255,.6); }
.focus-card.empty .focus-title { margin-top: 5px; font-size: 15px; }
.focus-card.empty .focus-meta { font-size: 12px; }
.focus-note { margin: 11px 0; padding: 9px 10px; }
.focus-progress-copy { font-size: 10px; }
.focus-open { width: 38px; height: 38px; }

.task-board-head {
  align-items: center;
  margin: 14px 0 8px;
}
.task-board-head > div { min-width: 0; display: grid; gap: 3px; }
.section-caption { color: #8797ae; font-size: 12px; line-height: 1.35; }
.task-kind-tabs {
  min-height: 50px;
  padding: 4px;
  border: 1px solid rgba(176,200,239,.15);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 4px;
  background: rgba(8,18,34,.38);
}
.task-kind-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #91a0b7;
  background: transparent;
  font-size: 14px;
  font-weight: 780;
}
.task-kind-tabs button strong {
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  color: #aab7ca;
  background: rgba(176,200,239,.08);
  font-size: 10px;
}
.task-kind-tabs button.active {
  color: #effffb;
  background: rgba(85,242,211,.105);
  box-shadow: inset 0 0 0 1px rgba(85,242,211,.2);
}
.task-kind-tabs button.active strong { color: #0c2630; background: var(--mint); }
.task-quick-add {
  width: 100%;
  min-height: 52px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(176,200,239,.15);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 20px;
  align-items: center;
  gap: 10px;
  color: #aab8cc;
  background: rgba(25,39,61,.58);
  text-align: left;
  font-size: 14px;
  font-weight: 720;
}
.task-quick-add:active { border-color: rgba(85,242,211,.36); transform: scale(.994); }
.task-quick-add-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #10232d;
  background: linear-gradient(135deg, var(--mint), #77d7ff);
  font-size: 24px;
  font-weight: 430;
  line-height: 1;
}
.task-quick-add svg { width: 18px; height: 18px; color: #7890ad; }
.task-smart-draft { margin-top: -3px; }
.task-smart-draft.warning {
  border-color: rgba(244,203,115,.3);
  color: #f8dfab;
  background: rgba(244,203,115,.085);
}
.task-smart-draft.warning svg { color: #f4cb73; }
/* .task-edit-top сюда же: база .modal-head-action — круглая иконка (border-radius: 50%),
   и текстовая кнопка «Обновить» / «Изменить» вытягивалась из неё в овал. Форма у всех
   текстовых кнопок в шапке карточки одна — прямоугольник со скруглением 7px. */
.task-save-top,
.task-edit-top {
  width: auto;
  min-width: 82px;
  padding: 0 13px;
  border-color: rgba(85, 242, 211, .38);
  border-radius: 7px;
  color: #082521;
  background: var(--mint);
  box-shadow: 0 10px 28px rgba(45, 221, 190, .18);
  font-size: 14px;
  font-weight: 800;
}
.task-option-selector {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.task-option-selector legend {
  margin-bottom: 7px;
  color: #aebbd0;
  font-size: 12px;
  font-weight: 760;
}
.task-option-selector > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.task-option-selector label {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(176,200,239,.17);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  color: #9faec3;
  background: rgba(255,255,255,.025);
  font-size: 12px;
  font-weight: 730;
}
.task-option-selector label.selected {
  border-color: rgba(85,242,211,.32);
  color: #e8fff9;
  background: rgba(85,242,211,.1);
  box-shadow: inset 0 0 0 1px rgba(85,242,211,.05);
}
.task-option-selector input { position: absolute; opacity: 0; pointer-events: none; }
.task-filter-bar {
  margin: 9px 0 10px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 5px;
  overflow: visible;
}
.task-filter-bar::-webkit-scrollbar { display: none; }
.task-filter-bar button {
  min-width: 0;
  min-height: 38px;
  padding: 0 6px;
  border: 1px solid rgba(176,200,239,.15);
  border-radius: 7px;
  flex: 0 0 auto;
  color: #9fadc1;
  background: rgba(255,255,255,.025);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.15;
  white-space: normal;
}
.task-filter-bar button.active {
  border-color: rgba(85,242,211,.28);
  color: #d7fff6;
  background: rgba(85,242,211,.09);
}
.office-task-list { display: grid; gap: 7px; margin-bottom: 19px; }
.list-swipe.task-list-swipe > .office-task-row { background: #1d2c44; }
.list-swipe.task-list-swipe > .office-task-row.next-task {
  border-color: rgba(85,242,211,.42);
  background: linear-gradient(90deg, rgba(85,242,211,.13), #1d2c44 58%);
  box-shadow: inset 3px 0 0 var(--mint), 0 8px 24px rgba(4,17,30,.18);
}
.office-task-row {
  min-height: 82px;
  padding: 11px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) 4px;
  align-items: stretch;
  gap: 9px;
  background: rgba(25,39,61,.64);
  transition: opacity .2s ease, transform .2s ease, border-color .2s ease;
}
.office-task-row:active { transform: scale(.992); border-color: rgba(85,242,211,.3); }
.office-task-row.done { opacity: .62; }
.office-task-row.done .office-task-copy strong {
  text-decoration: line-through;
  text-decoration-color: rgba(118,242,217,.72);
  text-decoration-thickness: 2px;
}
.office-task-next {
  min-height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  color: #08232a;
  background: var(--mint);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}
.office-task-check {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(176,200,239,.28);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #09212a;
  background: transparent;
  align-self: center;
}
.office-task-row.done .office-task-check { border-color: #55f2d3; background: #55f2d3; }
.office-task-row.done .office-task-check span {
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}
.office-task-open {
  min-width: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-content: center;
  gap: 7px;
  text-align: left;
  color: inherit;
  background: transparent;
}
.office-task-copy { min-width: 0; display: grid; gap: 4px; }
.office-task-badges {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.office-task-kind {
  width: fit-content;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid rgba(110,182,255,.22);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  color: #a9cff3;
  background: rgba(110,182,255,.07);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}
.office-task-kind.kind-meeting {
  border-color: rgba(129,120,255,.28);
  color: #c9c5ff;
  background: rgba(129,120,255,.09);
}
.office-task-source,
.task-source-chip {
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid rgba(244,203,115,.25);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  color: #f4d995;
  background: rgba(244,203,115,.075);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}
.office-task-copy strong {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
  color: #f3f7ff;
  font-size: 15px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  white-space: normal;
}
.office-task-copy strong::after,
.focus-title::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 52%;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: #76f2d9;
  transform: scaleX(0);
  transform-origin: left center;
}
.office-task-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.office-task-lifecycle {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: #a8b6c9;
  font-size: 11px;
  line-height: 1.35;
}
.office-task-lifecycle > span {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.office-task-lifecycle > span > span { color: #8291a8; font-weight: 690; }
.office-task-lifecycle time { color: #c3cede; font-weight: 720; white-space: nowrap; }
.office-task-lifecycle .completed > span,
.office-task-lifecycle .completed time { color: #80d9c4; }
.office-task-lifecycle.compact { gap: 3px 10px; font-size: 10px; }
.office-task-row.task-completing {
  pointer-events: none;
  animation: task-row-complete-mark .56s cubic-bezier(.2,.78,.22,1) both;
}
.office-task-row.task-completing .office-task-check {
  border-color: #55f2d3;
  background: #55f2d3;
  animation: task-check-complete .48s cubic-bezier(.2,.86,.24,1) both;
}
.office-task-row.task-completing .office-task-check span {
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
  animation: task-check-draw .28s ease-out .08s both;
}
.office-task-row.task-completing .office-task-copy strong::after,
.focus-card.task-completing .focus-title::after {
  animation: task-title-strike .4s cubic-bezier(.2,.78,.22,1) .08s forwards;
}
.office-task-row.task-reordering { pointer-events: none; will-change: transform, opacity; }
.office-task-meta {
  width: auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 9px;
  text-align: left;
}
.office-task-meta span { color: #a8b5c9; font-size: 10px; font-weight: 760; }
.office-task-meta .status-in_progress,
.office-task-meta .status-executing { color: #7cc6ff; }
.office-task-meta .status-needs_confirmation,
.office-task-meta .status-needs_setup { color: #f4cb73; }
.office-task-meta .status-done,
.office-task-meta .status-completed { color: #7cdec4; }
.office-task-meta time {
  max-width: 100%;
  color: #77879e;
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.office-task-priority { width: 4px; min-height: 38px; height: auto; align-self: stretch; border-radius: 2px; background: rgba(176,200,239,.2); }
.office-task-priority.priority-high { background: #f4cb73; }
.office-task-priority.priority-urgent { background: #ff7d8e; }
.office-task-priority.priority-low { background: #6eb6ff; }
.completed-tasks-toggle,
.timeline-completed-toggle {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 7px;
  color: #a8b7cc;
  background: rgba(255,255,255,.025);
  font-size: 12px;
  font-weight: 760;
}
.timeline-row.completed { opacity: .55; }
.timeline-row.completed .timeline-title { text-decoration: line-through; text-decoration-color: rgba(154,168,191,.7); }
.timeline-row.past { opacity: .52; }
.timeline-row.past .timeline-title { text-decoration: line-through; text-decoration-color: rgba(154,168,191,.66); }
.timeline-dot.past { background: #718096; box-shadow: none; }
.timeline-state.past { color: #8b99ad; }
.timeline-dot.done { background: #74d8bd; box-shadow: 0 0 0 3px rgba(85,242,211,.08); }
.timeline-state.completed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #85ddc6;
}
.timeline-state.completed svg { width: 13px; height: 13px; }
.timeline-completed-toggle { margin-top: 8px; }
.agenda-event.completed { opacity: 1; }
.agenda-event.completed h4 { text-decoration: line-through; }
.agenda-event.completed .agenda-event-mark { background: #74d8bd; }
.agenda-completed-check { margin-right: 5px; color: #85ddc6; font-weight: 850; }

@keyframes task-title-strike {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes task-row-complete-mark {
  0% { border-color: rgba(176,200,239,.16); background: rgba(25,39,61,.64); transform: scale(1); }
  46% { border-color: rgba(85,242,211,.54); background: rgba(35,72,78,.72); transform: scale(.994); }
  100% { border-color: rgba(85,242,211,.28); background: rgba(28,55,67,.7); transform: scale(1); }
}
@keyframes task-check-complete {
  0% { transform: scale(.8); box-shadow: 0 0 0 0 rgba(85,242,211,.36); }
  62% { transform: scale(1.14); box-shadow: 0 0 0 9px rgba(85,242,211,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(85,242,211,0); }
}
@keyframes task-check-draw {
  from { opacity: 0; transform: rotate(-45deg) translateY(-1px) scale(.35); }
  to { opacity: 1; transform: rotate(-45deg) translateY(-1px) scale(1); }
}
@keyframes task-focus-complete-away {
  0% { max-height: 520px; opacity: 1; transform: translateY(0) scale(1); }
  44% { max-height: 520px; opacity: 1; transform: translateY(0) scale(.997); }
  100% {
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    opacity: 0;
    transform: translateY(-9px) scale(.988);
  }
}
@keyframes task-panel-complete-away {
  0%, 44% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(16px) scale(.985); }
}

.agenda-row { min-height: 80px; padding: 11px; }
.agenda-time { font-size: 13px; }
.agenda-title { font-size: 17px; line-height: 1.32; }
.agenda-detail { font-size: 14px; line-height: 1.42; }
.timeline-row { min-height: 59px; grid-template-columns: 46px 15px minmax(0,1fr) auto; }
.timeline-list::before { left: 59px; }
.timeline-time { font-size: 11px; }
.timeline-title { font-size: 15px; }
.timeline-detail,
.timeline-state { font-size: 12px; }

.page-heading { margin-bottom: 16px !important; }
.page-heading h2 { font-size: 27px; }
.calendar-voice-quick {
  min-height: 72px;
  margin: 15px 0 14px;
  padding: 11px 11px 11px 14px;
  background: rgba(27,48,70,.88);
  box-shadow: 0 10px 25px rgba(2,9,20,.14), inset 2px 0 #55f2d3;
}
.calendar-voice-copy strong { font-size: 16px; }
.calendar-voice-copy > span { font-size: 13px; }
.calendar-voice-quick .voice-action { width: 48px; height: 48px; }
.view-toolbar { margin-bottom: 13px; }
.segmented { width: min(100%, 268px); }
.segment { min-height: 38px; font-size: 14px; }
.calendar-period { margin-bottom: 13px; font-size: 20px; }
.week-strip { margin-inline: -18px; padding-inline: 18px; }
.month-number { width: 26px; height: 26px; font-size: 14px; }
.agenda-date h3 { font-size: 18px; }
.agenda-event { min-height: 70px; grid-template-columns: 58px 3px minmax(0, 1fr); }
.agenda-event-time { font-size: 12px; }
.agenda-event h4 { font-size: 16px; }
.agenda-event p { font-size: 14px; }

.search-field input,
.field input,
.field textarea,
.field select,
.composer.live .composer-input { font-size: 16px; }
.field { gap: 6px; }
.field > span { font-size: 13px; }
.event-time-card > strong { font-size: 14px; }
.event-time-fields .field > span { font-size: 11px; }
.primary-button,
.secondary-button,
.danger-button { min-height: 46px; font-size: 15px; }
.filter-chip { min-height: 36px; height: 36px; padding-inline: 12px; font-size: 13px; }

.chat-row,
.mail-row,
.chat-open { min-height: 76px; }
.chat-row,
.mail-row,
.integration-strip,
.mail-connect {
  border-color: rgba(190,209,237,.17);
  background: rgba(27,41,63,.72);
}
.chat-name,
.mail-sender { font-size: 16px; }
.chat-preview,
.mail-preview { font-size: 14px; line-height: 1.42; }
.chat-time,
.mail-time { font-size: 11px; }
.channel,
.chat-label,
.mail-row-priority { font-size: 9px; }
.integration-copy strong,
.integration-row strong,
.mail-account strong { font-size: 15px; }
.integration-copy span,
.integration-row p,
.mail-account span,
.integration-status,
.connected { font-size: 12px; line-height: 1.4; }
.integration-action,
.mail-action { min-height: 39px; font-size: 13px; }
.integration-row { min-height: 72px; }

.digest { background: rgba(20,31,52,.68); }
.digest-head strong { font-size: 15px; }
.digest-label,
.digest-kind,
.digest-open { font-size: 10px; }
.digest-overview,
.digest p:last-child { font-size: 13px !important; }
.digest-item > strong { font-size: 14px; }
.digest-sender { font-size: 11px; }
.digest-detail { font-size: 13px; }
.mail-subject { font-size: 14px; }

.modal-panel { padding-inline: 18px; background: #142238; }
.modal-head { margin-bottom: 16px; }
.modal-head h2,
.mail-detail-shell .modal-head h2 { font-size: 21px; }
.modal-head p { font-size: 13px; }
.empty-state strong { font-size: 17px; }
.empty-state p { font-size: 14px; }
.sheet-panel { background: #16253a; }
.bot-head-copy p { font-size: 10px; }
.bot-head-copy h2 { font-size: 20px; }
.bubble { font-size: 17px; line-height: 1.5; }
.bubble.agent { border-color: rgba(197,215,240,.16); background: #293b56; }
.pending-card p { font-size: 15px; }
.pending-actions button { font-size: 13px; }

.thread-panel .modal-panel { background: #192a42; }
.thread-messages { border-color: rgba(166,194,230,.12); background: #122238; }
.thread-message { font-size: 17px; line-height: 1.5; color: #fff; background: #304560; }
.thread-message.out { color: #f3fffc; background: #176e68; }
.thread-message-meta { font-size: 10px; }
.thread-composer { background: #192a42; }
.thread-composer .composer-input,
.composer.live .composer-input { color: #fff; border-color: rgba(198,216,242,.2); background: #233650; }
.mail-detail-body { font-size: 18px; line-height: 1.65; }

.bottom-nav { height: 70px; }
.nav-item { gap: 3px; }
.nav-icon svg { width: 21px; height: 21px; }
.nav-label { font-size: 10px; line-height: 1.12; }
.bot-button { width: 60px; height: 60px; transform: translateY(-6px); border-radius: 18px; }
.bot-button::before { border-radius: 13px; }
.bot-face { width: 30px; height: 30px; }

@media (max-width: 370px) {
  .topbar { padding-inline: 14px; }
  .content { padding-inline: 14px; }
  .welcome-title { font-size: 27px; }
  .summary-strip,
  .home-calendar { margin-inline: -14px; padding-inline: 14px; }
  .week-strip { margin-inline: -14px; padding-inline: 14px; }
  .summary-label { font-size: 10px; }
  .nav-label { font-size: 9px; }
}

/* Balanced large-type rhythm: readable without stretching the interface. */
* { box-sizing: border-box; }
.topbar {
  min-width: 0;
  padding-top: calc(env(safe-area-inset-top) + 28px);
  padding-bottom: 10px;
  align-items: center;
}
.brand,
.brand-copy,
.welcome-row > div,
.page-heading,
.chat-main,
.mail-main { min-width: 0; }
.brand { align-items: center; }
.page-title {
  max-width: min(58vw, 320px);
  overflow: hidden;
  font-size: 24px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-actions { margin-left: auto; align-self: center; }
.avatar-button { width: 42px; min-width: 42px; }
.welcome-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}
.welcome-title { font-size: 29px; line-height: 1.13; }
.day-subtitle { max-width: 520px; }
.day-tags { grid-template-columns: repeat(3, 1fr); }
.section-head,
.digest-head,
.chat-top,
.mail-top { align-items: center; }
.view-toolbar { align-items: center; }
.segmented { min-width: 0; }
.calendar-nav { flex: 0 0 auto; }
.field input,
.field textarea,
.field select,
.search-field input,
.composer-input { line-height: 1.4; }
.field input,
.field select { min-height: 48px; height: 48px; }
.field textarea { min-height: 104px; }
.primary-button,
.secondary-button,
.danger-button,
.integration-action,
.mail-action { line-height: 1.2; }
.chat-row,
.mail-row { align-items: center; }
.chat-name,
.mail-sender,
.mail-subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-panel .modal-panel { padding-inline: 14px; }
.thread-panel .modal-head { margin-inline: 2px; }
.thread-messages {
  margin-inline: -2px;
  padding: 12px 8px 18px;
  gap: 9px;
  border: 0;
  background: #142944;
  scrollbar-width: none;
}
.thread-messages::-webkit-scrollbar { display: none; }
.thread-message {
  max-width: min(86%, 430px);
  padding: 9px 11px 7px;
  gap: 5px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.48;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: filter .15s ease, transform .15s ease;
}
.thread-message.pressing { filter: brightness(1.12); transform: scale(.985); }
.thread-message-copy { min-width: 0; }
.thread-message-meta { flex-wrap: wrap; gap: 5px; font-size: 10px; }
.thread-media {
  position: relative;
  min-width: min(210px, 64vw);
  max-width: min(340px, 78vw);
  min-height: 116px;
  background: #0d1b2d;
}
.thread-media img,
.thread-media video {
  max-height: 430px;
  object-fit: cover;
}
.thread-image img { opacity: 0; transition: opacity .18s ease; }
.thread-image.loaded img { opacity: 1; }
.thread-media-loader {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 0 !important;
  background: linear-gradient(100deg, #12233a 25%, #1c3450 45%, #12233a 65%);
  background-size: 220% 100%;
  animation: thread-media-loading 1.2s linear infinite;
}
.thread-image.loaded .thread-media-loader { display: none; }
.thread-image.failed .thread-media-loader { animation: none; background: #182a42; }
.thread-image.failed::after {
  content: var(--i18n-photo-load-failed, "Photo failed to load");
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #bcc9db;
  font-size: 13px;
  text-align: center;
}
@keyframes thread-media-loading { to { background-position: -220% 0; } }
.thread-message.has-visual-media .thread-message-copy { padding: 9px 10px 3px; }
.thread-message.has-visual-media .thread-message-meta { padding: 5px 8px 7px; }
.thread-composer {
  gap: 8px;
  padding: 10px 0 max(2px, env(safe-area-inset-bottom));
  background: #192a42;
}
.composer.live .composer-input {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 21px;
  font-size: 16px;
  line-height: 1.42;
}
.composer.live .composer-button,
.composer.live .send-button { width: 44px; height: 44px; }
.nav-label { font-size: 11px; white-space: nowrap; }

.message-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  align-items: end;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(2, 8, 16, .72);
  opacity: 0;
  transition: opacity .2s ease;
}
.message-action-overlay.open { opacity: 1; }
.message-action-sheet {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(199, 216, 242, .2);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  background: #192a42;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
}
.message-action-copy { padding: 10px 11px 12px; display: grid; gap: 4px; }
.message-action-copy strong { color: #f6f9ff; font-size: 17px; }
.message-action-copy span { color: #aebbd0; font-size: 13px; line-height: 1.4; }
.message-action-sheet button {
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #eff5fe;
  background: rgba(255, 255, 255, .055);
  font: 740 15px/1.2 inherit;
  text-align: left;
}
.message-action-sheet button.danger { color: #ffabb7; }
.message-action-sheet button.cancel { margin-top: 4px; color: #c9d4e4; text-align: center; }
.message-action-sheet .primary-button { margin: 0 4px; min-height: 46px; text-align: center; }
a.phone-link { cursor: pointer; }

/* Office workspaces scroll vertically only. */
html,
body,
.app,
.content,
.page,
.chat-list,
.mail-list,
.digest,
.mail-detail-shell,
.thread-panel #modalContent {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.content { overscroll-behavior-x: none; }
.page { min-width: 0; }
.filter-row {
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  overflow: visible;
}
.filter-row.label-filters { margin-top: -9px; }
.filter-chip {
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  white-space: normal;
  line-height: 1.2;
}
/* Четыре кнопки в трёх колонках означали, что «Обновить» всегда переносилась на
   отдельную строку и висела там одна. Третья колонка теперь по содержимому: в неё
   становится компактная иконка обновления — в один ряд с «Разобрать» и «Прочитать всё». */
.mail-actions {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  overflow: visible;
}
.mail-actions .mail-action:first-child { grid-column: 1 / -1; }
.mail-action {
  min-width: 0;
  width: 100%;
  padding-inline: 8px;
  white-space: normal;
}
.chat-row,
.mail-row,
.chat-open,
.chat-main,
.mail-main,
.mail-top,
.chat-top { min-width: 0; max-width: 100%; }
.chat-row,
.mail-row { overflow: hidden; }
.chat-preview,
.mail-preview {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.mail-sender,
.mail-subject,
.chat-name { max-width: 100%; }
.mail-time,
.chat-side { min-width: 0; }
.digest,
.digest-item,
.digest-overview,
.mail-detail-body { overflow-wrap: anywhere; word-break: break-word; }
.attachment-tray,
.thread-attachment-tray {
  flex-wrap: wrap;
  overflow-x: hidden;
  flex-shrink: 0;
}
.attachment-chip,
.thread-attachment-card { max-width: 100%; flex: 1 1 180px; }
.mail-list { position: relative; transition: opacity .16s ease; }
.mail-list.mail-refreshing { opacity: .64; }
.mail-list.mail-refreshing::before {
  content: var(--i18n-mail-refreshing, "Refreshing");
  position: sticky;
  z-index: 3;
  top: 0;
  width: max-content;
  margin: 0 auto -30px;
  padding: 5px 9px;
  border: 1px solid rgba(85,242,211,.22);
  border-radius: 6px;
  display: block;
  color: #d8fff7;
  background: rgba(17,40,58,.92);
  font-size: 12px;
  font-weight: 740;
}
.mail-loading-state {
  min-height: 220px;
  padding: 34px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  color: #93a5bc;
  text-align: center;
}
.mail-loading-state strong {
  color: #f2f7fd;
  font-size: 17px;
}
.mail-loading-state p {
  max-width: 320px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.mail-loading-pulse {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(85, 242, 211, .2);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: mail-refresh-spin .8s linear infinite;
}
.mail-pagination {
  min-height: 74px;
  margin: 8px 0 4px;
  padding: 12px 13px;
  border: 1px solid rgba(196, 214, 241, .18);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: #aebbd0;
  background: rgba(24, 39, 61, .72);
  font-size: 13px;
}
.mail-pagination strong { color: #f6f9ff; }
.mail-pagination .secondary-button {
  min-height: 42px;
  flex: 0 0 auto;
  padding-inline: 16px;
}
.mail-pagination-complete {
  color: #72d7c4;
  font-weight: 720;
}

/* Telegram-like message replies and actions. */
.thread-reply-quote {
  min-width: 0;
  margin: 1px 0 2px;
  padding: 7px 9px;
  border-left: 3px solid #63e9d0;
  border-radius: 4px;
  display: grid;
  gap: 2px;
  color: #dce7f6;
  background: rgba(8,22,36,.28);
}
.thread-reply-quote strong { color: #76f1d9; font-size: 12px; line-height: 1.25; }
.thread-reply-quote span { overflow: hidden; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.thread-message.has-visual-media .thread-reply-quote { margin: 8px 9px 4px; }
.thread-reply-preview {
  min-height: 54px;
  margin: 6px 0 0;
  padding: 7px 5px 7px 11px;
  border-left: 3px solid var(--mint);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eaf2fc;
  background: #1c3049;
  animation: thread-reply-in .18s ease both;
}
.thread-reply-preview-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.thread-reply-preview-copy strong { color: var(--mint); font-size: 13px; }
.thread-reply-preview-copy span { overflow: hidden; color: #c5d0df; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.thread-reply-preview button { width: 38px; height: 38px; border: 0; display: grid; place-items: center; color: #9eadc2; background: transparent; }
.thread-reply-preview button svg { width: 19px; height: 19px; }
@keyframes thread-reply-in { from { opacity: 0; transform: translateY(7px); } }

.message-action-overlay {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 9px;
  overscroll-behavior: contain;
}
.message-action-overlay.closing { pointer-events: none; }
.message-action-preview {
  width: min(82%, 430px);
  margin-left: auto;
  padding: 10px 12px;
  border: 1px solid rgba(85,242,211,.2);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  color: #f5f9ff;
  background: #25445d;
  box-shadow: 0 16px 44px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}
.message-action-preview strong { color: var(--mint); font-size: 12px; }
/* Раньше превью зажатого сообщения было одной обрезанной строкой — непонятно, что держишь.
   Теперь показываем несколько строк с мягким затуханием у нижнего края. */
.message-action-preview span {
  position: relative;
  max-height: 8.4em;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
}
.message-action-preview.short span { -webkit-mask-image: none; mask-image: none; }
.message-action-sheet {
  opacity: 0;
  transform: translateY(24px) scale(.98);
  transition: opacity .18s ease, transform .2s cubic-bezier(.2,.8,.2,1);
}
.message-action-overlay.open .message-action-preview,
.message-action-overlay.open .message-action-sheet { opacity: 1; transform: none; }
.message-action-overlay.closing .message-action-preview,
.message-action-overlay.closing .message-action-sheet { opacity: 0; transform: translateY(16px) scale(.985); }
.message-action-sheet.switching { opacity: 0 !important; transform: scale(.97) !important; }
.message-action-sheet button:not(.cancel) { display: flex; align-items: center; gap: 11px; }
.message-action-sheet button svg { width: 21px; height: 21px; flex: 0 0 auto; }

@media (max-width: 430px) {
  .mail-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .mail-action:first-child { grid-column: 1 / -1; }
  /* На узком экране у «Обновить» остаётся только иконка: подпись съедала ширину
     соседних кнопок и снова выталкивала её на новую строку. */
  .mail-action.refresh span { display: none; }
  .mail-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; }
  .mail-time { max-width: 54px; text-align: right; }
}

@media (max-width: 430px) {
  .content { padding-inline: 16px; }
  .welcome-row { align-items: center; }
  .welcome-title { font-size: 27px; }
  .summary-strip,
  .home-calendar { margin-inline: -16px; padding-inline: 16px; }
  .week-strip { margin-inline: -16px; padding-inline: 16px; }
  .view-toolbar { flex-wrap: wrap; }
  .segmented { width: calc(100% - 86px); }
  .calendar-nav button { width: 38px; height: 38px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions > * { min-width: calc(50% - 4px); }
}

@media (max-width: 360px) {
  .brand-mark { width: 43px; height: 43px; }
  .page-title { max-width: 50vw; font-size: 22px; }
  .welcome-row { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .calendar-nav { margin-left: auto; }
  .nav-label { font-size: 9.5px; }
}

/* Full-screen Telegram-style conversation. */
html.thread-open .app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 899;
  pointer-events: none;
  background: #192a42;
}
.thread-panel {
  align-items: stretch;
  background: #102039;
}
.thread-panel .modal-backdrop,
.thread-panel .modal-handle { display: none; }
.thread-panel .modal-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #192a42;
  box-shadow: none;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,.78,.2,1);
}
.thread-panel.open .modal-panel { transform: translateX(0); }
.thread-panel #modalContent,
html.keyboard-open .thread-panel #modalContent { height: 100%; }
html.keyboard-open .thread-panel .modal-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.thread-head {
  min-height: 58px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid rgba(190, 211, 239, .14);
}
.thread-back {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  color: #dce8f7;
  background: transparent;
}
.thread-back svg { width: 27px; height: 27px; }
.thread-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #10212a;
  background: linear-gradient(140deg, var(--mint), #a8f0b8);
  font-size: 15px;
  font-weight: 820;
}
.thread-head-copy { min-width: 0; display: grid; gap: 2px; }
.thread-head-copy strong { overflow: hidden; color: #fff; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.thread-head-copy span { color: #aab9cd; font-size: 12px; }
.thread-panel .thread-messages {
  margin: 0 -12px;
  padding-inline: 14px;
  border-radius: 0;
}
.thread-panel .thread-composer { margin-inline: 0; }

/* In-app photo viewer keeps the user inside the conversation. */

.thread-media-viewer {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: #fff;
  background: #04080e;
  opacity: 0;
  transform: scale(.985);
  transition: opacity .2s ease, transform .2s ease;
}
.thread-media-viewer.open { opacity: 1; transform: scale(1); }
.thread-media-toolbar {
  min-height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  background: rgba(9, 16, 26, .94);
}
.thread-media-toolbar button,
.thread-media-toolbar a {
  width: 44px;
  height: 44px;
  border: 0;
  display: grid;
  place-items: center;
  color: #f3f7fd;
  background: transparent;
  text-decoration: none;
}
.thread-media-toolbar svg { width: 25px; height: 25px; }
.thread-media-toolbar strong { overflow: hidden; font-size: 16px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.thread-media-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: auto; }
.thread-media-stage img { max-width: 100%; max-height: 100%; object-fit: contain; opacity: 0; transition: opacity .18s ease; }
.thread-media-viewer.loaded .thread-media-stage img { opacity: 1; }
.thread-media-viewer-loader { color: #aebbd0; font-size: 14px; }
.thread-media-viewer.loaded .thread-media-viewer-loader { display: none; }
.thread-media-viewer.failed .thread-media-stage img { display: none; }

/* Альбом в просмотрщике: кадры лежат лентой, свайп двигает ленту за пальцем.
   Правила идут после базовых — иначе overflow: auto у сцены съедал бы ленту. */
/* Жесты в просмотрщике полностью свои: листание, щипок и перетаскивание. Браузеру
   их отдавать нельзя — он перехватывает то же движение под прокрутку страницы,
   которой за полноэкранным просмотром всё равно нет. */
.thread-media-viewer .thread-media-stage { overflow: hidden; touch-action: none; place-items: stretch; }
/* Приближённый кадр не должен обрезаться отступом слайда. */
.thread-media-viewer.zoomed .thread-media-slide { padding: 0; }
.thread-media-slide img { transform-origin: center center; will-change: transform; }
.thread-media-viewer .thread-media-stage > * { grid-area: 1 / 1; }
.thread-media-viewer .thread-media-viewer-loader { align-self: center; justify-self: center; }
.thread-media-track { display: flex; width: 100%; height: 100%; will-change: transform; }
.thread-media-slide { flex: 0 0 100%; min-width: 0; display: grid; place-items: center; padding: 8px; box-sizing: border-box; }
.thread-media-slide img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.thread-media-dots {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1;
  display: flex;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 99px;
  background: rgba(6, 14, 26, .58);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}
.thread-media-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .34); transition: background .2s ease, width .2s ease; }
.thread-media-dots i.active { width: 18px; border-radius: 99px; background: #fff; }
.mail-pdf-stage { width: 100%; height: 100%; display: block; overflow: auto; padding: 10px; background: #202834; }
.mail-pdf-stage .mail-document-loader { display: block; padding: 26px 12px; color: #aebbd0; font-size: 14px; text-align: center; }
.mail-pdf-page { width: 100%; height: auto; display: block; margin: 0 auto 10px; border-radius: 4px; background: #fff; box-shadow: 0 6px 22px rgba(0,0,0,.3); }
.mail-media-stage { display:grid; place-items:center; padding:24px; }
.mail-media-stage audio,
.mail-media-stage video { width:min(100%,760px); max-height:calc(100dvh - 110px); }
.mail-document-stage { display:block; overflow:auto; padding:24px; background:#f7f9fc; color:#162131; }
.mail-document-stage pre { width:min(100%,880px); margin:0 auto; color:inherit; font:16px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; white-space:pre-wrap; overflow-wrap:anywhere; }
.mail-document-loader { display:grid; min-height:50vh; place-items:center; color:#5e6d80; font-weight:700; }

/* Calendar events are direct, editable controls. */
.agenda-event.editable {
  width: 100%;
  grid-template-columns: 62px 3px minmax(0, 1fr) 24px;
  align-items: center;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.agenda-event.editable:active { filter: brightness(1.1); transform: scale(.992); }
.agenda-event-open { width: 21px; height: 21px; color: #8191a8; }
.event-all-day {
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid rgba(191, 211, 238, .2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #eaf1fb;
  background: rgba(31, 47, 72, .72);
  font-size: 15px;
  font-weight: 700;
}
.event-all-day input { width: 20px; height: 20px; accent-color: var(--mint); }
.event-reminder-field { transition: opacity .18s ease; }
.event-reminder-field.disabled { opacity: .5; }
.event-smart-timing {
  min-height: 38px;
  margin: -4px 0 0;
  padding: 8px 11px;
  border: 1px solid rgba(79, 238, 210, .26);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #bdf8e9;
  background: rgba(32, 125, 111, .16);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.event-smart-timing.hidden { display: none; }
.event-smart-timing svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--mint); }
.event-timezone-note { margin: -3px 0 2px; color: #9dacbf; font-size: 12px; line-height: 1.45; }
.event-delete { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.event-delete svg { width: 18px; height: 18px; }
.calendar-push-strip { margin: -1px 0 14px; }

@media (max-width: 420px) {
  .thread-panel .modal-panel { padding-inline: 10px; }
  .thread-panel .thread-messages { margin-inline: -10px; padding-inline: 11px; }
  .thread-head { grid-template-columns: 38px 40px minmax(0, 1fr); gap: 7px; }
  .thread-back { width: 38px; }
  .thread-avatar { width: 40px; height: 40px; }
  .agenda-event.editable { grid-template-columns: 56px 3px minmax(0, 1fr) 20px; }
  .modal-head-actions { gap: 5px; }
  .modal-head-action { width: 36px; height: 36px; }
  .modal-head-action.event-add-top { width: auto; min-width: 104px; }
  .event-modal-actions { align-items: stretch; }
}

/* Annual planning and a more legible primary navigation. */
.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.year-month {
  min-width: 0;
  min-height: 92px;
  padding: 12px 9px;
  border: 1px solid rgba(190, 210, 239, .16);
  border-radius: 8px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 7px;
  color: #f4f8ff;
  background: #1c2b43;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.year-month:active { transform: scale(.975); }
.year-month.current {
  border-color: rgba(85, 242, 211, .48);
  background: #203b4b;
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .08);
}
.year-month.has-events { border-color: rgba(110, 182, 255, .28); }
.year-month > span {
  overflow: hidden;
  max-width: 100%;
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.year-month > strong { color: #aebbd0; font-size: 11px; font-weight: 680; }
.year-month > i { min-height: 5px; display: flex; gap: 4px; }
.year-month > i b { width: 5px; height: 5px; border-radius: 50%; background: #6eb6ff; }
.year-month > i b:nth-child(2) { background: var(--amber); }
.year-month > i b:nth-child(3) { background: var(--mint); }

.segmented { width: min(100%, 360px); }
.calendar-segmented {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.bottom-nav {
  left: 14px;
  right: 14px;
  bottom: max(10px, env(safe-area-inset-bottom));
  height: 88px;
  padding: 8px 6px;
  grid-template-columns: 1fr 1fr 76px 1fr 1fr;
  border-radius: 29px;
}
.nav-item {
  min-height: 70px;
  padding-inline: 0;
  gap: 5px;
  border-radius: 19px;
}
.nav-icon svg { width: 25px; height: 25px; }
.nav-label { font-size: 12px; line-height: 1.08; font-weight: 760; letter-spacing: 0; }
.bot-button {
  width: 74px;
  height: 74px;
  transform: translateY(-10px);
  border-radius: 22px;
}
.bot-button::before { border-radius: 17px; }
.bot-face { width: 35px; height: 35px; }
.bot-face svg { width: 24px; height: 24px; }
.content {
  height: calc(var(--app-size) - var(--office-topbar-height) - 110px);
  padding-bottom: 34px;
}

@media (min-width: 760px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(660px, calc(100% - 28px));
    max-width: 660px;
    transform: translateX(-50%);
  }
}

@media (max-width: 430px) {
  .view-toolbar .segmented { width: calc(100% - 86px); }
  .segment { padding-inline: 7px; font-size: 13px; }
  .bottom-nav { left: 10px; right: 10px; }
  .nav-label { font-size: 11.5px; }
}

@media (max-width: 370px) {
  .year-grid { gap: 6px; }
  .year-month { min-height: 84px; padding-inline: 7px; }
  .year-month > span { font-size: 13px; }
  .bottom-nav {
    left: 7px;
    right: 7px;
    height: 84px;
    grid-template-columns: 1fr 1fr 68px 1fr 1fr;
  }
  .nav-icon svg { width: 23px; height: 23px; }
  .nav-label { font-size: 10.5px; }
  .bot-button { width: 68px; height: 68px; }
}

.mail-detail-actions > * { min-width: 0; }

/* Unified mailbox workspace */
.mailbox-hub {
  margin: 0 0 13px;
  padding: 14px;
  border: 1px solid rgba(85,242,211,.19);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(31,54,73,.78), rgba(22,31,52,.92));
  box-shadow: 0 16px 34px rgba(1,8,18,.18);
}
/* Отозванный/протухший Google-токен: почта больше не опрашивает Gmail (circuit breaker),
   поэтому вместо тихой пустоты или вечного «Обновляю» — явный баннер с кнопкой действия. */
.mail-reauth-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 13px;
  padding: 14px;
  border: 1px solid rgba(244,203,115,.32);
  border-radius: 8px;
  background: rgba(244,203,115,.08);
}
.mail-reauth-copy { min-width: 0; }
.mail-reauth-copy strong { display: block; color: var(--amber); font-size: 13px; }
.mail-reauth-copy span { display: block; margin-top: 3px; color: #d8c9a3; font-size: 11px; line-height: 1.4; }
.mail-reauth-banner .primary-button { flex: 0 0 auto; min-height: 38px; padding: 0 16px; font-size: 13px; }
.mailbox-hub-head,
.mail-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mailbox-hub-head > span { min-width: 0; display: grid; gap: 2px; }
.mailbox-hub-head small {
  color: #91a1b8;
  font-size: 11px;
  font-weight: 760;
}
.mailbox-hub-head strong {
  overflow: hidden;
  color: #f4f8ff;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox-add,
.mail-filter-button {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(85,242,211,.28);
  border-radius: 8px;
  color: #09202a;
  background: var(--mint);
  cursor: pointer;
}
.mailbox-add svg,
.mail-filter-button svg { width: 21px; height: 21px; }
.mailbox-rail {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scrollbar-width: none;
}
.mailbox-rail::-webkit-scrollbar { display: none; }
.mailbox-pill {
  min-width: 138px;
  max-width: 220px;
  min-height: 52px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 7px;
  color: #b8c4d5;
  background: rgba(7,17,32,.44);
  text-align: left;
  cursor: pointer;
}
.mailbox-pill.active {
  border-color: rgba(85,242,211,.48);
  color: #f6fbff;
  background: rgba(85,242,211,.1);
  box-shadow: inset 0 0 0 1px rgba(85,242,211,.08);
}
.mailbox-pill-logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #071721;
  background: #f2f5fb;
  font-size: 12px;
  font-weight: 850;
}
.mailbox-pill-logo img { width: 21px; height: 21px; object-fit: contain; }
.mailbox-pill.all .mailbox-pill-logo { color: #09202a; background: var(--mint); }
.mailbox-pill > span:last-child { min-width: 0; display: grid; gap: 2px; }
.mailbox-pill strong,
.mailbox-pill small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox-pill strong { font-size: 12px; }
.mailbox-pill small { color: #8594aa; font-size: 10px; }
.mail-command-bar {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: start;
  gap: 8px;
}
.mail-search-wrap { min-width: 0; position: relative; z-index: 8; }
.mail-search-field {
  min-width: 0;
  min-height: 44px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(18,29,49,.72);
}
.mail-search-field:focus-within { border-color: rgba(85,242,211,.42); }
.mail-search-field svg { width: 20px; height: 20px; flex: 0 0 auto; color: #8392a9; }
.mail-search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #f4f7fc;
  background: transparent;
  font: inherit;
  font-size: 14px;
}
.mail-search-field input::-webkit-search-cancel-button { display: none; }
.mail-search-field input::placeholder { color: #8290a5; }
.mail-search-clear {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #b9c7d8;
  background: rgba(255,255,255,.075);
}
.mail-search-clear svg { width: 16px; height: 16px; }
.mail-search-clear:active { color: #10212a; background: var(--mint); }
.mail-sender-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(360px, 52vh);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(166,194,230,.22);
  border-radius: 8px;
  background: #152238;
  box-shadow: 0 18px 42px rgba(2,8,18,.48);
}
.mail-sender-suggestion {
  width: 100%;
  min-width: 0;
  min-height: 51px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  color: #f2f7ff;
  background: transparent;
  touch-action: pan-y;
  text-align: left;
}
.mail-sender-suggestion:active,
.mail-sender-suggestion:hover { background: rgba(105,233,211,.09); }
.mail-sender-suggestion > span { min-width: 0; display: grid; gap: 2px; }
.mail-sender-suggestion strong,
.mail-sender-suggestion small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-sender-suggestion strong { font-size: 13px; }
.mail-sender-suggestion small { color: #91a0b6; font-size: 10px; }
.mail-sender-suggestion em {
  min-width: 34px;
  padding: 5px 7px;
  border-radius: 6px;
  color: #b8fff1;
  background: rgba(85,242,211,.1);
  font-size: 10px;
  font-style: normal;
  font-weight: 780;
  text-align: center;
}
.mail-filter-button {
  color: #b8c5d8;
  border-color: var(--line-strong);
  background: rgba(18,29,49,.72);
}
.mail-filter-button.active { color: #07202a; border-color: var(--mint); background: var(--mint); }
.mail-filter-button > span {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border: 2px solid #0d1627;
  border-radius: 9px;
  color: #fff;
  background: #ff7185;
  font-size: 9px;
  font-weight: 850;
}
.mail-filter-panel {
  margin: -2px 0 12px;
  padding: 13px;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(176,200,239,.15);
  border-radius: 8px;
  background: rgba(18,29,49,.82);
  animation: mail-filter-in .18s ease both;
}
@keyframes mail-filter-in { from { opacity: 0; transform: translateY(-5px); } }
.mail-filter-section { display: grid; gap: 7px; }
.mail-filter-section > strong { color: #9cabc0; font-size: 11px; }
.mail-filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.mail-filter-options button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 7px;
  color: #afbdd0;
  background: rgba(255,255,255,.025);
  font-size: 11px;
  font-weight: 720;
}
.mail-filter-options button.active {
  color: #09202a;
  border-color: var(--mint);
  background: var(--mint);
}
.mail-overview {
  margin: 0 0 11px;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 6px;
}
.mail-overview-stat {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 8px 7px;
  display: grid;
  align-content: center;
  gap: 2px;
  border-top: 1px solid rgba(176,200,239,.13);
  border-bottom: 1px solid rgba(176,200,239,.13);
  border-left: 0;
  border-right: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}
.mail-overview-stat:disabled { opacity: 1; }
.mail-overview-stat.interactive { cursor: pointer; }
.mail-overview-stat.interactive:active { border-color: rgba(85,242,211,.45); background: rgba(85,242,211,.06); }
.mail-overview-stat.active {
  border-color: rgba(85,242,211,.34);
  color: var(--mint);
  background: rgba(85,242,211,.065);
  box-shadow: inset 0 -2px 0 var(--mint);
}
.mail-overview-stat.active strong,
.mail-overview-stat.active span { color: var(--mint); }
.mail-overview-stat strong { color: #f5f8fd; font-size: 15px; }
.mail-overview-stat span { overflow: hidden; color: #8493a9; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.map-choice-list { display: grid; gap: 10px; padding: 8px 0 calc(18px + env(safe-area-inset-bottom)); }
.map-choice {
  min-height: 68px;
  padding: 11px 14px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 22px;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(159,181,220,.2);
  border-radius: 8px;
  background: rgba(31,48,74,.78);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.map-choice:active { transform: scale(.985); background: rgba(41,62,91,.94); }
.map-choice > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.map-choice strong { font-size: 17px; }
.map-choice small { color: var(--muted); font-size: 13px; }
.map-choice > svg { width: 20px; color: var(--muted); }
.map-choice-icon {
  width: 44px;
  height: 44px;
  display: block;
  border: 1px solid rgba(15,35,54,.08);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 5px 14px rgba(2,10,22,.18);
}

.team-compact-button {
  min-width: 70px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(85,242,211,.24);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #dffff8;
  background: rgba(85,242,211,.07);
  font-weight: 800;
}
.team-compact-button svg { width: 20px; height: 20px; }
.office-task-assignee { padding: 3px 6px; border-radius: 5px; color: #10242e; background: #a7f4d5; font-size: 9px; font-weight: 820; }
.office-task-assignee.assigned-by { color: #f8f3ff; background: #665d8d; }
.team-panel-content, .team-section { display: grid; gap: 12px; }
.team-own-id { padding: 14px; border: 1px solid rgba(85,242,211,.24); border-radius: 8px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; background: #1b3046; }
.team-own-id span { grid-column: 1/-1; color: #9eb0c7; font-size: 12px; }
.team-own-id strong { align-self: center; color: var(--mint); letter-spacing: .04em; }
.team-own-id button { min-height: 40px; }
.team-invite-form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
.team-invite-form .field { margin: 0; }
.team-invite-form button { min-height: 50px; }
.team-section h3 { margin: 8px 0 0; font-size: 17px; }
.team-member, .team-request { min-height: 64px; padding: 10px; border: 1px solid rgba(176,200,239,.14); border-radius: 8px; display: flex; align-items: center; gap: 10px; background: #1d2c44; }
.team-member > span:nth-child(2), .team-request > span:first-child { min-width: 0; flex: 1; display: grid; gap: 3px; }
.team-member small, .team-request small { color: #96a7be; font-size: 11px; }
.team-member-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #0b2730; background: var(--mint); font-weight: 850; }
.team-member .icon-button { width: 42px; height: 42px; color: #ff9aaa; }
.team-member .icon-button svg { width: 19px; height: 19px; }
.team-request-actions { display: flex; gap: 6px; }
.team-request-actions button { min-height: 38px; padding: 0 10px; }
.team-empty, .team-pending-copy { margin: 0; color: #9eacc0; line-height: 1.45; }
.task-owner-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  border: 0;
}
.task-owner-fields:disabled { opacity: .74; }
.task-owner-fields:disabled input,
.task-owner-fields:disabled textarea { color: #d7e1ef; -webkit-text-fill-color: #d7e1ef; }
.task-participants {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}
.task-participants > span {
  min-width: 0;
  padding: 10px 11px;
  display: grid;
  gap: 3px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  background: #1c3048;
}
.task-participants small { color: #8fa0b7; font-size: 10px; }
.task-participants strong { overflow: hidden; color: #edf6ff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.task-readonly-note {
  margin: 0 0 14px;
  padding: 11px 12px;
  border-left: 3px solid var(--mint);
  color: #bdd0e4;
  background: rgba(85,242,211,.07);
  font-size: 12px;
  line-height: 1.45;
}
.task-assignee-selector { min-width: 0; margin: 0; padding: 0; border: 0; }
.task-assignee-selector legend { margin-bottom: 8px; color: #9fadc0; font-size: 13px; font-weight: 760; }
.task-assignee-selector > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.task-assignee-selector label {
  min-width: 0;
  min-height: 52px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 18px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(176,200,239,.16);
  border-radius: 8px;
  background: #1b2c44;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.task-assignee-selector label:active { transform: scale(.985); }
.task-assignee-selector label.selected { border-color: rgba(85,242,211,.55); background: rgba(85,242,211,.1); }
.task-assignee-selector input { position: absolute; opacity: 0; pointer-events: none; }
.task-assignee-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #102631; background: #a7f4d5; font-size: 11px; font-weight: 850; }
.task-assignee-name { overflow: hidden; color: #eaf2fc; font-size: 13px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.task-assignee-selector label > svg { width: 18px; opacity: 0; color: var(--mint); transform: scale(.7); transition: opacity .18s ease, transform .18s ease; }
.task-assignee-selector label.selected > svg { opacity: 1; transform: scale(1); }
.task-list-readonly { min-width: 0; }
.task-collaboration { margin-top: 8px; padding: 16px 0 2px; border-top: 1px solid rgba(176,200,239,.13); display: grid; gap: 10px; }
.task-collaboration-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-collaboration-head strong { color: #f4f8ff; font-size: 14px; }
.task-collaboration-head span { color: #8fa0b8; font-size: 11px; }
.task-comments-chat {
  min-height: 92px;
  max-height: 300px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #14263e, #132238);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
  overscroll-behavior: contain;
}
.task-comment-bubble {
  width: fit-content;
  max-width: 86%;
  padding: 9px 11px;
  align-self: flex-start;
  border-radius: 3px 8px 8px 8px;
  color: #edf5ff;
  background: #2c405d;
}
.task-comment-bubble.own { align-self: flex-end; border-radius: 8px 3px 8px 8px; background: #176b66; }
.task-comment-bubble > span { color: #8ff3df; font-size: 10px; font-weight: 790; }
.task-comment-bubble p { margin: 3px 0 4px; font-size: 13px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-comment-bubble time { display: block; color: rgba(223,236,250,.6); font-size: 9px; text-align: right; }
.task-comments-empty { margin: 12px 4px; color: #8192aa; text-align: center; }
.task-comment-upload-tray {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 2px 1px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.task-comment-upload-tray::-webkit-scrollbar { display: none; }
.task-comment-upload-tray.hidden { display: none; }
.task-comment-upload {
  width: min(210px, 76vw);
  min-width: min(210px, 76vw);
  height: 58px;
  padding: 7px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 30px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(176,200,239,.16);
  border-radius: 8px;
  color: #eaf3ff;
  background: rgba(24,43,68,.94);
}
.task-comment-upload.uploading { opacity: .72; }
.task-comment-upload.failed { border-color: rgba(255,139,159,.42); }
.task-comment-upload img,
.task-comment-upload-type {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: #9af3e2;
  background: #102238;
  font-size: 9px;
  font-weight: 820;
}
.task-comment-upload > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.task-comment-upload strong,
.task-comment-upload small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-comment-upload strong { font-size: 11px; }
.task-comment-upload small { color: #91a2b9; font-size: 9px; }
.task-comment-upload button {
  width: 30px;
  height: 30px;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  color: #a9b9cd;
  background: rgba(255,255,255,.045);
}
.task-comment-upload button svg { width: 100%; height: 100%; }
.task-comment-attachment-list { margin-top: 7px; display: grid; gap: 6px; }
.task-comment-attachment {
  min-width: 0;
  width: min(280px, 68vw);
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}
.task-comment-attachment.image {
  display: grid;
  gap: 4px;
}
.task-comment-attachment.image img {
  width: 100%;
  max-height: 220px;
  border-radius: 7px;
  object-fit: cover;
  background: #091422;
}
.task-comment-attachment.image > span {
  max-width: 100%;
  overflow: hidden;
  color: rgba(234,243,255,.74);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-comment-attachment.file {
  min-height: 54px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 20px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(225,239,255,.13);
  border-radius: 8px;
  background: rgba(8,24,40,.28);
}
.task-comment-file-type {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #8ff3df;
  background: rgba(85,242,211,.1);
  font-size: 8px;
  font-weight: 820;
}
.task-comment-file-copy { min-width: 0; display: grid; gap: 2px; }
.task-comment-file-copy strong,
.task-comment-file-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-comment-file-copy strong { font-size: 11px; }
.task-comment-file-copy small { color: rgba(223,236,250,.58); font-size: 9px; }
.task-comment-attachment.file > svg { width: 19px; height: 19px; color: #9eafc5; }
.task-comment-form { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: end; gap: 8px; }
.task-comment-attach {
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 1px solid rgba(85,242,211,.25);
  border-radius: 50%;
  color: #70ead4;
  background: rgba(13,45,59,.72);
  transition: transform .16s ease, background .16s ease;
}
.task-comment-attach:active { transform: scale(.95); background: rgba(31,84,89,.8); }
.task-comment-attach svg { width: 100%; height: 100%; }
.task-comment-form textarea {
  min-height: 48px;
  max-height: 132px;
  padding: 10px 12px;
  resize: none;
  overflow-y: auto;
  border: 1px solid rgba(176,200,239,.19);
  border-radius: 8px;
  color: #f4f8ff;
  background: #1a2c45;
  font-family: inherit;
  font-size: clamp(12.5px, 3.4vw, 14px);
  font-weight: 520;
  line-height: 1.35;
  box-sizing: border-box;
}
.task-comment-form textarea::placeholder {
  color: #9eacc0;
  font-size: clamp(11.5px, 3.15vw, 12.5px);
  line-height: 1.35;
  opacity: 1;
}
.task-comment-form textarea:focus { outline: none; border-color: rgba(85,242,211,.58); box-shadow: 0 0 0 3px rgba(85,242,211,.08); }
.task-comment-send { min-width: 112px; height: 48px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 8px; color: #09242c; background: var(--mint); box-shadow: 0 8px 22px rgba(85,242,211,.18); font-size: 12px; font-weight: 820; transition: transform .16s ease, opacity .16s ease; }
.task-comment-send:active { transform: scale(.975); }
.task-comment-send svg { width: 18px; height: 18px; }
.task-panel .modal-panel.task-comment-editor-open {
  overscroll-behavior: contain;
  scroll-padding-bottom: 78px;
}
.task-panel .modal-panel.task-comment-editor-open .task-comment-form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -4px;
  padding: 10px 4px;
  border-top: 1px solid rgba(176,200,239,.12);
  background: #14243a;
  box-shadow: 0 -14px 24px rgba(8,18,31,.22), 0 28px 0 #14243a;
}
html.keyboard-open.task-comment-focused .task-panel .modal-panel {
  height: calc(var(--visible-height) - 8px);
  max-height: calc(var(--visible-height) - 8px);
}
.task-activity-details { color: #aab8ca; font-size: 12px; }
.task-activity-details summary { cursor: pointer; font-weight: 760; }
.task-activity { margin-top: 8px; display: grid; gap: 5px; }
.task-activity > span { padding: 7px 9px; border-radius: 7px; color: #bdc9da; background: rgba(255,255,255,.04); font-size: 11px; }
.task-activity time { margin-left: 6px; color: #7f90a9; }
@media (max-width: 430px) {
  .task-assignee-selector > div,
  .task-participants { grid-template-columns: 1fr; }
  .task-comment-send { width: 48px; min-width: 48px; padding: 0; }
  .task-comment-send span { display: none; }
}
@media (max-width: 360px) {
  .task-comment-form { grid-template-columns: 44px minmax(0,1fr) 44px; gap: 6px; }
  .task-comment-attach,
  .task-comment-send { width: 44px; min-width: 44px; height: 44px; }
  .task-comment-form textarea { min-height: 44px; padding: 9px 10px; }
}
.mail-row.resolved-mail { opacity: .62; }
.mail-row.resolved-mail .mail-subject { text-decoration: line-through; text-decoration-color: rgba(176,200,239,.45); }
.mail-row-resolved,
.mail-resolved {
  color: #a8f3de;
  font-size: 9px;
  font-weight: 780;
  white-space: nowrap;
}
.mail-state-button {
  min-width: 0;
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid rgba(176,200,239,.16);
  border-radius: 6px;
  color: #c8d4e5;
  background: rgba(11,22,39,.72);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.15;
  white-space: normal;
}
.mail-state-button.active {
  border-color: rgba(85,242,211,.4);
  color: #bdf9ed;
  background: rgba(85,242,211,.1);
}
.mail-state-button.muted-active {
  border-color: rgba(176,200,239,.1);
  color: #8998ad;
}
.digest-now { margin-top: 12px; display: grid; gap: 6px; }
.digest-now-title {
  color: #91a1b8;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.digest-now-item {
  min-width: 0;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border: 1px solid rgba(244,203,115,.22);
  border-radius: 7px;
  background: rgba(244,203,115,.045);
  cursor: pointer;
}
.digest-now-item > span { min-width: 0; display: grid; gap: 3px; }
.digest-now-item strong { overflow: hidden; color: #f2f6fc; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.digest-now-item small { overflow: hidden; color: #8e9db2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.digest-resolve {
  min-height: 31px;
  padding: 0 9px;
  flex: 0 0 auto;
  border: 1px solid rgba(85,242,211,.25);
  border-radius: 6px;
  color: #aef6e7;
  background: rgba(85,242,211,.06);
  font-size: 10px;
  font-weight: 760;
}
.mail-actions { align-items: center; }
.mail-action { min-height: 39px; font-size: 12px; }
.mail-action.icon-only { width: 39px; padding: 0; display: grid; place-items: center; }
.mail-action.icon-only svg { width: 19px; height: 19px; }
/* «Обновить» — служебное действие, а не равноправная кнопка рядом с «Написать»:
   раньше она занимала целую строку и спорила по весу с основными действиями.
   Делаем её компактной иконкой с подписью и уводим в конец ряда. */
.mail-action.refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 40px;
  padding: 0 11px;
  border-color: transparent;
  color: var(--ink-mute);
  background: transparent;
}
.mail-action.refresh:hover { color: var(--ink-soft); background: rgba(255,255,255,.04); }
.mail-action.refresh svg { width: 15px; height: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .mail-action.refresh.syncing svg { animation: mail-refresh-spin 1s linear infinite; }
}
@keyframes mail-refresh-spin { to { transform: rotate(360deg); } }
.mail-action.refresh.syncing {
  border-color: rgba(85,242,211,.28);
  color: #bdfbf0;
  background: rgba(85,242,211,.07);
}
.mail-action.refresh.syncing svg { animation: mail-refresh-spin .8s linear infinite; }
@keyframes mail-refresh-spin { to { transform: rotate(360deg); } }
.mail-list-head { margin: 16px 0 9px; }
.mail-list-head > span { min-width: 0; display: grid; gap: 2px; }
.mail-list-head strong { color: #f3f7fd; font-size: 16px; }
.mail-list-head small { color: #8291a7; font-size: 10px; }
.mail-group-toggle {
  flex: 0 0 auto;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 7px;
  background: rgba(8,17,31,.45);
}
.mail-group-toggle button {
  min-height: 31px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  color: #8392a8;
  background: transparent;
  font-size: 10px;
  font-weight: 740;
}
.mail-group-toggle button.active { color: #f4f8fd; background: #283c58; }
.mail-account-tag {
  max-width: 160px;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #88a1bd;
  font-size: 10px;
}
.mail-account-tag::before { content: ""; width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); }
.mail-sender-folder {
  overflow: hidden;
  border-top: 1px solid rgba(176,200,239,.13);
  border-bottom: 1px solid rgba(176,200,239,.13);
}
.mail-sender-folder + .mail-sender-folder { border-top: 0; }
.mail-sender-folder-button {
  width: 100%;
  min-height: 72px;
  padding: 11px 3px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  color: #f1f5fb;
  background: transparent;
  text-align: left;
}
.mail-sender-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #071721;
  background: linear-gradient(135deg,#70ead5,#99bcff);
  font-weight: 850;
}
.mail-sender-folder-copy { min-width: 0; display: grid; gap: 3px; }
.mail-sender-folder-copy strong,
.mail-sender-folder-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-sender-folder-copy strong { font-size: 14px; }
.mail-sender-folder-copy span { color: #8e9db2; font-size: 11px; }
.mail-sender-folder-side { display: grid; justify-items: end; gap: 5px; }
.mail-sender-count { color: #91a0b5; font-size: 10px; }
.mail-sender-unread { min-width: 23px; height: 23px; padding: 0 6px; display: grid; place-items: center; border-radius: 7px; color: #08202a; background: var(--mint); font-size: 10px; font-weight: 850; }
.mail-sender-folder-messages { display: none; padding: 0 0 8px 13px; }
.mail-sender-folder.open .mail-sender-folder-messages { display: grid; gap: 6px; animation: mail-filter-in .18s ease both; }
.mail-sender-folder-messages .mail-row { border: 1px solid rgba(176,200,239,.11); border-radius: 7px; }
.mail-row .mail-check { border-radius: 8px; }
.mail-row-account {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8295ae;
  font-size: 10px;
}
.mail-row-account::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #6eb6ff; }
.mail-account-management { display: grid; gap: 8px; margin: 12px 0; }
.modal-section-label { margin: 18px 0 8px; color: #9dacbf; font-size: 12px; font-weight: 760; }
.mail-account-management-row {
  min-width: 0;
  padding: 11px;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.mail-account-management-row > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.mail-account-management-row strong,
.mail-account-management-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-account-management-row strong { font-size: 13px; }
.mail-account-management-row small { color: #8796ac; font-size: 10px; }
.mail-account-remove {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,125,142,.25);
  border-radius: 7px;
  color: #ff96a4;
  background: rgba(255,125,142,.06);
}
.mail-account-remove svg { width: 18px; height: 18px; }

@media (max-width: 390px) {
  .mail-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mail-list-head { align-items: flex-end; }
  .mail-list-head strong { font-size: 15px; }
  .mail-group-toggle button { padding-inline: 7px; font-size: 9px; }
}

@media (min-width: 900px) {
  .page[data-page="mail"] {
    width: min(100%, 1040px);
    margin-inline: auto;
  }
}

/* Match the calm, living assistant mark used in the main Adjutant app. */
.bot-button::before { display: none; }
.bot-button .bot-face {
  width: 46px;
  height: 46px;
  overflow: visible;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
}
.bot-button .bot-face svg { width: 46px; height: 46px; }
.bot-button .bot-ring-outer {
  transform-origin: 16px 16px;
  animation: office-bot-ring 18s linear infinite;
}
.bot-button .bot-core {
  transform-origin: center;
  animation: office-bot-float 2.6s ease-in-out infinite;
}
.bot-button .bot-eye {
  transform-origin: center;
  animation: office-bot-blink 5s ease-in-out infinite;
}
@keyframes office-bot-ring {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes office-bot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-.6px); }
}
@keyframes office-bot-blink {
  0%, 40%, 46%, 100% { transform: scaleY(1); }
  43% { transform: scaleY(.1); }
}
@media (max-width: 370px) {
  .bot-button .bot-face,
  .bot-button .bot-face svg { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .bot-button .bot-ring-outer,
  .bot-button .bot-core,
  .bot-button .bot-eye { animation: none; }
}

/* The home focus is an actionable task, not a decorative progress card. */
.focus-footer {
  margin-top: 8px;
  align-items: center;
  gap: 10px;
}
.focus-state {
  min-width: 0;
  color: #aebbd0;
  font-size: 12px;
  font-weight: 720;
}
.focus-state::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(110,182,255,.42);
}
.focus-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.focus-complete,
.focus-open {
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
}
.focus-complete:active,
.focus-open:active { transform: scale(.97); }
.focus-complete {
  width: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(85,242,211,.3);
  color: var(--mint);
  background: rgba(85,242,211,.07);
}
.focus-complete svg { width: 19px; height: 19px; }
.focus-open {
  width: auto;
  min-width: 104px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #09212a;
  font-size: 13px;
  font-weight: 820;
}
.focus-open svg { width: 17px; height: 17px; }

.task-panel .modal-panel { background: #14243a; }
.task-detail-head {
  margin: 4px 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.task-panel .office-task-lifecycle {
  margin: -7px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(176,200,239,.13);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  font-size: 12px;
}
.home-summary-copy .office-task-lifecycle { margin-top: 1px; }
.task-status-chip,
.task-priority-chip,
.task-kind-chip,
.task-source-chip {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(176,200,239,.16);
  border-radius: 7px;
  color: #bdcadc;
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 740;
}
.task-source-chip {
  border-color: rgba(244,203,115,.25);
  color: #f4d995;
  background: rgba(244,203,115,.075);
  font-size: 12px;
}
.task-status-chip {
  border-color: rgba(85,242,211,.25);
  color: #aef8e8;
  background: rgba(85,242,211,.065);
}
.task-kind-chip.kind-meeting {
  border-color: rgba(129,120,255,.3);
  color: #d0cdff;
  background: rgba(129,120,255,.08);
}
.task-kind-chip.kind-task {
  border-color: rgba(110,182,255,.25);
  color: #bfe0ff;
  background: rgba(110,182,255,.07);
}
.task-type-selector {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}
.task-type-selector legend {
  width: 100%;
  margin-bottom: 7px;
  color: #aeb9cc;
  font-size: 12px;
  font-weight: 740;
}
.task-type-selector label {
  position: relative;
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(176,200,239,.14);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  align-items: center;
  gap: 9px;
  color: #aab7ca;
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.task-type-selector label.selected {
  border-color: rgba(85,242,211,.36);
  color: #ecfffb;
  background: rgba(85,242,211,.075);
  box-shadow: inset 0 0 0 1px rgba(85,242,211,.05);
}
.task-type-selector input { position: absolute; opacity: 0; pointer-events: none; }
.task-type-selector svg { width: 25px; height: 25px; color: #82a6cf; }
.task-type-selector label.selected svg { color: var(--mint); }
.task-type-selector label > span { min-width: 0; display: grid; gap: 2px; }
.task-type-selector strong { font-size: 14px; }
.task-type-selector small { overflow: hidden; color: #8292aa; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-status-chip.status-needs_confirmation,
.task-status-chip.status-needs_setup {
  border-color: rgba(255,211,106,.3);
  color: #ffe4a2;
  background: rgba(255,211,106,.07);
}
.task-detail-form .field > textarea[name="title"] {
  min-height: 78px;
  color: #fff;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.35;
  resize: none;
}
.task-deadline-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}
.task-deadline-title {
  color: #aeb9cc;
  font-size: 10px;
  font-weight: 720;
}
.task-all-day-control {
  position: relative;
  min-height: 56px;
  padding: 9px 12px;
  border: 1px solid rgba(176,200,239,.17);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  color: #edf5ff;
  background: rgba(20,32,52,.82);
  cursor: pointer;
}
.task-all-day-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.task-all-day-switch {
  width: 42px;
  height: 24px;
  padding: 3px;
  border: 1px solid rgba(176,200,239,.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  background: rgba(6,14,26,.48);
  transition: border-color .18s ease, background .18s ease;
}
.task-all-day-switch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #91a0b6;
  box-shadow: 0 2px 6px rgba(0,0,0,.24);
  transition: transform .2s cubic-bezier(.2,.8,.2,1), background .18s ease;
}
.task-all-day-control input:checked + .task-all-day-switch {
  border-color: rgba(85,242,211,.55);
  background: rgba(85,242,211,.19);
}
.task-all-day-control input:checked + .task-all-day-switch span {
  background: var(--mint);
  transform: translateX(18px);
}
.task-all-day-control:focus-within {
  border-color: rgba(85,242,211,.45);
  box-shadow: 0 0 0 3px rgba(85,242,211,.07);
}
.task-all-day-copy { min-width: 0; display: grid; gap: 2px; }
.task-all-day-copy strong { color: #f4f8ff; font-size: 14px; line-height: 1.25; }
.task-all-day-copy small { color: #8f9fb6; font-size: 11px; line-height: 1.3; }
.task-deadline-grid {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(116px,.65fr);
  gap: 8px;
  transition: grid-template-columns .2s ease;
}
.task-deadline-grid.is-all-day { grid-template-columns: minmax(0,1fr); }
.task-deadline-grid .field { min-width: 0; }
.task-picker-control {
  position: relative;
  width: 100%;
  min-height: 52px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid rgba(176,200,239,.17);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 22px minmax(0,1fr);
  align-items: center;
  gap: 9px;
  overflow: hidden;
  color: #eef5ff;
  background: rgba(20,32,52,.82);
}
.task-picker-control svg { width: 20px; height: 20px; color: #75dfc8; }
.task-picker-control strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.timeline-row.all-day .timeline-time {
  color: #9adfd1;
  line-height: 1.12;
  white-space: normal;
}
.task-panel .modal-panel.task-completing {
  pointer-events: none;
  animation: task-panel-complete-away .72s cubic-bezier(.22,.72,.24,1) forwards;
}
.task-agent-action {
  padding: 13px 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(176,200,239,.12);
  border-bottom: 1px solid rgba(176,200,239,.12);
}
.task-agent-action > div { min-width: 0; display: grid; gap: 3px; }
.task-agent-action strong { color: #f4f8ff; font-size: 15px; }
.task-agent-action span { color: #93a3ba; font-size: 12px; line-height: 1.4; }
.task-agent-action .primary-button { min-width: 112px; }
.task-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.task-done-button {
  min-height: 48px;
  border: 1px solid rgba(85,242,211,.28);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #c6fbef;
  background: rgba(85,242,211,.07);
  font-size: 15px;
  font-weight: 780;
}
.task-done-button svg { width: 19px; height: 19px; }
.task-delete-button {
  min-height: 40px;
  border: 0;
  color: #ff9dab;
  background: transparent;
  font-size: 13px;
  font-weight: 720;
}

@media (max-width: 380px) {
  .focus-open { min-width: 102px; padding-inline: 11px; }
  .office-task-open { grid-template-columns: 1fr; gap: 5px; }
  .office-task-meta { width: auto; justify-items: start; grid-auto-flow: column; justify-content: start; text-align: left; }
  .task-agent-action { grid-template-columns: 1fr; }
  .task-agent-action .primary-button { width: 100%; }
}

@media (max-width: 370px) {
  .task-picker-control { padding-inline: 9px; gap: 6px; }
  .task-picker-control strong { font-size: 12px; }
}

/* Conversations stay anchored to the viewport; only a message may swipe to reply. */
html,
body,
.app {
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

.sheet,
.sheet-panel,
.conversation.live,
.thread-panel,
.thread-panel .modal-panel,
.thread-panel #modalContent,
.thread-panel .thread-messages {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

.sheet-panel,
.conversation.live,
.thread-panel .thread-messages {
  touch-action: pan-y;
}

.conversation.live > *,
.bubble,
.pending-card,
.pending-actions {
  min-width: 0;
  max-width: 100%;
}

.bubble {
  max-width: min(88%, 100%);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble *,
.pending-card *,
.thread-message *,
.thread-reply-preview * {
  min-width: 0;
  max-width: 100%;
}

.bubble img,
.bubble video,
.bubble canvas,
.bubble iframe,
.bubble table,
.bubble pre {
  max-width: 100%;
}

.bubble pre {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.thread-panel .thread-messages {
  width: auto;
  contain: paint;
}

.thread-message {
  width: fit-content;
  min-width: 0;
  max-width: min(86%, 430px);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.thread-message.out { margin-left: auto; }
.thread-file-list,
.thread-audio,
.thread-audio audio { width: 100%; max-width: 100%; }

.thread-file {
  width: min(260px, 72vw);
  min-width: 0;
  max-width: 100%;
}

.thread-media {
  width: min(340px, 78vw);
  min-width: 0;
  max-width: 100%;
}

/* Home counters are compact filters, with a readable drill-down sheet. */
button.day-tag {
  appearance: none;
  cursor: pointer;
  letter-spacing: 0;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
button.day-tag:active { transform: scale(.97); }
button.day-tag:focus-visible { outline: 2px solid rgba(85, 242, 211, .72); outline-offset: 2px; }

.home-summary-panel .modal-panel { max-height: min(78vh, 680px); }
.home-summary-list { display: grid; gap: 8px; }
.home-summary-row {
  width: 100%;
  min-height: 72px;
  padding: 10px 11px;
  border: 1px solid rgba(176, 200, 239, .17);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  color: #f4f8ff;
  background: rgba(31, 49, 75, .78);
  text-align: left;
  cursor: pointer;
}
.home-summary-row:active { border-color: rgba(85, 242, 211, .42); background: rgba(35, 59, 83, .92); }
.home-summary-row > svg { width: 20px; height: 20px; color: #8fa0b8; }
.home-summary-marker {
  width: 54px;
  min-height: 42px;
  padding: 0 5px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #dce9f7;
  background: rgba(110, 182, 255, .13);
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}
.home-summary-marker.priority-high { color: #f4cb73; background: rgba(244, 203, 115, .12); }
.home-summary-marker.priority-urgent { color: #ff9caa; background: rgba(255, 125, 142, .12); }
.home-summary-marker.meeting { color: #f4cb73; background: rgba(244, 203, 115, .1); }
.home-summary-marker.mail { color: #55f2d3; background: rgba(85, 242, 211, .1); }
.home-summary-copy { min-width: 0; display: grid; gap: 5px; }
.home-summary-copy strong { overflow-wrap: anywhere; font-size: 16px; line-height: 1.3; }
.home-summary-copy small { overflow-wrap: anywhere; color: #aab8ca; font-size: 13px; line-height: 1.4; }
.home-summary-loading {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #b8c5d6;
}
.home-summary-loading span {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(176, 200, 239, .16);
  border-top-color: #55f2d3;
  border-radius: 50%;
  animation: mail-refresh-spin .8s linear infinite;
}
.home-summary-loading strong { font-size: 14px; }

@media (max-width: 360px) {
  .home-summary-row { grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 9px; }
  .home-summary-marker { width: 48px; font-size: 12px; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Премиальный слой оформления. Добавляется поверх базовых правил и намеренно
   идёт последним: ничего не переверстывает, только доводит поверхности, глубину
   и движение до уровня современного мессенджера. Вся моторика — короткая
   (120–260 мс) и на пружинных кривых, чтобы интерфейс ощущался быстрым.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --ease-spring: cubic-bezier(.16, 1, .3, 1);
  --ease-out: cubic-bezier(.22, .75, .25, 1);
  --dur-fast: 130ms;
  --dur-base: 200ms;
  --dur-slow: 280ms;
  --sheen: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,0) 42%);
}

/* Уважаем системную настройку «уменьшить движение». */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* — Тактильный отклик нажатий: всё кликабельное слегка «проседает» — */
.nav-item,
.day-tag,
.task-quick-add,
.mail-action,
.filter-chip,
.segment,
.primary-button,
.secondary-button,
.integration-action,
.home-summary-row,
.mail-attachment-icon-btn,
.pending-actions button,
.mail-zoom-controls button,
.task-filter-bar button {
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-base) ease,
    color var(--dur-base) ease,
    border-color var(--dur-base) ease,
    box-shadow var(--dur-base) ease;
}
.nav-item:active,
.day-tag:active,
.task-quick-add:active,
.mail-action:active,
.filter-chip:active,
.segment:active,
.primary-button:active,
.secondary-button:active,
.integration-action:active,
.home-summary-row:active,
.pending-actions button:active,
.task-filter-bar button:active { transform: scale(.965); }
.mail-attachment-icon-btn:active,
.mail-zoom-controls button:active { transform: scale(.9); }

/* — Нижняя навигация: живой индикатор активной вкладки — */
.nav-item { position: relative; }
.nav-item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mint);
  opacity: 0;
  transform: translateX(-50%) scale(.4);
  transition: opacity var(--dur-base) ease, transform var(--dur-base) var(--ease-spring);
}
.nav-item.active::after { opacity: 1; transform: translateX(-50%) scale(1); }
.nav-item.active .nav-icon svg { animation: nav-pop var(--dur-slow) var(--ease-spring); }
@keyframes nav-pop {
  0% { transform: scale(.86); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.bot-button { transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) ease; }
.bot-button:active { transform: translateY(-10px) scale(.93); }

/* — Карточки и панели: мягкая глубина + едва заметный блик сверху — */
.day-hero,
.mailbox-hub,
.office-setting-group,
.pending-card,
.digest,
.home-calendar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.day-hero::before,
.mailbox-hub::before,
.office-setting-group::before,
.pending-card::before,
.digest::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sheen);
  pointer-events: none;
}

/* — Списки: аккуратное появление элементов вместо резкой отрисовки —
   Только на первом открытии раздела (класс .just-opened). Безусловная анимация
   перезапускалась при каждом переключении вкладки: неактивная страница уходит в
   display: none, и на возврате браузер проигрывает rise-in заново — все карточки
   опять проявлялись из прозрачности. Содержимое при этом не менялось, но глазу
   это читалось как моргание. */
.page.just-opened .office-task-list > *,
.page.just-opened .timeline-row,
.page.just-opened .mail-row,
.page.just-opened .chat-row,
.page.just-opened .home-summary-row,
.page.just-opened .digest-item,
.page.just-opened .digest-now-item {
  animation: rise-in var(--dur-slow) var(--ease-spring) both;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
/* Каскад только для первых элементов — дальше без задержек, чтобы длинные
   списки не «ползли» и прокрутка оставалась мгновенной. */
.office-task-list > *:nth-child(1),
.timeline-row:nth-child(1),
.mail-row:nth-child(1) { animation-delay: 0ms; }
.office-task-list > *:nth-child(2),
.timeline-row:nth-child(2),
.mail-row:nth-child(2) { animation-delay: 22ms; }
.office-task-list > *:nth-child(3),
.timeline-row:nth-child(3),
.mail-row:nth-child(3) { animation-delay: 44ms; }
.office-task-list > *:nth-child(4),
.timeline-row:nth-child(4),
.mail-row:nth-child(4) { animation-delay: 66ms; }
.office-task-list > *:nth-child(5),
.timeline-row:nth-child(5),
.mail-row:nth-child(5) { animation-delay: 88ms; }
.office-task-list > *:nth-child(n+6),
.timeline-row:nth-child(n+6),
.mail-row:nth-child(n+6) { animation-delay: 0ms; }

/* — Пузыри чата: появление «из-под пальца», как в мессенджерах — */
.bubble { animation: bubble-in var(--dur-base) var(--ease-spring) both; }
.bubble.user { transform-origin: bottom right; }
.bubble.agent { transform-origin: bottom left; }
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(9px) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* — Модалки и шторки: пружинный вход — */
.sheet-panel { transition: transform var(--dur-slow) var(--ease-spring); }
.modal-panel { transition: transform var(--dur-slow) var(--ease-spring), opacity var(--dur-base) ease; }
.modal-backdrop, .sheet-backdrop { transition: opacity var(--dur-base) ease; }

/* — Поля ввода: акцентная рамка и мягкое свечение в фокусе — */
.field input,
.field textarea,
.field select,
.composer-input,
.mail-search-field input,
.search-field input {
  transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease, background var(--dur-base) ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus,
.composer-input:focus,
.mail-search-field input:focus,
.search-field input:focus {
  border-color: rgba(85,242,211,.5);
  box-shadow: 0 0 0 3px rgba(85,242,211,.12);
  outline: none;
}

/* — Кнопка отправки/микрофона: заметная, но не крикливая — */
.voice-action.send-mode {
  box-shadow: 0 6px 18px rgba(85,242,211,.28);
}

/* — Скелетоны и загрузка: плавнее, без «мигания» — */
.skeleton::after { animation-duration: 1.1s; }

/* Premium glass layer: blur only fixed, large surfaces to keep iOS scrolling smooth. */
:root {
  --office-glass-surface: rgba(13, 27, 45, .88);
  --office-glass-strong: rgba(16, 32, 52, .965);
  --office-glass-border: rgba(202, 225, 248, .16);
  --office-glass-highlight: rgba(255, 255, 255, .055);
  --office-glass-shadow: 0 22px 58px rgba(2, 9, 20, .34), inset 0 1px 0 var(--office-glass-highlight);
}

.bottom-nav,
.modal-panel,
.sheet-panel {
  border-color: var(--office-glass-border);
  box-shadow: var(--office-glass-shadow);
}

.bottom-nav {
  background:
    linear-gradient(145deg, rgba(255,255,255,.045), transparent 42%),
    var(--office-glass-surface);
}

.modal-panel,
.sheet-panel {
  background:
    linear-gradient(150deg, rgba(255,255,255,.045), transparent 32%),
    var(--office-glass-strong);
}

.office-task-row,
.mail-row,
.timeline-row,
.task-comments-chat {
  border-color: rgba(202,225,248,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 10px 28px rgba(3,12,25,.1);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bottom-nav {
    -webkit-backdrop-filter: blur(22px) saturate(1.18);
    backdrop-filter: blur(22px) saturate(1.18);
  }

  .modal-panel,
  .sheet-panel {
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
    backdrop-filter: blur(24px) saturate(1.12);
  }
}

/* Task editor must completely cover the page, including with the iOS keyboard open. */
.modal-layer.task-panel,
.modal-layer.task-panel .modal-backdrop {
  background: #081321;
}
.modal-layer.task-panel .modal-panel {
  /* Карточка задачи разворачивается до самого верха экрана, а верхнего отступа под
     безопасную зону не было — заголовок уезжал под «остров» и часы. */
  padding-top: calc(env(safe-area-inset-top) + 11px);
  background: linear-gradient(155deg, rgba(255,255,255,.035), transparent 34%), #14243a;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* — Аватар и логотип: лёгкий отклик — */
.avatar-button { transition: transform var(--dur-fast) var(--ease-spring); }
.avatar-button:active { transform: scale(.92); }

/* — Тосты: въезжают сверху пружиной (переопределяем базовую ease-кривую) — */
.toast { animation: toast-in var(--dur-slow) var(--ease-spring) both; }

/* — Меню действий над сообщением: пружина вместо линейного проявления — */
.message-action-overlay.open .message-action-preview,
.message-action-overlay.open .message-action-sheet {
  transition-timing-function: var(--ease-spring);
}

/* Event editor shares the same legible date/time controls as tasks. */
.event-schedule-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.event-schedule-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(176, 200, 239, .18);
  border-radius: 8px;
  background: rgba(13, 27, 49, .58);
}
.event-schedule-title {
  display: block;
  margin-bottom: 10px;
  color: #f4f8ff;
  font-size: 15px;
  line-height: 1.2;
}
.event-schedule-card .task-deadline-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.event-schedule-connector { display: flex; align-items: center; justify-content: center; color: #8091aa; }
.event-schedule-connector span { display: none; }
.event-schedule-connector svg { width: 18px; height: 18px; }
.event-repeat-field small { margin-top: 7px; color: #8fa0b8; font-size: 12px; line-height: 1.4; }

/* Read mail stays quiet; unread mail is unmistakably actionable. */
.mail-row {
  border-color: rgba(176, 200, 239, .12) !important;
  background: rgba(20, 34, 55, .78) !important;
}
.mail-row .mail-sender { color: #c3cfdf; font-weight: 660; }
.mail-row .mail-subject { color: #c8d3e2; font-weight: 620; }
.mail-row .mail-preview { color: #7f8fa6; }
.mail-row.unread-mail {
  border-color: rgba(85, 242, 211, .38) !important;
  background: rgba(35, 61, 84, .96) !important;
  box-shadow: inset 3px 0 #55f2d3, 0 8px 22px rgba(3, 13, 29, .16);
}
.mail-row.unread-mail .mail-check { color: #06281f; background: linear-gradient(135deg, #55f2d3, #9df0ba); }
.mail-row.unread-mail .mail-sender,
.mail-row.unread-mail .mail-subject { color: #fff; font-weight: 840; }
.mail-row.unread-mail .mail-preview { color: #c9d8e8; font-weight: 560; }
.mail-row.unread-mail .mail-time { color: #7df3dd; font-weight: 760; }

@media (max-width: 560px) {
  .event-schedule-grid { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .event-schedule-connector { min-height: 18px; transform: rotate(90deg); }
  .event-schedule-card { padding: 11px; }
}

/* 2026 navigation and material system: navigation glass, quiet content materials. */
:root {
  --office-nav-height: calc(86px + env(safe-area-inset-bottom));
  --office-material-nav: rgba(13, 27, 45, .78);
  /* Непрозрачная база под стеклом панели: без неё нижняя часть панели показывала
     фон страницы и выглядела отдельной полосой. */
  --office-nav-base: #101a2c;
  --office-material-sheet: rgba(18, 36, 58, .9);
  --office-material-content: rgba(29, 48, 72, .78);
  --office-material-content-strong: rgba(32, 53, 78, .94);
  --office-material-line: rgba(214, 231, 250, .17);
  --office-material-shine: rgba(255, 255, 255, .07);
}

.content {
  height: calc(var(--app-size) - var(--office-topbar-height) - var(--office-nav-height));
  padding-bottom: 20px;
}

.bottom-nav {
  /* fixed, а не absolute: панель раньше жила внутри .app с overflow: clip и высотой
     --app-size. В установленном PWA этот контейнер оказывается короче экрана, и панель
     обрезалась вместе с ним — снизу оставалась полоса фона страницы. Привязка к
     вьюпорту убирает зависимость от высоты контейнера. */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: var(--office-nav-height);
  padding: 8px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  border: 1px solid var(--office-material-line);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  transform: none;
  /* Блик не должен обнуляться раньше нижнего края: он уходил в transparent на 74%
     высоты, и в зоне домашнего индикатора сквозь полупрозрачную подложку проступал
     фон страницы — панель выглядела короче экрана, а снизу читалась чужая полоса.
     Держим минимальный блик до самого низа и кладём непрозрачную подложку. */
  background:
    linear-gradient(180deg, rgba(255,255,255,.095), rgba(255,255,255,.026) 42%, rgba(255,255,255,.02) 100%),
    linear-gradient(180deg, var(--office-material-nav), var(--office-material-nav)),
    var(--office-nav-base);
  box-shadow: 0 -18px 52px rgba(1, 8, 18, .3), inset 0 1px 0 var(--office-material-shine);
  isolation: isolate;
  overflow: visible;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -20px;
  left: 50%;
  width: 94px;
  height: 94px;
  border: 1px solid var(--office-material-line);
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 23%, rgba(255,255,255,.15), transparent 45%),
    var(--office-material-nav);
  box-shadow: 0 -12px 34px rgba(1, 8, 18, .23), inset 0 1px 0 var(--office-material-shine);
}

.nav-item {
  min-height: 68px;
  padding: 7px 2px 5px;
  gap: 5px;
  border-radius: 18px;
  color: #91a0b6;
  background: transparent;
  transition: color .2s ease, background .2s ease, transform .16s ease;
}

.nav-item:active { transform: scale(.94); }
.nav-item.active {
  color: #f7fbff;
  background: rgba(153, 183, 218, .105);
}
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 22px;
  height: 3px;
  border-radius: 3px;
  transform: translateX(-50%);
  background: #65efd8;
  box-shadow: 0 0 12px rgba(101, 239, 216, .42);
}
.nav-icon svg { width: 25px; height: 25px; }
.nav-label { font-size: 11.5px; line-height: 1.05; font-weight: 760; }

.bot-button {
  z-index: 2;
  width: 76px;
  height: 76px;
  align-self: start;
  justify-self: center;
  margin-top: -22px;
  transform: none;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  box-shadow: 0 18px 36px rgba(69, 209, 217, .24), 0 5px 15px rgba(2, 8, 18, .34), inset 0 1px rgba(255,255,255,.38);
}
.bot-button:active { transform: scale(.93); }
.bot-button .bot-face { width: 48px; height: 48px; }
.bot-button .bot-face svg { width: 43px; height: 43px; }

.topbar,
.mailbox-hub,
.summary-card,
.digest,
.office-task-row,
.timeline-row,
.mail-row,
.integration-row,
.agenda-event,
.day-tag,
.segmented,
.field input,
.field textarea,
.field select,
.composer-input,
.mail-search-field,
.search-field {
  border-color: var(--office-material-line);
}

.mailbox-hub,
.summary-card,
.digest,
.office-task-row,
.timeline-row,
.mail-row,
.integration-row,
.agenda-event {
  background:
    linear-gradient(145deg, var(--office-material-shine), transparent 34%),
    var(--office-material-content);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 12px 30px rgba(2, 10, 22, .1);
}

.modal-panel,
.sheet-panel {
  background:
    linear-gradient(150deg, rgba(255,255,255,.075), transparent 34%),
    var(--office-material-sheet);
}

.apple-calendar-setup { display: grid; gap: 14px; }
.apple-calendar-mode {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--office-material-line);
  border-radius: 14px;
  background: var(--office-material-content);
}
.apple-calendar-mode-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(2, 8, 18, .2);
}
.apple-calendar-mode-icon img { width: 100%; height: 100%; display: block; }
.apple-calendar-mode strong { display: block; color: #f5f9ff; font-size: 17px; }
.apple-calendar-mode p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.apple-calendar-private-note {
  padding: 12px 14px;
  border: 1px solid rgba(255, 203, 112, .23);
  border-radius: 12px;
  color: #f3d59e;
  background: rgba(123, 83, 24, .18);
  font-size: 13px;
  line-height: 1.45;
}
.apple-calendar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.apple-calendar-actions > *,
.apple-calendar-enable { min-height: 48px; }
.apple-calendar-subscribe { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.apple-calendar-actions .danger-button { grid-column: 1 / -1; }

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bottom-nav,
  .bottom-nav::before {
    -webkit-backdrop-filter: blur(28px) saturate(1.35);
    backdrop-filter: blur(28px) saturate(1.35);
  }
  .topbar {
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);
  }
  .modal-panel,
  .sheet-panel {
    -webkit-backdrop-filter: blur(30px) saturate(1.22);
    backdrop-filter: blur(30px) saturate(1.22);
  }
}

@media (min-width: 760px) {
  .bottom-nav { left: 0; right: 0; width: 100%; max-width: none; transform: none; }
}

@media (max-width: 370px) {
  :root { --office-nav-height: calc(82px + env(safe-area-inset-bottom)); }
  .bottom-nav { left: 0; right: 0; width: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .nav-label { font-size: 10px; }
  .nav-icon svg { width: 23px; height: 23px; }
  .bot-button { width: 70px; height: 70px; margin-top: -18px; }
}

@media (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  :root {
    --office-material-nav: #0e1d30;
    --office-material-sheet: #14263c;
    --office-material-content: #1c324d;
    --office-material-content-strong: #203957;
    --office-material-line: rgba(230, 241, 255, .34);
  }
  .bottom-nav,
  .bottom-nav::before,
  .topbar,
  .modal-panel,
  .sheet-panel {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Final mobile polish: a true center-FAB cutout, balanced filters and a compact agenda. */
.day-hero::before { display: none !important; }

.avatar-button {
  display: grid !important;
  place-items: center !important;
  padding: 3px !important;
}
.avatar-button .avatar {
  margin: 0 !important;
  line-height: 1 !important;
  transform: none !important;
}

.task-filter-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
  overflow: visible !important;
}
.task-filter-bar button {
  width: 100%;
  min-height: 42px;
  padding-inline: 7px;
}

.timeline-list {
  gap: 8px;
}
.timeline-list::before { display: none !important; }
.timeline-row {
  position: relative;
  min-height: 72px !important;
  padding: 10px 11px !important;
  grid-template-columns: 62px 9px minmax(0, 1fr) auto !important;
  gap: 9px !important;
  border: 1px solid rgba(202, 225, 248, .13) !important;
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .045), transparent 38%),
    rgba(23, 42, 65, .78) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 10px 26px rgba(2, 10, 22, .13);
}
.timeline-time {
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid rgba(124, 185, 255, .14);
  border-radius: 9px;
  color: #c3d2e6 !important;
  background: rgba(8, 21, 37, .42);
  font-size: 12px !important;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}
.timeline-dot {
  width: 7px;
  height: 7px;
  border-width: 1px;
}
.timeline-title {
  margin-bottom: 3px;
  color: #f4f8ff;
  font-size: 15px !important;
  line-height: 1.25;
  white-space: normal;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.timeline-detail { font-size: 12px !important; }
.timeline-state {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #adbbcf;
  background: rgba(255, 255, 255, .045);
  font-size: 11px !important;
  white-space: nowrap;
}
.timeline-row.completed,
.timeline-row.past { opacity: .62; }

/* Центральная кнопка сидит в круглом вырезе сплошной панели: полоса огибает её
   ободом, а не расходится двумя половинками с провалом до низа экрана. */
:root {
  --nav-fab-size: 78px;
  --nav-fab-lift: 25px;
  --nav-fab-gap: 7px;
}
.bottom-nav {
  --nav-center-track: 96px;
  --nav-pad-top: 8px;
  --nav-notch-center: calc(var(--nav-pad-top) + var(--nav-fab-size) / 2 - var(--nav-fab-lift));
  --nav-notch-radius: calc(var(--nav-fab-size) / 2 + var(--nav-fab-gap));
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--nav-center-track) minmax(0, 1fr) minmax(0, 1fr);
  padding-inline: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
  border: 0;
  background: transparent;
  box-shadow: 0 -16px 44px rgba(1, 8, 18, .32);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.bottom-nav::before {
  content: "";
  display: block !important;
  position: absolute;
  box-sizing: border-box;
  inset: 0 !important;
  z-index: 1 !important;
  width: auto !important;
  height: auto !important;
  border: 1px solid var(--office-material-line) !important;
  border-bottom: 0 !important;
  border-radius: 30px 30px 0 0 !important;
  transform: none !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .018) 36%, transparent 74%),
    #0b1a2d !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055) !important;
  /* Вырез под кнопку: прозрачный круг радиусом «кнопка + обод». */
  -webkit-mask: radial-gradient(
    circle var(--nav-notch-radius) at 50% var(--nav-notch-center),
    transparent 0 99%,
    #000 100%
  ) !important;
  mask: radial-gradient(
    circle var(--nav-notch-radius) at 50% var(--nav-notch-center),
    transparent 0 99%,
    #000 100%
  ) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.25) !important;
  backdrop-filter: blur(28px) saturate(1.25) !important;
  overflow: hidden;
  pointer-events: none;
}
.bottom-nav::after { display: none !important; }
.bottom-nav .nav-item {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-inline: 0;
  overflow: hidden;
}
/* Подписи не должны обрезаться в узких колонках рядом с вырезом. */
.bottom-nav .nav-label {
  font-size: clamp(9px, 2.6vw, 11.5px);
  letter-spacing: -.1px;
}
.bottom-nav .bot-button {
  z-index: 3;
  width: var(--nav-fab-size);
  height: var(--nav-fab-size);
  margin-top: calc(var(--nav-fab-lift) * -1);
}

#botSheet .sheet-panel {
  height: calc(var(--visible-height) - max(8px, env(safe-area-inset-top))) !important;
  max-height: calc(var(--visible-height) - max(8px, env(safe-area-inset-top))) !important;
}

@media (max-width: 370px) {
  .task-filter-bar { gap: 5px !important; }
  .task-filter-bar button { min-height: 40px; padding-inline: 4px; font-size: 10.5px; }
  .timeline-row { grid-template-columns: 55px 7px minmax(0, 1fr) !important; }
  .timeline-state { grid-column: 3; justify-self: start; margin-top: 2px; }
  :root {
    --nav-fab-size: 72px;
    --nav-fab-lift: 21px;
    --nav-fab-gap: 6px;
  }
  .bottom-nav { --nav-center-track: 96px; }
  .bottom-nav .nav-label { font-size: clamp(7.5px, 2.35vw, 9px); letter-spacing: -.12px; }
}

@media (max-width: 340px) {
  .bottom-nav .nav-item { width: 100%; margin-inline: 0; }
}

@media (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  .bottom-nav::before {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .voice-lock-hint .voice-lock-arrow,
  .voice-recording-dot,
  .voice-pause-toggle,
  .voice-composer.voice-processing .voice-action::after { animation: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Док «Наговорить событие»: закреплён над нижней навигацией и не уезжает при
   скролле календаря. Лежит рядом с .bottom-nav внутри .app и позиционируется так
   же — absolute от рамки приложения, а не fixed от вьюпорта: на iOS адресная
   строка и клавиатура меняют вьюпорт, и fixed-док отрывался бы от навигации.
   ───────────────────────────────────────────────────────────────────────────── */
:root { --calendar-dock-height: 66px; --calendar-dock-gap: 10px; }

.calendar-voice-dock {
  position: absolute;
  z-index: 18;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(var(--office-nav-height) + var(--nav-fab-lift) + var(--calendar-dock-gap));
  min-height: var(--calendar-dock-height);
  margin: 0;
  padding: 10px 10px 10px 15px;
  border-radius: 19px;
  border-color: rgba(85, 242, 211, .3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .075), transparent 62%),
    rgba(19, 35, 53, .93);
  box-shadow:
    0 16px 38px rgba(1, 8, 18, .42),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .calendar-voice-dock {
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    backdrop-filter: blur(22px) saturate(1.25);
  }
}

/* Док появляется вместе с календарём, а не выпрыгивает. */
.calendar-voice-dock:not(.voice-recording) { animation: calendar-dock-in .26s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes calendar-dock-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Подпись в доке компактнее карточной версии: одна строка + подсказка. */
.calendar-voice-dock .calendar-voice-copy strong { font-size: 15px; }
.calendar-voice-dock .calendar-voice-copy > span {
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Место под док в конце ленты: последнее событие полностью видно над ним. */
.page[data-page="calendar"] {
  padding-bottom: calc(var(--calendar-dock-height) + var(--nav-fab-lift) + var(--calendar-dock-gap) * 2);
}

/* Во время записи док растёт вверх — вниз ему некуда, там навигация. Верхний отступ
   меньше, чем у прежней карточки: место нужно только под подсказку «вверх — закрепить»,
   а не под заголовок, который на время записи скрыт. */
.calendar-voice-dock.voice-recording {
  min-height: 128px;
  padding-top: 56px;
  padding-bottom: 12px;
}

.app[data-loading="true"] .calendar-voice-dock { visibility: hidden; opacity: 0; }

@media (max-width: 370px) {
  :root { --calendar-dock-height: 62px; }
  .calendar-voice-dock { left: 10px; right: 10px; padding-left: 13px; }
}

/* В ландшафте высоты мало: док сжимается до строки с кнопкой, подсказка убирается.
   Кнопка остаётся 44px — минимальная зона касания. */
@media (max-height: 520px) {
  :root { --calendar-dock-height: 54px; }
  .calendar-voice-dock { padding-block: 6px; }
  .calendar-voice-dock:not(.voice-recording) .calendar-voice-copy > span { display: none; }
  .calendar-voice-dock:not(.voice-recording) .voice-action { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-voice-dock:not(.voice-recording) { animation: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Подписи не вылезают за свои контролы — ни на узких экранах, ни на языках
   с длинными словами (немецкий, финский, венгерский: «Hinzufügen», «Aufgaben»).
   Правило одно на всё приложение: контрол сначала растёт под текст там, где
   место есть; где места нет — текст ужимается и в самом крайнем случае
   заканчивается многоточием. Наезжать друг на друга или обрезаться на полслова
   подписи не должны нигде.
   ───────────────────────────────────────────────────────────────────────────── */

/* 1. Кнопки-действия в шапке модалок с текстовой подписью («Добавить», «Сохранить»).
   База .modal-head-action — круглая иконка с фиксированной шириной, и на узких
   экранах (media ≤420px) эта ширина применялась и к текстовым вариантам: подпись
   вылезала из пилюли поверх крестика. Ширину таким кнопкам всегда задаёт текст. */
.modal-head-action.task-edit-top,
.modal-head-action.task-save-top,
.modal-head-action.event-add-top {
  width: auto;
  min-width: 0;
  max-width: 100%;
  padding-inline: 13px;
  white-space: nowrap;
}
.modal-head-action.task-save-top span,
.modal-head-action.event-add-top span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Заголовок ужимается первым — кнопка действия и крестик остаются целыми. */
.modal-head-copy { min-width: 0; }
.modal-head-copy h2 { overflow-wrap: break-word; }

/* 2. Переключатель периодов календаря: на 320px четыре подписи («Сегодня»,
   «Неделя», «Месяц», «Год») налезали друг на друга. Отдаём переключателю всю
   ширину строки и даём подписи ужиматься. */
.segment {
  min-width: 0;
  padding-inline: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(11px, 3.2vw, 14px);
}

/* До 430px «Сегодня» в четырёхколоночном переключателе не помещается рядом со
   стрелками навигации (на 393px не хватало одного пикселя, и подпись обрывалась) —
   отдаём переключателю всю строку, стрелки уходят на следующую. */
@media (max-width: 430px) {
  .view-toolbar { flex-wrap: wrap; row-gap: 9px; }
  .view-toolbar .segmented { width: 100%; }
  .view-toolbar .calendar-nav { margin-left: auto; }
}

@media (max-width: 380px) {
  .segment { padding-inline: 4px; }
}

/* 3. Кнопки-плитки (фильтры задач, действия почты, чипы дня): им есть куда
   переноситься, поэтому длинная подпись переносится по словам, а слишком длинное
   слово рвётся — вместо того чтобы вылезти за кнопку. Многоточие здесь не нужно. */
.task-filter-bar button,
.mail-action,
.filter-chip {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
}
.mail-action { flex-shrink: 1; }

/* Чипы дня («2 приоритета», «0 встречи») остаются однострочными: вместо того чтобы
   рвать слово посередине в узкой колонке, ряд переносит сам чип на вторую строку. */
.day-tags { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.day-tag { white-space: normal; overflow-wrap: break-word; }
.day-tag > strong,
.day-tag > span { min-width: 0; overflow-wrap: break-word; }

/* 4. Колонка кнопки в композере равна самой кнопке: при фиксированных 42px кнопка
   на 44px вылезала за рамку композера. */
.composer.live { grid-template-columns: auto minmax(0, 1fr) auto; }

/* 5. Заголовки строк-интеграций («Напоминания календаря», «Telegram»): в узкой
   колонке рядом с кнопкой они обрывались многоточием на середине слова, хотя под
   ними есть место — переносим по словам вместо обрезки. */
.integration-copy strong {
  overflow: visible;
  white-space: normal;
  overflow-wrap: break-word;
  text-overflow: clip;
}

/* 6. Однострочные подписи, которым переноситься некуда: ужимаются до многоточия. */
.bottom-nav .nav-label,
.brand-copy .eyebrow {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═════════════════════════════════════════════════════════════════════════════
   ДИЗАЙН-СИСТЕМА 2026: три поверхности, одна шкала, дисциплина акцента.
   До этого глубина держалась на 119 рамках в 1px и 76 разных тенях — карточка,
   полоса интеграции и панель навигации выглядели одинаково, и глаз не различал,
   что лежит на фоне, а что над ним парит. Здесь вводятся три уровня:
     ground   — фон экрана,
     raised   — плотный контент (карточки, строки списков): сквозь него не видно,
                потому что на нём читают текст,
     floating — то, что перекрывает контент (шапка, навигация, док, шторки):
                матовое стекло, размытие и световая линия сверху вместо рамки.
   Акцент #55F2D3 остаётся только за действием; состояния переезжают на
   отдельный семантический набор.
   ═════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Поверхности */
  --s-raised: rgba(19, 33, 52, .88);
  --s-raised-2: rgba(25, 42, 64, .94);
  --s-strong: rgba(21, 37, 58, .97);
  --s-glass: rgba(226, 240, 255, .07);
  --s-glass-strong: rgba(226, 240, 255, .1);
  --s-sunken: rgba(6, 13, 23, .5);

  /* Свет и высота: три уровня вместо семидесяти шести */
  --hairline: rgba(226, 240, 255, .1);
  --hairline-strong: rgba(226, 240, 255, .2);
  --lift-top: inset 0 1px 0 rgba(255, 255, 255, .055);
  --lift-top-glass: inset 0 1px 0 rgba(255, 255, 255, .16);
  --e-1: 0 2px 6px rgba(1, 7, 15, .2);
  --e-2: 0 10px 24px rgba(1, 7, 15, .32);
  --e-3: 0 22px 54px rgba(1, 7, 15, .5);

  /* Скругления */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Шкала текста */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 15px;
  --t-lg: 17px;
  --t-xl: 21px;
  --t-2xl: 27px;

  /* Акцент — только действие */
  --accent: #55f2d3;
  --accent-ink: #04231d;
  --accent-quiet: rgba(85, 242, 211, .12);

  /* Семантика состояний — отдельно от акцента */
  --sig-soon: #f4cb73;
  --sig-alt: #9c93ff;
  --sig-alert: #ff8fa3;
  --sig-info: #6eb6ff;

  /* Текст */
  --ink: #f2f7ff;
  --ink-soft: #b9c8dc;
  --ink-mute: #8095ae;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ── Слой 2: плотный контент ────────────────────────────────────────────────
   Рамка убирается, разделение делают собственный тон, световая линия сверху и
   мягкая тень. Так карточка читается как физический объект, а не как обводка. */
.office-task-row,
.agenda-event,
.mail-row,
.timeline-row,
.digest,
.mailbox-hub,
.integration-row,
.integration-strip,
.summary-card,
.event-schedule-card,
.task-comments-chat {
  border: 0 !important;
  border-radius: var(--r-md) !important;
  background: var(--s-raised) !important;
  box-shadow: var(--lift-top), var(--e-2) !important;
}

.agenda-event-swipe .agenda-event { background: var(--s-raised) !important; }

/* Непрочитанное письмо — состояние, а не акцент действия: тёплый рельс слева. */
.mail-row.unread-mail {
  background: var(--s-raised-2) !important;
  box-shadow: inset 3px 0 var(--sig-soon), var(--lift-top), var(--e-2) !important;
}
.mail-row.unread-mail .mail-time { color: var(--sig-soon); }

/* ── Слой 3: стекло только там, где под ним не читают ─────────────────────── */
.topbar {
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(10, 21, 35, .82), rgba(10, 21, 35, .52));
}

.modal-panel,
.sheet-panel {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--s-strong);
  box-shadow: var(--lift-top-glass), var(--e-3);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar {
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
  }
}

/* Плавающие панели — общее стекло: размытие + световая линия вместо рамки. */
.bottom-nav::before,
.calendar-voice-dock {
  border-color: var(--hairline) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 58%),
    var(--s-glass-strong) !important;
  box-shadow: var(--lift-top-glass), var(--e-3) !important;
}

/* ── Управляющие элементы: тон и форма, а не мятная заливка ───────────────── */
.segmented {
  border: 0;
  border-radius: var(--r-md);
  background: var(--s-sunken);
  box-shadow: inset 0 1px 2px rgba(1, 7, 15, .4);
}
.segment { border-radius: var(--r-sm); font-weight: 700; }
.segment.active {
  color: var(--ink);
  background: var(--s-raised-2);
  box-shadow: var(--lift-top), var(--e-1);
}

.task-filter-bar button,
.filter-chip,
.mail-action,
.day-tag {
  border: 0;
  border-radius: var(--r-sm);
  background: var(--s-raised);
  box-shadow: var(--lift-top), var(--e-1);
}
/* Активный фильтр — это состояние, а не действие: мятная заливка тут спорила
   с кнопкой «Добавить задачу» за роль главного элемента экрана. */
.task-filter-bar button.active,
.filter-chip.active {
  color: var(--accent);
  background: var(--accent-quiet);
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .42), var(--e-1);
}
.mail-action.primary {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(85, 242, 211, .22);
}

/* Поля ввода остаются с рамкой: она сообщает, что сюда можно писать. */
.field input,
.field textarea,
.field select,
.composer-input,
.mail-search-field,
.search-field {
  border-radius: var(--r-sm);
  background: var(--s-sunken);
}

/* ── Карточка события: время моноширинным, заголовок — главная строка ─────── */
.agenda-event {
  grid-template-columns: 46px 3px minmax(0, 1fr) 14px;
  gap: 11px;
  align-items: start;
  padding: 13px 12px 13px 11px;
}
.agenda-event-time {
  align-content: start;
  gap: 2px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.agenda-event-time b {
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 620;
  line-height: 1.3;
}
.agenda-event-time span {
  color: var(--ink-mute);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.3;
}
.agenda-event-mark {
  height: 100%;
  min-height: 34px;
  border-radius: var(--r-pill);
}
.agenda-event h4 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: var(--t-md);
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -.005em;
}
.agenda-event p {
  color: var(--ink-mute);
  font-size: var(--t-sm);
  line-height: 1.4;
}
.agenda-event-open { align-self: center; color: var(--ink-mute); }

/* Цвет рельса — источник события, а не порядковый номер в списке. */
.agenda-event .agenda-event-mark { background: var(--sig-info); }
.agenda-event.tone-1 .agenda-event-mark { background: var(--sig-alt); }
.agenda-event.tone-2 .agenda-event-mark { background: var(--accent); }
.agenda-event.past .agenda-event-mark,
.agenda-event.completed .agenda-event-mark { background: #4a5a70; }

/* ── Шкала текста на ключевых экранах ─────────────────────────────────────── */
.office-task-row .task-title,
.mail-subject,
.timeline-title { font-size: var(--t-md); }
.mail-preview,
.timeline-detail,
.office-task-row .task-meta { font-size: var(--t-sm); }
.section-head h3,
.mail-list-head strong { font-size: var(--t-lg); }

/* ── Фокус виден всегда: премиум — это в том числе доступность ────────────── */
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Режим экономии прозрачности: стекло становится плотным, размытие отключено. */
@media (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  :root {
    --s-glass: #14243a;
    --s-glass-strong: #16283f;
    --s-raised: #16283f;
    --s-raised-2: #1c3350;
    --s-strong: #172a42;
  }
  .bottom-nav::before,
  .calendar-voice-dock,
  .topbar {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Дата в колонке недельного режима — тише времени, но различима. */
.agenda-event-time i {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ── Полоса недели: точка события больше не сплющивается, выбранный день —
   мятное кольцо вместо сплошной заливки: сплошная спорила с кнопкой микрофона
   за роль самого яркого пятна экрана. ─────────────────────────────────────── */
.week-strip.dynamic .day {
  padding-block: 6px 8px;
  gap: 2px;
  border-radius: var(--r-md);
}
.week-strip.dynamic .day i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 3px;
  background: var(--sig-info);
}
.week-strip.dynamic .day.active {
  color: var(--accent);
  background: var(--accent-quiet);
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .45);
}
.week-strip.dynamic .day.active span { color: var(--accent); }
.week-strip.dynamic .day.active i { background: var(--accent); box-shadow: none; }

/* Заголовок периода — крупная величина экрана, лента ниже уже не повторяет дату. */
.calendar-period {
  font-size: var(--t-xl);
  font-weight: 740;
  letter-spacing: -.02em;
}
.agenda-date h3 { font-size: var(--t-lg); font-weight: 720; }

/* Период и стрелки — одна строка: отдельный ряд под переключателем занимал
   ~60px высоты и ни на что не указывал. */
.calendar-period-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.calendar-period-row .calendar-period { margin: 0; min-width: 0; }
.calendar-period-row .calendar-nav { flex: 0 0 auto; }
.calendar-nav button {
  border: 0;
  background: var(--s-raised);
  box-shadow: var(--lift-top), var(--e-1);
  color: var(--ink-soft);
}

/* Полоса разрешений — служебная, а не главная: акцент ей не нужен. */
.push-strip .integration-copy strong { color: var(--ink); }
.integration-action {
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  background: var(--s-raised-2);
  box-shadow: var(--lift-top), var(--e-1);
  font-weight: 660;
}

/* ═════════════════════════════════════════════════════════════════════════════
   ДВИЖЕНИЕ: одна кривая, три длительности, ничего лишнего.
   Пружина cubic-bezier(.2,.9,.25,1) — общий «характер» приложения: быстрый старт,
   мягкая остановка. Всё, что анимируется, двигает только transform и opacity —
   layout-свойства (height, width, top) не трогаем, иначе на среднем телефоне
   появляются пропущенные кадры.
   ═════════════════════════════════════════════════════════════════════════════ */
:root {
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --ease-spring-soft: cubic-bezier(.34, 1.32, .5, 1);
  --d-fast: .16s;
  --d-base: .26s;
  --d-slow: .38s;
}

/* Шторка ассистента: выезд с лёгким «доездом» и уход быстрее, чем приход —
   закрытие не должно заставлять ждать. */
.sheet-panel {
  transform: translateY(102%) scale(.985);
  transform-origin: bottom center;
  transition: transform var(--d-fast) var(--ease-out);
  will-change: transform;
}
.sheet.open .sheet-panel {
  transform: translateY(0) scale(1);
  transition: transform var(--d-slow) var(--ease-spring-soft);
}
.sheet-backdrop { transition: opacity var(--d-base) var(--ease-out); }
.sheet.open .sheet-backdrop { transition-duration: var(--d-slow); }

/* Содержимое шторки догоняет панель — короткая лесенка вместо одного рывка. */
.sheet.open .bot-head { animation: sheet-rise var(--d-slow) var(--ease-out) backwards; animation-delay: .05s; }
.sheet.open .conversation { animation: sheet-rise var(--d-slow) var(--ease-out) backwards; animation-delay: .09s; }
.sheet.open .composer.live { animation: sheet-rise var(--d-slow) var(--ease-out) backwards; animation-delay: .13s; }
@keyframes sheet-rise {
  from { opacity: 0; transform: translateY(14px); }
}

/* Переключение вкладок: страница проявляется снизу, а не мигает. */
.page.active { animation: page-in var(--d-base) var(--ease-out) backwards; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Карточки списка появляются лесенкой — но только когда экран действительно
   открыли. Данные перерисовываются часто (фокус окна, синхронизация, ответ
   сервера), и если анимировать каждую перерисовку, список мигает — ровно то,
   что читается как «страница перезагрузилась». Поэтому анимация живёт на классе
   .just-opened, который снимается через 700мс после переключения вкладки. */
.page.just-opened .agenda-list > *:nth-child(-n+6),
.page.just-opened .office-task-list > *:nth-child(-n+6),
.page.just-opened .mail-list > *:nth-child(-n+6),
.page.just-opened .timeline-list > *:nth-child(-n+6) { animation: list-in var(--d-base) var(--ease-out) backwards; }
.page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > *:nth-child(2) { animation-delay: .03s; }
.page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > *:nth-child(3) { animation-delay: .06s; }
.page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > *:nth-child(4) { animation-delay: .09s; }
.page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > *:nth-child(5) { animation-delay: .12s; }
.page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > *:nth-child(6) { animation-delay: .15s; }
@keyframes list-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* Нажатие: отклик под пальцем на всех основных поверхностях. */
.agenda-event,
.office-task-row,
.mail-row,
.day-tag,
.task-filter-bar button,
.filter-chip,
.mail-action,
.segment,
.calendar-nav button,
.integration-action { transition: transform var(--d-fast) var(--ease-out), background-color var(--d-fast) ease, box-shadow var(--d-fast) ease; }
.agenda-event:active,
.office-task-row:active,
.mail-row:active { transform: scale(.985); }
.day-tag:active,
.task-filter-bar button:active,
.filter-chip:active,
.mail-action:active,
.segment:active,
.calendar-nav button:active,
.integration-action:active { transform: scale(.96); }

/* Модалка приезжает так же, как шторка. */
.modal-layer .modal-panel { transition: transform var(--d-slow) var(--ease-spring-soft), opacity var(--d-base) ease; }

@media (prefers-reduced-motion: reduce) {
  .sheet.open .bot-head,
  .sheet.open .conversation,
  .sheet.open .composer.live,
  .page.active,
  .page.just-opened :is(.agenda-list, .office-task-list, .mail-list, .timeline-list) > * { animation: none !important; }
}

/* ── Запись в календаре: подсказка блокировки крупнее, панель без рамки ──────
   При зажатии микрофона док рисовал большую пустую рамку с фоном — она ничего
   не сообщала, только перекрывала ленту. Оставляем полосу таймера и кнопку,
   сам док на время записи становится прозрачным. */
.calendar-voice-dock.voice-recording {
  border: 0 !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.calendar-voice-dock.voice-recording .voice-recording-strip {
  border-radius: var(--r-lg);
  background: var(--s-glass-strong);
  box-shadow: var(--lift-top-glass), var(--e-2);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .calendar-voice-dock.voice-recording .voice-recording-strip {
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
  }
}

/* Подсказка «вверх — закрепить» была мелкой мишенью: увеличиваем пилюлю,
   стрелку и замок, чтобы жест читался с первого раза. */
.voice-lock-hint {
  width: 52px;
  height: 92px;
  padding: 10px 0 11px;
  border-radius: 26px;
}
.voice-lock-hint .voice-lock-arrow { width: 22px; height: 22px; }
.voice-lock-hint .voice-lock-icon { width: 22px; height: 22px; }

/* Выделение включается по команде «Выделить текст» — до этого long-press отдан
   меню действий, иначе жесты конфликтуют. */
.bubble.selectable {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
}
.bubble.selectable::selection,
.bubble.selectable *::selection { background: rgba(85, 242, 211, .3); color: #fff; }

/* ═════════════════════════════════════════════════════════════════════════════
   ДОКУМЕНТЫ
   Экран собирает сгенерированные файлы и загруженные исходники в один список.
   Композер сверху — главное действие: описал задание, выбрал формат, получил файл.
   ═════════════════════════════════════════════════════════════════════════════ */
.doc-composer {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--s-raised-2);
  box-shadow: var(--lift-top), var(--e-2);
}
.doc-composer-label {
  color: var(--ink-soft);
  font-size: var(--t-sm);
  font-weight: 660;
}
.doc-instruction {
  min-height: 84px;
  padding: 12px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--ink);
  background: var(--s-sunken);
  font: inherit;
  font-size: var(--t-md);
  line-height: 1.45;
  resize: vertical;
}
.doc-instruction:focus { outline: none; border-color: rgba(85, 242, 211, .5); }

.doc-format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.doc-format {
  /* flex сжимал чипы, и длинная подпись («Markdown», «PowerPoint») обрезалась.
     Чип не сжимается и не переносится — ряд просто уходит на следующую строку. */
  flex: 0 0 auto;
  min-width: 0;
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  background: var(--s-raised);
  box-shadow: var(--lift-top), var(--e-1);
  font-size: var(--t-sm);
  font-weight: 660;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--d-fast) var(--ease-out), color var(--d-fast) ease, box-shadow var(--d-fast) ease;
}
@media (max-width: 400px) {
  .doc-format { padding: 0 11px; font-size: 12.5px; }
}
.doc-format:active { transform: scale(.95); }
.doc-format.active {
  color: var(--accent);
  background: var(--accent-quiet);
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .45);
}

.doc-source {
  display: grid;
  gap: 9px;
  padding: 11px 12px 12px;
  border-radius: var(--r-md);
  background: rgba(110, 182, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(110, 182, 255, .28);
}
.doc-source-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.doc-source-copy { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.doc-source-copy strong { color: var(--sig-info); font-size: var(--t-xs); font-weight: 720; }
.doc-source-copy span { color: var(--ink-mute); font-size: var(--t-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-source-clear {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .06);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 680;
  cursor: pointer;
}
.doc-source-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 7px; }
.doc-source-chip {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 8px;
  border-radius: 12px;
  color: var(--ink-soft);
  background: rgba(6, 21, 39, .32);
  box-shadow: inset 0 0 0 1px rgba(110, 182, 255, .17);
}
.doc-source-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--sig-info);
  background: rgba(110, 182, 255, .12);
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}
.doc-source-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-sm); }
.doc-source-remove {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  color: var(--ink-mute);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}
.doc-source-clear:active,
.doc-source-remove:active { transform: scale(.94); }
.doc-source-clear:disabled,
.doc-source-remove:disabled { opacity: .48; cursor: default; transform: none; }
@media (max-width: 430px) {
  .doc-source-list { grid-template-columns: minmax(0, 1fr); }
}

.doc-composer-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; }
.doc-upload { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.doc-upload svg { width: 18px; height: 18px; }

.doc-toolbar { display: grid; gap: 10px; margin-bottom: 14px; }
.doc-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--s-sunken);
}
.doc-search svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--ink-mute); }
.doc-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: none;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: var(--t-md);
}
.doc-filters { display: flex; flex-wrap: wrap; gap: 7px; }

.doc-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.doc-list-head strong { font-size: var(--t-lg); font-weight: 720; }
.doc-list-head small { color: var(--ink-mute); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }

.doc-list { display: grid; gap: 9px; }
.doc-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 13px 13px 12px;
  border-radius: var(--r-md);
  background: var(--s-raised);
  box-shadow: var(--lift-top), var(--e-2);
  transition: transform var(--d-fast) var(--ease-out);
}
.doc-card:active { transform: scale(.99); }
.doc-card.is-source { background: var(--s-raised); opacity: .92; }
.doc-badge {
  min-width: 54px;
  min-height: 34px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .01em;
  text-align: center;
  overflow-wrap: break-word;
}
.doc-tone-sheet { color: #0b2b22; background: linear-gradient(150deg, #7ef0c8, #55f2d3); }
.doc-tone-text { color: #0a1e33; background: linear-gradient(150deg, #9cc4ff, #6eb6ff); }
.doc-tone-pdf { color: #2c0d12; background: linear-gradient(150deg, #ffb3c0, #ff8fa3); }
.doc-tone-slides { color: #2d1c05; background: linear-gradient(150deg, #ffd79a, #f4cb73); }
.doc-tone-code { color: #1a1832; background: linear-gradient(150deg, #c0b9ff, #9c93ff); }

.doc-card-main { min-width: 0; display: grid; gap: 4px; }
.doc-card-main h4 {
  margin: 0;
  color: var(--ink);
  font-size: var(--t-md);
  font-weight: 660;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.doc-card-main p {
  margin: 0;
  color: var(--ink-mute);
  font-size: var(--t-sm);
  line-height: 1.4;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.doc-card-actions { display: flex; align-items: center; gap: 6px; }
.doc-action {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .05);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--d-fast) var(--ease-out), background-color var(--d-fast) ease;
}
.doc-action:active { transform: scale(.92); }
.doc-action svg { width: 19px; height: 19px; }
.doc-action.danger { color: var(--sig-alert); background: rgba(255, 143, 163, .1); }

.doc-empty { padding: 28px 18px; text-align: center; }
.doc-empty strong { display: block; color: var(--ink); font-size: var(--t-lg); font-weight: 720; }
.doc-empty p { margin: 8px auto 0; max-width: 34ch; color: var(--ink-mute); font-size: var(--t-sm); line-height: 1.5; }

.archived-page { display: none !important; }

/* Порог был 370px, а типовой iPhone — 375px: на нём «Загрузить исходник» забирал всю
   ширину, и надпись «Создать документ» вылезала за кнопку. Кладём кнопки друг под
   друга уже на 430px и разрешаем подписи переноситься внутри кнопки. */
.doc-composer-actions > button { min-width: 0; white-space: normal; line-height: 1.2; }
@media (max-width: 430px) {
  .doc-composer-actions { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 370px) {
  .doc-card { grid-template-columns: 46px minmax(0, 1fr); }
  .doc-card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .doc-badge { min-width: 46px; }
}

/* Длинное имя не должно раздувать карточку на пять строк. */
.doc-card-main h4 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Замок ещё крупнее — это цель для пальца во время записи, а не иконка-подсказка. */
.voice-lock-hint { width: 58px; height: 100px; border-radius: 29px; }
.voice-lock-hint .voice-lock-arrow,
.voice-lock-hint .voice-lock-icon { width: 26px; height: 26px; }

/* Пульс кнопки записи, как в Telegram: расходящееся кольцо вокруг микрофона.
   Кольцо рисуется тенью — не влияет на раскладку и не тормозит на слабом железе. */
.voice-action.recording-mode {
  animation: voice-record-pulse 1.6s var(--ease-out) infinite;
}
@keyframes voice-record-pulse {
  0% { box-shadow: 0 0 0 0 rgba(85, 242, 211, .42), 0 9px 24px rgba(47, 140, 255, .38); }
  70% { box-shadow: 0 0 0 18px rgba(85, 242, 211, 0), 0 9px 24px rgba(47, 140, 255, .38); }
  100% { box-shadow: 0 0 0 0 rgba(85, 242, 211, 0), 0 9px 24px rgba(47, 140, 255, .38); }
}

@media (prefers-reduced-motion: reduce) {
  .voice-action.recording-mode { animation: none; }
}

/* ── Документы: теги источника, выбор, шаблоны, предпросмотр ────────────────── */
.doc-card { grid-template-columns: 30px 54px minmax(0, 1fr) auto; }
.doc-card.is-selected { box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .5), var(--e-2); }
.doc-select {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: transparent;
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px var(--hairline);
  cursor: pointer;
  transition: background-color var(--d-fast) ease, color var(--d-fast) ease;
}
.doc-select svg { width: 15px; height: 15px; }
.doc-card.is-selected .doc-select { color: var(--accent-ink); background: var(--accent); box-shadow: none; }
.doc-select-placeholder { width: 26px; height: 26px; }

.doc-origin {
  justify-self: start;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 720;
  letter-spacing: .01em;
}
.doc-origin-office { color: var(--ink-mute); background: rgba(255, 255, 255, .06); }
.doc-origin-chat { color: var(--sig-alt); background: rgba(156, 147, 255, .14); }
.doc-origin-mail { color: var(--sig-soon); background: rgba(244, 203, 115, .14); }
.doc-origin-upload { color: var(--sig-info); background: rgba(110, 182, 255, .13); }

.doc-templates { display: flex; flex-wrap: wrap; gap: 7px; }
.doc-template {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px var(--hairline);
  overflow: hidden;
}
.doc-template-run {
  max-width: 190px;
  min-height: 34px;
  padding: 0 6px 0 13px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: var(--t-sm);
  font-weight: 640;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-template-remove {
  width: 28px;
  min-height: 34px;
  border: 0;
  color: var(--ink-mute);
  background: transparent;
  cursor: pointer;
}
.doc-composer-actions { grid-template-columns: auto minmax(0, 1fr); }
.doc-template-save {
  width: 46px;
  border: 0;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: var(--s-raised);
  box-shadow: var(--lift-top), var(--e-1);
  cursor: pointer;
}
.doc-template-save svg { width: 19px; height: 19px; }

.doc-bulk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--accent-quiet);
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .32);
  color: var(--accent);
  font-size: var(--t-sm);
  font-weight: 660;
}
.doc-bulk-actions { display: flex; gap: 6px; }
.doc-bulk-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  background: rgba(255, 255, 255, .08);
  font-size: var(--t-sm);
  font-weight: 640;
  cursor: pointer;
}
.doc-bulk-actions .danger { color: var(--sig-alert); background: rgba(255, 143, 163, .12); }
.doc-bulk-actions .ghost { color: var(--ink-mute); background: transparent; }

.doc-preview { display: grid; gap: 14px; }
.doc-preview-loading { padding: 24px; text-align: center; color: var(--ink-mute); }
.doc-preview-table-wrap { overflow-x: auto; border-radius: var(--r-md); background: var(--s-sunken); }
.doc-preview-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.doc-preview-table th,
.doc-preview-table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.doc-preview-table th { color: var(--ink); font-weight: 700; background: rgba(255, 255, 255, .04); }
.doc-preview-table td { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.doc-preview-text {
  max-height: 52vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--s-sunken);
  color: var(--ink-soft);
  font-size: var(--t-md);
  line-height: 1.55;
}
.doc-preview-empty { padding: 22px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.doc-preview-empty strong { color: var(--ink); font-size: var(--t-lg); }
.doc-preview-empty p { color: var(--ink-mute); font-size: var(--t-sm); max-width: 34ch; }
.doc-preview-open { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

@media (max-width: 370px) {
  .doc-card { grid-template-columns: 26px 46px minmax(0, 1fr); }
  .doc-composer-actions { grid-template-columns: minmax(0, 1fr); }
  .doc-bulk { flex-direction: column; align-items: stretch; }
}

/* Панель действий над выбранными письмами стояла фиксированной у самой шапки —
   письма внизу, действия вверху, глаз мечется через весь экран. Возвращаем её в
   поток списка: она едет вместе с письмами и липнет к верху только при скролле. */
.mail-selection-bar {
  position: sticky !important;
  top: 4px;
  left: auto !important;
  right: auto !important;
  z-index: 12 !important;
  margin: 0 0 10px !important;
  padding: 10px 12px !important;
  border-radius: var(--r-md) !important;
  background: var(--s-glass-strong) !important;
  box-shadow: var(--lift-top-glass), var(--e-2) !important;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .mail-selection-bar {
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
  }
}

/* Непрочитанные комментарии: точка с числом у задачи и на фильтре «Команда». */
.task-comment-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: #2b0d13;
  background: var(--sig-alert);
  box-shadow: 0 4px 12px rgba(255, 143, 163, .3);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.office-task-row { position: relative; }
.task-filter-bar button { position: relative; }
.task-filter-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: #2b0d13;
  background: var(--sig-alert);
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
/* right: 0, а не -3px: у правой колонки чипов край совпадает с краем .page, а тот режет
   по горизонтали (overflow-x: hidden). Вынос бейджа наружу срезался ровно на эти 3px —
   получался кружок с откушенным боком. Прижимаем к краю чипа, за габарит не выходим. */
.task-filter-count {
  position: absolute;
  top: -6px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(176,200,239,.18);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  background: #273750;
  font-size: 9px;
  font-weight: 800;
}
.task-filter-badge + .task-filter-count { right: 19px; }

.agent-starters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 4px 4px; }
.agent-starters button { min-height: 36px; padding: 7px 11px; border: 1px solid rgba(85,242,211,.2); border-radius: var(--r-pill); color: var(--ink-soft); background: rgba(85,242,211,.07); font: inherit; font-size: 12px; font-weight: 700; }
.mail-disconnected .mail-connected-only { display: none !important; }

/* PDF и картинки открываются внутри модалки: раньше «открыть целиком» уводило в
   полноэкранный просмотрщик PWA, из которого нет кнопки назад. */
.doc-preview-frame {
  width: 100%;
  height: min(62vh, 520px);
  border: 0;
  border-radius: var(--r-md);
  background: #fff;
}
.doc-preview-image {
  width: 100%;
  max-height: min(62vh, 520px);
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--s-sunken);
}

/* Панель выбранных писем липнет к верху списка: .page клипует по X, из-за чего
   sticky ломался — для почты отключаем клип, ширину держит сам контейнер. */
.page[data-page="mail"] { overflow: visible !important; }
.mail-selection-bar { top: 0 !important; }

/* Карточка документа в процессе генерации: место в списке занято сразу, полоса
   показывает, что работа идёт — файл не появляется «из ниоткуда» через минуту. */
.doc-card-pending { opacity: .9; }
.doc-progress {
  display: block;
  height: 4px;
  margin-top: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.doc-progress i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
  animation: doc-progress-slide 1.25s var(--ease-out) infinite;
}
@keyframes doc-progress-slide {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(240%); }
}
@media (prefers-reduced-motion: reduce) {
  .doc-progress i { animation: none; width: 100%; opacity: .6; }
}

/* ── Просмотр файла: системная отрисовка внутри, наша кнопка «Назад» сверху ─── */
.doc-file {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #0b1524;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease-out);
}
.doc-file.open { opacity: 1; }
.doc-file-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  background: rgba(11, 21, 36, .96);
  border-bottom: 1px solid var(--hairline);
}
.doc-file-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.doc-file-back svg { width: 24px; height: 24px; }
.doc-file-back:active { opacity: .6; }
.doc-file-name {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 660;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-file-share {
  justify-self: end;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}
.doc-file-share svg { width: 21px; height: 21px; }
.doc-file-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.doc-file-image { width: 100%; height: 100%; object-fit: contain; }

/* Слой просмотра файла: кнопка «Назад» всегда на месте, содержимое рисует система. */
.doc-file {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #0b1524;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease-out);
}
.doc-file.open { opacity: 1; }
.doc-file-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  background: rgba(11, 21, 36, .97);
  border-bottom: 1px solid var(--hairline);
}
.doc-file-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.doc-file-back svg { width: 24px; height: 24px; }
.doc-file-back:active { opacity: .6; }
.doc-file-name {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 660;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-file-share {
  justify-self: end;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}
.doc-file-share svg { width: 21px; height: 21px; }
.doc-file-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.doc-file-image { width: 100%; height: 100%; object-fit: contain; }

/* ── Просмотр документа: файл целиком, с масштабом ─────────────────────────── */
.doc-preview-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #0b1524;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease-out);
}
.doc-preview-layer.open { opacity: 1; }
.doc-preview-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  background: rgba(11, 21, 36, .97);
  border-bottom: 1px solid var(--hairline);
}
.doc-preview-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.doc-preview-back svg { width: 24px; height: 24px; }
.doc-preview-back:active { opacity: .6; }
.doc-preview-name {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 660;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-preview-tools { justify-self: end; display: flex; gap: 4px; }
.doc-preview-tool {
  min-width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: rgba(255, 255, 255, .06);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}
.doc-preview-tool svg { width: 19px; height: 19px; }
/* Родной пинч-зум внутри области просмотра, кнопки — как запасной путь. */
.doc-preview-scroll {
  min-height: 0;
  overflow: auto;
  touch-action: pinch-zoom pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  background: #f4f6fa;
  padding: 14px;
}
.doc-preview-stage {
  display: grid;
  gap: 14px;
  justify-items: center;
}
.doc-preview-stage canvas,
.doc-preview-media {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 26px rgba(2, 9, 20, .18);
  background: #fff;
}
.doc-preview-status {
  padding: 26px 18px;
  color: #445167;
  font-size: var(--t-md);
  text-align: center;
}
.doc-sheet {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
  color: #0f172a;
  box-shadow: 0 8px 26px rgba(2, 9, 20, .12);
}
.doc-sheet th,
.doc-sheet td { padding: 8px 10px; border-bottom: 1px solid #e6ebf3; text-align: left; white-space: nowrap; }
.doc-sheet th { background: #eef2f8; font-weight: 700; }
.doc-sheet td { font-variant-numeric: tabular-nums; }
.doc-sheet-name { margin: 4px 0; color: #334155; font-size: 13px; font-weight: 700; }
.doc-preview-text-block {
  width: 100%;
  margin: 0;
  padding: 16px;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 26px rgba(2, 9, 20, .12);
}

/* Дата — главная строка на главной: заголовок «Ваш день уже собран» убран,
   его роль занимает день недели и число. */
.date-line {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: var(--t-2xl);
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-transform: none;
}
.day-hero .day-subtitle { margin-top: 6px; }

/* 4. Шапка просмотра: назад и отправить над названием, кнопки масштаба убраны —
   масштаб делается пальцами. */
.doc-preview-bar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "back . share" "name name name";
  row-gap: 4px;
}
.doc-preview-back { grid-area: back; }
.doc-preview-tools { grid-area: share; }
.doc-preview-name {
  grid-area: name;
  text-align: left;
  padding: 0 4px 2px;
  font-size: 13px;
  color: var(--ink-mute);
}
/* Масштаб и перетаскивание считает bindDocPreviewZoom(): системный пинч выключен на
   уровне viewport. Сцена трансформируется от центра — так зум «к пальцам» и перенос
   листа считаются одной формулой. При увеличении прокрутку контейнера отключаем,
   иначе она конфликтует с перетаскиванием. */
.doc-preview-scroll { touch-action: pan-y; }
.doc-preview-scroll.is-zoomed { overflow: hidden; touch-action: none; }
.doc-preview-stage {
  /* Начало координат — левый верхний угол: центр сцены у многостраничного документа
     находится далеко за экраном, и зум «от центра» уводил лист в сторону. */
  transform-origin: 0 0;
  will-change: transform;
  transform: translate3d(0, 0, 0) scale(1);
}

/* 9. Панель действий над письмами — заметная: акцентная подложка и крупные кнопки. */
.mail-selection-bar {
  background: var(--accent-quiet) !important;
  box-shadow: inset 0 0 0 1px rgba(85, 242, 211, .45), var(--e-2) !important;
}
.mail-selection-count { color: var(--accent); font-weight: 760; font-size: var(--t-sm); }
.mail-selection-actions button {
  min-height: 38px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: var(--r-sm) !important;
  color: var(--ink) !important;
  background: rgba(255, 255, 255, .1) !important;
  font-size: var(--t-sm) !important;
  font-weight: 660 !important;
}
.mail-selection-actions .danger { color: var(--sig-alert) !important; background: rgba(255, 143, 163, .14) !important; }

/* Свайп-удаление документа: контейнер повторяет геометрию карточки, чтобы
   красная подложка совпадала с ней по краям и радиусу. */
.doc-swipe { position: relative; border-radius: var(--r-md); overflow: hidden; }
.doc-swipe .doc-card { border-radius: var(--r-md); }
.doc-list { gap: 9px; }

/* ── Накладки в расписании: баннер над лентой и значок на карточке ── */
.conflict-banner {
  margin: 0 0 12px;
  padding: 13px 14px;
  border-radius: var(--r-lg, 16px);
  background: linear-gradient(180deg, rgba(255, 143, 163, .16), rgba(255, 143, 163, .07));
  border: 1px solid rgba(255, 143, 163, .34);
  box-shadow: var(--e-1, 0 6px 20px rgba(2, 9, 20, .28));
  display: grid;
  gap: 11px;
  animation: page-in var(--d-fast, .18s) var(--ease-out, ease) backwards;
}
.conflict-banner-head { display: flex; gap: 10px; align-items: flex-start; }
.conflict-banner-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #06111f;
  background: var(--sig-alert, #ff8fa3);
}
.conflict-banner-icon svg { width: 18px; height: 18px; }
.conflict-banner-head strong { display: block; color: var(--ink); font-size: var(--t-md, 15px); font-weight: 760; }
.conflict-banner-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: var(--t-sm, 13px); line-height: 1.35; }
.conflict-rows { display: grid; gap: 8px; }
.conflict-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: var(--r-md, 12px);
  background: rgba(9, 16, 28, .5);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .08));
}
.conflict-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.conflict-row-main strong { color: var(--ink); font-size: var(--t-sm, 13px); font-weight: 640; line-height: 1.3; overflow-wrap: anywhere; }
.conflict-row-time { color: var(--ink-mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.conflict-row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.conflict-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-sm, 9px);
  border: 0;
  font-size: 12.5px;
  font-weight: 680;
  cursor: pointer;
  white-space: nowrap;
}
.conflict-btn-move { color: var(--accent-ink); background: var(--accent); }
.conflict-btn-keep { color: var(--ink-soft); background: rgba(255, 255, 255, .08); }
.conflict-btn:active { opacity: .7; }

.agenda-conflict-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: .02em;
  color: #06111f;
  background: var(--sig-alert, #ff8fa3);
}
.agenda-event.has-conflict { box-shadow: inset 3px 0 0 var(--sig-alert, #ff8fa3); }
.agenda-event.has-conflict .agenda-event-mark { background: var(--sig-alert, #ff8fa3); }

/* ── Встреча из письма: свободно/занято + внести в календарь ── */
.mail-meeting-card {
  margin: 12px 0 0;
  padding: 12px 13px;
  border-radius: var(--r-md, 12px);
  border: 1px solid var(--hairline, rgba(255, 255, 255, .1));
  background: rgba(9, 16, 28, .45);
  display: grid;
  gap: 9px;
}
.mail-meeting-card.is-free { border-color: rgba(85, 242, 211, .38); background: var(--accent-quiet, rgba(85, 242, 211, .12)); }
.mail-meeting-card.is-busy { border-color: rgba(255, 143, 163, .4); background: rgba(255, 143, 163, .1); }
.mail-meeting-head { display: flex; gap: 9px; align-items: flex-start; }
.mail-meeting-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.mail-meeting-card.is-free .mail-meeting-dot { background: var(--accent, #55f2d3); }
.mail-meeting-card.is-busy .mail-meeting-dot { background: var(--sig-alert, #ff8fa3); }
.mail-meeting-head strong { display: block; color: var(--ink); font-size: var(--t-sm, 13px); font-weight: 720; }
.mail-meeting-when { color: var(--ink-soft); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mail-meeting-status { margin: 0; color: var(--ink); font-size: var(--t-sm, 13px); font-weight: 640; }
.mail-meeting-busy-with { margin: 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.35; }
.mail-meeting-hint { margin: 0; color: var(--ink-mute); font-size: 12px; line-height: 1.35; }
.mail-meeting-actions { display: flex; }
.mail-meeting-add { flex: 1 1 auto; min-height: 40px; }

/* Кнопки композера «Документов»: на типовом iPhone (375px) две колонки не помещались и
   подпись «Создать документ» вылезала за кнопку. Правило объявлено последним, потому что
   выше по файлу grid-template-columns переопределяется без медиазапроса. */
@media (max-width: 430px) {
  .doc-composer-actions { grid-template-columns: minmax(0, 1fr); }
}

/* ── Непрочитанная задача: как непрочитанное письмо — точка и плотный заголовок ── */
.office-task-row.is-unread .office-task-open strong { font-weight: 780; color: var(--ink); }
.office-task-unread-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, #55f2d3);
  box-shadow: 0 0 0 3px rgba(85, 242, 211, .18);
}
.office-task-row.is-unread { box-shadow: inset 3px 0 0 var(--accent, #55f2d3); }
/* Точка и счётчик комментариев не должны налезать друг на друга. */
.office-task-row.is-unread .task-comment-badge { right: 30px; }

/* ─────────────────────────────────────────────────────────────────────────────
   БУХГАЛТЕРИЯ: переключатель раздела, сводка, лента расходов
   ───────────────────────────────────────────────────────────────────────────── */
.doc-mode-switch { margin: 0 0 14px; }
.acc-scope-switch { margin: 0 0 14px; }
.doc-pane.hidden { display: none; }

.acc-summary { display: grid; gap: 10px; margin-bottom: 14px; }
.acc-total-card {
  display: grid;
  gap: 3px;
  padding: 16px 16px 14px;
  border-radius: var(--r-lg, 16px);
  background: linear-gradient(160deg, rgba(85, 242, 211, .16), rgba(129, 120, 255, .12));
  border: 1px solid rgba(85, 242, 211, .3);
  box-shadow: var(--e-1, 0 6px 20px rgba(2, 9, 20, .28));
}
/* Карточка итога и строка «Средний чек / Прошлый период» лежали в обычном потоке
   без отступов и слипались в один блок. Раскладываем секцию сеткой с шагом. */
/* Смена периода в календаре: короткий въезд со стороны нажатой стрелки. Раньше экран
   вообще не двигался до ответа сервера, и переход читался как зависание. */
.calendar-period-stage { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .calendar-period-stage.shift-back { animation: calendar-slide-back .28s cubic-bezier(.22, .84, .3, 1); }
  .calendar-period-stage.shift-forward { animation: calendar-slide-forward .28s cubic-bezier(.22, .84, .3, 1); }
}
@keyframes calendar-slide-back {
  from { transform: translateX(-7%); opacity: .45; }
  to { transform: none; opacity: 1; }
}
@keyframes calendar-slide-forward {
  from { transform: translateX(7%); opacity: .45; }
  to { transform: none; opacity: 1; }
}

/* «Личная / Бизнес» — второстепенный выбор, а не действие: он тянулся во всю ширину
   и по весу спорил с «Добавить расход». Делаем уже основных кнопок и центрируем. */
.acc-scope-switch {
  width: min(100%, 240px);
  margin-inline: auto;
}
.acc-scope-switch .segment {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 12.5px;
}

.acc-currency-summary { display: grid; gap: 10px; }
.acc-currency-summary + .acc-currency-summary { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.acc-total-label { color: var(--ink-soft); font-size: var(--t-sm, 13px); font-weight: 620; }
.acc-total-value { color: var(--ink); font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.acc-total-meta { color: var(--ink-mute); font-size: 12.5px; }
.acc-delta { font-size: 12.5px; font-weight: 760; }
.acc-delta.up { color: var(--sig-alert, #ff8fa3); }
.acc-delta.down { color: var(--accent, #55f2d3); }

.acc-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-stat {
  display: grid;
  gap: 2px;
  padding: 11px 13px;
  border-radius: var(--r-md, 12px);
  background: var(--s-raised);
  border: 1px solid var(--hairline);
}
.acc-stat small { color: var(--ink-mute); font-size: 11.5px; }
.acc-stat b { color: var(--ink); font-size: var(--t-md, 15px); font-weight: 720; font-variant-numeric: tabular-nums; }

/* Колонки заданы на контейнере, а строки в него «проваливаются» через display: contents.
   Раньше сетка была у каждой строки отдельно, и колонки между строками не совпадали:
   названия, полоски и суммы стояли уступами — из-за разной длины сумм. */
.acc-bars {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) minmax(60px, 1.4fr) max-content;
  gap: 7px 9px;
  align-items: center;
  padding: 12px 13px;
  border-radius: var(--r-md, 12px);
  background: var(--s-sunken);
  border: 1px solid var(--hairline);
}
/* Полоска категории — кнопка-фильтр. display: contents оставляем, чтобы три её
   части по-прежнему попадали в колонки общей сетки и суммы стояли столбиком;
   поэтому подсветку выбранной категории вешаем на сами части. */
.acc-bar-row {
  display: contents;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  /* У кнопки браузерный text-align: center, и он наследуется в ячейки даже при
     display: contents — названия категорий вставали по центру колонки и левый край
     списка получался рваным. */
  text-align: left;
  cursor: pointer;
}
.acc-bar-row.active .acc-bar-name,
.acc-bar-row.active .acc-bar-value { color: var(--mint); }
.acc-bar-row.active .acc-bar-track { box-shadow: 0 0 0 1px rgba(85, 242, 211, .45); }
.acc-bar-row:focus-visible .acc-bar-track { outline: 2px solid var(--mint); outline-offset: 2px; }

/* Прочие валюты — строками внутри карточки итога, а не отдельными блоками. */
.acc-total-others {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.acc-total-other {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.acc-total-other small { color: var(--ink-mute); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.acc-total-other b { color: var(--ink); font-size: 15px; font-weight: 760; }
.acc-total-other em { color: var(--ink-mute); font-size: 11.5px; font-style: normal; margin-left: auto; }

/* Плашка активного фильтра над лентой трат. */
.acc-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 11px;
  border: 1px solid rgba(85, 242, 211, .32);
  border-radius: var(--r-pill);
  color: var(--mint);
  background: rgba(85, 242, 211, .09);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.acc-filter-chip em { color: var(--ink-mute); font-style: normal; font-weight: 600; }
.acc-filter-chip svg { width: 13px; height: 13px; }

.acc-bar-name { color: var(--ink-soft); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-bar-track { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.acc-bar-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent, #55f2d3), #8178ff); }
.acc-bar-value { color: var(--ink); font-size: 12.5px; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

.acc-period { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 8px; align-items: center; margin-bottom: 12px; }
.acc-period-nav {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm, 9px);
  color: var(--ink-soft); background: var(--s-raised); cursor: pointer;
}
.acc-period-nav svg { width: 18px; height: 18px; }
.acc-period-label {
  min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm, 9px);
  color: var(--ink); background: var(--s-raised);
  font-size: var(--t-md, 15px); font-weight: 700; cursor: pointer;
}

.acc-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
.acc-actions button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; white-space: normal; line-height: 1.15; font-size: 13px; }
.acc-actions svg { width: 17px; height: 17px; flex: 0 0 auto; }
@media (max-width: 430px) {
  .acc-actions { grid-template-columns: minmax(0, 1fr); }
}

.acc-list { display: grid; gap: 14px; }
.acc-day { display: grid; gap: 8px; }
.acc-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 2px; }
.acc-day-head span { color: var(--ink-mute); font-size: 12px; font-weight: 660; text-transform: capitalize; }
.acc-day-head strong { color: var(--ink-soft); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.acc-swipe { position: relative; border-radius: var(--r-md, 12px); overflow: hidden; }
.acc-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 12px 13px;
  border-radius: var(--r-md, 12px);
  background: var(--s-raised);
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.acc-card-icon { font-size: 19px; text-align: center; }
.acc-card-main { min-width: 0; display: grid; gap: 2px; }
.acc-card-main strong { color: var(--ink); font-size: var(--t-sm, 13px); font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card-main small { color: var(--ink-mute); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card-items { color: var(--accent, #55f2d3); font-size: 11px; font-weight: 640; }
/* Адрес заведения и оценка: чек через месяц должен отвечать не только «сколько»,
   но и «что это было за место» и «стоит ли туда возвращаться». */
.acc-card-address { display: block; margin-top: 2px; color: #8fa2bd; font-size: 11px; line-height: 1.35; }
.acc-card-rating { display: inline-flex; align-items: center; gap: 1px; margin-top: 5px; }
.acc-star {
  min-width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .22);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, transform .12s ease;
}
.acc-star.on { color: #f4cb73; }
.acc-star:active { transform: scale(.88); }
.acc-star-clear {
  min-width: 24px;
  height: 26px;
  margin-left: 4px;
  border: 0;
  background: none;
  color: #7f8ca0;
  font-size: 11px;
  cursor: pointer;
}

.acc-card-comment { color: var(--ink-soft); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card-amount { color: var(--ink); font-size: var(--t-md, 15px); font-weight: 740; font-variant-numeric: tabular-nums; white-space: nowrap; }

.acc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 400px) { .acc-form-row { grid-template-columns: minmax(0, 1fr); } }
.acc-items { display: grid; gap: 6px; padding: 12px 13px; border-radius: var(--r-md, 12px); background: var(--s-sunken); border: 1px solid var(--hairline); }
.acc-items > strong { color: var(--ink); font-size: var(--t-sm, 13px); }
.acc-item-row { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; color: var(--ink-soft); font-size: 12.5px; }
.acc-item-row span { min-width: 0; overflow-wrap: anywhere; }
.acc-item-row em { color: var(--ink-mute); font-style: normal; }
.acc-item-row b { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Пакет чеков: один компактный статус остаётся над формой от загрузки до сохранения.
   Так на телефоне всегда видно, какой снимок сейчас обрабатывается и сколько осталось. */
.receipt-batch-card {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
  padding: 13px;
  border: 1px solid rgba(85, 242, 211, .24);
  border-radius: var(--r-lg, 16px);
  background: linear-gradient(145deg, rgba(85, 242, 211, .09), rgba(129, 120, 255, .08));
  box-shadow: inset 0 1px rgba(255, 255, 255, .03);
}
.receipt-batch-overview { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.receipt-batch-overview strong { color: var(--ink); font-size: 14px; }
.receipt-batch-overview span { color: var(--mint); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.receipt-batch-dots { display: grid; grid-template-columns: repeat(var(--receipt-count, 10), minmax(4px, 1fr)); grid-auto-flow: column; gap: 4px; }
.receipt-batch-dots i { height: 4px; border-radius: 99px; background: rgba(176, 200, 239, .14); }
.receipt-batch-dots i.current { background: #8178ff; box-shadow: 0 0 0 1px rgba(129, 120, 255, .24); }
.receipt-batch-dots i.saved { background: var(--mint); }
.receipt-batch-dots i.skipped { background: rgba(176, 200, 239, .4); }
.receipt-batch-dots i.failed { background: var(--sig-alert, #ff8fa3); }
.receipt-batch-current { min-width: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 11px; }
.receipt-batch-current > img,
.receipt-batch-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: rgba(6, 21, 36, .42);
}
.receipt-batch-placeholder { font-size: 23px; }
.receipt-batch-current > span { min-width: 0; display: grid; gap: 4px; }
.receipt-batch-current strong,
.receipt-batch-current small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-batch-current strong { color: var(--ink); font-size: 13px; }
.receipt-batch-current small { color: var(--ink-mute); font-size: 11.5px; }
.receipt-batch-card.error .receipt-batch-current small { color: var(--sig-alert, #ff8fa3); }
.receipt-batch-progress { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(176, 200, 239, .12); }
.receipt-batch-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #8178ff); transition: width .2s ease; }
.receipt-batch-card.analyzing .receipt-batch-progress i { animation: receipt-batch-pulse 1.25s ease-in-out infinite; }
@keyframes receipt-batch-pulse { 50% { opacity: .5; transform: scaleX(.94); transform-origin: left; } }

/* Выбор режима: лента снимков сверху и два крупных варианта под ней. Мелкие кнопки
   в ряд здесь не годятся — выбор делается один раз и определяет, один расход
   получится или пять. */
.receipt-mode-strip { display: flex; gap: 8px; margin-bottom: 14px; }
.receipt-mode-strip img,
.receipt-mode-strip span {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  border-radius: 12px;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 25px;
  background: rgba(6, 21, 36, .42);
}
.receipt-mode-options { display: grid; gap: 10px; }
.receipt-mode-option {
  display: grid;
  gap: 3px;
  padding: 14px;
  text-align: left;
  border: 1px solid rgba(176, 200, 239, .16);
  border-radius: var(--r-lg, 16px);
  background: rgba(255, 255, 255, .03);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.receipt-mode-option:first-child { border-color: rgba(85, 242, 211, .34); background: linear-gradient(145deg, rgba(85, 242, 211, .1), rgba(129, 120, 255, .08)); }
.receipt-mode-option strong { color: var(--ink); font-size: 15px; }
.receipt-mode-option small { color: var(--ink-mute); font-size: 12.5px; line-height: 1.35; }
.receipt-mode-option:active { transform: scale(.99); }
.receipt-batch-error { margin: 0 0 14px; padding: 12px 13px; border: 1px solid rgba(255, 143, 163, .28); border-radius: var(--r-md, 12px); background: rgba(255, 143, 163, .08); }
.receipt-batch-error strong { color: #ffdbe2; font-size: 13px; }
.receipt-batch-error p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.receipt-batch-actions { margin-top: 0; }
@media (prefers-reduced-motion: reduce) {
  .receipt-batch-progress i { transition: none; }
  .receipt-batch-card.analyzing .receipt-batch-progress i { animation: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ПЕРЕКЛЮЧАТЕЛИ И ПОЛЕ ДАТЫ
   ───────────────────────────────────────────────────────────────────────────── */

/* Базовый .segmented был жёстко трёхколоночным. У переключателей «Документы /
   Бухгалтерия» и «Личная / Бизнес» по две кнопки — третья колонка оставалась
   пустой, и подписи стояли не по центру. Колонки теперь создаются по числу
   кнопок, поэтому любой переключатель делит ширину поровну. */
.segmented {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
}
.calendar-segmented { grid-auto-columns: minmax(0, 1fr); }
.segment { display: grid; place-items: center; text-align: center; }

/* Поле даты: системный контрол на iOS требует больше ширины, чем колонка формы,
   а gridовый элемент по умолчанию отказывается ужиматься (min-width: auto) — из-за
   этого дата вылезала за правый край модалки и стояла прижатой к краю. */
.acc-form-row > * { min-width: 0; }
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="time"] {
  min-width: 0;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.field input[type="date"]::-webkit-date-and-time-value,
.field input[type="datetime-local"]::-webkit-date-and-time-value,
.field input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
  min-height: 1.2em;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: auto;
  padding: 0;
  opacity: .5;
  filter: invert(1);
}

/* Прогресс загрузки файла: без него отправка фото выглядела как зависание экрана. */
.upload-progress {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 240;
  width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke, rgba(255, 255, 255, .12));
  background: var(--surface-raised, rgba(22, 28, 38, .96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  backdrop-filter: blur(12px);
}
.upload-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.upload-progress-label {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-progress-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: .7;
}
.upload-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.upload-progress-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #55f2d3);
  transition: width .18s ease-out;
}
/* Байты ушли, работает сервер — полоса перестаёт врать про проценты и «дышит». */
.upload-progress.is-processing .upload-progress-bar { animation: upload-pulse 1.4s ease-in-out infinite; }
@keyframes upload-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.mail-meeting-card.is-added { border-color: rgba(85, 242, 211, .5); background: var(--accent-quiet, rgba(85, 242, 211, .14)); }
.mail-meeting-card.is-removed { opacity: .55; }
.mail-ai-progress { display: flex; align-items: center; gap: 8px; opacity: .8; }
.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: var(--accent, #55f2d3);
  animation: spinner-turn .7s linear infinite;
}
@keyframes spinner-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .upload-progress-bar { transition: none; }
  .upload-progress.is-processing .upload-progress-bar,
  .spinner { animation: none; }
}

/* Приоритет письма виден до открытия: цветная кромка слева, значок уровня рядом
   с отправителем и строка-причина. Раньше сводка писала «требует внимания: 1»,
   а какое именно письмо — приходилось искать глазами по всему списку. */
.mail-row {
  border-left: 3px solid transparent;
  transition: border-color .18s ease, background .18s ease;
}
.mail-row.mail-level-very_important {
  border-left-color: var(--danger, #ff6b81);
  background: linear-gradient(90deg, rgba(255, 107, 129, .12), transparent 42%);
}
.mail-row.mail-level-important {
  border-left-color: var(--accent, #55f2d3);
  background: linear-gradient(90deg, rgba(85, 242, 211, .1), transparent 42%);
}
.mail-row.mail-level-promotion {
  border-left-color: rgba(255, 255, 255, .1);
}
/* Реклама не кричит: приглушаем текст, но письмо остаётся читаемым и кликабельным. */
.mail-row.mail-level-promotion .mail-subject,
.mail-row.mail-level-promotion .mail-preview,
.mail-row.mail-level-promotion .mail-sender { opacity: .62; }

.mail-priority-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted, rgba(255, 255, 255, .62));
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--stroke, rgba(255, 255, 255, .12));
}
.mail-priority-badge span { font-weight: 900; letter-spacing: .04em; }
.mail-priority-badge.very_important {
  color: #ffd9df;
  background: rgba(255, 107, 129, .2);
  border-color: rgba(255, 107, 129, .5);
}
.mail-priority-badge.important {
  color: #ccfff4;
  background: rgba(85, 242, 211, .16);
  border-color: rgba(85, 242, 211, .42);
}
/* Обычные письма не нуждаются в ярлыке — он только зашумляет список. */
.mail-priority-badge.normal { display: none; }
.mail-priority-badge.promotion { opacity: .8; }

.mail-priority-reason {
  display: block;
  margin: 2px 0 1px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted, rgba(255, 255, 255, .62));
}
.mail-row.mail-level-very_important .mail-priority-reason { color: #ffc2cc; }

/* Плитки статистики — это и фильтры: нажал «срочных» и видишь только их. */
.mail-overview-stat.interactive { cursor: pointer; }
.mail-overview-stat.active {
  border-color: var(--accent, #55f2d3);
  background: var(--accent-quiet, rgba(85, 242, 211, .1));
}


/* Переключатель разделов «Документы / Бухгалтерия» — по центру экрана. */
.doc-mode-switch { margin-inline: auto; }

/* Вложение над полем ввода: миниатюра + имя + полоса отправки, как в мессенджере. */
.attachment-card {
  min-width: 0;
  max-width: 240px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px 6px 6px;
  border: 1px solid var(--hairline, rgba(255, 255, 255, .12));
  border-radius: 12px;
  background: var(--s-raised, rgba(255, 255, 255, .05));
}
.attachment-card.failed { border-color: rgba(255, 125, 142, .35); background: rgba(255, 125, 142, .08); }
.attachment-card-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 9px;
  object-fit: cover;
  background: rgba(255, 255, 255, .07);
}
.attachment-card-thumb.is-file {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .03em;
  color: var(--ink-mute, rgba(255, 255, 255, .6));
}
.attachment-card-copy { min-width: 0; display: grid; gap: 2px; }
.attachment-card-name {
  font-size: 12.5px;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-card-copy small { color: var(--ink-mute, rgba(255, 255, 255, .6)); font-size: 11px; }
.attachment-card-track {
  display: block;
  height: 3px;
  margin-top: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
}
.attachment-card-track i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent, #55f2d3);
  transition: width .18s ease-out;
}
@media (prefers-reduced-motion: reduce) { .attachment-card-track i { transition: none; } }

/* Фото в переписке по образцу мессенджеров: снимок во всю ширину пузыря, подпись под
   ним, время — в правом нижнем углу. Рамок вокруг снимка нет ни в каком случае.

   Скругление вешаем на сам снимок, а НЕ через overflow: hidden на пузыре: overflow
   обнуляет автоматический минимальный размер элемента сетки, строка схлопывалась,
   и подпись со временем обрезало. */
.bubble.has-media { padding: 0; }
.bubble.has-media .message-attachments { margin: 0; gap: 2px; }
/* Снимок тянется на всю ширину пузыря. Базовый .thread-media ограничен 290px — из-под
   более широкого пузыря торчал фон, и фото выглядело вставкой, а не самим сообщением. */
.bubble.has-media .thread-media { width: 100%; max-width: 100%; min-width: 0; }
.bubble.has-media .message-attachments { display: block; }
.bubble.has-media .thread-media,
.bubble.has-media .thread-media img { border-radius: 18px 18px 0 0; }
/* Подпись и время получают отступы сами — у пузыря их больше нет. */
.bubble.has-media .agent-message-content { display: block; padding: 8px 13px 0; }
.bubble.has-media .agent-message-meta { margin-top: 4px; padding: 0 13px 8px; }
.bubble.has-media .agent-reply-quote { margin: 8px 8px 6px; }

/* Альбом сгенерированных картинок. Раньше при трёх вариантах они стояли столбиком
   на всю ширину, каждая со скруглением только сверху: сравнить их было нельзя, а
   выглядело как склейка. Теперь раскладка зависит от количества, а внешние углы
   режет сам контейнер — по-тайловые радиусы для каждой позиции не нужны. */
.bubble.has-media .message-attachments[data-media-count] {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
}
.bubble.media-only .message-attachments[data-media-count] { border-radius: 18px; }
.bubble.has-media .message-attachments[data-media-count] .thread-media { width: 100%; max-width: 100%; min-width: 0; border-radius: 0; }
.bubble.has-media .message-attachments[data-media-count] .thread-media img { border-radius: 0; }

/* Один снимок живёт своей пропорцией: обрезать единственную картинку незачем. */
.bubble.has-media .message-attachments[data-media-count="1"] .thread-media img { max-height: 420px; object-fit: cover; }

.bubble.has-media .message-attachments[data-media-count="2"],
.bubble.has-media .message-attachments[data-media-count="3"],
.bubble.has-media .message-attachments[data-media-count="4"] { grid-template-columns: 1fr 1fr; }
.bubble.has-media .message-attachments[data-media-count="2"] .thread-media img,
.bubble.has-media .message-attachments[data-media-count="4"] .thread-media img { aspect-ratio: 4 / 3; max-height: none; height: 100%; }

/* Три варианта: первый крупно во всю ширину, два других под ним. Так видно и
   главный кадр, и что есть выбор. */
.bubble.has-media .message-attachments[data-media-count="3"] .thread-media:first-child { grid-column: 1 / -1; }
.bubble.has-media .message-attachments[data-media-count="3"] .thread-media:first-child img { aspect-ratio: 16 / 10; max-height: none; height: 100%; }
.bubble.has-media .message-attachments[data-media-count="3"] .thread-media:not(:first-child) img { aspect-ratio: 4 / 3; max-height: none; height: 100%; }

/* Нажатие на плитку заметно: альбом кликабелен целиком, и это должно быть видно. */
.bubble.has-media .message-attachments[data-media-count] .thread-media { transition: opacity .15s ease; }
.bubble.has-media .message-attachments[data-media-count] .thread-media:active { opacity: .82; }
@media (hover: hover) {
  .bubble.has-media .message-attachments[data-media-count] .thread-media:hover { opacity: .92; }
}

/* Только снимок, без подписи: он занимает пузырь целиком, время ложится поверх. */
.bubble.media-only { position: relative; background: transparent; box-shadow: none; }
.bubble.media-only .agent-message-content { display: none; }
.bubble.media-only .thread-media,
.bubble.media-only .thread-media img { border-radius: 18px; }
.bubble.media-only.user .thread-media,
.bubble.media-only.user .thread-media img { border-bottom-right-radius: 6px; }
.bubble.media-only.agent .thread-media,
.bubble.media-only.agent .thread-media img { border-bottom-left-radius: 6px; }
.bubble.media-only .agent-message-meta {
  position: absolute;
  right: 8px;
  bottom: 8px;
  margin: 0;
  padding: 3px 8px;
  border-radius: 9px;
  color: rgba(255, 255, 255, .95);
  background: rgba(4, 10, 18, .58);
  backdrop-filter: blur(10px);
}
.agent-message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 7px;
}
.agent-message-footer:has(.agent-feedback) { justify-content: space-between; }
.bubble .agent-message-footer .agent-message-meta { margin: 0; padding: 0; }
.agent-feedback { display: inline-flex; align-items: center; gap: 3px; }
.agent-feedback button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: rgba(226, 236, 250, .58);
  background: transparent;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.agent-feedback button svg { width: 17px; height: 17px; }
.agent-feedback button:active { transform: scale(.92); }
.agent-feedback button.active { color: #55f2d3; background: rgba(85, 242, 211, .13); }
@media (hover: hover) { .agent-feedback button:hover { color: #f6f9ff; background: rgba(255, 255, 255, .08); } }
.bubble.has-media .agent-message-footer { margin-top: 4px; padding: 0 13px 8px; }
.bubble.media-only .agent-message-footer { margin: 0; }
.bubble.media-only .agent-feedback { display: none; }

/* Место под снимок резервируется заранее: без этого пузырь схлопывался в ноль и
   подпрыгивал в момент загрузки — прокрутка дёргалась. Плюс шиммеру нужен
   позиционированный контейнер, иначе он растекался по всему пузырю. */
.thread-media { position: relative; }
.thread-image:not(.loaded):not(.failed) { min-height: 190px; background: #12233a; }

/* Контуры внутри переписки убраны — в мессенджерах их нет, и от них весь «старый» вид. */
.agent-reply-quote { border-radius: 9px; border-left-width: 3px; }
.agent-file-card,
.thread-file { border: 0; }
.agent-file-card { background: rgba(85, 242, 211, .12); }
.thread-file { background: rgba(110, 182, 255, .1); }

/* Подряд идущие сообщения одного автора собираются в группу, как в мессенджерах:
   зазор меньше, а смежные углы поджаты — видно, что это одна очередь реплик. */
.conversation.live .bubble.user + .bubble.user,
.conversation.live .bubble.agent + .bubble.agent { margin-top: -7px; }
.conversation.live .bubble.user:has(+ .bubble.user) { border-bottom-right-radius: 7px; }
.conversation.live .bubble.user + .bubble.user { border-top-right-radius: 7px; }
.conversation.live .bubble.agent:has(+ .bubble.agent) { border-bottom-left-radius: 7px; }
.conversation.live .bubble.agent + .bubble.agent { border-top-left-radius: 7px; }

/* Обёртка нужна, чтобы кнопку «вниз» можно было прижать к нижнему краю переписки:
   сама переписка прокручивается, и внутри неё кнопка уезжала бы вместе с текстом. */
.conversation-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.conversation-wrap > .conversation.live { flex: 1 1 auto; min-height: 0; }
.conversation-jump {
  position: absolute;
  right: 6px;
  bottom: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink, #e8f0fb);
  background: var(--s-raised, rgba(30, 44, 66, .96));
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(8px) scale(.9);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.conversation-jump.visible { opacity: 1; transform: none; pointer-events: auto; }
.conversation-jump svg { width: 19px; height: 19px; }
.conversation-jump:active { transform: scale(.93); }
@media (prefers-reduced-motion: reduce) { .conversation-jump { transition: none; } }

.task-view { display: grid; gap: 16px; }
.task-view-title { margin: 0; color: var(--ink); font-size: clamp(22px, 5vw, 30px); line-height: 1.15; overflow-wrap: anywhere; }
.task-view-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.task-view-facts > span,
.task-view-context { padding: 12px 14px; border: 1px solid rgba(176,200,239,.12); border-radius: var(--r-md); background: rgba(255,255,255,.025); }
.task-view-facts small,
.task-view-context small { display: block; margin-bottom: 4px; color: var(--ink-mute); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.task-view-facts strong { color: var(--ink); font-size: 14px; }
.task-view-context p { margin: 0; color: var(--ink-soft); line-height: 1.55; white-space: pre-wrap; }

@media (min-width: 900px) {
  .app { max-width: 1180px; margin-inline: auto; box-shadow: 0 0 80px rgba(0,0,0,.22); }
}

/* Фирменное написание сохраняет строчную my и заглавную S. */
.boot-kicker, .auth-kicker, .brand-copy .eyebrow { text-transform: none; }

/* Одна линия со стрелкой во всех фирменных знаках. */
/* Draw the reveal mask, preserving the approved filled lower contour. */
.mysasha-road { stroke-dasharray: 240; stroke-dashoffset: 240; animation: mysasha-draw 1s ease-out forwards; }
.mysasha-arrow { opacity: 0; animation: mysasha-arrow-in .3s ease-out .8s forwards; }
@keyframes mysasha-draw { to { stroke-dashoffset: 0; } }
@keyframes mysasha-arrow-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .mysasha-road { animation: none; stroke-dashoffset: 0; }
  .mysasha-arrow { animation: none; opacity: 1; }
}

/* ─── Рабочие документы ─────────────────────────────────────────────────────── */

.doc-library-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 8px 0 16px; }
.doc-library-intro > div:first-child { display: grid; gap: 4px; }
.doc-library-intro strong { color: var(--ink); font-size: 22px; line-height: 1.15; }
.doc-library-intro span { color: var(--ink-mute); font-size: 13px; }
.doc-library-search { margin-bottom: 18px; }
.doc-library-search .doc-search { width: min(100%, 560px); }
.doc-working-head { margin-top: 0; }
.doc-actions-row { display: flex; gap: 8px; margin: 0; flex-wrap: wrap; }
.doc-actions-row .doc-action {
  width: auto; height: auto; display: inline-flex;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.doc-actions-row .doc-action.primary { background: var(--accent); border-color: var(--accent); color: #04201a; font-weight: 600; }
.doc-work-card { cursor: pointer; grid-template-columns: 72px minmax(0, 1fr) 30px; min-height: 82px; }
.doc-work-card .doc-badge { width: 72px; min-width: 72px; min-height: 46px; }
.doc-work-card .doc-card-main h4 { -webkit-line-clamp: 1; }
.doc-work-card .doc-card-meta:empty { display: none; }
.doc-work-card .doc-card-sub { display: block; color: var(--ink-mute); font-size: 12px; margin-top: 2px; }
.doc-work-open { color: var(--ink-mute); font-size: 28px; justify-self: end; }
.doc-tone-file { background: rgba(148, 163, 184, .18); color: var(--ink-mute); }

/* Рабочее пространство: на широком экране редактор и чат рядом, на телефоне —
   вкладки. Позиция прокрутки и черновик ввода при переключении не теряются. */
.doc-workspace {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  /* Непрозрачный фон обязателен: слой лежит поверх экрана приложения, и сквозь
     полупрозрачный сквозь текст документа просвечивали задачи и почта. */
  background: #09111f; animation: docWorkspaceIn .18s ease-out;
}
@keyframes docWorkspaceIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.doc-workspace.is-busy { cursor: progress; }
.doc-ws-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.doc-ws-back { border: 0; background: transparent; color: var(--ink); font-size: 28px; line-height: 1; cursor: pointer; padding: 0 6px; }
.doc-ws-title { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 17px; font-weight: 600; padding: 6px; }
.doc-ws-title:focus { outline: 2px solid var(--accent); border-radius: 8px; }
.doc-ws-status { font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.doc-ws-status[data-tone="dirty"] { color: #d97706; }
.doc-ws-status[data-tone="busy"] { color: var(--accent); }
.doc-ws-status[data-tone="error"] { color: #dc2626; }
/* Панели инструментов сверху нет. Действия документа открываются нижним листом:
   так на телефоне не пропадает страница документа, и верх экрана остаётся под
   название и состояние сохранения. */
.doc-actions-fab {
  position: absolute; right: 16px; bottom: 16px; z-index: 12;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: #131f31; color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,.34);
}
.doc-actions-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 14;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  background: #111b2b; box-shadow: 0 -18px 40px rgba(0,0,0,.4);
}
.doc-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.doc-actions-grid button, .doc-actions-grid select {
  min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 14px; cursor: pointer;
}
.doc-actions-close { width: 100%; margin-top: 10px; min-height: 42px; border: 0; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--ink-mute); cursor: pointer; }
.doc-file-hint { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: rgba(110,182,255,.08); color: var(--ink-mute); font-size: 12.5px; }

.doc-ws-tabs { display: none; gap: 6px; padding: 8px 12px; }
.doc-ws-tabs button { flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--ink-mute); border-radius: 10px; padding: 8px; }
.doc-ws-tabs button.active { background: var(--accent); color: #04201a; border-color: var(--accent); }

.doc-ws-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; }
.doc-ws-editor-wrap { position: relative; overflow: auto; padding: 24px; min-width: 0; background: #111b2b; }
.doc-workspace[data-doc-engine="onlyoffice"] .doc-ws-editor-wrap,
.doc-workspace[data-doc-engine="collabora"] .doc-ws-editor-wrap { overflow: hidden; padding: 0; background: #f3f3f3; }
.doc-workspace[data-doc-engine="onlyoffice"] .doc-editor-stage,
.doc-workspace[data-doc-engine="collabora"] .doc-editor-stage { width: 100%; height: 100%; }
.doc-onlyoffice-frame, .doc-onlyoffice-frame > div, .doc-onlyoffice-frame iframe { width: 100%; height: 100%; min-height: 0; border: 0; display: block; }
.doc-editor-stage.has-source { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr); gap: 16px; align-items: start; }
.doc-ocr-source { position: sticky; top: 0; max-height: calc(100vh - 160px); overflow: auto; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.06); }
.doc-ocr-source-head { display: flex; flex-direction: column; margin-bottom: 10px; }
.doc-ocr-source-head small { color: var(--ink-mute); }
.doc-ocr-source figure { margin: 0 0 12px; }
.doc-ocr-source img { display: block; width: 100%; background: #fff; border-radius: 8px; }
.doc-ocr-source figcaption { margin-top: 4px; color: var(--ink-mute); font-size: 12px; text-align: center; }
.doc-original-pane { width: min(100%, 920px); height: calc(100vh - 110px); min-height: 520px; margin: 0 auto; overflow: auto; background: #272727; border-radius: 6px; box-shadow: 0 18px 55px rgba(0,0,0,.35); }
.doc-original-pages { width: 100%; min-height: 100%; padding: 10px; }
.doc-pdf-page { position: relative; margin: 0 auto 10px; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.3); }
.doc-pdf-page canvas { display: block; width: 100%; height: 100%; margin: 0; }
.doc-pdf-text-layer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; }
.doc-pdf-text-layer span, .doc-pdf-text-layer br { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; cursor: text; }
.doc-pdf-text-layer ::selection { background: rgba(37, 99, 235, .34); }
.doc-original-loading { min-height: 240px; display: grid; place-items: center; padding: 30px; color: #e5e7eb; text-align: center; }
.doc-editor { position: relative; max-width: 794px; margin: 0 auto; color: #14161a; display: grid; gap: 20px; counter-reset: doc-page; }
.doc-page { position: relative; box-sizing: border-box; width: 100%; min-height: 1123px; padding: 74px 72px; background: #fff; border-radius: 4px; box-shadow: 0 18px 55px rgba(0,0,0,.28); counter-increment: doc-page; }
.doc-page::after { content: counter(doc-page); position: absolute; right: 28px; bottom: 22px; color: #89919d; font-size: 11px; }
.doc-editor a { color: #0b57d0; }
.doc-editor h1, .doc-editor h2, .doc-editor h3, .doc-editor h4 { margin: 18px 0 10px; line-height: 1.25; }
.doc-editor p { margin: 0 0 12px; line-height: 1.6; }
.doc-editor ul, .doc-editor ol { margin: 0 0 12px 20px; }
.doc-editor .doc-block:focus { outline: 2px solid rgba(16, 185, 129, .35); outline-offset: 4px; border-radius: 4px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 0 0 14px; }
.doc-table td, .doc-table th { border: 1px solid var(--line); padding: 6px 8px; font-size: 14px; }
.doc-figure { margin: 0 0 16px; }
.doc-figure img { max-width: 100%; border-radius: 8px; cursor: pointer; }
/* Подпись пишется чёрными чернилами на прозрачном фоне — ровно так она нужна в
   готовом файле. На тёмном листе редактора её не видно, поэтому здесь она лежит
   на белой «бумаге»: человек видит то же, что уедет в PDF. */
.doc-figure[data-block-type="signature"] img { background: #fff; padding: 6px 10px; }
.doc-signature { position: absolute; z-index: 3; margin: 0; cursor: move; touch-action: none; min-width: 70px; }
.doc-signature img { display: block; width: 100%; user-select: none; pointer-events: none; }
.doc-signature-resize { position: absolute; right: -12px; bottom: -12px; width: 30px; height: 30px; border: 1px solid #8190a5; border-radius: 50%; background: #fff; color: #172033; cursor: nwse-resize; touch-action: none; }
.doc-figure figcaption { font-size: 13px; color: var(--ink-mute); margin-top: 6px; }
.doc-page-break { display: none; }
.doc-readonly { padding: 24px; color: var(--ink-mute); }
.doc-insert-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.doc-insert-actions > * { justify-content: center; text-align: center; }
.doc-insert-actions .ghost { grid-column: 1 / -1; }

.doc-selection-menu { position: absolute; display: flex; align-items: center; gap: 4px; max-width: calc(100% - 16px); overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 8; }
.doc-selection-menu button { border: 0; background: transparent; color: var(--ink); font-size: 13px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.doc-selection-menu button:hover { background: rgba(16,185,129,.12); }
/* Начертания идут после действий ИИ и отделяются слева: на узком экране первым
   видно то, ради чего окно и открывают. */
.doc-selection-format { display: flex; padding-left: 4px; margin-left: 2px; border-left: 1px solid var(--line); }

.doc-suggestion { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 16px auto 0; max-width: 760px; }
.doc-suggestion-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.doc-suggestion-head small { color: var(--ink-mute); font-size: 12px; }
.doc-suggestion-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.doc-suggestion-side span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mute); }
.doc-suggestion-side p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }
.doc-suggestion-next p { color: var(--ink); }
.doc-suggestion-actions { display: flex; gap: 8px; margin-top: 12px; }

.doc-ws-chat { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.doc-chat-messages { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.doc-chat-message { padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; max-width: 92%; }
.doc-chat-message.from-user { align-self: flex-end; background: var(--accent); color: #04201a; }
.doc-chat-message.from-agent { align-self: flex-start; background: var(--surface-2, rgba(148,163,184,.14)); }
.doc-chat-message p { margin: 0; white-space: pre-wrap; }
.doc-chat-message small { display: block; margin-top: 4px; font-size: 11px; opacity: .7; }
.doc-chat-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.doc-chat-composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #151f32; color: var(--ink); font: inherit; }
.doc-versions { border-top: 1px solid var(--line); max-height: 26vh; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.doc-version { text-align: left; border: 0; background: transparent; color: var(--ink); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.doc-version:hover { background: rgba(148,163,184,.14); }
.doc-version small { display: block; color: var(--ink-mute); font-size: 11px; }

/* Подпись и сканер */
.modal-layer.signature-modal .modal-panel { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
.signature-pad { display: flex; min-height: calc(100vh - 110px); flex-direction: column; }
.signature-pad canvas { width: 100%; flex: 1; min-height: 260px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; touch-action: none; }
.signature-hint { font-size: 12px; color: var(--ink-mute); margin: 8px 0 0; }
.scan-view { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 46vh; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 8% 6%; border: 2px solid rgba(16,185,129,.9); border-radius: 8px; pointer-events: none; }
.scan-fallback { padding: 16px; color: #fff; font-size: 14px; }
.scan-modes { display: flex; gap: 6px; margin: 10px 0; }
.scan-modes button { flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px; }
.scan-modes button.active { background: var(--accent); color: #04201a; border-color: var(--accent); }
.scan-pages { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.scan-page { position: relative; margin: 0; flex: 0 0 92px; }
.scan-page img { width: 92px; height: 124px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.scan-page figcaption { text-align: center; font-size: 12px; color: var(--ink-mute); }
.scan-page-actions { position: absolute; top: 2px; left: 2px; right: 2px; display: flex; justify-content: flex-end; gap: 2px; }
.scan-page-actions button { border: 0; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; width: 22px; height: 22px; cursor: pointer; }
.scan-page-actions button:disabled { opacity: .3; }
.scan-crop-editor { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.scan-crop-stage { position: relative; margin-top: 8px; max-height: 48vh; overflow: hidden; background: #000; }
.scan-crop-stage img { display: block; width: 100%; max-height: 48vh; object-fit: contain; }
.scan-crop-stage button { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,.8); touch-action: none; }
.doc-image-actions { display: flex; flex-direction: column; gap: 8px; }
.doc-image-preview img { width: 100%; border-radius: 10px; margin-bottom: 10px; }

@media (max-width: 900px) {
  .doc-library-intro { align-items: stretch; flex-direction: column; gap: 12px; }
  .doc-library-intro .doc-actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-library-intro .doc-action { justify-content: center; min-height: 42px; padding: 9px 8px; font-size: 13px; white-space: normal; line-height: 1.2; text-align: center; }
  .doc-library-intro .doc-action:last-of-type { grid-column: 1 / -1; }
  .doc-work-card { grid-template-columns: 58px minmax(0, 1fr) 22px; gap: 10px; padding: 12px 10px; }
  .doc-work-card .doc-badge { width: 58px; min-width: 58px; min-height: 42px; font-size: 9.5px; }
  .doc-ws-head { padding: 7px 8px; }
  .doc-ws-title { font-size: 15px; }
  .doc-ws-status { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
  .doc-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-actions-fab { right: 12px; bottom: 76px; }
  .doc-ws-body { grid-template-columns: minmax(0, 1fr); }
  .doc-ws-tabs { display: flex; }
  .doc-ws-chat { border-left: 0; border-top: 1px solid var(--line); }
  .doc-workspace[data-doc-active-tab="document"] .doc-ws-chat { display: none; }
  .doc-workspace[data-doc-active-tab="chat"] .doc-ws-editor-wrap { display: none; }
  .doc-ws-editor-wrap { padding: 12px; }
  .doc-workspace[data-doc-engine="onlyoffice"] .doc-ws-editor-wrap,
  .doc-workspace[data-doc-engine="collabora"] .doc-ws-editor-wrap { padding: 0; }
  .doc-editor { width: 100%; gap: 12px; }
  .doc-page { min-height: calc((100vw - 24px) * 1.414); padding: 38px 28px 48px; border-radius: 3px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
  .doc-page::after { right: 18px; bottom: 15px; }
  .doc-original-pane { width: 100%; height: calc(100vh - 145px); min-height: 360px; }
  .doc-editor-stage.has-source { grid-template-columns: minmax(0, 1fr); }
  .doc-ocr-source { position: static; max-height: 42vh; }
  .doc-suggestion-body { grid-template-columns: minmax(0, 1fr); }
}

.agent-history-search { display: flex; gap: 8px; padding: 6px 16px; flex-wrap: wrap; }
.agent-history-search input { flex: 1 1 140px; width: 0; min-width: 100px; border: 1px solid var(--line, #42506b); border-radius: 14px; background: transparent; color: inherit; padding: 8px 10px; min-height: 44px; }
.agent-history-search button { min-height: 44px; border-radius: 14px; padding: 8px 10px; background: transparent; color: inherit; border: 1px solid var(--line, #42506b); }

.chat-retention-select { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid rgba(176, 200, 239, .18); border-radius: 12px; color: #f5f8ff; background: #151f32; font: inherit; font-size: 16px; }
