@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;600&display=swap');

/* HGC Hub components. Every class starts with h- so the new look can live beside the old hub.css while
   pages move over one at a time. Values come from tokens.json (tokens.css); nothing here repeats a value
   that is a token. Breakpoints: 640px (phone: stacked tables, bottom sheets, 44px targets), 820px (top menu
   collapses to one Menu button). */

/* ---------- base ---------- */
.h-app, .h-app body { margin: 0; }
.h-app { font-family: var(--font-sans); font-size: 15px; line-height: 22px; color: var(--ink); background: var(--canvas);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.h-app *, .h-app *::before, .h-app *::after { box-sizing: border-box; }
.h-app :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.h-app ::selection { background: var(--success-soft); }
.h-num { font-variant-numeric: tabular-nums; }
.h-muted { color: var(--ink-muted); }
.h-nowrap { white-space: nowrap; }
.h-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h-link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.h-link:hover { color: var(--brand-hover); }
.h-main { max-width: var(--page-max); margin: 0 auto; padding: var(--space-8) var(--space-8) 96px; }
@media (max-width: 640px) { .h-main { padding: var(--space-4) var(--space-4) 112px; } }

/* ---------- Button ---------- */
.h-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control);
  padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: 600 14px/20px var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color 130ms cubic-bezier(.2,.8,.2,1), border-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-btn:hover { background: var(--surface-muted); }
.h-btn:active { transform: translateY(1px); }
.h-btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); min-width: 96px; }
.h-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.h-btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-primary); }
.h-btn--danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.h-btn--ghost { border-color: transparent; background: transparent; color: var(--ink-muted); }
.h-btn--ghost:hover { background: var(--surface-muted); color: var(--ink); }
.h-btn--sm { min-height: var(--control-sm); padding: 0 12px; font-size: 13px; }
.h-btn--icon { width: var(--control); padding: 0; }
.h-btn--icon.h-btn--sm { width: var(--control-sm); }
.h-btn--block { display: flex; width: 100%; }
.h-btn[disabled], .h-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.h-btn.is-busy { color: transparent !important; position: relative; pointer-events: none; }
.h-btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-primary) var(--on-primary) transparent transparent;
  animation: h-spin .7s linear infinite; }
.h-btn:not(.h-btn--primary):not(.h-btn--danger).is-busy::after { border-color: var(--ink) var(--ink) transparent transparent; }
.h-btn svg { width: 16px; height: 16px; flex: none; }
.h-btns { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
@keyframes h-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .h-btn, .h-btn--sm { min-height: var(--control-touch); font-size: 15px; }
  .h-btn--icon, .h-btn--icon.h-btn--sm { width: var(--control-touch); }
}

/* ---------- Count badge ---------- */
.h-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--danger); color: var(--on-primary); font: 600 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }

/* ---------- Status pill ---------- */
.h-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-muted); color: var(--ink-muted);
  font: 600 12.5px/1 var(--font-sans); white-space: nowrap; }
.h-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.h-pill--danger, .h-pill[data-status="not_started"], .h-pill[data-status="attention"], .h-pill[data-status="blocked"], .h-pill[data-status="off"], .h-pill[data-status="sent_back"], .h-pill[data-status="returned"], .h-pill[data-status="failed"]
  { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.h-pill--warn, .h-pill[data-status="in_progress"], .h-pill[data-status="open"], .h-pill[data-status="ready"], .h-pill[data-status="ready_for_review"], .h-pill[data-status="fs_planned"], .h-pill[data-status="outstanding"], .h-pill[data-status="stale"], .h-pill[data-status="waiting"]
  { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.h-pill--info, .h-pill[data-status="submitted"], .h-pill[data-status="planned"], .h-pill[data-status="approved"], .h-pill[data-status="building"], .h-pill[data-status="scheduled"], .h-pill[data-status="sent"]
  { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.h-pill--success, .h-pill[data-status="locked"], .h-pill[data-status="exported"], .h-pill[data-status="done"], .h-pill[data-status="posted"], .h-pill[data-status="live"], .h-pill[data-status="on"], .h-pill[data-status="cleared"]
  { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.h-pill--neutral, .h-pill[data-status="workbook"], .h-pill[data-status="new"], .h-pill[data-status="wont_do"], .h-pill[data-status="idea"], .h-pill[data-status="draft"], .h-pill[data-status="voided"]
  { background: var(--surface-muted); border-color: var(--line); color: var(--ink-muted); }
.h-pill--tag { height: 20px; padding: 0 7px; border-radius: var(--radius-sm); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.h-pill--tag::before { display: none; }

/* ---------- Card ---------- */
.h-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); }
.h-card--flush { padding: 0; overflow: hidden; }
.h-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); }
.h-card__title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -.01em; }
.h-card__note { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-card__body { padding: var(--space-6); }
.h-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-6); border-top: 1px solid var(--line); background: var(--surface); }
.h-card > .h-card__title + * { margin-top: var(--space-3); }
.h-stack { display: grid; gap: var(--space-6); }
.h-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-3); }
@media (max-width: 640px) {
  .h-card, .h-card__body { padding: var(--space-4); }
  .h-card--flush { padding: 0; }
  .h-card__head, .h-card__foot { padding: var(--space-3) var(--space-4); }
  .h-stack { gap: var(--space-4); }
}

