/* MethodConnect — styles. Mobile first. Brand: charcoal + teal #0F9E94, Open Sans. */
:root {
  --teal: #0F9E94;
  --teal-dark: #0B7A72;
  --teal-soft: #E6F6F4;
  --charcoal: #2F3437;
  --text: #1F2937;
  --muted: #5B6470;
  --line: #E3E7EA;
  --bg: #F6F8F9;
  --card: #FFFFFF;
  --green: #1E7B34;
  --green-soft: #E7F5EA;
  --amber: #8A5A00;
  --amber-soft: #FFF4DB;
  --red: #B42318;
  --red-soft: #FDECEA;
  --gray-soft: #EEF0F2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --focus: 0 0 0 3px rgba(15, 158, 148, .35);
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }
a { color: var(--teal-dark); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Brand */
.wordmark { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.wordmark.big { font-size: 2rem; }
.wm-method { color: var(--charcoal); }
.wm-connect { color: var(--teal); }
.tagline { color: var(--muted); font-size: .85rem; margin-top: -4px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; min-height: 44px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tagline { color: var(--muted); font-size: .68rem; font-weight: 500; white-space: nowrap; }
.brand:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.topnav { display: none; gap: 4px; margin-left: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  min-width: 44px; min-height: 44px; border-radius: 22px; border: 1px solid var(--line);
  background: #fff; font-weight: 700; color: var(--teal-dark); cursor: pointer;
}
.sync-pill { font-size: .75rem; background: var(--amber-soft); color: var(--amber); padding: 4px 10px; border-radius: 999px; }

/* Layout */
main { max-width: 960px; margin: 0 auto; padding: 16px; outline: none; }
.screen { animation: fade .15s ease-out; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }
.center-stack { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 0 0 16px; }
.card.draft { border-left: 4px solid var(--amber); }
.card.accent { border-top: 4px solid var(--teal); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Bottom nav (mobile) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.navbtn {
  flex: 1; min-height: 44px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .75rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.navbtn svg { width: 24px; height: 24px; }
.navbtn[aria-current="page"] { color: var(--teal-dark); font-weight: 700; }
.navbtn .badge { position: absolute; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottomnav { display: none !important; }
  .topnav { display: flex; }
  .topnav .navbtn { flex-direction: row; white-space: nowrap; font-size: .9rem; padding: 0 12px; border-radius: 8px; }
  .topnav .navbtn[aria-current="page"] { background: var(--teal-soft); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--teal-dark); border-color: var(--teal); }
.btn-secondary:hover:not([disabled]) { background: var(--teal-soft); }
.btn-ghost { background: transparent; color: var(--teal-dark); }
.btn-ghost:hover:not([disabled]) { background: var(--teal-soft); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger:hover:not([disabled]) { background: var(--red-soft); }
.btn-google { background: #fff; color: var(--text); border-color: var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn + .btn { margin-left: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none; box-shadow: var(--focus);
}

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.field .error { font-size: .85rem; color: var(--red); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #C9D0D6; border-radius: 10px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 88px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6470' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[aria-invalid=true] { border-color: var(--red); }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.chip-toggle input { width: 18px; height: 18px; accent-color: var(--teal); }
.client-picker { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }

/* Status chips (color + text, never color alone) */
.status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.s-green { background: var(--green-soft); color: var(--green); }
.s-amber { background: var(--amber-soft); color: var(--amber); }
.s-red { background: var(--red-soft); color: var(--red); }
.s-gray { background: var(--gray-soft); color: var(--muted); }
.s-teal { background: var(--teal-soft); color: var(--teal-dark); }

/* Progress */
.progress { height: 10px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .3s; }
.ring { width: 96px; height: 96px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; gap: 12px; align-items: center; padding: 12px; background: #fff; border-radius: 10px;
  box-shadow: var(--shadow); margin-bottom: 8px; min-height: 56px; width: 100%; border: 0; text-align: left; font: inherit; cursor: pointer;
}
.list-item:hover { background: #FBFCFC; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow-wrap: anywhere; }

/* Tasks */
.task { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; border-left: 4px solid var(--line); }
.task.t-done { border-left-color: var(--teal); }
.task.t-verified { border-left-color: var(--green); }
.task.t-retake_needed { border-left-color: var(--red); }
.task.t-na { border-left-color: #B8BFC6; opacity: .8; }
.task-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.task-title { font-weight: 600; }
.task-detail { color: var(--muted); font-size: .92rem; margin: 6px 0 0; white-space: pre-line; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.task-meta { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.group-title { margin-top: 20px; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* First Day card */
.firstday { background: linear-gradient(135deg, var(--teal) 0%, #13B3A7 100%); color: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.firstday h2 { margin-top: 0; color: #fff; }
.firstday .when { font-size: 1.25rem; font-weight: 700; }
.firstday a { color: #fff; }
.firstday .place { background: rgba(255,255,255,.14); border-radius: 12px; padding: 12px; margin-top: 12px; }
.firstday .first-shift { background: #fff; color: #7A4A00; border-left: 4px solid #D97706; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.first-shift .pre { white-space: pre-line; margin-top: 4px; }
.firstday img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; margin-top: 8px; background: rgba(255,255,255,.2); }

/* ID upload */
.id-slot { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed #B8C4CC; border-radius: 12px; margin-bottom: 10px; background: #FBFCFD; }
.id-slot .grow { flex: 1; }
.id-preview { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin: 8px 0; }
.secure-note { display: flex; gap: 8px; align-items: flex-start; background: var(--teal-soft); color: var(--teal-dark); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.simple th, table.simple td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { min-height: 44px; padding: 8px 14px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected=true] { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 700; }

/* Banners */
.banner { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: .92rem; }
.banner.info { background: var(--teal-soft); color: var(--teal-dark); }
.banner.warn { background: var(--amber-soft); color: var(--amber); }
.banner.error { background: var(--red-soft); color: var(--red); }

/* Empty state & spinner */
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--teal-soft); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toast-host { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--charcoal); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); cursor: pointer; animation: slidein .2s ease-out; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
@keyframes slidein { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } .modal { border-radius: 16px; } }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* Login */
.login-wrap { max-width: 420px; margin: 24px auto; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

@media (max-width: 479px) {
  .row.stack-sm { flex-direction: column; align-items: stretch; }
  .task-actions .btn { flex: 1 1 auto; }
}
@media print { .bottomnav, .topbar { display: none !important; } }

/* Icon sizing inside buttons / labels */
.btn svg { width: 20px; height: 20px; flex: none; }
.secure-note svg { width: 22px; height: 22px; flex: none; }
/* Buttons inside the teal First Day card keep readable text */
.firstday a.btn { color: var(--teal-dark); background: #fff; }

/* Idle sign-out warning (js/idle.js) — above every other dialog */
.idle-warn { position: fixed; inset: 0; background: rgba(17, 24, 39, .6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.idle-card { background: #fff; width: 100%; max-width: 420px; border-radius: 16px; padding: 20px; }
.idle-card .btn { margin-top: 8px; }

/* Collapsed "Completed" block at the foot of each checklist section
   (Paul, 2026-09-17: finished work moves out of the way of what's left). */
.done-block { margin: 6px 0 18px; border-top: 1px solid var(--line); }
.done-block > summary {
  list-style: none; cursor: pointer; color: var(--muted);
  font-size: .85rem; font-weight: 600;
  min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 2px;
}
.done-block > summary::-webkit-details-marker { display: none; }
.done-block > summary::before {
  content: '▸'; display: inline-block; transition: transform .15s ease; font-size: .9rem;
}
.done-block[open] > summary::before { transform: rotate(90deg); }
.done-block > summary:hover { color: var(--text); }
.done-block > summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(15, 158, 148, .18); border-radius: 8px; }
.done-list { opacity: .72; }
.done-list:hover { opacity: 1; }

/* "Add MethodConnect to your phone" prompt on the employee task list. */
.install-banner { margin-bottom: 14px; }

/* Where the signature goes — the placement editor (js/layout-editor.js, rule 36).
   Laptop only: the editor itself refuses to draw below 920px, so nothing here
   needs a phone breakpoint. Boxes are positioned in percentages of the page, so
   they follow the canvas when the window is resized without recomputing. */
/* The toolbar follows you down the page. Without this, scrolling to the
   signature line takes the "+ Signature" buttons off screen with it. 57px is the
   sticky .topbar's height, so the two stack instead of overlapping. */
.le-tools {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 10px;
  position: sticky; top: 57px; z-index: 15;
  background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line);
}
.le-tools .le-gap { flex: 0 0 12px; }
.le-stage { display: flex; justify-content: center; background: var(--bg-soft, #f3f4f6); border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow: auto; }
.le-paper { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(17, 24, 39, .18); }
.le-paper canvas { display: block; }
.le-layer { position: absolute; inset: 0; }
.le-box {
  position: absolute; box-sizing: border-box; cursor: grab;
  border: 1.5px solid var(--teal, #0f9e94); background: rgba(15, 158, 148, .13);
  border-radius: 3px; display: flex; align-items: center; white-space: nowrap;
  overflow: visible;   /* the × badge overhangs the corner — clipping it made it unclickable */
}
.le-clip { overflow: hidden; white-space: nowrap; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.le-box.ro { cursor: default; border-style: dashed; }
.le-box:focus-visible { outline: none; box-shadow: var(--focus); }
.le-box.sel { border-width: 2px; background: rgba(15, 158, 148, .22); }
.le-box.le-date { border-color: #b45309; background: rgba(180, 83, 9, .12); }
.le-box.le-printed_name { border-color: #1d4ed8; background: rgba(29, 78, 216, .12); }
.le-box.le-text { border-color: #7c3aed; background: rgba(124, 58, 237, .12); }
.le-tag { font-size: 10px; line-height: 1; padding: 0 3px; color: #111827; font-weight: 600; pointer-events: none; }
.le-preview { padding-left: 2px; color: #111827; pointer-events: none; font-family: Helvetica, Arial, sans-serif; }
.le-box.le-signature .le-preview { font-style: italic; }
.le-handle {
  position: absolute; right: -5px; bottom: -5px; width: 12px; height: 12px;
  background: #fff; border: 2px solid var(--teal, #0f9e94); border-radius: 3px; cursor: nwse-resize;
}
.le-row { margin-bottom: 10px; }
/* Waiting for a click that says where the box goes. */
.le-stage.arming .le-paper { cursor: crosshair; }
.le-stage.arming .le-box { pointer-events: none; opacity: .65; }
.le-box.sel { box-shadow: 0 0 0 2px rgba(15, 158, 148, .55); z-index: 2; }
.le-x {
  position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--red); color: var(--red);
  font-size: 13px; line-height: 15px; text-align: center; font-weight: 700;
  cursor: pointer; user-select: none;
}
.le-x:focus-visible { outline: none; box-shadow: var(--focus); }

/* The signer's preview of their own document (js/employee.js _paintSignPreview).
   Read-only by design: nothing here is draggable, so the council's objection to a
   cleaner aiming at a box on a phone still holds — they only ever look. */
.sign-preview { max-height: 56vh; overflow: auto; display: flex; flex-direction: column; align-items: center; }
.sign-page { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(17, 24, 39, .18); margin-bottom: 8px; }
.sign-page canvas { display: block; }
.sign-layer { position: absolute; inset: 0; pointer-events: none; }
.sign-box {
  position: absolute; box-sizing: border-box; display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; color: #111827;
  font-family: Helvetica, Arial, sans-serif; padding: 0 2px;
}
.sign-box.sig { font-style: italic; }
