/* AMC Workforce admin UI. Tokens follow amc-workforce-integrated-fixed.html */
:root {
  --bg: #f5f3ee; --surface: #ffffff; --ink: #14171c; --muted: #6b6b6b; --soft: #9a9a9a;
  --border: #e5e2db; --border-strong: #d1cdc4;
  --accent: #c2410c; --accent-soft: #fef2eb;
  --ok: #166534; --ok-soft: #ecfdf5; --warn: #a16207; --warn-soft: #fefbeb;
  --bad: #991b1b; --bad-soft: #fef2f2; --info: #1e40af; --info-soft: #eff6ff;
  --dark: #0f1419;
  --radius: 10px; --tap: 48px;
  --page-max: 1760px;                                  /* wide screens: use the width, keep the gutters */
  --gutter: clamp(12px, 2.2vw, 32px);
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* buttons + chips */
.btn { min-height: 40px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
       background: var(--surface); font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chips { display: flex; gap: 8px; align-items: center; overflow-x: auto; }
.chips.wrap { flex-wrap: wrap; }
.chip { min-height: 34px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
        background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.is-on { background: var(--dark); border-color: var(--dark); color: #fff; }
.icon-btn { width: var(--tap); height: 40px; border-radius: var(--radius); border: 1px solid var(--border);
            background: var(--surface); font-size: 22px; line-height: 1; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px var(--gutter) 8px;
          border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: var(--page-max); margin: 0 auto; }
.topbar-row { display: flex; gap: 10px; align-items: center; }
.topbar-row + .topbar-row { margin-top: 8px; }
.day-label { flex: 1; text-align: center; display: flex; flex-direction: column; }
.day-label strong { font: 700 18px/1.2 var(--display); }
.progress { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.sync-pill { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft);
             padding: 4px 10px; border-radius: 999px; }

/* board */
.board { padding: 12px var(--gutter); max-width: 720px; margin: 0 auto 96px; display: flex; flex-direction: column; gap: 12px; }
.site { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.site.is-complete { border-color: var(--ok); background: var(--ok-soft); }
.site.is-open-card { border: 2px solid var(--accent); }
.site.has-errors { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.site-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 60px; }
.site-title { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.site-title strong { display: block; font: 700 16px/1.25 var(--display); }
.site-title .muted { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-count { font-size: 13px; font-weight: 700; white-space: nowrap; }
.site-body { border-top: 1px solid var(--border); }
.site-foot { padding: 12px 14px; display: flex; gap: 8px; }
.site-foot .btn { flex: 1; min-height: var(--tap); }

/* slot rows */
.slot { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 14px;
        border-bottom: 1px solid var(--border); align-items: center; }
.slot:last-child { border-bottom: 0; }
.slot.is-missing { background: var(--bad-soft); }
.slot-name { font-weight: 600; }
.slot-who { grid-column: 1; font-size: 13px; color: var(--muted); }
.slot-who .code { font-variant-numeric: tabular-nums; }
.slot-who .relief { color: var(--ink); font-weight: 700; }
.slot-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; }
.pill { min-width: 56px; min-height: var(--tap); border-radius: 999px; border: 1.5px solid var(--border-strong);
        background: var(--surface); font-weight: 700; font-size: 13px; }
.pill-in.is-on  { background: var(--ok-soft);  border-color: var(--ok);  color: var(--ok); }
.pill-in.is-relief { padding: 0 12px; white-space: nowrap; }       /* "Relief IN": covered by the relief */
.slot.is-twice { background: var(--bad-soft); }
.slot-who .rostered-off { text-decoration: line-through; text-decoration-color: var(--soft); }
.pill-off.is-on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.hours-chip { border: 0; background: var(--info-soft); color: var(--info); border-radius: 6px; padding: 1px 6px;
              font-size: 12px; font-weight: 700; margin-left: 4px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.badge-relief { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.cancelled { color: var(--soft); font-style: italic; }

/* sheets, modal, toast */
.sheet-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, .45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface);
         border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
         max-height: 86vh; display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 0 auto; }
/* Rows of a sheet keep their natural height; only the candidate list flexes (and scrolls). */
.sheet > * { flex-shrink: 0; }
.sheet .candidates { flex: 1 1 0; min-height: 0; overscroll-behavior: contain; }
.sheet .candidates[aria-busy="true"] { opacity: .55; transition: opacity .15s; }
#absence-chips { overflow: visible; flex-wrap: wrap; row-gap: 8px; padding: 2px 0; }
/* Relief picker: a fixed height, so filtering never shrinks or jumps the window. */
.sheet-relief { height: 82vh; height: 82dvh; max-height: none; }
.sheet h2, .modal h2 { margin: 4px 0 0; font: 700 18px/1.25 var(--display); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 0 auto; }
.search { min-height: var(--tap); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0 12px; font: inherit; }
.candidates { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; border: 1px solid var(--border); border-radius: var(--radius); }
.candidates li button { width: 100%; min-height: 56px; display: flex; justify-content: space-between; align-items: center;
                        gap: 8px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; }
.candidates li:last-child button { border-bottom: 0; }
.candidates .meta { font-size: 12px; color: var(--muted); }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions .btn { flex: 1; min-height: var(--tap); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper .btn { width: 64px; min-height: 56px; font-size: 22px; }
.stepper output { font: 700 28px var(--display); min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
.modal-backdrop { display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; }
.modal ul { padding-left: 18px; }
.modal p { margin: 10px 0 16px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; min-height: var(--tap); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
         background: var(--dark); color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; gap: 14px;
         align-items: center; max-width: calc(100% - 24px); }
.toast button { background: none; border: 0; color: #fdba74; font-weight: 700; min-height: 36px; }
.toast.is-error { background: var(--bad); }
.banner-complete { position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 30; max-width: 696px; margin: 0 auto;
                   background: var(--ok); color: #fff; font-weight: 700; text-align: center; padding: 14px; border-radius: 12px; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.brand { font: 700 28px var(--display); } .brand span { color: var(--accent); }
.field { display: block; margin: 12px 0; } .field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input { width: 100%; min-height: var(--tap); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0 12px; font: inherit; }
.login-error { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px; font-size: 13px; }

/* tablet / desktop: the relief picker is a centred dialog of fixed size */
@media (min-width: 768px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%);
           width: min(600px, calc(100vw - 48px)); border-radius: 18px; padding: 20px 22px; margin: 0; }
  .sheet .sheet-handle { display: none; }
  .sheet-relief { height: min(640px, calc(100vh - 64px)); }
}
/* desktop: two columns of site cards; wide screens: three */
@media (min-width: 1024px) {
  .board { max-width: var(--page-max); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (min-width: 1440px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* site budget chip on the board: worked / budget hours; amber when the plan is below budget */
.budget-chip { font-size: 12px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 999px;
               border: 1px solid var(--border-strong); color: var(--muted); }
.budget-chip.is-short { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.badge-bad { background: var(--bad-soft); color: var(--bad); margin-left: 0; white-space: normal; }
.candidates .empty-row { padding: 14px 12px; }

/* shown when the server runs a newer build than this page (see app/build.py) */
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; gap: 12px; align-items: center;
              justify-content: center; flex-wrap: wrap; padding: 8px 12px; background: var(--info); color: #fff;
              font-weight: 600; font-size: 13.5px; }
.update-bar .btn { background: #fff; color: var(--info); border-color: #fff; }

/* board modes (012): future dates are a read-only roster preview */
.mode-banner { max-width: var(--page-max); margin: 10px auto 0; padding: 0 var(--gutter); display: grid; gap: 6px; }
.mode-note { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; }
.mode-note.is-info { background: var(--info-soft); color: var(--info); }
.mode-note.is-warn { background: var(--warn-soft); color: var(--warn); }
.badge-sched { background: var(--info-soft); color: var(--info); padding: 4px 10px; font-size: 12px; border-radius: 999px; }
body.board-readonly .site.is-open-card { border-color: var(--info); }