/* ---------- Page head + person stepper ---------- */
.h-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-8); }
.h-pagehead__title { margin: 0; font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; }
.h-pagehead__sub { margin: 4px 0 0; color: var(--ink-muted); }
.h-pagehead__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--space-3); margin-top: var(--space-2);
  color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.h-pagehead__meta > * + *::before { content: "·"; margin-right: var(--space-3); color: var(--line-control); }
.h-pagehead__meta > .h-pill::before { content: ""; margin: 0; }
.h-pagehead__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.h-stepper { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-4); }
.h-stepper__nav { display: flex; gap: var(--space-2); }
.h-stepper__pos { color: var(--ink-muted); font-size: 13px; }
@media (max-width: 640px) {
  .h-pagehead { margin-bottom: var(--space-6); align-items: stretch; }
  .h-pagehead__title { font-size: 22px; line-height: 28px; }
  .h-pagehead__tools { width: 100%; }
  .h-pagehead__tools > * { flex: 1 1 auto; }
  .h-stepper__name { display: none; }
}

/* ---------- Count tiles ---------- */
.h-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.h-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: var(--space-4); text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink);
  font: inherit; cursor: pointer; text-decoration: none; transition: border-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-stat:hover { border-color: var(--line-control); }
.h-stat[aria-pressed="true"], .h-stat[aria-current="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.h-stat__num { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.h-stat__label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.h-stat__label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-control); }
.h-stat[data-status="not_started"] .h-stat__label::before, .h-stat[data-status="attention"] .h-stat__label::before { background: var(--danger); }
.h-stat[data-status="in_progress"] .h-stat__label::before, .h-stat[data-status="ready"] .h-stat__label::before { background: var(--warn); }
.h-stat[data-status="submitted"] .h-stat__label::before, .h-stat[data-status="approved"] .h-stat__label::before { background: var(--info); }
.h-stat[data-status="locked"] .h-stat__label::before, .h-stat[data-status="posted"] .h-stat__label::before { background: var(--success); }
@media (max-width: 640px) {
  .h-stats { display: flex; overflow-x: auto; gap: var(--space-2); margin: 0 calc(-1 * var(--space-4)) var(--space-4);
    padding: 0 var(--space-4); scrollbar-width: none; scroll-snap-type: x proximity; }
  .h-stat { flex: 0 0 auto; min-width: 120px; padding: var(--space-3); scroll-snap-align: start; }
  .h-stat__num { font-size: 22px; line-height: 28px; }
}

/* ---------- Choice chips (reason chips, filter chips, segmented) ---------- */
.h-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.h-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-sm); padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: 500 13px/18px var(--font-sans); cursor: pointer; user-select: none;
  transition: background-color 130ms cubic-bezier(.2,.8,.2,1), border-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-chip:hover { border-color: var(--line-control); }
.h-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.h-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.h-chip[aria-pressed="true"], .h-chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.h-chip[aria-pressed="true"]:hover, .h-chip:has(input:checked):hover { background: var(--primary-hover); }
.h-chip--check::before { content: ""; width: 14px; height: 14px; border: 1px solid var(--line-control); border-radius: 3px; background: var(--surface); flex: none; }
.h-chip--check:has(input:checked)::before { border-color: var(--on-primary); background: var(--on-primary)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%231c1b19' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.h-chip:has(input:disabled), .h-chip[disabled] { opacity: .45; cursor: not-allowed; }
.h-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 8px; }
.h-seg .h-chip { border-color: transparent; background: transparent; min-height: 28px; padding: 0 10px; }
.h-seg .h-chip:has(input:checked), .h-seg .h-chip[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.06); font-weight: 600; }
@media (max-width: 640px) {
  .h-chips { gap: var(--space-2); }
  .h-chip { min-height: var(--control-touch); padding: 0 14px; font-size: 15px; }
  .h-seg .h-chip { min-height: 36px; }
  .h-chips--fill { display: grid; grid-template-columns: repeat(3, 1fr); }
  .h-chips--fill .h-chip { justify-content: center; }
}

/* ---------- Form fields ---------- */
.h-form { display: grid; gap: var(--space-5); }
.h-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.h-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.h-label, .h-field > legend { padding: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.h-field > legend { margin-bottom: 6px; }
.h-label .h-opt { font-weight: 400; color: var(--ink-muted); }
.h-help { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-input { width: 100%; min-height: var(--control); padding: 9px 12px; border: 1px solid var(--line-control); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 400 15px/20px var(--font-sans); appearance: none; -webkit-appearance: none;
  transition: border-color 130ms cubic-bezier(.2,.8,.2,1), box-shadow 130ms cubic-bezier(.2,.8,.2,1); }
.h-input::placeholder { color: var(--ink-placeholder); }
.h-input:hover { border-color: var(--ink-muted); }
.h-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.h-input[readonly] { background: var(--surface-muted); border-color: var(--line-strong); color: var(--ink); font-variant-numeric: tabular-nums; }
.h-input:disabled { background: var(--surface-muted); border-color: var(--line); color: var(--ink-muted); cursor: not-allowed; }
.h-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
textarea.h-input { min-height: 88px; resize: vertical; }
select.h-input { padding-right: 36px; background: var(--surface)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235f5c55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/16px no-repeat; }
.h-field__error { display: flex; gap: 6px; margin: 0; font-size: 13px; line-height: 18px; color: var(--danger); font-weight: 500; }
.h-field__error::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; margin-top: 1px;
  border-radius: 50%; background: var(--danger); color: var(--on-primary); font-size: 11px; font-weight: 700; }
.h-check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 22px; cursor: pointer; }
.h-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.h-search { position: relative; }
.h-search .h-input { padding-left: 36px; }
.h-search::before { content: ""; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='%235f5c55' stroke-width='1.5'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%235f5c55' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/16px no-repeat; }
@media (max-width: 640px) {
  .h-input { min-height: var(--control-touch); font-size: 16px; }
  .h-form-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .h-form-grid > .h-field--wide { grid-column: 1 / -1; }
}

/* ---------- Reason field + confirm ---------- */
.h-reason { display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.h-reason > legend { padding: 0; margin-bottom: var(--space-2); font-size: 13px; line-height: 18px; font-weight: 600; }
.h-reason .h-help::before { content: ""; display: inline-block; width: 12px; height: 12px; margin: 0 6px -1px 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6' fill='none' stroke='%235f5c55' stroke-width='1.5'/%3E%3Cpath d='M8 5v3.5l2 1.5' fill='none' stroke='%235f5c55' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.h-confirm { display: flex; gap: var(--space-3); align-items: flex-start; padding: 14px var(--space-4); border-radius: var(--radius-md);
  background: var(--confirm-soft); color: var(--confirm); cursor: pointer; }
.h-confirm input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.h-confirm__main { display: block; font-size: 14px; line-height: 20px; font-weight: 600; }
.h-confirm__hint { display: block; font-size: 13px; line-height: 18px; }

/* ---------- Alert (errors, flags, done, info, system strip) ---------- */
.h-alert { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); align-items: start; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-muted); color: var(--ink);
  font-size: 14px; line-height: 20px; }
