/* Phone layout: one week, readable shifts, and primary actions within thumb reach. */
.mobile-planner, .mobile-bottom-nav, .shift-history-cards, .cash-history-cards { display: none; }
.demo-label { padding: 3px 7px; border: 1px solid #6e8194; border-radius: 20px; font-size: 10px; font-weight: 400; color: #e4eaf0; }
.cashbook-today { border-top: 3px solid var(--blue); }
.cashbook-amount { margin: 10px 0; font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.history-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.history-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-card-top > strong { font-size: 13px; }
.history-card p { margin: 10px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.history-card .history-time { color: var(--ink); font-size: 17px; font-weight: 600; }
.history-time span { color: var(--muted); font-size: 12px; font-weight: 400; }
.cash-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.cash-breakdown dt { color: var(--muted); font-size: 11px; }
.cash-breakdown dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cash-entry-total, .cash-history-total { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.cash-history-total { padding: 15px; border: 0; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 14px; }

@media (max-width: 760px) {
  html { scroll-padding-top: 78px; }
  body { background: var(--paper); }
  button, a, input, select, textarea { touch-action: manipulation; }
  .app-shell, .layout, .main { min-width: 0; max-width: 100%; }
  .main { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); min-height: calc(100dvh - 64px); }
  .sidebar { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 8px; }
  .sidebar-top { gap: 10px; }
  .sidebar .brand-icon { width: 36px; height: 36px; }
  .sidebar .brand-mark { gap: 8px; font-size: 15px; }
  .header-user { display: none; }
  .sidebar .menu-btn { min-width: 62px; width: 62px; min-height: 44px; height: 44px; padding: 0 8px; font-size: 11px; }
  .nav { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nav button { font-size: 13px; min-height: 46px; }
  .menu-panel.open { max-height: calc(75dvh - 70px); overflow-y: auto; padding: 8px 0; }
  .mobile-bottom-nav { position: fixed; inset: auto 0 0; z-index: 9; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -4px 20px #233b5209; }
  .mobile-bottom-nav button { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; min-height: 54px; padding: 7px 2px; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; }
  .mobile-bottom-nav button[aria-current="page"] { color: var(--navy); background: var(--blue-soft); font-weight: 600; }
  .calendar-toolbar, .topbar { margin: 0 0 18px; gap: 10px; align-items: start; }
  .calendar-toolbar { display: grid; }
  .calendar-eyebrow { font-size: 10px; margin-bottom: 6px; }
  .calendar-title h1, .topbar h1 { font-size: 27px; line-height: 1.22; }
  .calendar-subtitle { display: block; margin-top: 8px; line-height: 1.65; font-size: 12px; }
  .calendar-subtitle > span { margin: 0 4px; }
  .announcements-block { margin-bottom: 16px; }
  .announcements-block details { padding: 11px 12px; }
  .announcements-block summary { display: list-item; font-size: 13px; min-height: 26px; }
  .announcements-block.compact .notification-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 7px; padding: 10px 12px; }
  .announcements-block.compact .notification-list strong { font-size: 12px; }
  .announcements-block.compact .notification-list p { font-size: 11px; line-height: 1.5; }
  .announcements-block.compact .notification-list .badge { display: none; }
  .mobile-planner { display: block; margin: 14px 0 16px; }
  .week-toolbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; align-items: center; margin-bottom: 12px; }
  .week-toolbar > div { display: grid; gap: 4px; text-align: center; }
  .week-toolbar strong { font-size: 13px; font-weight: 600; }
  .week-toolbar .icon-btn { width: 44px; height: 44px; font-size: 30px; line-height: 1; background: white; border: 1px solid var(--line); box-shadow: none; }
  .today-link { justify-self: center; min-height: 30px; padding: 3px 10px; color: var(--blue); background: transparent; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
  .week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .week-strip > button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 1px 8px; min-height: 82px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; }
  .week-strip > button > span:first-child { font-size: 10px; }
  .week-strip strong { font-size: 18px; color: var(--ink); font-weight: 600; }
  .week-strip > button[aria-current="date"] { border-color: var(--blue); }
  .week-strip > button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #d8e3ec; }
  .week-strip > button[aria-pressed="true"] strong { color: white; }
  .week-dots { display: flex; gap: 4px; height: 5px; }
  .week-dots i { display: block; width: 5px; height: 5px; border-radius: 50%; background: #bdc7d0; opacity: 0.3; }
  .week-dots i.booked { background: var(--taxi); opacity: 1; }
  .mobile-day-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 22px 0 12px; }
  .mobile-day-heading .eyebrow { margin-bottom: 5px; font-size: 9px; }
  .mobile-day-heading h2 { margin: 0; font-size: 17px; line-height: 1.35; text-transform: capitalize; }
  .mobile-day-heading > span { flex-shrink: 0; color: var(--muted); font-size: 11px; }
  .mobile-periods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .mobile-period { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 11px; min-width: 0; min-height: 154px; border: 1.5px solid var(--calendar-line); border-radius: 14px; text-align: left; }
  .mobile-period.morning { background: var(--morning-bg); color: var(--morning-ink); }
  .mobile-period.night { background: var(--night-bg); color: var(--night-ink); }
  .period-label { font-size: 14px; font-weight: 600; }
  .period-time { font-size: clamp(13px, 3.6vw, 17px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; }
  .period-drivers { display: grid; gap: 7px; margin-top: 4px; font-size: 12px; line-height: 1.5; }
  .period-drivers > span { overflow-wrap: anywhere; }
  .period-drivers small { display: block; font-size: 10px; opacity: 0.85; }
  .period-empty { font-size: 12px; opacity: 0.8; font-weight: 400; }
  .month-shell { overflow: visible; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .month-shell > .month-nav, .month-shell > .calendar-hint, .month-shell > .calendar-scroll { display: none; }
  .selected-day-panel { padding: 0; border: 0; background: transparent; }
  .selected-day-panel:not(.has-shifts), .selected-day-panel > .selected-date { display: none; }
  .day-info-card { grid-template-columns: 52px minmax(0, 1fr); padding: 12px; gap: 12px; }
  .day-info-card .vehicle-photo.compact { width: 52px; height: 56px; }
  .day-info-main { gap: 8px; min-width: 0; }
  .day-info-main .avatar { display: none; }
  .day-info-main strong { font-size: 13px; overflow-wrap: anywhere; }
  .day-info-main span { font-size: 12px; }
  .day-info-meta { grid-column: 1 / -1 !important; font-size: 12px; }
  .day-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .day-actions > button { min-height: 46px; font-size: 12px; padding: 10px 7px; }
  .day-actions > button:last-of-type { grid-column: 1 / -1; }
  .stat-grid, .compact-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { padding: 13px; min-width: 0; }
  .stat-card span { font-size: 11px; }
  .stat-card strong { font-size: 23px; overflow-wrap: anywhere; }
  .fleet-grid, .rules-grid, .driver-grid, .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .fleet-grid .vehicle-photo { height: 175px; }
  .panel, .item-card { padding: 16px; min-width: 0; }
  .panel h2 { font-size: 20px; }
  .profile-hero { gap: 12px; }
  .profile-hero h2 { font-size: 18px; }
  .profile-hero .avatar { flex-shrink: 0; }
  .field { min-width: 0; }
  .field input, .field select, .field textarea { min-width: 0; min-height: 48px; font-size: 16px; }
  .field input[type="file"] { font-size: 12px; max-width: 100%; }
  .photo-form, .vehicle-image-form { min-width: 0; }
  .section-title { margin: 24px 0 12px; align-items: start; }
  .section-title h2 { font-size: 19px; }
  .section-title .ghost-btn { font-size: 11px; padding: 8px; }
  .table { display: block; max-width: 100%; overflow-x: auto; }
  .desktop-shift-table, .desktop-cash-table { display: none; }
  .shift-history-cards, .cash-history-cards { display: grid; gap: 10px; }
  .history-card .compact-action { min-height: 44px; padding: 8px 10px; }
  .cashbook-today .primary-btn { width: 100%; min-height: 48px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-width: 100%; max-height: calc(100dvh - 20px - env(safe-area-inset-top)); padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; }
  .modal-header { align-items: start; gap: 10px; }
  .modal-header h2 { font-size: 22px; }
  .modal-header .muted { font-size: 13px; line-height: 1.5; }
  .close-btn { flex-shrink: 0; width: 44px; height: 44px; }
  .modal .form-grid, .modal[data-action="book-shift"] .form-grid { grid-template-columns: 1fr; }
  .modal > .primary-btn { width: 100%; min-height: 50px; margin-top: 10px; }
  .shift-options { padding: 10px; gap: 8px; }
  .shift-choice { padding: 14px 8px; min-height: 76px; font-size: 14px; }
  .shift-choice > span > span { font-size: 11px; line-height: 1.5; }
  .vehicle-options { padding: 10px; }
  .vehicle-choice { padding: 12px 8px; }
  .vehicle-choice .vehicle-photo { flex-basis: 52px; width: 52px; height: 52px; min-height: 52px; }
  .vehicle-choice strong { font-size: 13px; }
  .vehicle-choice > span > span { font-size: 11px; }
  .cash-fields { grid-template-columns: 1fr; gap: 0; }
  .cash-total { padding: 16px; }
  .cash-total output { font-size: 25px; }
  .toast { left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); max-width: none; font-size: 13px; }
  .login-view { display: flex; flex-direction: column; min-height: 100dvh; }
  .login-hero { min-height: auto; padding: calc(24px + env(safe-area-inset-top)) 22px 28px; gap: 28px; }
  .login-copy h1 { font-size: 29px; line-height: 1.15; margin-bottom: 14px; }
  .login-copy p { font-size: 14px; line-height: 1.6; }
  .login-panel { width: 100%; padding: 18px 14px; background: var(--paper); }
  .login-card { max-width: 460px; margin: 0 auto; padding: 22px 18px; }
  .login-card h2 { font-size: 23px; }
  .login-card > .primary-btn { width: 100%; min-height: 50px; }
  .login-card .muted { font-size: 13px; }
  .hint-list { margin: 18px 0; }
}

@media (max-width: 359px) {
  .main { padding-left: 10px; padding-right: 10px; }
  .week-strip { gap: 3px; }
  .week-strip > button > span:first-child { font-size: 9px; }
  .mobile-period { padding: 12px 9px; }
  .calendar-title h1, .topbar h1 { font-size: 25px; }
  .period-time { font-size: 13px; }
  .cash-breakdown dd { font-size: 13px; }
}
