/* Progon HR Portal. Tokens, shell and components follow the Progon Client Portal so the two feel like one product. */
:root {
  --brand-light: #5ec5f5;
  --brand: #2e7cd6;
  --brand-deep: #123f96;
  --navy: #0b1428;
  --navy-2: #0f1e42;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #17233a;
  --muted: #64748c;
  --border: #dfe6f0;
  --accent: var(--brand);
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a1220; --card: #131c30; --text: #e7edf7; --muted: #8fa1bd; --border: #24304a; --accent: #4da3ff; }
}
:root[data-theme="dark"] { --bg: #0a1220; --card: #131c30; --text: #e7edf7; --muted: #8fa1bd; --border: #24304a; --accent: #4da3ff; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.ico { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: 0 0 auto; }
.ico-lg { width: 1.6rem; height: 1.6rem; }
h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
h2 { margin: 0 0 0.6rem; font-size: 1.1rem; font-weight: 700; }
h3 { margin: 0 0 0.4rem; font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 0.8rem; }
.est { font-size: 0.8rem; color: var(--muted); }
.muted { color: var(--muted); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 2rem 0 0.6rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
button, .btn, .card, .sidebar nav a, input, select, textarea, .badge, .stat { transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease; }

/* --- app shell --- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 235px; flex-shrink: 0; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); border-right: 1px solid rgba(94, 197, 245, 0.15); display: flex; flex-direction: column; padding: 1.1rem 0.8rem; gap: 1.1rem; color: #e7edf7; box-shadow: 2px 0 18px rgba(6, 14, 30, 0.28); }
@media (min-width: 721px) {
  .sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow: hidden; }
  .sidebar nav { overflow-y: auto; min-height: 0; }
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0.4rem; text-decoration: none; color: inherit; }
.brand-mark-img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; display: block; }
.brand-text strong { display: block; color: #fff; font-weight: 800; letter-spacing: 0.14em; font-size: 1.05rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }
.brand-text small { display: block; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.3em; background: linear-gradient(90deg, var(--brand-light), #9ad8fb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-header { font-size: 0.63rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-light); padding: 0.7rem 0.75rem 0.15rem; }
.nav-header:first-child { padding-top: 0.1rem; }
.sidebar nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; border-radius: 8px; color: #c6d4ea; text-decoration: none; font-size: 0.92rem; }
.sidebar nav a .ico { width: 1.1rem; height: 1.1rem; opacity: 0.85; }
.sidebar nav a:hover { background: rgba(94, 197, 245, 0.12); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(46, 124, 214, 0.35), rgba(18, 63, 150, 0.35)); color: #fff; font-weight: 600; border-left: 3px solid var(--brand-light); }
.sidebar nav a .count { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px; font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.45rem; }
.locbox { display: flex; flex-direction: column; gap: 0.25rem; padding: 0 0.4rem; }
.locbox select { width: 100%; background: #ffffff; color: #17233a; border-color: rgba(94, 197, 245, 0.35); }
.locbox .est, .userbox .est { color: #8fa1bd; }
.userbox { display: flex; flex-direction: column; gap: 0.45rem; border-top: 1px solid rgba(94, 197, 245, 0.15); padding-top: 0.9rem; }
.userbox button, .userbox .btn { background: rgba(255, 255, 255, 0.07); color: #e7edf7; border: 1px solid rgba(94, 197, 245, 0.25); text-align: left; width: 100%; font-weight: 400; font-size: 1rem; }
.userbox button:hover, .userbox .btn:hover { background: rgba(94, 197, 245, 0.15); }
.whoami { display: flex; align-items: center; gap: 0.55rem; padding: 0.1rem 0.15rem 0.35rem; min-width: 0; }
.whoami-avatar { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 55%, var(--brand-deep) 100%); box-shadow: 0 2px 7px rgba(18, 63, 150, 0.45); }
.whoami-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.whoami-name { font-weight: 700; font-size: 0.86rem; color: #e7edf7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami-biz { font-size: 0.72rem; color: #8fa1bd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { flex: 1; padding: 0 1.5rem 3rem; min-width: 0; }
.nav-toggle { display: none; width: 42px; height: 40px; padding: 0; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(94, 197, 245, 0.25); border-radius: 8px; flex-shrink: 0; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; display: block; width: 20px; height: 2px; border-radius: 2px; background: #e7edf7; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after { position: absolute; top: 6px; }
.nav-open .nav-toggle-bars { background: transparent; }
.nav-open .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin: 0 -1.5rem 1.8rem; padding: 0.8rem 1.5rem; background: color-mix(in srgb, var(--card) 84%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); box-shadow: 0 6px 18px rgba(6, 14, 30, 0.06); }
.topbar-left { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; }
.topbar-logo { flex: none; width: 28px; height: 28px; object-fit: contain; display: block; }
.topbar-brand { display: inline-flex; align-items: baseline; gap: 0.4rem; font-weight: 700; color: var(--text); font-size: 0.95rem; white-space: nowrap; }
.topbar-brand-sub { font-weight: 500; color: var(--muted); font-size: 0.82rem; }
.topbar-right { display: inline-flex; align-items: center; gap: 0.6rem; flex: none; }
.theme-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); }
.theme-btn:hover { color: var(--text); }
.theme-btn .theme-ico-moon { display: none; }
:root[data-theme="dark"] .theme-btn .theme-ico-sun { display: none; }
:root[data-theme="dark"] .theme-btn .theme-ico-moon { display: block; }
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 0.9rem; position: sticky; top: 0; z-index: 30; }
  .brand { flex: 1; min-width: 0; padding: 0; }
  .nav-toggle { display: inline-flex; }
  .sidebar nav, .sidebar .locbox, .sidebar .userbox { display: none; width: 100%; order: 5; }
  .sidebar.nav-open nav { display: flex; flex: 0 0 100%; flex-direction: column; gap: 0.15rem; }
  .sidebar.nav-open .locbox { display: flex; padding: 0.2rem 0; }
  .sidebar.nav-open .userbox { display: flex; flex-direction: column; padding-top: 0.7rem; margin-top: 0.2rem; }
  .topbar { display: none; }
  main { padding: 1.2rem 1rem 3rem; }
}

/* --- common controls --- */
header.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; justify-content: space-between; margin-bottom: 1.2rem; }
header.page-head > div:first-child { flex: 1 1 20rem; min-width: 0; }
header.page-head p { margin: 0.25rem 0 0; }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.controls label { font-size: 0.85rem; color: var(--muted); }
input:not([type]), input[type="date"], input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], input[type="url"], input[type="time"], input[type="file"], select, textarea, button, .btn { font: inherit; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); }
textarea { width: 100%; min-height: 6rem; resize: vertical; line-height: 1.5; }
input[type="color"] { width: 3rem; height: 2.3rem; padding: 0.15rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none; font-size: 0.92rem; font-weight: 600; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%); border: 1px solid transparent; color: #fff; box-shadow: 0 2px 6px rgba(18, 63, 150, 0.35); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(18, 63, 150, 0.4); }
button:disabled { opacity: 0.5; cursor: wait; }
button.danger, .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: var(--bad); }
button.big, .btn.big { padding: 0.75rem 1.2rem; font-size: 1rem; width: 100%; }
.linky { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; font-weight: 400; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
form.inline { display: inline; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem 1.2rem; margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem; text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--accent); }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.7rem 1rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.8rem; }
.field-grid .field { margin-bottom: 0; }
.field > label, .field > span.label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.5rem 0; font-size: 0.95rem; }
.check input { margin-top: 0.15rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: top; }
th { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
td a.row-link { color: var(--text); font-weight: 600; text-decoration: none; }
td a.row-link:hover { color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; --tone: var(--muted); color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); }
.badge.s-invited { --tone: #8a94a6; }
.badge.s-in_progress { --tone: #2f7fe0; }
.badge.s-submitted { --tone: #8b5cf6; }
.badge.s-needs_changes { --tone: #d9a300; }
.badge.s-approved, .badge.ok { --tone: #16a34a; }
.badge.s-inactive, .badge.bad { --tone: #dc2626; }
.badge.warn { --tone: #d97706; }
.badge.info { --tone: #2f7fe0; }
.badge.leader { --tone: #0d9488; }

.alert { border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--border)); background: color-mix(in srgb, var(--tone) 9%, var(--card)); border-radius: 10px; padding: 0.75rem 1rem; margin: 0 0 1rem; --tone: var(--brand); display: flex; gap: 0.6rem; align-items: flex-start; }
.alert .ico { color: var(--tone); margin-top: 0.15rem; }
.alert.ok { --tone: var(--ok); }
.alert.warn { --tone: var(--warn); }
.alert.bad { --tone: var(--bad); }
.alert > div { flex: 1; min-width: 0; }
.alert p:last-child { margin-bottom: 0; }

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 1.2rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: 0.5rem 0.9rem; border-radius: 8px 8px 0 0; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
details.panel { border: 1px solid var(--border); border-radius: 10px; background: var(--card); margin-bottom: 0.7rem; }
details.panel > summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "\203A"; font-size: 1.2rem; color: var(--muted); transition: transform 0.14s ease; }
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > .panel-body { padding: 0 1rem 1rem; }
.copy-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.copy-row input { flex: 1 1 14rem; min-width: 0; font-size: 0.9rem; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.86em; background: color-mix(in srgb, var(--muted) 12%, transparent); padding: 0.05rem 0.3rem; border-radius: 4px; }
.kv { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: 0.35rem 1rem; font-size: 0.92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 0.7rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list li:last-child { border-bottom: none; }
.list li .grow { flex: 1 1 12rem; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.timeline li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); display: flex; gap: 0.6rem; flex-wrap: wrap; }
.timeline li:last-child { border-bottom: none; }
.timeline time { color: var(--muted); white-space: nowrap; }
.row-edit { display: grid; grid-template-columns: 2fr 3fr 7rem auto; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.row-edit.q { grid-template-columns: 2fr 1.4fr 6.5rem 2fr auto; }
@media (max-width: 720px) { .row-edit, .row-edit.q { grid-template-columns: 1fr; padding-bottom: 0.7rem; border-bottom: 1px dashed var(--border); } }
.editor textarea { min-height: 28rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.88rem; }
mark.needs { background: color-mix(in srgb, #f5a623 30%, transparent); color: inherit; border-radius: 4px; padding: 0 0.2rem; }
.merge { background: color-mix(in srgb, var(--brand) 14%, transparent); border-radius: 4px; padding: 0 0.25rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; }
.doc-view { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.3rem; max-height: 28rem; overflow-y: auto; font-family: Georgia, "Times New Roman", serif; font-size: 0.98rem; line-height: 1.6; }
.doc-view h3 { font-family: "Segoe UI", system-ui, sans-serif; font-size: 0.98rem; margin: 1.1rem 0 0.3rem; }
.doc-view h3:first-child { margin-top: 0; }
.doc-view.full { max-height: none; }
.hero { border-radius: 16px; padding: 1.5rem 1.6rem; color: #e7edf7; background: radial-gradient(40rem 20rem at 85% -20%, rgba(46, 124, 214, 0.45), transparent), linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); border: 1px solid rgba(94, 197, 245, 0.2); margin-bottom: 1.2rem; }
.hero h1 { font-size: 1.6rem; font-weight: 800; color: #fff; letter-spacing: -0.01em; }
.hero p { color: #c6d4ea; margin: 0.4rem 0 0; }
.hero .copy-row { margin-top: 1rem; }
.hero input { background: rgba(255, 255, 255, 0.08); border-color: rgba(94, 197, 245, 0.3); color: #fff; }
.hero button { background: rgba(255, 255, 255, 0.1); border-color: rgba(94, 197, 245, 0.3); color: #fff; }
.pill { display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-light); margin-bottom: 0.4rem; }

/* --- sign-in (always on-brand dark, like the portal) --- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 1.5rem; background: radial-gradient(60rem 30rem at 80% -10%, rgba(46, 124, 214, 0.28), transparent), radial-gradient(40rem 24rem at 10% 110%, rgba(94, 197, 245, 0.18), transparent), linear-gradient(180deg, var(--navy) 0%, #060b16 100%); color: #e7edf7; }
.login-card { background: rgba(19, 28, 48, 0.92); border: 1px solid rgba(94, 197, 245, 0.22); border-radius: 14px; padding: 2rem; width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
.login-card .brand { justify-content: center; margin-bottom: 0.9rem; }
.login-card h2 { margin: 0 0 0.5rem; color: #fff; font-size: 1.3rem; }
.login-card .est, .login-card label { color: #8fa1bd; }
.login-card form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1rem; }
.login-card input { font: inherit; padding: 0.6rem 0.75rem; border: 1px solid rgba(94, 197, 245, 0.3); border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: #e7edf7; width: 100%; }
.login-card input::placeholder { color: #7487a5; }
.login-card a { color: var(--brand-light); }
.login-error { color: #ff9c9c; font-size: 0.9rem; }
.login-card .code-input { font-size: 1.5rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border-radius: 10px; padding: 0.4rem; display: block; margin: 0.8rem auto; width: 200px; height: 200px; image-rendering: pixelated; }

/* --- worker-facing pages --- */
body.public { background: var(--bg); }
.pub-bar { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-bottom: 3px solid var(--accent); }
.pub-bar-in { max-width: 820px; margin: 0 auto; padding: 0.8rem 1rem; display: flex; align-items: center; gap: 0.8rem; }
.pub-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; flex: none; }
.pub-logo.tile, .brand-mark-img.tile { background: #fff; padding: 3px; border-radius: 10px; }
.pub-name { font-weight: 800; font-size: 1.05rem; line-height: 1.2; flex: 1; min-width: 0; }
.pub-name small { display: block; font-weight: 500; font-size: 0.75rem; color: #a9bbd6; letter-spacing: 0.04em; }
.pub-bar button, .pub-bar .btn { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; font-size: 0.85rem; }
.pub-nav { max-width: 820px; margin: 0 auto; padding: 0 1rem; display: flex; gap: 0.3rem; overflow-x: auto; }
.pub-nav a { padding: 0.55rem 0.9rem; color: #c6d4ea; text-decoration: none; font-weight: 600; font-size: 0.9rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.pub-nav a.active { color: #fff; border-bottom-color: var(--brand-light); }
.wrap { max-width: 820px; margin: 0 auto; padding: 1.3rem 1rem 4rem; }
.wrap h1 { font-size: 1.45rem; margin-bottom: 0.3rem; }
.lead { color: var(--muted); margin-bottom: 1.2rem; }
.foot { text-align: center; font-size: 0.78rem; color: var(--muted); padding: 1.5rem 1rem 2.5rem; }
.foot img { width: 16px; height: 16px; vertical-align: -3px; margin-right: 0.25rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem; margin: 1rem 0 1.3rem; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.choice-body { display: block; height: 100%; border: 2px solid var(--border); border-radius: 14px; background: var(--card); padding: 1.1rem 1.2rem; }
.choice-body b { display: block; font-size: 1.08rem; margin-bottom: 0.3rem; }
.choice-body .tag { display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.35rem; }
.choice-body span.d { display: block; color: var(--muted); font-size: 0.9rem; }
.choice input:checked + .choice-body { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--brand); outline-offset: 2px; }
.progress { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden; margin: 0.5rem 0 1rem; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-light), var(--accent)); border-radius: 999px; }
.w-0 { width: 2%; } .w-1 { width: 10%; } .w-2 { width: 20%; } .w-3 { width: 30%; } .w-4 { width: 40%; } .w-5 { width: 50%; } .w-6 { width: 60%; } .w-7 { width: 70%; } .w-8 { width: 80%; } .w-9 { width: 90%; } .w-10 { width: 100%; }
.steps { list-style: none; margin: 0 0 1.2rem; padding: 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.steps a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.steps a .n { display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: color-mix(in srgb, var(--muted) 22%, transparent); font-size: 0.72rem; }
.steps a.done .n { background: var(--ok); color: #fff; }
.steps a.reopened .n { background: #d9a300; color: #fff; }
.steps a.current { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.sign-box { border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 12px; padding: 1rem 1.1rem; margin-top: 1rem; background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.sign-box input[name="signature"] { font-family: Georgia, serif; font-style: italic; font-size: 1.2rem; }
.upload-item { border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; margin-bottom: 0.7rem; background: var(--card); }
.upload-item form { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.upload-item input[type="file"] { flex: 1 1 14rem; min-width: 0; }
.job { display: block; color: inherit; text-decoration: none; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 0.9rem 1rem; background: var(--card); margin-bottom: 0.8rem; }
.job.cancelled { border-left-color: var(--bad); opacity: 0.75; }
.job .when { font-weight: 800; font-size: 1.05rem; }
.job .where { display: flex; gap: 0.4rem; align-items: flex-start; margin-top: 0.3rem; }
.day-head { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 1.4rem 0 0.5rem; }
.checklist label { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--border); font-size: 1rem; }
.checklist label:last-of-type { border-bottom: none; }
.crew-pick { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; }
.crew-pick label { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.88rem; }
.pre { white-space: pre-line; }
a.job:hover { border-color: var(--accent); }
input[type="file"] { max-width: 100%; min-width: 0; }
details.panel > summary > * { min-width: 0; }
.list li details[open] { flex: 1 1 100%; }
.mobile-only { display: none; }
html { -webkit-tap-highlight-color: transparent; }
a, button, .btn, summary, label, select, input, textarea { touch-action: manipulation; }

/* --- a row's actions: side by side on a wide screen, one tidy menu on a phone --- */
.actions { position: relative; display: flex; }
.actions-toggle { display: none; }
.actions-items { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* --- phones --- */
@media (max-width: 720px), (pointer: coarse) {
  /* iOS Safari zooms the whole page when a focused field's text is smaller than 16px. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]), select, textarea { font-size: 16px !important; }
  .login-card .code-input { font-size: 1.5rem !important; }
  .sign-box input[name="signature"] { font-size: 1.2rem !important; }
}
@media (max-width: 720px) {
  .mobile-only { display: inline-flex; }
  h1 { font-size: 1.3rem; }
  .section-title { margin-top: 1.6rem; }
  th, td { padding: 0.5rem 0.6rem; }
  .hide-sm { display: none !important; }
  .card { padding: 1rem; }
  button, .btn { white-space: normal; }
  .hero { padding: 1.2rem 1.1rem; border-radius: 14px; }
  .hero h1 { font-size: 1.4rem; }

  /* comfortable to tap */
  button:not(.linky):not(.theme-btn):not(.nav-toggle), .btn, select, .steps a, .tabs a,
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]) { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 1.3rem; height: 1.3rem; }
  input[type="file"] { width: 100%; padding: 0.6rem; }
  .check { gap: 0.65rem; align-items: flex-start; }
  .linky { padding: 0.5rem 0; }

  /* the notch, the rounded corners and the home bar */
  .sidebar { padding: max(0.7rem, env(safe-area-inset-top)) max(0.9rem, env(safe-area-inset-right)) 0.7rem max(0.9rem, env(safe-area-inset-left)); }
  .sidebar.nav-open { max-height: 100vh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
  .sidebar .theme-btn { background: rgba(255, 255, 255, 0.07); border-color: rgba(94, 197, 245, 0.25); color: #e7edf7; width: 40px; height: 40px; border-radius: 8px; }
  main { padding: 1.2rem max(1rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
  .pub-bar { padding-top: env(safe-area-inset-top); }
  .pub-bar-in, .pub-nav, .wrap { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .foot { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
  .login-body { padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); }
  .login-card { padding: 1.5rem 1.25rem; }

  /* one clean column: fields and actions span the width instead of sitting ragged on the left */
  header.page-head { gap: 0.7rem; }
  header.page-head > .btn, header.page-head > .btn-row, header.page-head > form { flex: 1 1 100%; }
  .btn-row { align-items: stretch; }
  .btn-row > button, .btn-row > .btn, .btn-row > form, .btn-row > select, .btn-row > .actions,
  .btn-row > input:not([type="checkbox"]):not([type="radio"]):not([type="color"]) { flex: 1 1 100%; min-width: 0; }
  .btn-row > form > button, .btn-row > form > .btn { width: 100%; }
  .btn-row > .spacer { display: none; }
  .btn-row > h2 { flex: 1 1 100%; margin-bottom: 0; }
  form:not(.inline):not(.btn-row):not(.controls) > button:not(.linky), .card > .btn, .wrap > .btn, .sign-box + p + button { width: 100%; }
  .pub-bar form > button { width: auto; min-height: 40px; }
  .copy-row input { flex: 1 1 100%; }
  .copy-row button { flex: 1 1 100%; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; align-items: end; }
  .controls > input, .controls > button, .controls > .check { grid-column: 1 / -1; }
  .controls > label:not(.check) { display: flex; flex-direction: column; gap: 0.2rem; }
  .controls select { width: 100%; }
  .crew-pick { flex-direction: column; gap: 0; }
  .crew-pick label { display: flex; gap: 0.65rem; align-items: center; min-height: 44px; font-size: 0.95rem; }
  .kv { grid-template-columns: minmax(5.5rem, auto) 1fr; }
  .upload-item form > button { flex: 1 1 100%; }
  .steps { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .steps a { width: 100%; }
  .choices { grid-template-columns: 1fr; }
  .doc-view { padding: 1rem; max-height: 60vh; }
  .editor textarea { min-height: 20rem; }
  details.panel > summary { padding: 0.8rem 0.9rem; min-height: 48px; }
  details.panel > summary > .est { flex: 1 1 100%; order: 3; }
  details.panel > summary > .spacer { display: none; }

  /* list rows: the text first, then its actions sharing one full-width row underneath */
  .list li { align-items: stretch; }
  .list li:has(> .btn, > form, > button, > .actions) > .grow { flex-basis: 100%; }
  .list li > .btn, .list li > form, .list li > button { flex: 1 1 0; min-width: 0; }
  .list li > form > button { width: 100%; }
  .list li > .badge { align-self: center; }
  .list li > .actions { flex: 1 1 100%; }

  /* a row's actions fold into one menu */
  .actions.ready > .actions-toggle { display: inline-flex; width: 100%; }
  .actions.ready > .actions-items { display: none; }
  .actions.ready.open > .actions-items { display: flex; flex-direction: column; align-items: stretch; position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem; box-shadow: 0 14px 34px rgba(6, 14, 30, 0.28); }
  .actions-items > form { display: block; }
  .actions-items > form > button, .actions-items > .btn, .actions-items > button { width: 100%; justify-content: flex-start; border-color: transparent; }
  .actions.ready.open > .actions-toggle { border-color: var(--accent); }

  /* tables read as cards */
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
  table.stack tr:last-child { border-bottom: none; }
  table.stack td { border: none; padding: 0.15rem 0; text-align: left; overflow-wrap: anywhere; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; }
  table.stack td.right { margin-top: 0.4rem; }
  table.stack td.right form, table.stack td.right button { width: 100%; }
  table.stack td .linky { padding: 0; font-weight: 700; }
  table.stack code { overflow-wrap: anywhere; }
}
@media print { .sidebar, .topbar, .pub-bar, .foot { display: none; } }
@media (max-width: 720px) {
  table.stack td.nowrap { color: var(--muted); font-size: 0.8rem; }
  table.stack td:empty { display: none; }
}
.login-alt { margin: 1.4rem 0 0; padding-top: 1.1rem; border-top: 1px solid rgba(94, 197, 245, 0.18); text-align: center; color: #8fa1bd; font-size: 0.95rem; }
.login-alt a { display: inline-block; padding: 0.35rem 0.2rem; font-weight: 700; }
.login-card form + p.est { margin-top: 1.1rem; }
.center { text-align: center; }
form > button.big + p.est { margin-top: 0.9rem; }

/* --- drawn signatures --- */
.sign-name { margin: 0 0 0.6rem; font-size: 0.95rem; }
.sign-hint { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); }
.sign-canvas { display: block; width: 100%; height: 170px; background: #fff; border: 1.5px solid var(--border); border-radius: 10px; touch-action: none; cursor: crosshair; background-image: linear-gradient(#c9d2dc, #c9d2dc); background-size: calc(100% - 2.4rem) 1.5px; background-position: 1.2rem calc(100% - 2.6rem); background-repeat: no-repeat; }
.sign-canvas.inked { border-color: var(--accent); }
.sign-tools { display: flex; gap: 0.8rem; align-items: center; justify-content: space-between; margin: 0.5rem 0 0.2rem; flex-wrap: wrap; }
.sign-saved { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.sign-img { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.8rem; height: 76px; max-width: 100%; object-fit: contain; }
.sign-error { color: var(--bad); font-size: 0.9rem; margin: 0.4rem 0 0; }
.sign-box .check { margin-top: 0.9rem; }
.sign-box .big { margin-top: 0.6rem; }
@media (max-width: 720px) { .sign-canvas { height: 190px; } .sign-tools button:not(.linky) { flex: 0 0 auto; } }
.section-gap { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
/* language choice (first visit) and the switch to the other language on worker pages */
.lang-title span { display: block; }
.lang-choices { display: grid; gap: 0.8rem; margin-top: 1.2rem; }
.lang-choices .btn { padding: 1rem 1.2rem; font-size: 1.15rem; font-weight: 700; color: #fff; text-decoration: none; text-align: center; justify-content: center; }
.lang-row { margin: 1.3rem 0 0; text-align: center; font-size: 0.9rem; }
.lang-row a { display: inline-block; padding: 0.35rem 0.6rem; font-weight: 600; }
.pub-bar .lang-switch { color: #fff; font-size: 0.85rem; font-weight: 600; white-space: nowrap; padding: 0.5rem 0.3rem; text-underline-offset: 3px; }
/* the English wording that is recorded with a signature, shown beneath its Spanish translation */
.recorded { display: block; margin: 0.5rem 0 0.2rem; padding-left: 0.7rem; border-left: 2px solid var(--border); font-size: 0.82rem; color: var(--muted); }
.recorded-note { display: block; margin: 0 0 0.25rem; font-style: italic; }
.recorded p, .recorded ol { margin: 0.25rem 0; }
.doc-view p.notice { font-weight: 700; border: 1.5px solid var(--text); border-radius: 6px; padding: 0.7rem 0.8rem; }

/* --- one-button uploads --- */
.upload-one { position: relative; display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.upload-one.ready .upload-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-width: 0; min-height: 0; padding: 0; border: 0; margin: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.upload-one.ready .upload-fallback { display: none; }
.upload-one:not(.ready) .upload-pick { display: none; }
.upload-pick { cursor: pointer; }
.upload-input:focus-visible + .upload-pick { outline: 2px solid var(--brand); outline-offset: 2px; }
.upload-one.busy .upload-pick { opacity: 0.6; pointer-events: none; }
.list li > .upload-one { margin-top: 0; flex: 0 0 auto; }
/* --- pick several (days, times of day) --- */
fieldset.pick { border: 0; padding: 0; margin: 0.9rem 0 0.2rem; min-width: 0; }
fieldset.pick legend { padding: 0; font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 0.3rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.1rem 0.8rem; }
.pick-grid .check { margin: 0.25rem 0; align-items: center; }
@media (max-width: 720px) { .pick-grid { grid-template-columns: 1fr 1fr; } .pick-grid .check { min-height: 40px; } .list li > .upload-one { flex: 1 1 0; } .list li > .upload-one .upload-pick { width: 100%; } }
fieldset.pick + .field { margin-top: 0.9rem; }

/* iPhone dispatch: thumb-sized navigation, readable forms, roomy crew picks. */
.mobile-dispatch { display: none; }
@media (max-width: 720px) {
  .mobile-dispatch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 20px; }
  .mobile-dispatch a { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; text-align: center; font-weight: 700; text-decoration: none; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 50px; }
  .crew-pick { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .crew-pick label { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 17px; }
  .crew-pick input { width: 24px; height: 24px; flex: 0 0 24px; }
  .crew-pick label:has(input:checked) { border-color: var(--accent); background: rgba(28,111,181,.12); }
  .panel summary { flex-wrap: wrap; gap: 10px; padding: 18px 14px; font-size: 17px; }
  .panel-body { padding: 16px 14px; }
  .panel-body .primary.big { width: 100%; min-height: 56px; font-size: 17px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  header.page-head > *, header.page-head > div:first-child { flex: 0 0 auto; }
  .page-head form, .page-head button, .page-head .btn { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .list li { flex-wrap: wrap; gap: 10px; }
  main { min-width: 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

.document-preview { display: block; width: 100%; height: 65vh; min-height: 360px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; background: white; }

/* Crews on a phone: big tap targets, one job per card, plain stacking. */
@media (max-width: 720px) {
  .panel summary .job-time { font-size: 18px; font-weight: 700; }
  .panel summary .job-client { flex: 1 1 100%; order: -1; font-size: 18px; font-weight: 700; }
  .day-head { font-size: 19px; padding: 14px 4px 8px; }
  .panel-body .field label, .panel-body .field .label { font-size: 17px; font-weight: 700; }
  .panel-body select { width: 100%; }
  .btn.big, .primary.big { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 56px; font-size: 17px; }
  .mobile-dispatch a { font-size: 17px; min-height: 58px; }
}

/* The job leader is always on the job: shown ticked and locked in the crew list. */
.crew-leader-tag { display: none; margin-left: auto; }
.crew-pick label.is-leader .crew-leader-tag { display: inline-flex; }
.crew-pick label.is-leader { opacity: 1; cursor: default; }
.crew-pick label.is-leader input { cursor: default; }

/* Crews: the team at a glance. */
.crew-stats { margin-bottom: 0.4rem; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.team-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.team-card[open] { border-color: var(--accent); }
.team-card summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.team-card summary::-webkit-details-marker { display: none; }
.team-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team-name { font-size: 1.02rem; }
.team-counts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.team-count b { font-size: 1.5rem; font-weight: 800; margin-right: 2px; }
.team-count.zero b { color: var(--muted); }
.team-next { font-size: 0.85rem; }
.team-jobs { list-style: none; margin: 0; padding: 0 16px 4px; border-top: 1px solid var(--border); }
.team-jobs li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.team-jobs li:last-child { border-bottom: 0; }
.team-jobs a { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none; color: inherit; min-height: 36px; }
.team-link { display: block; padding: 10px 16px 14px; font-size: 0.88rem; }
@media (max-width: 720px) {
  .team-grid { grid-template-columns: 1fr; }
  .team-card summary { padding: 16px; }
  .team-name { font-size: 18px; }
  .team-jobs a { min-height: 48px; font-size: 16px; }
  .crew-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Branded sharing preview stays within the settings card on mobile. */
.share-preview{display:block;max-width:100%;height:auto;border-radius:12px}