.h-alert::before { content: var(--h-alert-glyph, ""); grid-row: 1 / span 2; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%; background: var(--h-alert-c, var(--ink-muted)); color: var(--surface); font: 700 12px/1 var(--font-sans); }
.h-alert__title { margin: 0; font-weight: 600; }
.h-alert__body { margin: 0; grid-column: 2; }
.h-alert__body ul { margin: 4px 0 0; padding-left: 18px; }
.h-alert > :only-child, .h-alert__title:last-child { grid-column: 2; }
.h-alert--danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); --h-alert-c: var(--danger); --h-alert-glyph: "!"; }
.h-alert--warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); --h-alert-c: var(--warn); --h-alert-glyph: "!"; }
.h-alert--warn::before { border-radius: 4px; }
.h-alert--success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); --h-alert-c: var(--success); --h-alert-glyph: "\2713"; }
.h-alert--info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); --h-alert-c: var(--info); --h-alert-glyph: "i"; }
.h-alert:not([class*="--"])::before { display: none; }
.h-alert:not([class*="--"]) { grid-template-columns: 1fr; }
.h-alert:not([class*="--"]) > * { grid-column: 1; }
.h-alert .h-alert__body, .h-alert .h-alert__body li { color: var(--ink); }
.h-alert--strip { border-radius: 0; border-width: 0 0 1px; padding: 10px var(--space-8); font-size: 13px; line-height: 18px; }
@media (max-width: 640px) { .h-alert--strip { padding: 10px var(--space-4); } }

/* ---------- Dialog / bottom sheet ---------- */
.h-dialog { width: min(var(--dialog-width), calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-dialog); overflow: auto;
  opacity: 0; transform: translateY(8px);
  transition: opacity 190ms cubic-bezier(.2,.8,.2,1), transform 190ms cubic-bezier(.2,.8,.2,1), overlay 190ms allow-discrete, display 190ms allow-discrete; }
