/* 555 Clock: the team's own pages on their phones (/me). Made for a 360–390 px phone first,
   then centred on wider screens. Uses the colours, fonts, buttons and badges from app.css.
   Everything here starts with "me-" (or sits under .me-page), so the clock and the manager
   pages look exactly as before. */

.me-page { background: var(--cream); }
.me-page:has(dialog[open]) { overflow: hidden; }
.me-page #toast { bottom: calc(96px + env(safe-area-inset-bottom)); text-align: center; }
.me { min-height: 100svh; }
.me-icon { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar: logo on the left, the person (menu) on the right. iPhones get room for the notch. */
.me-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left)); background: var(--cream); border-bottom: 1px solid var(--line); }
.me-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.me-brand img { width: 64px; height: 38px; object-fit: contain; }
.me-brand .eyebrow { font-size: 9px; letter-spacing: 1.3px; line-height: 1.4; padding-left: 12px; border-left: 1px solid #c8c1a8; }
.me-menu-btn { display: flex; align-items: center; gap: 8px; min-height: 48px; max-width: 52%; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 40px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 600; }
.me-menu-btn > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu-btn .avatar { width: 36px; height: 36px; font-size: 15px; }
.me-caret { color: var(--muted); font-size: 11px; }

/* The page, with room at the bottom for the tab bar. */
.me-main { width: 100%; max-width: 620px; margin: 0 auto; padding: 18px calc(16px + env(safe-area-inset-right)) calc(104px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
.me-main .loading { padding: 70px 0; }
.me-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.me-head h1 { font-size: 42px; margin: 4px 0 2px; }
.me-section { margin-top: 24px; }
.me-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.me-section-head h3 { font-size: 24px; }
.me-quiet { color: var(--muted); font-size: 13px; padding: 14px 16px; border: 1px dashed #cfc9b3; border-radius: 14px; }
.me-foot-note { color: var(--muted); font-size: 11px; margin-top: 18px; text-align: center; }
.me-main .panel .empty { padding: 36px 18px; }
.me-label { display: block; font-size: 12px; font-weight: 600; margin: 0 0 8px; padding: 0; }
.me-link { border: 0; background: none; color: var(--red); font-size: 12px; font-weight: 600; text-decoration: underline; padding: 6px; min-height: 32px; }
.me-gap { margin-top: 16px; }

/* Tabs at the bottom: Home · Calendar · Requests · Hours. Thumb-sized, above the iPhone home bar. */
.me-tabs { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px calc(8px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px #2416080f; }
.me-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; }
.me-tab-icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; }
.me-tab.active { color: var(--red); }
.me-tab.active .me-tab-icon { background: #fde5e5; }
.me-pill { position: absolute; top: 2px; left: calc(50% + 12px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; border: 2px solid var(--white); box-sizing: content-box; }

/* Getting in: the link, the PIN, "ask a manager". */
.me-gate { min-height: 100svh; display: flex; flex-direction: column; }
.me-gate-main { flex: 1; width: 100%; max-width: 440px; margin: 0 auto; padding: 22px calc(16px + env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
.me-gate-card { text-align: center; padding: 26px 20px 22px; }
.me-gate-card .avatar { margin: 0 auto 14px; }
.me-gate-card h1 { font-size: 40px; letter-spacing: -.5px; margin: 8px 0 10px; overflow-wrap: anywhere; }
.me-gate-card .pin-pad { margin-bottom: 14px; }
.me-gate-card .pin-pad .btn { min-height: 64px; font-size: 26px; border-radius: 12px; }
.me-gate-card .pin-pad .btn.word { font-size: 14px; }
.me-lead { font-size: 15px; line-height: 1.55; color: var(--muted); }
.me-wide { width: 100%; min-height: 54px; margin-top: 20px; font-size: 14px; }
.me-gate-foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 16px; }

/* Home */
.me-hello h1 { font-size: 48px; letter-spacing: -1px; margin: 4px 0 14px; overflow-wrap: anywhere; }
.me-status { display: grid; gap: 5px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.me-status .badge { justify-self: start; }
.me-status strong { font-size: 18px; line-height: 1.3; }
.me-status.in { border-color: #b9d1b4; }
.me-status.break { border-color: var(--yellow); }
.me-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.me-stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.me-stat p { font-size: 11px; color: var(--muted); }
.me-stat strong { display: block; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 30px; line-height: 1.25; white-space: nowrap; }
.me-stat em { display: block; font-style: normal; font-size: 11px; color: var(--muted); line-height: 1.35; }
.me-stat.first { background: var(--red); border-color: var(--red); color: #fff; }
.me-stat.first p, .me-stat.first em { color: #ffe3cf; }
.me-stat.wide { grid-column: 1 / -1; }
.me-big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.me-big { flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 104px; padding: 14px 16px; border-radius: 16px; text-align: left; box-shadow: 0 5px 0 #b9161c; }
.me-big.yellow { box-shadow: 0 5px 0 #c99a0c; }
.me-big:active { transform: translateY(3px); box-shadow: 0 2px 0 #b9161c; }
.me-big.yellow:active { box-shadow: 0 2px 0 #c99a0c; }
.me-big .me-icon { width: 28px; height: 28px; }
.me-big b { display: block; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 23px; line-height: 1.05; }
.me-big small { display: block; font-size: 11px; font-weight: 500; opacity: .85; margin-top: 3px; }
.me-big-actions.slim .me-big { min-height: 0; flex-direction: row; align-items: center; justify-content: center; padding: 12px; }
.me-big-actions.slim .me-big b { font-size: 19px; }
.me-strip { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 16px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink); font-size: 13px; text-align: left; }
.me-strip.alert { background: #fde5e5; border-color: #f6c3c3; color: #7d1015; }
.me-strip.alert .btn { flex-shrink: 0; min-height: 44px; }
.me-strip.wait { background: #fff6d6; border-color: var(--yellow); }
.me-strip-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Leave colours come from app.css (.lv-mc, .lv-off, .lv-annual, .lv-emergency, .lv-unpaid set
   --lv, --lv-soft and --lv-ink), so the phone pages match the manager calendar. Chips are app.css's
   .lv too. Waiting for a manager = a dashed outline. */
.me-req-top .lv { font-size: 12px; padding: 3px 11px 3px 9px; }

/* Requests */
.me-req-list { display: grid; gap: 12px; }
.me-req { display: grid; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px; scroll-margin: 90px; }
.me-req.rejected, .me-req.cancelled { background: var(--paper); }
.me-req.rejected .me-req-note, .me-req.cancelled .me-req-note { background: var(--white); }
.me-req.rejected .lv, .me-req.cancelled .lv { opacity: .6; }
.me-req.flash { animation: me-flash 1.6s ease-out; }
@keyframes me-flash { from { box-shadow: 0 0 0 4px var(--yellow); } to { box-shadow: 0 0 0 4px transparent; } }
.me-req-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-req h4 { margin: 0; font-size: 17px; line-height: 1.3; }
.me-req h4 .muted { font-weight: 500; font-size: 14px; }
.me-req-note { font-size: 13px; background: var(--paper); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; white-space: pre-line; }
.me-req-reason { font-size: 13px; border-left: 3px solid var(--line); padding-left: 10px; overflow-wrap: anywhere; }
.me-req-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.me-req-actions .btn { flex: 1 1 140px; min-height: 50px; font-size: 13px; white-space: nowrap; }
.me-files { display: flex; gap: 8px; flex-wrap: wrap; }
.me-thumb { display: grid; place-items: center; width: 68px; height: 68px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); color: var(--red); font-family: 'Lilita One', sans-serif; font-size: 18px; text-decoration: none; }
.me-thumb img { width: 100%; height: 100%; object-fit: cover; }
.me-fail { padding-left: 18px; font-size: 13px; margin: 10px 0; }

/* Sheets: on a phone, dialogs slide up from the bottom with the buttons always in reach. */
dialog.me-sheet { width: min(560px, 94vw); }
dialog.me-sheet h2 { font-size: 30px; overflow-wrap: anywhere; }
dialog.me-sheet .photo-big { max-height: 70dvh; object-fit: contain; background: var(--cream); }
.me-menu-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.me-menu-head h2 { margin: 2px 0 0; }
.me-menu-list { display: grid; gap: 10px; margin: 16px 0; }
.me-menu-item { justify-content: flex-start; gap: 14px; min-height: 66px; border-radius: 14px; font-size: 15px; text-align: left; }
.me-menu-item small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.me-menu-item.danger { color: #a6171e; }

/* The new request form */
.me-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; }
.me-type-pick { position: relative; }
.me-type-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.me-type-pick span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 15px; border: 1.5px solid var(--line); border-radius: 30px; background: #fff; font-size: 13px; font-weight: 600; }
.me-type-pick input:checked + span { background: var(--lv, var(--ink)); border-color: var(--lv, var(--ink)); color: #fff; }
.me-type-pick input:checked + span::before { content: '✓'; margin-right: 6px; }
.me-type-pick input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.me-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.me-dates .field { margin-bottom: 6px; min-width: 0; }
.me-dates input { min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
.me-dates input::-webkit-date-and-time-value { text-align: left; }
.me-days { font-size: 13px; margin: 0 0 18px; min-height: 20px; }
#me-mc-box { margin-bottom: 18px; }
#me-mc-box .hint { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; }
.me-file-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.me-file-btns .btn { min-height: 56px; font-size: 13px; border-radius: 12px; background: #fff; }
.me-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.me-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.me-previews:not(:empty) { margin-top: 12px; }
.me-preview { position: relative; display: grid; place-items: center; margin: 0; aspect-ratio: 3 / 4; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); }
.me-preview img { width: 100%; height: 100%; object-fit: cover; }
.me-preview figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 7px; background: #241608b8; color: #fff; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-preview .button-spinner { color: var(--red); width: 22px; height: 22px; }
.me-pdf { font-family: 'Lilita One', sans-serif; font-size: 26px; color: var(--red); }
.me-remove { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; }

/* Calendar: Monday first. Each day shows the hours worked and any leave. */
.me-cal-head { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 8px; margin-bottom: 6px; text-align: center; }
.me-cal-head h2 { font-size: 30px; }
.me-cal-nav { min-height: 52px; padding: 0; font-size: 30px; line-height: 1; border-radius: 12px; background: var(--white); }
.me-cal-sum { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.me-cal-sum b { color: var(--ink); }
.me-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.me-cal-wd { padding: 2px 0 4px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.me-cal-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; min-height: 66px; padding: 4px 2px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); }
.me-cal-cell.blank { background: transparent; border-color: transparent; }
.me-cal-date { width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 700; line-height: 24px; text-align: center; }
.me-cal-cell.today .me-cal-date { background: var(--red); color: #fff; }
.me-cal-cell.picked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.me-cal-hours { font-size: 10px; font-weight: 700; color: var(--green); line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-cal-hours.warn { color: #a6171e; }
.me-cal-leave { display: inline-block; max-width: 100%; padding: 0 5px; border: 1.5px solid var(--lv, var(--muted)); border-radius: 6px; background: var(--lv, var(--muted)); color: #fff; font-size: 9px; font-style: normal; font-weight: 700; line-height: 14px; overflow: hidden; }
.me-cal-leave.pending { background: var(--white); color: var(--lv-ink, var(--ink)); border-style: dashed; }
.me-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; font-size: 11px; color: var(--muted); }
.me-legend span { display: inline-flex; align-items: center; gap: 6px; }
.me-day { margin-top: 20px; scroll-margin-top: 80px; scroll-margin-bottom: 100px; }
.me-day h3 { font-size: 24px; margin-bottom: 10px; }

/* Hours: one card per shift */
.me-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.me-seg button { min-height: 46px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.me-seg button.active { background: var(--red); color: #fff; }
.me-shifts { display: grid; gap: 12px; }
.me-shift { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.me-shift.missing { border-color: #f6c3c3; }
.me-shift-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.me-shift-top strong { display: block; font-size: 14px; margin-bottom: 4px; }
.me-shift-hours { font-family: 'Lilita One', sans-serif; font-size: 26px; line-height: 1; color: var(--red); text-align: right; white-space: nowrap; }
.me-shift-hours small { display: block; margin-top: 3px; font-family: Poppins, Arial, sans-serif; font-size: 10px; color: var(--muted); }
.me-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 10px; padding: 10px 0; border-top: 1px solid #eeeade; border-bottom: 1px solid #eeeade; }
.me-times dt { font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.me-times dd { margin: 3px 0 0; font-size: 13px; font-weight: 600; line-height: 1.45; font-variant-numeric: tabular-nums; }
.me-times dd > span { display: block; }
.me-times small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); line-height: 1.2; }
.me-warn { color: #a6171e; }
.me-live { color: var(--green); }
.me-shift-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.me-shift-foot b { color: var(--ink); }
.me-shift-warn { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: #fde5e5; color: #7d1015; font-size: 12px; font-weight: 600; }

/* Phones */
@media (max-width: 760px) {
  dialog.me-sheet { width: 100%; max-width: 100%; margin: auto 0 0; padding: 24px calc(18px + env(safe-area-inset-right)) 0 calc(18px + env(safe-area-inset-left)); border-width: 1px 0 0; border-radius: 22px 22px 0 0; max-height: calc(100dvh - 24px - env(safe-area-inset-top)); }
  dialog.me-sheet::before { content: ''; display: block; width: 44px; height: 5px; margin: -10px auto 14px; border-radius: 3px; background: var(--line); }
  dialog.me-sheet .modal-actions { position: sticky; bottom: 0; z-index: 1; margin: 18px 0 0; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid #eeeade; flex-wrap: nowrap; }
  dialog.me-sheet .modal-actions .btn { flex: 1; min-height: 54px; font-size: 14px; }
  dialog.me-sheet .modal-actions .btn.ghost { flex: 0 1 auto; }
  /* The confirm box (Remove this phone, Cancel request) gets big buttons too. */
  .me-page dialog:not(.me-sheet) .modal-actions .btn { flex: 1; min-height: 52px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 760px) {
  dialog.me-sheet[open] { animation: me-up .22s ease-out; }
  @keyframes me-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}
@media (max-width: 374px) {
  .me-brand .eyebrow { display: none; }
  .me-hello h1, .me-head h1 { font-size: 38px; }
  .me-gate-card h1 { font-size: 34px; }
  .me-stat strong { font-size: 25px; }
  .me-big b { font-size: 20px; }
  .me-cal-leave { padding: 0 3px; }
}
@media (max-width: 339px) {
  .me-times { grid-template-columns: 1fr 1fr; }
}

/* Tablets and computers: the same page, centred, with the tab bar under it. */
@media (min-width: 700px) {
  .me-top { padding-left: max(24px, calc(50% - 310px)); padding-right: max(24px, calc(50% - 310px)); }
  .me-tabs { max-width: 620px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
  .me-main { padding-top: 28px; }
  .me-cal { gap: 6px; }
  .me-cal-cell { min-height: 84px; }
  .me-cal-hours { font-size: 12px; }
  .me-cal-leave { font-size: 10px; }
}
