:root.mobile-host {
  --mobile-gutter: 10px;
  --mobile-control-height: 42px;
}

:root.mobile-host body {
  min-width: 320px;
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 13px;
  -webkit-text-size-adjust: 100%;
}

:root.mobile-host .app-shell {
  display: block;
  min-height: 100vh;
  height: auto;
}

:root.mobile-host .topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 6px 8px;
  min-height: 0;
  padding: 7px var(--mobile-gutter);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(31, 41, 55, .08);
}

:root.mobile-host .brand {
  min-width: 42px;
  width: 42px;
  height: 42px;
  justify-content: center;
  border-radius: 9px;
}

:root.mobile-host .brand-mark { margin-left: 0; }
:root.mobile-host .brand-title { display: none; }
:root.mobile-host .app-page-title { align-self: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
:root.mobile-host .userbar { gap: 4px; }
:root.mobile-host .userbar #userInfo { display: none; }
:root.mobile-host .userbar button { min-height: 36px; padding: 7px 9px; }
:root.mobile-host .backlog { grid-column: 1 / -1; grid-row: 2; display: flex; min-width: 0; overflow: hidden; }
:root.mobile-host .backlog button { min-height: 38px; max-width: 68%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root.mobile-host .backlog span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

:root.mobile-host .main-nav {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  order: 3;
  width: calc(100% + 2 * var(--mobile-gutter));
  margin: 0 calc(-1 * var(--mobile-gutter));
  padding: 2px var(--mobile-gutter) 1px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

:root.mobile-host .main-nav a {
  flex: 0 0 auto;
  min-width: auto;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 9px;
  white-space: nowrap;
  font-size: 12px;
}

:root.mobile-host .main-nav-toggle { display: none; }
:root.mobile-host .tracker-section,
:root.mobile-host .dailies-section,
:root.mobile-host .admin-section,
:root.mobile-host .profile-section { min-height: calc(100vh - 110px); overflow: visible; }
:root.mobile-host .tracker-page { height: auto; min-height: calc(100vh - 110px); }
:root.mobile-host .tracker-layout { display: block; min-height: 0; }
:root.mobile-host .tracker-sidebar { border: 0; border-bottom: 1px solid var(--line); padding: var(--mobile-gutter); }
:root.mobile-host .tracker-sidebar .sidebar-heading { margin-bottom: 6px; }
:root.mobile-host .tracker-search,
:root.mobile-host .tracker-filter,
:root.mobile-host .tracker-date-preset { margin-top: 9px; }
:root.mobile-host .tracker-search input,
:root.mobile-host .multi-select-button,
:root.mobile-host .tracker-date-preset input { min-height: var(--mobile-control-height); }
:root.mobile-host .tracker-content { display: block; min-height: 0; padding: var(--mobile-gutter); overflow: visible; }
:root.mobile-host .tracker-tabs-row { align-items: center; gap: 8px; flex-wrap: wrap; }
:root.mobile-host .tracker-tabs { flex: 1 1 100%; margin: 0 0 4px; }
:root.mobile-host .tracker-tabs button { flex: 1 1 0; min-width: 0; min-height: 40px; }
:root.mobile-host .tracker-result-count { padding: 3px 0 8px; }
:root.mobile-host .tracker-table-wrap { max-width: 100%; max-height: 62vh; }
:root.mobile-host .tracker-table th,
:root.mobile-host .tracker-table td { padding: 9px 8px; }
:root.mobile-host .tracker-pagination { flex-wrap: wrap; gap: 8px; padding: 9px 0 0; }
:root.mobile-host .tracker-pagination label { flex: 1 1 100%; }
:root.mobile-host .tracker-export { margin-left: 0; min-height: 40px; }

:root.mobile-host .dailies-content,
:root.mobile-host .vacations-section,
:root.mobile-host .admin-section,
:root.mobile-host .profile-section { padding: var(--mobile-gutter); }
:root.mobile-host .daily-controls-row { grid-template-columns: 1fr; gap: 9px; padding: 8px 0; }
:root.mobile-host .daily-department-picker { order: 1; }
:root.mobile-host .daily-member-add { order: 2; grid-auto-flow: row; }
:root.mobile-host .week-controls { order: 3; display: flex; flex-wrap: wrap; justify-content: flex-start; }
:root.mobile-host .daily-table-wrap { max-width: 100%; max-height: calc(100vh - 235px); overflow: auto; }
:root.mobile-host .daily-table { min-width: 860px; }
:root.mobile-host .daily-table thead th { top: 0; }
:root.mobile-host .daily-task-card { font-size: 13px; }

:root.mobile-host .vacations-layout,
:root.mobile-host .departments-admin-layout,
:root.mobile-host .admin-grid { display: block; }
:root.mobile-host .vacations-card,
:root.mobile-host .admin-card { margin-bottom: 10px; }
:root.mobile-host .vacation-form,
:root.mobile-host .vacation-row,
:root.mobile-host .admin-form,
:root.mobile-host .user-profile-fields,
:root.mobile-host .cron-task-form,
:root.mobile-host .profile-password-form { grid-template-columns: 1fr; }
:root.mobile-host .vacation-calendar { overflow-x: auto; }
:root.mobile-host .users-table-wrap,
:root.mobile-host .permissions-table-wrap { max-width: calc(100vw - 2 * var(--mobile-gutter)); }
:root.mobile-host .admin-tabs { gap: 4px; margin: 0 0 9px; padding-bottom: 3px; }
:root.mobile-host .admin-tab { min-height: 38px; padding: 8px 10px; }
:root.mobile-host .admin-block-heading { display: block; }
:root.mobile-host .admin-block-actions { justify-content: flex-start; margin-top: 8px; }
:root.mobile-host .profile-readonly-grid { grid-template-columns: 1fr; }
:root.mobile-host .profile-password-form h2,
:root.mobile-host .profile-password-form .hint { grid-column: auto; }
:root.mobile-host .telegram-settings-grid { grid-template-columns: 1fr 1fr; }

:root.mobile-host dialog {
  width: calc(100vw - 20px);
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  margin: auto;
}

:root.mobile-host .daily-task-dialog form,
:root.mobile-host .tracker-issue-dialog { padding: 13px; }
:root.mobile-host .tracker-issue-dialog-body dl { grid-template-columns: 1fr; gap: 3px; }
:root.mobile-host .tracker-issue-dialog-body dd { margin-bottom: 7px; }
:root.mobile-host .daily-task-dialog form { gap: 9px; }
:root.mobile-host .daily-task-dialog input,
:root.mobile-host .daily-task-dialog textarea,
:root.mobile-host .create-user-dialog input,
:root.mobile-host button { min-height: 40px; }

@media (min-width: 700px) {
  :root.mobile-host .main-nav { grid-column: 2; grid-row: 1; width: auto; margin: 0; padding: 0; }
  :root.mobile-host .backlog { grid-column: 1 / -1; }
}