.h-dialog[open] { opacity: 1; transform: none; }
@starting-style { .h-dialog[open] { opacity: 0; transform: translateY(8px); } }
.h-dialog::backdrop { background: var(--scrim); }
.h-dialog--wide { width: min(560px, calc(100vw - 32px)); }
.h-dialog__form { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-6); margin: 0; }
.h-dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4);
  padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.h-dialog__eyebrow { margin: 0 0 4px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.h-dialog__title { margin: 0; font-size: 19px; line-height: 26px; font-weight: 600; letter-spacing: -.015em; }
.h-dialog__close { margin: -6px -8px 0 0; }
.h-dialog__note { margin: 0; padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-dialog__foot { display: flex; justify-content: flex-end; gap: var(--space-2); }
.h-dialog__foot .h-btn--danger-text { margin-right: auto; color: var(--danger); }
.h-change { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: 14px var(--space-4); border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--surface-muted); font-size: 14px; }
.h-change__from { color: var(--ink-muted); }
.h-change__arrow { color: var(--ink-muted); }
@media (max-width: 640px) {
  .h-dialog, .h-dialog--wide { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-width: 1px 0 0; transform: translateY(24px); }
  .h-dialog[open] { transform: none; }
  @starting-style { .h-dialog[open] { transform: translateY(24px); } }
  .h-dialog__form { padding: var(--space-2) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); }
  .h-dialog__form::before { content: ""; align-self: center; width: 36px; height: 4px; border-radius: var(--radius-pill); background: var(--line-strong); }
  .h-dialog__foot { flex-direction: column-reverse; margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
    padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .h-dialog[open] .h-dialog__foot { position: sticky; bottom: 0; }
  .h-dialog__foot .h-btn { width: 100%; }
  .h-dialog__foot .h-btn--primary, .h-dialog__foot .h-btn--danger { min-height: var(--control-touch-lg); }
  .h-dialog__foot .h-btn--danger-text { margin: 0; }
}

/* ---------- Menu (group dropdown, account, export, phone Menu sheet list) ---------- */
.h-menu { min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); z-index: var(--z-menu); }
.h-menu__label { margin: 8px 10px 4px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.h-menu__item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: 400 14px/20px var(--font-sans); text-align: left;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.h-menu__item:hover, .h-menu__item:focus-visible { background: var(--surface-muted); outline-offset: -2px; }
.h-menu__item[aria-current="page"] { background: var(--surface-muted); font-weight: 600; }
.h-menu__item[aria-current="page"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.h-menu__item--danger { color: var(--danger); }
.h-menu__sep { height: 1px; margin: 6px -6px; background: var(--line); border: 0; }
.h-menu__head { padding: 8px 10px 10px; margin: -6px -6px 6px; border-bottom: 1px solid var(--line); }
.h-menu__head b { display: block; font-size: 14px; }
.h-menu__head span { font-size: 13px; color: var(--ink-muted); }
@media (max-width: 640px) { .h-menu__item { min-height: var(--control-touch); font-size: 15px; } }

/* ---------- Top bar ---------- */
.h-topbar { position: sticky; top: 0; z-index: var(--z-topbar); display: flex; align-items: center; gap: var(--space-6); height: var(--topbar-height);
  padding: 0 var(--space-6); background: var(--surface); border-bottom: 1px solid var(--line); }
.h-brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.h-brand img { height: 24px; width: auto; display: block; }
.h-nav { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.h-nav__item { position: relative; }
.h-nav__btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink-muted); font: 500 14px/20px var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.h-nav__btn:hover, .h-nav__btn[aria-expanded="true"] { background: var(--surface-muted); color: var(--ink); }
.h-nav__btn[aria-current="page"], .h-nav__btn.is-here { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.h-nav__btn .h-caret { width: 12px; height: 12px; opacity: .7; transition: transform 130ms cubic-bezier(.2,.8,.2,1); }
.h-nav__btn[aria-expanded="true"] .h-caret { transform: rotate(180deg); }
.h-nav__item > .h-menu { position: absolute; top: calc(100% + 6px); left: 0; }
.h-topbar__end { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.h-avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  font: 600 12px/1 var(--font-sans); letter-spacing: .02em; }
.h-account { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); cursor: pointer; color: var(--ink-muted); }
.h-account:hover { border-color: var(--line-strong); }
.h-menubtn { display: none; }
@media (max-width: 820px) {
  .h-topbar { gap: var(--space-3); padding: 0 var(--space-4); }
  .h-nav { display: none; }
  .h-menubtn { display: inline-flex; }
}
@media (max-width: 640px) { .h-account { padding: 3px; } .h-account .h-caret { display: none; } .h-avatar { width: 36px; height: 36px; } }

/* ---------- Data table (stacks on phones) ---------- */
.h-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 22px; }
.h-table th { padding: 10px var(--space-4); background: var(--surface-muted); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
  font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.h-table td { padding: 12px var(--space-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.h-table tr:last-child td { border-bottom: 0; }
.h-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.h-table td.num { font-weight: 600; }
.h-table tbody tr.is-click { cursor: pointer; }
.h-table tbody tr.is-click:hover td { background: var(--surface-muted); }
.h-table__name { color: var(--ink); font-weight: 600; text-decoration: none; }
.h-table__name:hover { text-decoration: underline; text-underline-offset: 2px; }
.h-table__sub { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); font-weight: 400; }
.h-table__group td { padding-top: 10px; padding-bottom: 10px; background: var(--canvas); border-top: 1px solid var(--line-strong);
  font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.h-table__group td .h-muted { font-weight: 400; }
.h-table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; }
.h-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.h-sort:hover { color: var(--ink); }
th[aria-sort] .h-sort { color: var(--ink); }
th[aria-sort="ascending"] .h-sort::after { content: "↑"; }
th[aria-sort="descending"] .h-sort::after { content: "↓"; }
.h-table--compact td { padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
@media (max-width: 640px) {
  .h-table--stack, .h-table--stack tbody { display: block; }
  .h-table--stack thead { display: none; }
  .h-table--stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); padding: 14px var(--space-4);
    border-bottom: 1px solid var(--line); }
  .h-table--stack tr:last-child { border-bottom: 0; }
  .h-table--stack td { display: inline; padding: 0; border: 0; text-align: left; font-size: 13px; line-height: 18px; color: var(--ink-muted); font-weight: 400; order: 3; }
  .h-table--stack tbody tr::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .h-table--stack tbody tr.h-table__group::after { display: none; }
  .h-table--stack td[data-role="primary"] { order: 1; flex: 1 1 0; min-width: 0; font-size: 15px; line-height: 22px; color: var(--ink); }
  .h-table--stack td[data-role="status"] { order: 2; flex: none; }
  .h-table--stack td:not([data-role]) + td:not([data-role])::before { content: "·"; margin-right: var(--space-2); color: var(--line-control); }
  .h-table--stack td.num::after { content: " " attr(data-unit); }
  .h-table--stack td.num { color: var(--ink); font-weight: 600; }
  .h-table--stack td[colspan] { order: 1; flex: 1 1 100%; font-size: 14px; }
  .h-table--stack tfoot { display: block; }
  .h-table--stack tfoot tr { display: flex; justify-content: space-between; padding: 12px var(--space-4); border-top: 1px solid var(--line-strong); }
  .h-table--stack tfoot td, .h-table--stack tfoot td[colspan] { padding: 0; border: 0; font-weight: 600; flex: none; }
  .h-table--stack tfoot td::before { content: none !important; }
  .h-table--stack td.h-hide-phone { display: none; }
  .h-table--stack .h-table__group { padding: 10px var(--space-4); background: var(--canvas); }
  .h-table--stack .h-table__group td { order: 1; flex: none; padding: 0; background: none; border: 0; font-size: 13px; color: var(--ink); }
}

/* ---------- Key-value list ---------- */
.h-kv { display: grid; grid-template-columns: minmax(96px, max-content) 1fr; margin: 0; }
.h-kv dt, .h-kv dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.h-kv dt { color: var(--ink-muted); font-size: 14px; padding-right: var(--space-6); }
.h-kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.h-kv dt:last-of-type, .h-kv dd:last-of-type { border-bottom: 0; }
.h-kv .h-kv__src { font-size: 13px; color: var(--ink-muted); }
.h-kv .h-kv__act { margin-left: auto; }
@media (max-width: 640px) {
  .h-kv { grid-template-columns: 1fr; }
  .h-kv dt { padding: 12px 0 2px; border: 0; font-size: 13px; }
  .h-kv dd { padding: 0 0 12px; }
}

/* ---------- Filter bar ---------- */
.h-filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: var(--space-4); }
.h-filters > summary { display: flex; align-items: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-4); list-style: none; cursor: pointer;
  font-size: 14px; font-weight: 600; border-radius: var(--radius-lg); }
