.mobile-nav { display: none; }
.lucide { width: 22px; height: 22px; flex: 0 0 auto; }
.icon-button { width: 44px; min-width: 44px; height: 44px; padding: 0; background: transparent; color: var(--brand); }
.icon-button.primary { background: var(--brand); color: white; }
button:focus-visible, summary:focus-visible { outline: 3px solid #327a94; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.app-sheet { padding: 22px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.app-sheet::backdrop { background: rgb(20 35 35 / 40%); }
body:has(dialog[open]) { overflow: hidden; }
.sheet-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.sheet-person { margin: 0 0 18px; font-weight: 600; color: var(--muted); }
.time-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.time-field-pair > *, .profile-form > * { min-width: 0; }
.sheet-actions { display: grid; gap: 8px; }
.manual-time-total { padding: 12px; background: var(--available-bg); color: var(--available-ink); border-radius: 6px; font-weight: 700; line-height: 1.5; }
.app-sheet .form-grid { position: static; width: 100%; border: 0; padding: 0; max-height: none; overflow: visible; }
.app-sheet .date-popover { position: static; width: 100%; box-shadow: none; }
.app-sheet [data-toggle-past-weeks], .app-sheet [data-toggle-roster-view] { display: none; }

@media (max-width: 980px) {
  body { background: #f6f8f8; overflow-x: visible; }
  .shell { max-width: 720px; padding: max(12px, env(safe-area-inset-top)) 16px calc(94px + env(safe-area-inset-bottom)); }
  .shell > * { min-width: 0; }
  .topbar { display: flex; flex-direction: row; align-items: center; gap: 10px; margin-bottom: 20px; }
  .topbar h1, .topbar .avatar, .topbar .profile-trigger { display: none; }
  .topbar .eyebrow { font-size: 12px; margin: 0; letter-spacing: 0; }
  .userbox { width: auto; padding: 0; border: 0; background: none; }
  .userbox [data-action="logout"] { min-height: 36px; font-size: 12px; padding: 0 10px; background: transparent; }
  .mobile-nav { display: flex; position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; justify-content: center; padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid #dbe3e1; background: #fff; box-shadow: 0 -3px 15px rgb(30 55 50 / 4%); }
  .mobile-nav button { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 130px; min-width: 0; min-height: 52px; padding: 6px 2px; background: transparent; color: #687773; border-radius: 6px; }
  .mobile-nav button span { font-size: 11px; font-weight: 600; }
  .mobile-nav button[aria-current] { color: #195f54; background: #e9f3ee; }
  .mobile-page-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 20px; }
  .mobile-page-heading h1 { font-size: 26px; margin: 0; line-height: 1.25; }
  .mobile-page-heading > span { color: var(--muted); font-size: 12px; max-width: 96px; text-align: right; }
  .mobile-month-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px 40px 40px; gap: 0; align-items: center; margin-bottom: 12px; }
  .mobile-month-head h2 { font-size: 17px; text-align: center; }
  .mobile-month-head .icon-button { min-width: 40px; width: 40px; }
  [data-mobile-error]:empty { display: none; }
  .mobile-month { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
  .mobile-weekdays, .mobile-date-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .mobile-weekdays { margin-bottom: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); }
  .mobile-date { width: 100%; padding: 5px 0; min-width: 0; height: 51px; min-height: 51px; display: grid; grid-template-rows: 24px 8px; gap: 3px; align-content: center; justify-content: stretch; justify-items: center; background: #fff; color: var(--ink); border: 1px solid transparent; font-size: 15px; }
  .mobile-date.other-month { background: transparent; color: #929c9c; }
  .mobile-date.is-today { border-color: var(--brand); }
  .mobile-date[aria-pressed="true"] { color: #fff; background: #246e62; border-color: #246e62; font-weight: 800; }
  .date-dots { display: flex; justify-content: center; align-items: center; gap: 3px; min-height: 8px; }
  .date-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; flex: 0 0 auto; }
  .dot-roster { background: #d6ae35; }
  .dot-available { background: #76ad85; }
  .dot-unavailable { background: #d78c87; }
  .dot-time { background: #538cb4; }
  .calendar-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 20px; font-size: 11px; color: var(--muted); }
  .calendar-legend span { display: inline-flex; gap: 5px; align-items: center; }
  .mobile-agenda { margin-top: 20px; }
  .mobile-day-heading, .mobile-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .mobile-day-heading h2 { font-size: 18px; }
  .mobile-section-heading h2, .mobile-section-heading h3 { font-size: 15px; margin: 0; }
  .mobile-section-heading > b { font-size: 14px; white-space: nowrap; color: var(--brand); }
  .mobile-shift { display: grid; grid-template-columns: minmax(100px, .8fr) minmax(0, 1.4fr) 20px; align-items: center; gap: 10px; width: 100%; padding: 13px 12px; margin-bottom: 9px; text-align: left; color: var(--ink); border-left: 3px solid var(--line); }
  .mobile-shift.is-roster { background: var(--roster-bg); border-color: var(--roster-line); }
  .mobile-shift.is-available { background: var(--available-bg); border-color: var(--available-line); }
  .mobile-shift.is-unavailable { background: var(--unavailable-bg); border-color: var(--unavailable-line); }
  .mobile-shift-time { font-size: 14px; font-weight: 700; }
  .mobile-shift small { display: block; font-size: 12px; font-weight: 400; margin-top: 4px; color: #586460; }
  .mobile-shift-person { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
  .mobile-empty { padding: 18px 0; color: var(--muted); font-size: 14px; }
  .mobile-wide-action { width: 100%; gap: 8px; margin: 12px 0; }
  .mobile-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 0; }
  .mobile-totals > div { display: grid; gap: 6px; }
  .mobile-totals span { font-size: 12px; color: var(--muted); }
  .mobile-totals b { font-size: 22px; color: #245f54; }
  .mobile-totals > div:last-child { border-left: 1px solid var(--line); padding-left: 18px; }
  .mobile-clock { border-block: 1px solid var(--line); padding: 12px 0; }
  .mobile-clock summary { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; min-height: 32px; }
  .mobile-clock summary b { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 15px; }
  .mobile-clock summary::-webkit-details-marker { display: none; }
  .mobile-clock .time-actions { grid-template-columns: 1fr 1fr; padding-top: 12px; }
  .mobile-clock .time-actions button:last-child { grid-column: 1 / -1; }
  .mobile-range { display: flex; gap: 4px; background: #e9eeed; border-radius: 6px; padding: 4px; margin: 20px 0; }
  .mobile-range button { flex: 1; min-height: 36px; border: 0; background: transparent; color: var(--muted); }
  .mobile-range button[aria-pressed="true"] { background: white; color: var(--brand); box-shadow: 0 1px 4px #ccd5d1; }
  .mobile-time-row { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; border-radius: 0; text-align: left; background: transparent; color: var(--ink); border-bottom: 1px solid var(--line); }
  .mobile-time-row > span { flex: 1; min-width: 0; }
  .mobile-time-row small { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
  .mobile-time-row strong { font-size: 14px; white-space: nowrap; }
  .mobile-time-day { margin-bottom: 20px; }
  .mobile-time-day > .mobile-section-heading { margin-top: 24px; }
  .mobile-exports { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
  .mobile-exports button { flex: 1 1 140px; width: auto; gap: 7px; font-size: 13px; }
  .mobile-person-select { margin-bottom: 20px; }
  .mobile-inventory .toolbar { display: none; }
  .mobile-inventory .grid { grid-template-columns: minmax(0, 1fr); }
  .mobile-inventory .panel { padding: 0; border: 0; background: transparent; }
  .mobile-inventory .panel-head h2 { font-size: 23px; margin: 10px 0; }
  .mobile-product-form { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  .mobile-product-form summary { display: flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 600; color: var(--brand); cursor: pointer; }
  .mobile-product-form form { padding: 12px 0 !important; }
  .mobile-product-form .hint { display: none; }
  .mobile-inventory .table-wrap { overflow: visible; margin: 0; }
  .mobile-inventory table, .mobile-inventory tbody { display: block; min-width: 0; }
  .mobile-inventory thead { display: none; }
  .mobile-inventory tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .mobile-inventory td { border: 0; padding: 0; min-width: 0; font-size: 14px; }
  .mobile-inventory td:first-child { width: 100%; font-weight: 600; overflow-wrap: anywhere; }
  .mobile-inventory td:has([data-stock-current]) { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .mobile-inventory td:empty { display: none; }
  .mobile-inventory tr.category-row { padding: 18px 0 8px; border: 0; }
  .mobile-inventory .category-row td { background: none; font-size: 17px; text-transform: none; color: var(--brand); }
  .mobile-inventory .buy-pill, .mobile-inventory .ok-pill { margin-left: 0; font-size: 11px; }
  .stock-input { width: 60px; }
  input, select, textarea { font-size: 16px; min-height: 44px; min-width: 0; }
  input[type="date"], input[type="time"] { max-width: 100%; }
  .app-sheet { margin: auto auto 0; width: min(600px, 100%); max-height: calc(100dvh - env(safe-area-inset-top) - 12px); border-radius: 8px 8px 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); }
  .app-sheet .sheet-heading { position: sticky; top: -18px; z-index: 1; background: #fff; padding: 8px 0; }
  .app-sheet .profile-form { gap: 14px; }
  .app-sheet .date-popover { max-height: none; }
  .app-sheet .date-choice { min-height: 38px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-card { width: min(600px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto; margin: auto auto 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 8px 8px 0 0; }
  .modal-card h2 { font-size: 18px; overflow-wrap: anywhere; }
  .modal-card .panel-head { gap: 12px; }
  .modal-card .icon { flex: 0 0 44px; }
  .modal-actions { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .shell { padding-inline: 10px; }
  .mobile-month-head { grid-template-columns: 36px minmax(0, 1fr) 36px 36px 36px; }
  .mobile-month-head .icon-button { width: 36px; min-width: 36px; }
  .mobile-month-head h2 { font-size: 15px; }
  .mobile-shift { gap: 7px; padding: 12px 9px; grid-template-columns: 100px minmax(0, 1fr) 18px; }
  .mobile-nav button span { font-size: 10px; }
}
