/* Phone layout only. The desktop planner and its original logo stay intact. */
.mobile-planner,
.mobile-bottom-nav {
  display: none;
}

/* A single assigned site uses the same box dimensions as the site picker. */
.topbar .location-fixed {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 205px;
  width: 205px;
  min-width: 205px;
  max-width: 205px;
  height: 42px;
  margin: 0;
  padding: 0 11px;
  border: 1px solid #d6e1e5;
  border-radius: 6px;
  background: #f5f8f9;
  color: #20383f;
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
}
.topbar .location-fixed .location-dot {
  display: inline-block;
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--location-color, #71808b);
}
.topbar .location-fixed > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media screen and (max-width: 700px) {
  html {
    scrollbar-gutter: auto;
    scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  body {
    background: #f5f8f9;
    -webkit-text-size-adjust: 100%;
  }
  #app {
    min-width: 0;
  }
  #app:has(.mobile-bottom-nav) {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
  button,
  button.small,
  button.flat {
    min-height: 44px;
    touch-action: manipulation;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .modal input:not([type="checkbox"]):not([type="radio"]),
  .modal select,
  .modal textarea,
  .time-toolbar select,
  .auth-form input,
  .candidate-search input {
    min-height: 44px;
    max-width: 100%;
    font-size: 16px;
  }
  textarea {
    resize: vertical;
    line-height: 1.5;
  }
  label,
  .modal label {
    font-size: 13px;
    line-height: 1.45;
  }
  .check-label,
  .deleted-times-toggle {
    min-height: 44px;
  }
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  /* Stable header: original logo and account above the location control. */
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 72px;
    height: auto;
    gap: 8px 12px;
    padding: max(10px, env(safe-area-inset-top, 0px)) 16px 12px;
    background: #fff;
    box-shadow: 0 2px 10px #20383f05;
  }
  .topbar .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .topbar .brand img {
    width: 134px;
    max-width: 100%;
    height: auto;
  }
  .topbar .account {
    grid-column: 2;
    grid-row: 1;
    gap: 6px;
    margin-left: auto;
  }
  .topbar .account .name,
  .topbar .nav {
    display: none;
  }
  .topbar .account > button {
    min-width: 44px;
    padding: 8px;
    font-size: 20px;
  }
  .topbar .location-switcher,
  .topbar .location-fixed {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 205px;
    min-width: 205px;
    max-width: 205px;
    height: 44px;
    margin: 0;
  }
  .topbar .location-switcher .location-select {
    height: 44px;
    min-height: 44px;
  }
  .topbar .location-switcher .location-option {
    min-height: 44px;
    font-size: 14px;
  }
  .topbar .location-fixed {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid #e0e9ec;
    border-radius: 7px;
    background: #f5f8f9;
    color: #20383f;
    font-size: 14px;
    font-weight: 600;
  }
  .location-fixed .location-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: var(--location-color, #71808b);
  }
  .location-fixed > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 70;
    inset: auto 0 0;
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-height: 68px;
    padding: 6px max(10px, env(safe-area-inset-right, 0px))
      calc(6px + env(safe-area-inset-bottom, 0px))
      max(10px, env(safe-area-inset-left, 0px));
    border-top: 1px solid #dce7eb;
    background: #fff;
    box-shadow: 0 -3px 18px #193c4808;
  }
  .mobile-bottom-nav > button {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 54px;
    padding: 6px 3px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #617782;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
  }
  .mobile-bottom-nav > button.active {
    border-color: #d3e9ec;
    background: #edf7f8;
    color: #087586;
  }
  .mobile-bottom-nav svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  .mobile-nav-label {
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: center;
  }

  /* A focused day replaces the wide desktop schedule. */
  .workspace {
    padding: 0;
  }
  .workspace > .schedule-toolbar,
  .workspace > .schedule-body {
    display: none;
  }
  .mobile-planner {
    display: block;
    min-width: 0;
    padding: 18px 16px 24px;
  }
  .mobile-week-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }
  .mobile-week-heading h1 {
    color: #172f39;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.5px;
  }
  .mobile-week-heading > button {
    min-width: 64px;
    flex-shrink: 0;
    border-color: #cfe2e7;
    background: #fff;
    color: #087586;
    font-size: 14px;
    font-weight: 600;
  }
  .mobile-week-switch {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid #dee9ed;
    border-radius: 12px;
    background: #fff;
  }
  .mobile-week-switch > button {
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f3f7f8;
    color: #315b68;
    font-size: 25px;
  }
  .mobile-week-switch > div {
    min-width: 0;
    text-align: center;
  }
  .mobile-week-switch strong,
  .mobile-week-switch span {
    display: block;
  }
  .mobile-week-switch strong {
    color: #203a45;
    font-size: 16px;
  }
  .mobile-week-switch span {
    margin-top: 3px;
    color: #607782;
    font-size: 12px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
  }
  .mobile-plan-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
  }
  .mobile-plan-summary > div {
    min-width: 0;
    padding: 14px;
    border: 1px solid #dce9ed;
    border-radius: 12px;
    background: #fff;
  }
  .mobile-plan-summary small {
    display: block;
    color: #607782;
    font-size: 12px;
    line-height: 1.5;
  }
  .mobile-plan-summary strong {
    display: block;
    margin-top: 5px;
    color: #126b78;
    font-size: 23px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
  }
  .mobile-day-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    margin: 17px 0;
  }
  .mobile-day-tabs > button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    min-height: 68px;
    padding: 9px 0 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #5b7380;
  }
  .mobile-day-tabs span {
    font-size: 11px;
    line-height: 1.1;
  }
  .mobile-day-tabs strong {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
  }
  .mobile-day-tabs > button.today {
    border-color: #c9e0e5;
    color: #087586;
  }
  .mobile-day-tabs > button.selected {
    border-color: #087f91;
    background: #087f91;
    color: #fff;
    box-shadow: 0 3px 8px #087f911f;
  }
  .mobile-day-tabs i {
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    visibility: hidden;
  }
  .mobile-day-tabs i.has-shift {
    visibility: visible;
  }
  .mobile-plan-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
  }
  .mobile-plan-controls select {
    flex: 1 1 130px;
    min-width: 0;
    padding: 10px;
    background: #fff;
    font-size: 16px;
  }
  .mobile-plan-controls .badge {
    font-size: 11px;
    padding: 7px 9px;
  }
  .mobile-plan-controls > button {
    flex: 0 0 auto;
    padding: 10px 12px;
    font-size: 13px;
  }
  .mobile-day-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 0 0 12px;
  }
  .mobile-day-heading h2 {
    color: #203a45;
    font-size: 18px;
    letter-spacing: -.3px;
  }
  .mobile-day-heading small {
    color: #607782;
    font-size: 12px;
  }
  .mobile-day-heading > button {
    min-width: 44px;
    margin-left: auto;
    border-color: #cadfe5;
    background: #fff;
    color: #087586;
    font-size: 21px;
  }
  .mobile-shift-list {
    display: grid;
    gap: 10px;
  }
  .mobile-shift-list .shift {
    min-height: 82px;
    margin: 0;
    padding: 13px 14px;
    border-color: #eadf9e;
    border-radius: 12px;
    background: #fff8d7;
    color: #223b46;
    box-shadow: 0 2px 5px #193c4805;
  }
  .mobile-shift-list .shift.assigned {
    border-color: #cfdfeb;
    background: #edf4fc;
  }
  .mobile-shift-list .shift.mine {
    border-left: 4px solid #0b8292;
  }
  .mobile-shift-list .shift-time {
    align-items: center;
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.4;
  }
  .mobile-shift-list .shift-time strong {
    font-size: 16px;
    font-weight: 650;
  }
  .mobile-shift-list .shift-time small {
    font-size: 12px;
  }
  .mobile-shift-list .shift-person {
    min-height: 25px;
    gap: 7px;
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.5;
  }
  .mobile-shift-list .shift-person .tiny-avatar {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    font-size: 9px;
  }
  .mobile-shift-list .shift-person-detail {
    min-width: 0;
    flex: 1;
    gap: 9px;
    line-height: 25px;
  }
  .mobile-shift-list .shift-person .hours-name {
    font-size: 14px;
    line-height: 25px;
  }
  .mobile-shift-list .shift-person-detail .plan-hour-pair {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 25px;
  }
  .mobile-shift-list .applications,
  .mobile-shift-list .swap-count {
    margin-top: 5px;
    white-space: normal;
    font-size: 12px;
    line-height: 1.45;
    font-style: normal;
  }
  .mobile-shift-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #c9be814d;
    color: #596a60;
    font-size: 12px;
    line-height: 1.4;
  }
  .mobile-shift-status > span:last-child {
    font-size: 22px;
    line-height: 1;
  }
  .mobile-shift-status.is-assigned,
  .mobile-shift-status.is-applied {
    color: #086d7a;
    font-weight: 600;
  }
  .mobile-plan-empty {
    padding: 32px 20px;
    border: 1px dashed #d3e2e8;
    border-radius: 12px;
    background: #fff;
    color: #607782;
    text-align: center;
  }
  .mobile-plan-empty p {
    font-size: 14px;
    line-height: 1.65;
  }
  .mobile-plan-actions {
    display: grid;
    gap: 10px;
    margin-top: 24px;
  }
  .mobile-plan-actions > button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    font-weight: 600;
  }

  /* Employees see their own week at a glance, with applications in a separate tab. */
  .topbar.employee-header {
    grid-template-columns: minmax(80px, 1fr) minmax(0, 170px);
    min-height: 64px;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
  }
  .topbar.employee-header .brand img {
    width: 110px;
  }
  .topbar.employee-header .account {
    display: none;
  }
  .topbar.employee-header .location-fixed,
  .topbar.employee-header .location-switcher {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: 170px;
    font-size: 13px;
  }
  .employee-mobile-planner {
    padding: 14px 16px 20px;
  }
  .employee-mobile-planner .mobile-week-heading {
    margin-bottom: 10px;
  }
  .employee-mobile-planner .mobile-week-heading h1 {
    font-size: 22px;
  }
  .employee-mobile-planner .mobile-week-switch {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 4px;
    border-radius: 10px;
  }
  .employee-mobile-planner .mobile-week-switch > button {
    width: 44px;
    height: 44px;
  }
  .employee-mobile-planner .mobile-week-switch span {
    margin-top: 1px;
    font-size: 13px;
  }
  .employee-plan-hours {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    margin: 12px 0;
    color: #4c636e;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .employee-plan-hours b {
    color: #142a33;
    font-weight: 650;
  }
  .employee-plan-hours > strong {
    margin: 0 2px;
    color: #324f5b;
    font-size: 15px;
    font-weight: 800;
  }
  .employee-plan-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 12px 0 16px;
    padding: 4px;
    border: 1px solid #dce6e9;
    border-radius: 11px;
    background: #eaf0f3;
  }
  .employee-plan-tabs > button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 44px;
    padding: 9px 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #506872;
    font-size: 14px;
    font-weight: 600;
  }
  .employee-plan-tabs > button[aria-selected="true"] {
    border-color: #d4e1e6;
    background: #fff;
    color: #125d6a;
    box-shadow: 0 1px 3px #183e4910;
  }
  .employee-plan-tabs button > span {
    min-width: 19px;
    padding: 2px 5px;
    border-radius: 12px;
    background: #e5f0f3;
    color: #246472;
    font-size: 11px;
    line-height: 1.2;
  }
  .employee-agenda-day {
    margin-bottom: 15px;
  }
  .employee-agenda-day h2 {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 7px;
    color: #263c46;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: 0;
  }
  .employee-agenda-day h2 > span {
    color: #647985;
    font-size: 13px;
    font-weight: 400;
  }
  .employee-shift-list {
    display: grid;
    gap: 7px;
  }
  .employee-shift-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 72px;
    padding: 11px 12px;
    border: 1px solid #d9e5e9;
    border-radius: 10px;
    background: #fff;
    text-align: left;
  }
  .employee-shift-card.is-assigned {
    border-left: 3px solid #087f91;
  }
  .employee-shift-card.is-applied {
    border-left: 3px solid #b28a26;
    background: #fffdf6;
  }
  .employee-shift-main {
    min-width: 0;
  }
  .employee-shift-main > strong,
  .employee-detail-time {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    color: #14242d;
    font-size: 17px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    white-space: nowrap;
  }
  .employee-shift-main > strong > small,
  .employee-detail-time > small {
    color: #617580;
    font-size: 11px;
    font-weight: 400;
  }
  .employee-shift-site {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    color: #596f7a;
    font-size: 13px;
    line-height: 1.3;
  }
  .employee-shift-site > .location-dot {
    display: inline-block;
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
  }
  .employee-note-hint {
    font-size: 11px;
  }
  .employee-shift-action {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    color: #087586;
    font-size: 12px;
    font-weight: 600;
  }
  .employee-shift-action > span {
    color: #69828b;
    font-size: 20px;
    font-weight: 400;
  }
  .employee-shift-card.is-applied .employee-shift-action {
    color: #83671e;
  }
  .employee-mobile-planner .mobile-plan-empty {
    padding: 22px 16px;
  }
  .employee-mobile-planner .mobile-plan-empty p {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
  }
  .employee-mobile-planner .mobile-plan-empty button {
    margin-top: 16px;
    font-size: 13px;
  }
  .employee-shift-detail .employee-detail-time {
    font-size: 25px;
  }
  .employee-shift-detail .employee-shift-site {
    font-size: 14px;
  }
  .employee-shift-detail > p {
    margin-top: 20px;
    color: #3c5864;
    font-size: 15px;
    line-height: 1.5;
  }
  .employee-detail-note {
    margin-top: 16px;
    padding: 12px;
    border-radius: 7px;
    background: #f1f6f8;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
  }
  @media (max-width: 350px) {
    .employee-plan-tabs {
      grid-template-columns: 1.25fr 1fr;
    }
    .employee-plan-hours {
      gap: 4px;
      font-size: 12px;
    }
    .employee-shift-main > strong {
      font-size: 16px;
    }
    .employee-shift-action {
      gap: 4px;
      font-size: 11px;
    }
    .employee-plan-tabs > button {
      font-size: 13px;
      white-space: nowrap;
    }
  }

  /* Existing pages retain their controls in a narrow, readable column. */
  .panel,
  .time-page {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px 16px 28px;
  }
  .page-title,
  .time-page .page-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
  }
  .page-title h1,
  .time-page .page-title h1 {
    font-size: 23px;
    line-height: 1.2;
  }
  .page-title p {
    font-size: 13px;
    line-height: 1.5;
  }
  .time-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .time-actions > button {
    min-width: 0;
    min-height: 46px;
    padding: 10px;
    font-size: 13px;
  }
  .time-actions .terminal-link {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 8px 0;
  }
  .time-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding: 13px;
    border-radius: 12px;
    background: #eff5f7;
  }
  .time-toolbar > label,
  .time-toolbar .time-employee-field {
    min-width: 0;
    width: 100%;
    margin: 0;
  }
  .time-toolbar select {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px 8px;
    font-size: 16px;
  }
  .time-range-field {
    grid-column: 1 / -1;
    order: -1;
    min-width: 0;
    width: 100%;
  }
  .time-range-controls {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    width: 100%;
  }
  .time-range-controls button {
    min-height: 46px;
  }
  .time-range-controls #time-range {
    min-width: 0;
    width: 100%;
    padding: 8px 4px;
    white-space: normal;
    font-size: 12px;
    line-height: 1.5;
  }
  .time-reset {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
    padding: 7px 0;
    min-height: 44px;
    color: #087586;
  }
  .time-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 22px 0 18px;
    font-size: 13px;
    line-height: 1.5;
  }
  .time-summary strong {
    font-size: 27px;
  }
  .time-page.is-personal .page-title {
    margin-bottom: 16px;
  }
  .time-page.is-personal .time-actions:empty {
    display: none;
  }
  .time-page.is-personal .time-toolbar {
    gap: 10px;
    padding: 12px;
  }
  .time-page.is-personal .time-toolbar select,
  .time-page.is-personal .time-range-controls button {
    min-height: 44px;
  }
  .time-page.is-personal .time-reset {
    grid-column: auto;
    justify-self: stretch;
    align-self: end;
    padding: 8px 3px;
    font-size: 12px;
    line-height: 1.3;
  }
  .time-page.is-personal .time-summary {
    margin: 18px 0;
    padding: 0;
    gap: 4px;
    font-size: 12px;
  }
  .time-page.is-personal .time-summary strong {
    font-size: 24px;
  }
  .time-page.is-personal .time-summary > span:last-child {
    font-size: 11px;
  }
  .time-page.is-personal .time-person,
  .time-page.is-personal .time-table tr:not(.time-deleted) td[data-label="Mitarbeiter"] {
    display: none;
  }
  .time-list-tools,
  .time-list-tools > div {
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }
  .time-list-tools > span {
    font-size: 12px;
    line-height: 1.5;
  }
  .time-list-tools > div {
    justify-content: space-between;
  }
  .time-table-wrap {
    width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .time-table,
  .time-table.is-cross-site {
    display: block;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
  }
  .time-table colgroup {
    display: none;
  }
  .time-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .time-table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }
  .time-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
    padding: 15px;
    border: 1px solid #dbe7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 7px #193c4805;
  }
  .time-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
  }
  .time-table td::before {
    display: block;
    margin-bottom: 5px;
    color: #607782;
    content: attr(data-label);
    font-size: 12px;
    font-weight: 500;
  }
  .time-table td:first-child,
  .time-table td[data-label="Einsatzort"],
  .time-table td[colspan] {
    grid-column: 1 / -1;
  }
  .time-table td:first-child::before,
  .time-table td.time-table-actions::before,
  .time-table td[colspan]::before {
    display: none;
  }
  .time-table td:first-child {
    padding-bottom: 12px;
    border-bottom: 1px solid #e8eff2;
  }
  .time-table .time-person {
    min-width: 0;
    gap: 10px;
    white-space: normal;
  }
  .time-table .time-person strong {
    overflow: visible;
    font-size: 15px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .time-table .time-day {
    margin-bottom: 3px;
    white-space: normal;
    font-size: 12px;
    line-height: 1.4;
  }
  .time-table td > strong {
    font-size: 17px;
    line-height: 1.4;
  }
  .time-table .time-duration {
    align-self: center;
  }
  .time-table .time-table-actions {
    align-self: end;
    text-align: right;
  }
  .time-table .time-table-actions button {
    width: 100%;
    min-height: 44px;
    padding: 8px;
    border-color: #cfe1e7;
    background: #f6fafb;
    color: #126b78;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
  }
  .time-table .time-deleted {
    border-style: dashed;
    background: #f3f5f6;
  }
  .time-table .deleted-time-label {
    margin-left: 42px;
    font-size: 11px;
  }
  .time-table td[colspan] {
    border: 0;
    padding: 0;
  }
  .time-table .empty {
    padding: 28px 10px;
  }

  /* Bottom sheets keep long forms and histories within the phone viewport. */
  .modal-backdrop {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: #17313d55;
    backdrop-filter: blur(2px);
  }
  .modal,
  .modal.wide,
  .modal.shift-dialog,
  .modal.time-detail-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    max-height: 95dvh;
    margin: 0;
    border: 1px solid #d8e4e9;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    box-shadow: 0 -12px 45px #17313d26;
  }
  .modal-header {
    flex: 0 0 auto;
    gap: 12px;
    padding: 13px 16px 12px;
    background: #fff;
  }
  .modal-header h2 {
    min-width: 0;
    font-size: 17px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .modal .close {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 24px;
  }
  .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .modal-body p {
    font-size: 14px;
    line-height: 1.65;
  }
  .modal-footer {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff;
  }
  .modal-footer > button {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    padding: 11px 12px;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .modal .form-grid .full {
    grid-column: 1;
  }
  .applicant-grid,
  .candidate-grid,
  .template-options,
  .location-checks,
  .manager-permissions {
    grid-template-columns: minmax(0, 1fr);
  }
  .applicant-grid,
  .candidate-grid {
    gap: 12px;
    margin-top: 15px;
  }
  .applicant-card,
  .candidate-card {
    padding: 13px;
    border-radius: 10px;
  }
  .person-row {
    align-items: flex-start;
    gap: 9px;
    font-size: 14px;
  }
  .person-row .person-name {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .person-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
  }
  .person-actions button {
    min-width: 44px;
    padding: 8px;
    font-size: 13px;
  }
  .shift-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }
  .shift-tabs button {
    min-width: 0;
    min-height: 48px;
    padding: 8px 4px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
  }
  .self-shift {
    flex-wrap: wrap;
    gap: 10px;
    padding: 13px;
  }
  .self-shift > button {
    width: 100%;
  }
  .time-detail-values {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: 15px 0 24px;
  }
  .time-detail-values > div {
    padding: 13px;
  }
  .time-detail-values strong {
    font-size: 18px;
  }
  .time-history-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .audit-timeline {
    padding-left: 7px;
  }
  .audit-item {
    padding-left: 14px;
  }
  .audit-changes {
    table-layout: fixed;
  }
  .audit-changes th,
  .audit-changes td {
    min-width: 0;
    padding: 8px 6px;
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .audit-change-wrap {
    overflow: hidden;
  }

  .ttr-popup {
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-height: 95vh !important;
    max-height: 95dvh !important;
    border-radius: 18px 18px 0 0;
  }
  .ttr-header {
    position: sticky;
    z-index: 2;
    top: 0;
    background: #fff;
    padding: 12px 16px;
  }
  .ttr-popup .ttr-close,
  .ttr-navigation button {
    width: 44px;
    min-height: 44px;
    flex-basis: 44px;
  }
  .ttr-fields,
  .ttr-calendars {
    grid-template-columns: minmax(0, 1fr);
  }
  .ttr-field input {
    min-height: 46px;
    font-size: 16px;
  }
  .ttr-popup .ttr-boundary {
    min-width: 52px;
    font-size: 14px;
  }
  .ttr-days .ttr-day,
  .ttr-empty-day {
    height: 44px;
    font-size: 14px;
  }
  .ttr-footer {
    position: sticky;
    z-index: 2;
    bottom: 0;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff;
  }
  .ttr-actions {
    width: 100%;
    margin: 0;
  }
  .ttr-actions button {
    flex: 1;
    min-height: 46px;
    font-size: 14px;
  }

  .mobile-profile {
    padding: 20px 16px 28px;
  }
  .profile-card {
    min-width: 0;
    margin-bottom: 14px;
    padding: 19px 17px;
    border: 1px solid #dce7eb;
    border-radius: 14px;
    background: #fff;
  }
  .profile-person {
    display: flex;
    align-items: center;
    gap: 13px;
  }
  .profile-person .avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    font-size: 15px;
  }
  .profile-person > div {
    min-width: 0;
  }
  .profile-person h1,
  .profile-person h2 {
    color: #172f39;
    font-size: 21px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .profile-person p,
  .profile-person > div > span {
    display: block;
    margin-top: 5px;
    color: #607782;
    font-size: 13px;
  }
  dl.profile-details,
  .profile-details dl {
    display: grid;
    grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
    gap: 15px 12px;
    margin: 22px 0;
    font-size: 14px;
    line-height: 1.5;
  }
  .profile-details dl > div {
    display: contents;
  }
  .profile-details dt {
    color: #607782;
  }
  .profile-details dd {
    min-width: 0;
    margin: 0;
    color: #203a45;
    overflow-wrap: anywhere;
  }
  .profile-locations {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .profile-locations .badge {
    gap: 6px;
    padding: 7px 10px;
    font-size: 12px;
  }
  .profile-locations > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }
  .profile-locations .location-dot {
    display: inline-block;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }
  .profile-help {
    margin-bottom: 18px;
    color: #607782;
    font-size: 14px;
    line-height: 1.65;
  }
  .profile-card h3 {
    margin-bottom: 12px;
    color: #203a45;
    font-size: 16px;
  }
  .mobile-menu-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .mobile-menu-links > button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    min-height: 64px;
    padding: 12px;
    border-color: #dce7eb;
    border-radius: 10px;
    background: #f8fbfc;
    color: #244d5a;
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
  }
  .mobile-menu-links svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
  }

  /* Compact login and terminal, using the unchanged original image logo. */
  .auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
  }
  .auth-art {
    flex: 0 0 auto;
    padding: 25px 22px 0;
    background: #fff;
    border: 0;
  }
  .auth-art .brand img {
    width: 180px;
    height: auto;
  }
  .auth-art .brand small {
    margin-top: 8px;
    font-size: 9px;
  }
  .auth-art h1,
  .auth-art p,
  .auth-art > small,
  .mini-calendar {
    display: none;
  }
  .auth-form-wrap {
    display: block;
    flex: 1 1 auto;
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .auth-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }
  .auth-form h2 {
    font-size: 27px;
    line-height: 1.2;
  }
  .auth-form > p {
    margin: 10px 0 24px;
    font-size: 14px;
    line-height: 1.6;
  }
  .auth-form label {
    margin-bottom: 18px;
    font-size: 14px;
  }
  .auth-form input,
  .auth-form .primary {
    min-height: 48px;
    font-size: 16px;
  }
  .terminal-page {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .terminal-top .brand img {
    width: 160px;
    max-width: 45vw;
  }
  .terminal-top button {
    min-height: 44px;
    font-size: 12px;
  }
  .terminal-card {
    margin: 24px auto;
  }
  .keypad button {
    min-height: 56px;
  }
  #toast {
    right: 14px;
    left: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    padding: 13px 16px;
    font-size: 14px;
    line-height: 1.5;
  }
}