.h-filters > summary::-webkit-details-marker { display: none; }
.h-filters > summary::after { content: ""; margin-left: auto; width: 16px; height: 16px; transition: transform 130ms cubic-bezier(.2,.8,.2,1);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235f5c55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
.h-filters[open] > summary::after { transform: rotate(180deg); }
.h-filters__active { color: var(--ink-muted); font-weight: 400; }
.h-filters__body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4) var(--space-6); padding: var(--space-4); border-top: 1px solid var(--line); }
.h-filters__body .h-field { flex: 0 1 auto; }
.h-filters__body .h-search { min-width: 240px; }
.h-filters__body .h-help { flex-basis: 100%; }
@media (max-width: 640px) { .h-filters__body { flex-direction: column; align-items: stretch; } .h-filters__body .h-search { min-width: 0; } }

/* ---------- Toast ---------- */
.h-toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: var(--space-6); transform: translateX(-50%); display: grid; gap: var(--space-2);
  width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.h-toast { display: flex; align-items: center; gap: var(--space-3); padding: 12px 12px 12px var(--space-4); border-radius: var(--radius-md);
  background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-pop); font-size: 14px; line-height: 20px; pointer-events: auto;
  animation: h-toast-in 190ms cubic-bezier(.2,.8,.2,1); }
.h-toast__icon { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 700; }
.h-toast--danger .h-toast__icon { background: var(--danger-soft); color: var(--danger); }
.h-toast__msg { flex: 1; }
.h-toast__act { flex: none; border: 0; background: none; color: var(--on-primary); font: 600 14px/20px var(--font-sans); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 4px 6px; }
.h-toast__x { flex: none; width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--on-primary); opacity: .7; cursor: pointer; font-size: 18px; line-height: 1; }
.h-toast__x:hover { opacity: 1; background: var(--primary-hover); }
.h-toast :focus-visible { outline-color: var(--on-primary); }
@keyframes h-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .h-toasts { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* ---------- Week picker ---------- */
.h-weekpick { position: relative; display: inline-block; }
.h-weekpick__btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control); padding: 0 12px; border: 1px solid var(--line-control);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 500 15px/20px var(--font-sans); cursor: pointer; white-space: nowrap; }
.h-weekpick__btn:hover { border-color: var(--ink-muted); }
.h-weekpick__btn .h-muted { font-weight: 400; }
.h-weekpick__step { display: inline-flex; gap: 4px; flex: none; }
.h-btns:has(> .h-weekpick) { flex-wrap: nowrap; }
.h-btns > .h-weekpick { min-width: 0; }
.h-cal { width: 300px; padding: var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.h-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); font-weight: 600; font-size: 14px; }
.h-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.h-cal__dow { font-size: 11px; line-height: 24px; font-weight: 600; letter-spacing: .06em; color: var(--ink-muted); }
.h-cal__day { position: relative; height: 36px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-placeholder);
  font: 400 13px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.h-cal__day:disabled { cursor: default; }
.h-cal__day--end { color: var(--ink); font-weight: 600; background: var(--surface-muted); cursor: pointer; }
.h-cal__day--end:hover { background: var(--line); }
.h-cal__day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.h-cal__day[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.h-cal__day.has-hours::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--warn); }
.h-cal__day[aria-pressed="true"].has-hours::after { background: var(--on-primary); }
.h-cal__foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-2); padding-top: var(--space-2);
  border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); }
.h-cal__foot i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
@media (max-width: 640px) {
  .h-weekpick, .h-weekpick__btn { width: 100%; }
  .h-btns > .h-weekpick { flex: 1; }
  .h-weekpick__btn { min-height: var(--control-touch); justify-content: space-between; }
  .h-cal { width: 100%; }
  .h-cal__day { height: 44px; font-size: 15px; }
}

