/* Home (home.js): the signed-in "/" page. index.html also hosts the public homepage, so every rule
   here is scoped under .hh (or a class only Home creates). The page itself is the shared layout
   (.page-head, .stat-row, .page-grid in styles.css); this file styles the app cards and My shift.
   Written against the app's tokens, so the night-shift theme follows. Phone first. */

.hh { display: flex; flex-direction: column; gap: 1.5rem; }
.hh > .page-head, .hh > .stat-row { margin-bottom: 0; }
.hh-headline[hidden] { display: none; }
.hh .dash-alerts:empty { display: none; }
.hh .dash-alerts:not(:empty) { margin-bottom: 0; }
.hh .setup-card { margin-top: 0; }
.hh-muted { color: var(--ink-muted); font-size: 0.875rem; }

/* Section headings */
.hh-section { display: flex; flex-direction: column; gap: 0.75rem; }
.hh-section-title { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: 0; }

.hh-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 1.25rem; }
.hh-card[hidden] { display: none; }

/* My shift: a slim card in the side column (above the Today cards below 1280px). */
.hh-shift { border-color: var(--spark); }
.hh-shift-main { display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 720px) and (max-width: 1279.98px) { .hh-shift-main { flex-direction: row; align-items: center; justify-content: space-between; } }
.hh-shift-info { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.hh-shift-info .hh-section-title { margin-bottom: 0.25rem; }
.hh-shift-when { margin: 0; font-size: 1.0625rem; line-height: 1.4; }
.hh-shift-day { font-weight: 600; margin-right: 0.25rem; }
.hh-shift-worked { margin: 0; font-size: 0.9375rem; color: var(--ink-muted); }
.hh-shift-worked .mono { color: var(--ink); font-weight: 600; }
.hh-shift-status { margin: 0; display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.hh-shift-status--in { color: var(--spark); }
.hh-shift-status--break { color: var(--ink); }
.hh-dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.hh-shift-status--break .hh-dot { background: transparent; border: 2px solid currentColor; }
.hh-shift-site { margin-top: 0.5rem; max-width: 20rem; }
.hh-shift .hh-section-title { font-size: 0.9375rem; }
.hh-shift-site label { font-size: 0.8125rem; color: var(--ink-muted); }
.hh-shift-site select { min-height: 44px; }

.hh-shift-buttons { display: flex; flex-direction: column; gap: 0.625rem; flex-shrink: 0; }
@media (min-width: 720px) and (max-width: 1279.98px) { .hh-shift-buttons { min-width: 15rem; } }
.hh-clock-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.625rem; width: 100%; min-height: 56px; padding: 0 1.5rem; border: 0; border-radius: var(--radius-md); background: var(--spark); color: var(--on-spark); font-family: var(--font-body); font-size: 1.125rem; font-weight: 600; cursor: pointer; transition: transform 0.1s var(--ease-out), background-color 0.15s ease; }
.hh-clock-btn:not(:disabled):active { transform: scale(0.97); }
.hh-clock-btn:hover { background: var(--spark-hover); }
.hh-clock-btn:disabled { opacity: 0.7; cursor: progress; }
.hh-clock-btn svg { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.hh-clock-btn--out { background: var(--ink); color: var(--paper); }
.hh-clock-btn--out:hover { background: var(--ink); opacity: 0.9; }
.hh-break-btn { justify-content: center; min-height: 48px; }
.hh-shift-foot { margin-top: 0.75rem; padding-top: 0.875rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; font-size: 0.9375rem; }
.hh-shift-foot a { color: var(--spark); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.hh-link-btn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0; border: 0; background: none; color: var(--spark); font: inherit; font-weight: 500; cursor: pointer; }
.hh-link-btn svg { width: 1.125rem; height: 1.125rem; }
.hh-link-btn:hover span, .hh-shift-foot a:hover { text-decoration: underline; }

/* PIN dialog */
.hh-pin-dialog { display: flex; flex-direction: column; gap: 0.5rem; width: min(92vw, 24rem); }
.hh-pin-dialog h2 { margin: 0; font-size: 1.125rem; }
.hh-pin-dialog .hh-muted { margin: 0 0 0.5rem; }
.hh-pin-dialog label { font-size: 0.875rem; }
.hh-pin-input { font-family: var(--font-mono); font-size: 1.5rem !important; letter-spacing: 0.5em; text-align: center; min-height: 52px; }
.hh-pin-dialog .confirm-dialog-actions { margin-top: 0.75rem; }

/* Card slots (Customize): every card sits in one. Wide ones (Get set up, More apps) span the main
   grid; a card with nothing to show takes no room, except while customizing. */
.hh-site, .hh-custom { display: contents; }
.hh-today-note { margin: 0; }
.hh-today-note[hidden], .hh-section-title[hidden], .hh-edit-note[hidden] { display: none; }
.hh-edit-note { margin: 0; }
.hh-slot { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.hh-slot--wide { grid-column: 1 / -1; }
.hh-slot-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hh-slot-body > .hh-app-today { flex: 1; }
.hh:not(.hh--editing) .hh-slot:has(> .hh-slot-body > [hidden]:only-child) { display: none; }
.hh--editing .hh-slot-body { opacity: 0.55; }
.hh--editing .hh-slot-body:has(> [hidden]:only-child)::after { content: "Nothing to show right now."; padding: 0.75rem; color: var(--ink-muted); font-size: 0.875rem; }
.hh-slot-bar { display: flex; align-items: center; gap: 0.125rem; padding: 0.125rem 0.125rem 0.125rem 0.875rem; border: 1px dashed var(--spark); border-radius: var(--radius-md); background: var(--spark-soft); }
.hh-slot-bar[hidden] { display: none; }
.hh-slot-name { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-slot-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); cursor: pointer; transition: background-color 0.15s ease, transform 0.1s var(--ease-out); }
.hh-slot-btn svg { width: 1.25rem; height: 1.25rem; }
.hh-slot-btn:not(:disabled):hover { background: var(--paper-raised); }
.hh-slot-btn:not(:disabled):active { transform: scale(0.94); }
.hh-slot-btn:disabled { opacity: 0.3; cursor: default; }
.hh-slot-btn:focus-visible { outline: 2px solid var(--spark); outline-offset: -2px; }
.hh-add-dialog h2 { margin: 0 0 0.5rem; font-size: 1.125rem; }
.hh-add-dialog .hh-muted { margin: 0 0 0.75rem; }
.hh-add-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.hh-add-item { display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 48px; padding: 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.hh-add-item:hover { border-color: var(--spark); }
.hh-add-item .btn-icon { color: var(--spark); display: inline-flex; }
.hh-add-item svg { width: 1.125rem; height: 1.125rem; }

/* Today: a card per app */
/* Two columns from about 660px of room (a tablet), three on a wide screen. */
.hh-today { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.hh-app-today { display: flex; flex-direction: column; gap: 1rem; }
.hh-app-today-head { display: flex; align-items: center; gap: 0.625rem; }
.hh-app-today-head h3 { margin: 0; font-size: 1.0625rem; }
.hh-app-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); background: var(--spark-soft); color: var(--spark); flex-shrink: 0; }
.hh-app-icon svg { width: 1.25rem; height: 1.25rem; }

/* As many tiles across as the card has room for: two in a column card, four or five in a wide one. */
.hh-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: 0.625rem; }
/* Three Prep counts on a phone: the first full width, then two side by side, with no gap left over. */
@media (max-width: 479px) { .hh-app-today[data-app="prep"] .hh-stats { grid-template-columns: repeat(2, 1fr); } .hh-app-today[data-app="prep"] .hh-stat:first-child:nth-last-child(3) { grid-column: 1 / -1; } }
/* Serve: the top item is a name, not a number. */
.hh-stat--text .hh-stat-value { font-family: var(--font-body); font-size: 1.125rem; line-height: 1.25; letter-spacing: 0; overflow-wrap: anywhere; }
.hh-stat--money .hh-stat-value { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 1.5rem; line-height: 1.1; white-space: nowrap; }
.hh-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; padding: 0.875rem 1rem; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { a.hh-stat:hover { border-color: var(--spark); } }
a.hh-stat { transition: border-color 0.15s ease, transform 0.1s var(--ease-out); }
a.hh-stat:active { transform: scale(0.98); }
.hh-stat-icon { width: 1.25rem; height: 1.25rem; color: var(--ink-muted); }
.hh-stat-icon svg { width: 100%; height: 100%; display: block; }
.hh-stat-icon--soon { color: var(--discard); }
.hh-stat-icon--bad { color: var(--expired); }
.hh-stat-value { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.hh-stat-value.shimmer { min-width: 2.5rem; border-radius: 6px; }
/* Nothing to report (0, None, 0.00): smaller and quiet, so the figures that matter stand out. */
.hh-stat--quiet { background: transparent; }
.hh-stat--quiet .hh-stat-value { font-size: 1.25rem; font-weight: 500; color: var(--ink-muted); }
.hh-stat--quiet .hh-stat-icon { opacity: 0.7; }
.hh-stat-label { font-size: 0.8125rem; color: var(--ink-muted); line-height: 1.3; }
/* Cards in a row are the same height; the actions sit on the bottom edge of each. */
.hh-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
.hh-actions .btn-primary, .hh-actions .btn-outline { min-height: 44px; }
@media (max-width: 479px) { .hh-actions > a { flex: 1 1 100%; justify-content: center; } }

/* App launcher */
.hh-apps { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 560px) { .hh-apps { grid-template-columns: repeat(2, 1fr); } }

.hh-app { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0.5rem 0.875rem; align-items: start; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised); color: var(--ink); text-decoration: none; }
.hh-app-text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.hh-app-name { font-weight: 600; }
.hh-app-line { font-size: 0.8125rem; color: var(--ink-muted); line-height: 1.4; }
.hh-app-foot { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.875rem; }
.hh-app--on { box-shadow: var(--shadow-card); }
.hh-app--on:hover { border-color: var(--spark); }
.hh-app-open { display: inline-flex; align-items: center; gap: 0.125rem; margin-left: auto; color: var(--spark); font-weight: 600; }
.hh-app-open svg { width: 1rem; height: 1rem; }
.hh-app--off { background: var(--paper); }
.hh-app--off .hh-app-icon { background: var(--paper-deep); color: var(--ink-muted); }
.hh-app-soon { color: var(--ink-muted); }
.hh-app-ask { color: var(--spark); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.hh-app-ask:hover { text-decoration: underline; }

@media (min-width: 1100px) {
  .hh-apps { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
  /* Five narrow tiles in a row: icon on top, so the name gets the full width. */
  .hh-app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .hh-app-foot { grid-column: 1; }
}
.hh-disclaimer { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.hh-disclaimer[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { :is(.hh-clock-btn, a.hh-stat, .hh-slot-btn):active { transform: none; } }

/* The staff dashboard cards: My hours (a figure and a meter), Quick print, My rounds, My shifts. */
.hh-hours { display: flex; flex-direction: column; gap: 0.625rem; }
.hh-hours[hidden] { display: none; }
.hh-hours .hh-section-title { font-size: 0.9375rem; }
.hh-hours-figure { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem; }
.hh-hours-worked { font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.hh-meter { height: 0.5rem; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.hh-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--spark); }
.hh-hours .hh-shift-foot { margin-top: 0.25rem; }
.hh-app-today .side-list { margin: 0; }
.hh-print-stuck { margin: 0; display: flex; align-items: center; gap: 0.5rem; color: var(--expired); font-weight: 600; font-size: 0.9375rem; }
.hh-print-stuck svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.hh-myshifts { display: flex; flex-direction: column; gap: 0.75rem; }
