/* =========================================================================
   Field app — task screens: forms (log work, resolve, notes), hours stepper, photos + lightbox,
   signature pad and sign-off, timeline, search, profile. Loaded after app.css.
   ========================================================================= */
/* ---------- forms ------------------------------------------------------- */
.fa-form { display: flex; flex-direction: column; gap: var(--ts-space-4); }
.fa-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fa-label { font-weight: 600; font-size: 0.875rem; }
.fa-required { color: var(--fa-danger-text); margin-left: 4px; font-weight: 700; }
.fa-help { font-size: 0.8125rem; color: var(--ts-text-muted); }

.fa-error {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--fa-danger-text);
    font-size: 0.8125rem;
}

.fa-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--ts-border-strong);
    border-radius: var(--ts-radius-sm);
    background: var(--ts-surface);
    color: var(--ts-text);
    font: inherit;
    box-sizing: border-box;
}

.fa-input:focus { outline: none; border-color: var(--ts-accent); box-shadow: inset 0 -2px 0 var(--ts-accent); }
textarea.fa-input { min-height: 120px; resize: vertical; line-height: 1.45; }

.fa-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.9375rem; }
.fa-check input { width: 22px; height: 22px; accent-color: var(--ts-accent); }

/* Hours stepper: big +/- buttons and quick picks. */
.fa-stepper { display: flex; align-items: center; gap: 12px; }

.fa-stepper__btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--ts-border-strong);
    border-radius: 50%;
    background: var(--ts-surface);
    color: var(--ts-accent);
    font-size: 1.4rem;
    cursor: pointer;
}

/* The value is a real input (type a 1.75 h directly): 48 px tall like the +/- buttons. Its font stays
   above iOS's 16 px zoom threshold, so it may override the phone-wide 16 px input rule. */