/* ---------- Combobox (project picker) ---------- */
.h-combo { position: relative; }
.h-combo .h-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; }
.h-combo [role="option"] { white-space: normal; min-height: 40px; padding: 6px 10px; }
.h-combo [role="option"][aria-selected="true"] { background: var(--surface-muted); box-shadow: inset 2px 0 0 var(--ink); }
.h-combo [role="option"] .h-table__sub { margin-top: 1px; }
.h-combo mark { background: none; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.h-combo__empty { padding: 12px 10px; font-size: 14px; color: var(--ink-muted); }

/* ---------- Day card + entries (My timesheet) ---------- */
.h-days { display: grid; gap: var(--space-3); }
.h-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
.h-day__head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.h-day__name { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }
.h-day__date { color: var(--ink-muted); font-size: 14px; }
.h-day__total { margin-left: auto; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.h-day__total small { font-size: 13px; font-weight: 500; color: var(--ink-muted); margin-left: 2px; }
.h-day__empty { margin: 0 0 var(--space-3); color: var(--ink-muted); font-size: 14px; }
.h-day__acts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.h-day--holiday { background: var(--info-soft); border-color: var(--info-line); }
.h-day--today { border-color: var(--line-control); }
.h-entries { display: grid; gap: var(--space-2); }
.h-entry { display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 2px var(--space-3); width: 100%; min-height: 56px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--canvas); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: border-color 130ms cubic-bezier(.2,.8,.2,1), background-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-entry:hover:not([disabled]) { border-color: var(--line-control); background: var(--surface); }
.h-entry__what { font-weight: 600; font-size: 15px; line-height: 22px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-entry__meta { grid-column: 1; font-size: 13px; line-height: 18px; color: var(--ink-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-entry__hrs { grid-column: 2; grid-row: 1 / span 2; font-weight: 600; font-variant-numeric: tabular-nums; }
.h-entry::after { content: ""; grid-column: 3; grid-row: 1 / span 2; width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4l4 4-4 4' fill='none' stroke='%235f5c55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
.h-entry[disabled] { cursor: default; }
.h-entry[disabled]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3.5' y='7' width='9' height='6.5' rx='1.5' fill='none' stroke='%235f5c55' stroke-width='1.5'/%3E%3Cpath d='M5.5 7V5.5a2.5 2.5 0 015 0V7' fill='none' stroke='%235f5c55' stroke-width='1.5'/%3E%3C/svg%3E"); }

/* ---------- Submit bar ---------- */
.h-submitbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-submitbar); display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-3) max(var(--space-6), calc((100vw - var(--page-max)) / 2 + var(--space-8)));
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.h-submitbar__total { display: flex; flex-direction: column; }
.h-submitbar__label { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-submitbar__num { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.h-submitbar .h-btn--primary { min-height: var(--control-touch-lg); padding: 0 24px; }
@media (max-width: 640px) { .h-submitbar { padding-left: var(--space-4); padding-right: var(--space-4); } }

/* ---------- Empty state ---------- */
.h-empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); text-align: center; color: var(--ink-muted); }
.h-empty__title { margin: 0; color: var(--ink); font-size: 15px; line-height: 22px; font-weight: 600; }
.h-empty__text { margin: 0; max-width: 44ch; font-size: 14px; line-height: 20px; }
.h-empty .h-btn { margin-top: var(--space-2); }

/* ---------- Pagination ---------- */
.h-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.h-pager__pos { font-size: 13px; color: var(--ink-muted); }
.h-pager__btns { display: flex; gap: var(--space-2); }

/* ---------- Sign-in card ---------- */
.h-auth { min-height: 100dvh; display: grid; place-items: start center; padding: var(--space-12) var(--space-4); background: var(--canvas); }
.h-auth__card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-8) var(--space-6); }
.h-auth__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-8); }
.h-auth__title { margin: 0; font-size: 19px; line-height: 26px; font-weight: 600; letter-spacing: -.015em; }
.h-auth__sub { margin: 4px 0 var(--space-6); color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.h-auth__foot { margin: var(--space-6) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-code { text-align: center; font: 600 26px/32px var(--font-mono); letter-spacing: .3em; padding-left: calc(12px + .3em); min-height: 56px; }
.h-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--space-4); margin: 0; padding: var(--space-4); list-style: none; counter-reset: c;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--canvas); font: 400 14px/20px var(--font-mono); }
.h-codes li { counter-increment: c; }
.h-codes li::before { content: counter(c) "."; display: inline-block; width: 2.4ch; color: var(--ink-muted); font-size: 12px; }
.h-steps { display: grid; gap: var(--space-6); margin: 0; padding: 0; list-style: none; counter-reset: s; }
.h-steps > li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); }
.h-steps > li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; }
.h-steps > li > * { grid-column: 2; }
.h-qr { width: 168px; height: 168px; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
@media (max-width: 640px) { .h-auth { padding-top: var(--space-6); } .h-auth__card { padding: var(--space-6) var(--space-4); } }

/* ---------- Receipt upload (reimbursements) ---------- */
.h-upload { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); border: 1px dashed var(--line-control);
  border-radius: var(--radius-md); background: var(--canvas); text-align: center; cursor: pointer; transition: border-color 130ms cubic-bezier(.2,.8,.2,1), background-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-upload:hover, .h-upload.is-over { border-color: var(--ink); background: var(--surface); }
.h-upload__title { margin: 0; font-weight: 600; font-size: 15px; }
.h-upload__hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.h-upload:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.h-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.h-thumb { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-muted); }
.h-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h-thumb__x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  font-size: 16px; line-height: 1; cursor: pointer; }
.h-thumb__bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: var(--radius-pill); background: var(--surface); overflow: hidden; }
.h-thumb__bar span { display: block; height: 100%; background: var(--ink); }
.h-thumb.is-error { border-color: var(--danger); }
.h-thumb__err { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; background: var(--danger-soft); color: var(--danger); font-size: 11px; line-height: 14px; font-weight: 600; }
@media (max-width: 640px) { .h-upload { padding: var(--space-5) var(--space-4); } .h-upload .h-btn { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .h-app *, .h-app *::before, .h-app *::after { animation: none !important; transition: none !important; }
}
@media print { .h-topbar, .h-submitbar, .h-toasts { display: none !important; } .h-card, .h-day { break-inside: avoid; } }

/* ---------- Page layouts ---------- */
.h-split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-6); align-items: start; }
.h-split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.h-split > .h-aside { position: sticky; top: calc(var(--topbar-height) + var(--space-6)); }
.h-section-title { margin: 0 0 var(--space-3); font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -.01em; }
.h-receipt { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-muted); overflow: hidden; }
.h-receipt img, .h-receipt svg { display: block; width: 100%; height: auto; }
.h-receipt__bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  background: var(--surface); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); }
.h-money { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 960px) { .h-split, .h-split--even { grid-template-columns: 1fr; } .h-split > .h-aside { position: static; } }