.fa-stepper input.fa-stepper__value {
    width: 112px;
    height: 48px;
    padding: 0 8px;
    border: 1px solid var(--ts-border-strong);
    border-radius: var(--ts-radius-sm);
    background: var(--ts-surface);
    color: var(--ts-text);
    font-family: inherit;
    font-size: 1.5rem !important;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

.fa-stepper input.fa-stepper__value:focus { outline: none; border-color: var(--ts-accent); box-shadow: inset 0 -2px 0 var(--ts-accent); }
.fa-stepper__unit { font-size: 1rem; font-weight: 600; color: var(--ts-text-muted); margin-left: -4px; }

/* ---------- photos ------------------------------------------------------ */
.fa-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
@media (min-width: 600px) { .fa-photos { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.fa-photo {
    position: relative;
    display: block;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: var(--ts-radius-sm);
    overflow: hidden;
    background: var(--ts-surface-page);
    cursor: pointer;
}

.fa-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fa-photo__tag { position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: var(--ts-radius-pill); background: rgba(0, 0, 0, 0.6); color: #ffffff; font-size: 0.6875rem; }

.fa-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.fa-upload { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.875rem; }
.fa-upload__bar { flex: 1 1 auto; height: 6px; border: 0; border-radius: 3px; background: var(--ts-surface-page); overflow: hidden; appearance: none; accent-color: var(--ts-accent); }
.fa-upload__bar::-webkit-progress-bar { background: var(--ts-surface-page); }
.fa-upload__bar::-webkit-progress-value { background: var(--ts-accent); transition: width 0.2s ease; }
.fa-upload__bar::-moz-progress-bar { background: var(--ts-accent); }

.fa-lightbox {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.94);
    color: #ffffff;
}

.fa-lightbox__bar { display: flex; align-items: center; gap: 8px; padding: var(--fa-safe-top) 8px 0; min-height: var(--fa-appbar-h); }
.fa-lightbox__bar .fa-iconbtn { color: #ffffff; }
.fa-lightbox__bar .fa-iconbtn:hover { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.fa-lightbox__caption { flex: 1 1 auto; min-width: 0; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fa-lightbox__img { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 8px calc(8px + var(--fa-safe-bottom)); }
.fa-lightbox__img img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- signature pad ----------------------------------------------- */
.fa-sigpad {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 2;
    background: #ffffff;
    border: 1px dashed var(--ts-border-strong);
    border-radius: var(--ts-radius-md);
    overflow: hidden;
    touch-action: none;
}

.fa-sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.fa-sigpad__line { position: absolute; left: 24px; right: 24px; bottom: 26%; border-bottom: 1px solid #c7c7c7; pointer-events: none; }
.fa-sigpad__hint { position: absolute; left: 24px; bottom: calc(26% + 6px); color: #9ca3af; font-size: 0.875rem; pointer-events: none; }
.fa-sigpad--signed .fa-sigpad__hint { display: none; }
.fa-sigpad__tools { display: flex; justify-content: flex-end; gap: 4px; margin-top: 4px; }

/* ---------- timeline ---------------------------------------------------- */
.fa-timeline { list-style: none; margin: 0 0 0 6px; padding: 0 0 0 18px; border-left: 2px solid var(--ts-border); }
.fa-timeline__item { position: relative; padding-bottom: var(--ts-space-3); }

.fa-timeline__dot {
    position: absolute;
    left: -25px;
    top: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--ts-surface-page);
    background: var(--ts-tone-neutral);
}

.fa-timeline__dot--customer { background: var(--ts-accent); }
.fa-timeline__dot--internal { background: #7c3aed; }
.fa-timeline__dot--status { background: var(--ts-tone-success); }
.fa-timeline__dot--work { background: var(--ts-tone-info); }
.fa-timeline__body { background: var(--ts-surface); border: 1px solid var(--ts-border); border-radius: var(--ts-radius-md); padding: 8px 12px; }
.fa-timeline__body--quiet { background: transparent; border-style: dashed; }
.fa-timeline__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.8125rem; color: var(--ts-text-muted); margin-bottom: 2px; }
.fa-timeline__meta strong { color: var(--ts-text); }

/* Photo / file links inside a timeline entry: own line, 44 px tap target. */
.fa-timeline__link { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 0.875rem; overflow-wrap: anywhere; }

/* ---------- task pages -------------------------------------------------- */
.fa-ticket-ref { display: flex; flex-direction: column; gap: 2px; }
.fa-ticket-ref__title { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.fa-input--tall { min-height: 160px; }
.fa-chips--inline { margin: 4px 0 0; padding: 0; flex-wrap: wrap; overflow: visible; }

.fa-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fa-summary-row__value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }

.fa-cards > .fa-worklog { list-style: none; }
.fa-worklog__head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; }
.fa-worklog__text { margin-top: 6px; }
.fa-worklog__part { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--ts-border); font-size: 0.875rem; }
.fa-worklog__part i { color: var(--ts-accent); }

.fa-composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--ts-space-4); }
.fa-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Sign-off */
.fa-signed { display: flex; flex-direction: column; gap: 4px; margin-top: var(--ts-space-3); }
.fa-signed__img { width: 100%; max-width: 360px; aspect-ratio: 5 / 2; object-fit: contain; background: #ffffff; border: 1px solid var(--ts-border); border-radius: var(--ts-radius-md); }
.fa-signed__report { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: var(--ts-space-3); }
.fa-signed__report a { display: inline-flex; align-items: center; min-height: 44px; }
.fa-report__summary { margin: 8px 0; }
.fa-report__sent { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; color: var(--fa-success-strong); font-weight: 600; }
.fa-report__sent a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 400; }
.fa-report__recipients { margin: 4px 0 8px; font-size: 0.875rem; }
.fa-report__recipients li span { overflow-wrap: anywhere; }
.fa-report__blockers { margin: 4px 0 0; padding-left: 18px; }
.fa-report__work { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--ts-border); }
.fa-report__parts { margin: 0; font-size: 0.875rem; }
.fa-report__parts li { padding: 4px 0; }
.fa-report__parts i { color: var(--ts-accent); }

/* Machine search */
.fa-search { position: relative; margin-bottom: var(--ts-space-4); }
.fa-search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 1; color: var(--ts-text-muted); pointer-events: none; }
.fa-search__box { width: 100%; }
.fa-search__box input { padding-left: 34px !important; min-height: 44px; }
.fa-center { text-align: center; }

/* Profile */
.fa-profile { display: flex; align-items: center; gap: var(--ts-space-4); }
.fa-profile__avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ts-accent); color: var(--ts-on-accent); font-size: 1.25rem; font-weight: 700; }
.fa-profile__text { min-width: 0; }
.fa-profile__name { margin: 0; font-size: 1.125rem; font-weight: 600; overflow-wrap: anywhere; }
.fa-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fa-signout { margin: 0; }

/* Machine assets: warranty, running hours, components (MachineAssetsCard, RecordHours) */
.fa-assets__record { margin-top: var(--ts-space-4); }
.fa-assets__component { align-items: flex-start; }
.fa-assets__badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex: 0 0 auto; }
.fa-assets__last { margin: 0; font-size: 0.875rem; }