/* ---------- Status meter + legend (dashboard) ---------- */
.h-meter { display: flex; gap: 2px; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-muted); }
.h-meter--lg { height: 12px; }
.h-meter > span { display: block; height: 100%; min-width: 4px; background: var(--line-control); }
.h-meter > [data-status="not_started"], .h-meter > [data-status="attention"], .h-meter > [data-status="failed"], .h-meter > [data-status="returned"], .h-meter > [data-status="sent_back"] { background: var(--danger); }
.h-meter > [data-status="in_progress"], .h-meter > [data-status="ready"], .h-meter > [data-status="outstanding"], .h-meter > [data-status="waiting"] { background: var(--warn); }
.h-meter > [data-status="submitted"], .h-meter > [data-status="approved"], .h-meter > [data-status="scheduled"], .h-meter > [data-status="sent"] { background: var(--info); }
.h-meter > [data-status="locked"], .h-meter > [data-status="posted"], .h-meter > [data-status="cleared"] { background: var(--success); }
.h-legend { display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-legend li { display: inline-flex; align-items: center; gap: 6px; }
.h-legend li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--line-control); }
.h-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.h-legend [data-status="not_started"]::before, .h-legend [data-status="attention"]::before, .h-legend [data-status="failed"]::before, .h-legend [data-status="sent_back"]::before { background: var(--danger); }
.h-legend [data-status="in_progress"]::before, .h-legend [data-status="ready"]::before, .h-legend [data-status="outstanding"]::before, .h-legend [data-status="waiting"]::before { background: var(--warn); }
.h-legend [data-status="submitted"]::before, .h-legend [data-status="approved"]::before, .h-legend [data-status="sent"]::before { background: var(--info); }
.h-legend [data-status="locked"]::before, .h-legend [data-status="posted"]::before, .h-legend [data-status="cleared"]::before { background: var(--success); }

/* ---------- Module card (dashboard) ---------- */
.h-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-3); }
.h-module { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; }
.h-module__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.h-module__title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }
.h-module__num { display: flex; align-items: baseline; gap: var(--space-2); }
.h-module__num b { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.h-module__num span { font-size: 13px; color: var(--ink-muted); }
.h-module__next { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto; padding-top: var(--space-3);
  border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; }

/* ---------- Week trend (small bar chart) ---------- */
.h-trend { display: block; width: 100%; height: auto; overflow: visible; }
.h-trend .bar { fill: var(--line-control); }
.h-trend .bar.is-now { fill: var(--primary); }
.h-trend .bar:hover { fill: var(--ink-muted); }
.h-trend .grid { stroke: var(--line); stroke-width: 1; }
.h-trend text { fill: var(--ink-muted); font: 400 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.h-trend text.val { fill: var(--ink); font-weight: 600; }

/* ---------- Action list ("needs you") ---------- */
.h-todo { margin: 0; padding: 0; list-style: none; }
.h-todo li { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: 8px var(--space-5); border-bottom: 1px solid var(--line); }
.h-todo li:last-child { border-bottom: 0; }
.h-todo__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line-control); }
.h-todo__dot[data-tone="danger"] { background: var(--danger); } .h-todo__dot[data-tone="warn"] { background: var(--warn); } .h-todo__dot[data-tone="info"] { background: var(--info); }
.h-todo__text { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; }
.h-todo__text small { display: block; color: var(--ink-muted); font-size: 13px; line-height: 18px; }

/* ---------- Sync status (QuickBooks, iSolved, n8n) ---------- */
.h-sync { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-sync__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.h-sync[data-state="warn"] .h-sync__dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.h-sync[data-state="error"] .h-sync__dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.h-sync b { color: var(--ink); font-weight: 600; }

/* ---------- Payment track (money moving) ---------- */
.h-track { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0; padding: 0; list-style: none; counter-reset: t; }
.h-track li { position: relative; display: grid; justify-items: center; gap: 4px; padding-top: 0; text-align: center; font-size: 13px; line-height: 18px; color: var(--ink-muted); min-width: 0; }
.h-track li::before { content: ""; position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-control); background: var(--surface); }
.h-track li::after { content: ""; position: absolute; top: 7px; left: calc(-50% + 10px); right: calc(50% + 10px); height: 2px; background: var(--line-strong); }
.h-track li:first-child::after { display: none; }
.h-track li b { color: var(--ink); font-weight: 600; }
.h-track li[data-state="done"]::before { border-color: var(--success); background: var(--success); }
.h-track li[data-state="done"]::after, .h-track li[data-state="current"]::after, .h-track li[data-state="failed"]::after { background: var(--success); }
.h-track li[data-state="current"]::before { border-color: var(--info); box-shadow: inset 0 0 0 3px var(--surface); background: var(--info); }
.h-track li[data-state="failed"]::before { border-color: var(--danger); background: var(--danger); }
.h-track li[data-state="failed"] b { color: var(--danger); }
.h-track--compact li { font-size: 12px; }
.h-track--compact li span { display: none; }
@media (max-width: 640px) {
  .h-track { grid-auto-flow: row; gap: var(--space-4); }
  .h-track li { grid-template-columns: 16px 1fr; justify-items: start; text-align: left; column-gap: var(--space-3); }
  .h-track li > * { grid-column: 2; }
  .h-track li::before { grid-row: 1 / span 2; }
  .h-track li::after { top: -16px; bottom: auto; left: 7px; right: auto; width: 2px; height: 16px; }
}

/* ---------- Reference number + three-way match ---------- */
.h-ref { font-family: var(--font-mono); font-size: 13px; letter-spacing: .02em; color: var(--ink); }
.h-match { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.h-match__col { padding: var(--space-3) var(--space-4); border-right: 1px solid var(--line); min-width: 0; }
.h-match__col:last-child { border-right: 0; }
.h-match__src { margin: 0 0 6px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.h-match__val { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.h-match__sub { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.h-match__col[data-state="differs"] { background: var(--warn-soft); }
.h-match__col[data-state="differs"] .h-match__val { color: var(--warn); }
.h-match__col[data-state="missing"] { background: var(--danger-soft); }
.h-match__col[data-state="missing"] .h-match__val { color: var(--danger); }
@media (max-width: 640px) { .h-match { grid-template-columns: 1fr; } .h-match__col { border-right: 0; border-bottom: 1px solid var(--line); } .h-match__col:last-child { border-bottom: 0; } }
.h-split--aside-lg { grid-template-columns: minmax(0, 1fr) 440px; }
@media (max-width: 960px) { .h-split--aside-lg { grid-template-columns: 1fr; } }

/* ---------- Deadline chip ---------- */
.h-due { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-muted); font: 500 12px/1 var(--font-sans); white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-due::before { content: ""; width: 12px; height: 12px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center/12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center/12px no-repeat; }
.h-due[data-state="soon"] { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.h-due[data-state="late"] { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }

/* ---------- Manpower board ---------- */
.h-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2);
  scroll-snap-type: x proximity; }
.h-board__col { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; padding: var(--space-3); background: var(--surface-muted);
  border: 1px solid var(--line); border-radius: var(--radius-lg); scroll-snap-align: start; transition: border-color 130ms cubic-bezier(.2,.8,.2,1), background-color 130ms cubic-bezier(.2,.8,.2,1); }
.h-board__col.is-over { border-color: var(--ink); background: var(--canvas); }
.h-board__head { display: grid; gap: 6px; padding: 2px 4px 8px; }
.h-board__title { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.h-board__title span { font-weight: 500; color: var(--ink-muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.h-board__title span.is-short { color: var(--danger); }
.h-board__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-muted); }
.h-board__empty { padding: var(--space-4); border: 1px dashed var(--line-control); border-radius: var(--radius-md); text-align: center; font-size: 13px; color: var(--ink-muted); }
.h-person { display: grid; grid-template-columns: 32px 1fr auto; gap: 2px var(--space-3); align-items: center; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); cursor: grab; }
.h-person:hover { border-color: var(--line-control); }
.h-person.is-dragging { opacity: .5; }
.h-person .h-avatar { grid-row: 1 / span 2; width: 32px; height: 32px; background: var(--surface-muted); color: var(--ink); border: 1px solid var(--line-strong); }
.h-person__name { font-size: 14px; line-height: 20px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-person__meta { grid-column: 2; font-size: 12px; line-height: 16px; color: var(--ink-muted); min-width: 0; }
.h-person__move { grid-column: 3; grid-row: 1 / span 2; }
.h-person__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (max-width: 640px) { .h-board { grid-auto-columns: 86%; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4) var(--space-2); } .h-person { cursor: default; } }

/* ---------- Staffing timeline (who is on which job, for how long) ---------- */
.h-gantt { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.h-gantt__grid { display: grid; grid-template-columns: 200px repeat(var(--weeks, 12), minmax(56px, 1fr)); min-width: 860px; position: relative; }
.h-gantt__hd { padding: 10px 8px; background: var(--surface-muted); border-bottom: 1px solid var(--line); font-size: 11px; line-height: 16px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.h-gantt__hd.is-now { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.h-gantt__who { padding: 10px var(--space-4); border-bottom: 1px solid var(--line); font-size: 14px; line-height: 20px; font-weight: 600; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.h-gantt__who small { display: block; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-muted); }
.h-gantt__lane { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--weeks, 12), minmax(56px, 1fr)); align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line); background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--weeks, 12)) 100%; }
.h-bar { height: 28px; margin: 0 2px; padding: 0 8px; display: flex; align-items: center; border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 600;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--surface-muted); border: 1px solid var(--line-strong); color: var(--ink); }
.h-bar--now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.h-bar--planned { background: var(--surface); border-style: dashed; border-color: var(--line-control); color: var(--ink-muted); }
.h-bar--leave { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.h-gantt__key { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px var(--space-4); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); }
.h-gantt__key span { display: inline-flex; align-items: center; gap: 6px; }
.h-gantt__key i { width: 16px; height: 10px; border-radius: 3px; display: inline-block; }
