/* CCBIS Inspection Web — responsive app-style layout (no fake phone frame) */
:root {
    --accent-blue: #0ea5e9;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-orange: #f97316;
    --accent-amber: #fbbf24;
    --accent-red: #ef4444;
    --bg-darker: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --glass-border: rgba(255, 255, 255, 0.1);
    --content-max: 720px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body.app-body,
body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Outfit', system-ui, sans-serif;
    color: var(--text-primary);
    background: var(--bg-darker);
    -webkit-font-smoothing: antialiased;
}

.background-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: #020617;
    filter: blur(40px) contrast(120%);
    opacity: 0.85;
}
.blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.blob-1 {
    width: 70vw; height: 70vw;
    background: radial-gradient(circle, rgba(46, 49, 146, 0.9) 0%, transparent 70%);
    top: -20%; left: -15%;
    animation: drift 18s ease-in-out infinite alternate;
}
.blob-2 {
    width: 55vw; height: 55vw;
    background: radial-gradient(circle, rgba(200, 80, 192, 0.7) 0%, transparent 70%);
    top: 40%; right: -20%;
    animation: drift 22s ease-in-out infinite alternate-reverse;
}
.blob-3 {
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.55) 0%, transparent 70%);
    bottom: -20%; left: 25%;
    animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(4%, 6%) scale(1.08); }
}

/* Full-page shell — uses screen width, content centered with a readable max width */
.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-top {
    flex-shrink: 0;
    padding: 16px 16px 8px;
    padding-top: max(16px, env(safe-area-inset-top));
}
.app-top-inner {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}
.app-top-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.brand-text { display: flex; flex-direction: column; }
.brand-ccbis {
    color: var(--accent-blue);
    font-weight: 900;
    font-size: clamp(1.85rem, 5vw, 2.5rem);
    letter-spacing: 0.5px;
    line-height: 1;
}
.brand-sub {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.68rem, 2vw, 0.8rem);
    font-weight: 700;
    letter-spacing: 0.28em;
    margin-top: 4px;
}
.app-logo {
    width: clamp(56px, 14vw, 88px);
    height: clamp(56px, 14vw, 88px);
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(14, 165, 233, 0.25));
}

.app-user-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0 8px;
}
.app-user-chip .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-hello { color: var(--text-secondary); font-size: 0.92rem; }
.user-name {
    color: #fff;
    font-size: clamp(1.15rem, 3.5vw, 1.4rem);
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-role {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 2px;
}
.user-meta .area-chip {
    margin-top: 8px;
    align-self: flex-start;
}

.app-main {
    flex: 1;
    width: 100%;
    padding: 8px 16px 28px;
    padding-bottom: max(28px, calc(16px + var(--safe-bottom)));
}
.app-main--full { padding-bottom: max(28px, calc(16px + var(--safe-bottom))); }
.app-content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

/* Page toolbar (e.g. Profile home button) */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.page-toolbar-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.15s, border-color 0.15s;
}
.btn-home:hover {
    background: rgba(14, 165, 233, 0.22);
    border-color: rgba(14, 165, 233, 0.55);
}
.btn-home .home-ico {
    font-size: 1.15rem;
    line-height: 1;
    color: var(--accent-blue);
}

.btn-back-float {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 0 10px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.45rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s, color 0.15s, transform 0.15s;
}
.btn-back-float:hover {
    opacity: 1;
    color: var(--accent-blue);
    transform: translateX(-2px);
}

/* Bottom nav removed — app has no persistent bottom nav / sign-out */

/* Dashboard */
.dash-block { display: flex; flex-direction: column; gap: 12px; }
.dash-clock {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: right;
}
.area-chip {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}
.menu-row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.menu-row:hover,
.menu-row:focus-visible {
    outline: none;
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.35);
}
.menu-ico {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(14, 165, 233, 0.12);
    color: var(--accent-blue);
    font-weight: 800;
    font-size: 1.15rem;
}
.menu-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-title { color: #fff; font-size: 1.1rem; font-weight: 700; }
.menu-sub { color: rgba(148, 163, 184, 0.9); font-size: 0.8rem; line-height: 1.3; }
.menu-chevron { color: rgba(255, 255, 255, 0.25); font-size: 1.4rem; font-weight: 300; }

/* Wider screens: slightly wider content, same row layout (not a fake phone) */
@media (min-width: 768px) {
    :root { --content-max: 820px; }
    .app-top { padding-left: 28px; padding-right: 28px; }
    .app-main { padding-left: 28px; padding-right: 28px; }
    .app-user-chip .avatar { width: 56px; height: 56px; font-size: 1.35rem; }
}

@media (min-width: 1100px) {
    :root { --content-max: 960px; }
}

/* Panels / forms */
.panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 14px;
}
.panel h2 { margin: 0 0 6px; font-size: 1.2rem; }
.panel .sub { margin: 0 0 14px; color: var(--text-secondary); font-size: 0.88rem; }

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
}
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }
.alert.warn {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.35);
    color: #fdba74;
}
.alert.err {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}
.alert.ok {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.field { margin-bottom: 14px; }
.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}
.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.field-status {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
}
.field-status.ok {
    opacity: 1;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.field-status.bad {
    opacity: 1;
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}
.field-status.checking {
    opacity: 1;
    background: transparent;
    border: 2px solid rgba(56, 189, 248, 0.55);
    border-top-color: #38bdf8;
    animation: spin 0.7s linear infinite;
}
.field-hint {
    margin-top: 6px;
    font-size: 0.78rem;
    color: #fecaca;
}
.field input,
.field select,
.field textarea,
.input-group input,
.toolbar input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent-blue); }

/* Native dropdown list: OS uses a light panel — force dark, readable option text */
.field select option,
.modal select option,
select option {
    color: #0f172a;
    background-color: #ffffff;
}
.field select option:checked,
.modal select option:checked,
select option:checked,
.field select option:hover,
.modal select option:hover,
select option:hover {
    color: #ffffff;
    background-color: #0ea5e9;
}

.field input:read-only,
.field input[readonly] {
    opacity: 0.85;
    cursor: default;
    color: var(--text-secondary);
}
.field input:read-only:focus,
.field input[readonly]:focus {
    border-color: rgba(255, 255, 255, 0.1);
}
.field input.is-valid {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}
.field input.is-valid:focus {
    border-color: #22c55e;
}
.field input.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}
.field input.is-invalid:focus {
    border-color: #ef4444;
}
.field textarea { min-height: 80px; resize: vertical; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) {
    .row-2 { grid-template-columns: 1fr; }
}

/* Searchable lorry combobox (select existing or Add — not on the record) */
.lorry-combo {
    position: relative;
}
.lorry-combo-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.lorry-combo .lorry-combo-input {
    flex: 1;
    margin: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.lorry-combo-toggle {
    flex: 0 0 42px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-left: none;
    border-radius: 0 10px 10px 0;
    background: rgba(15, 23, 42, 0.55);
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.lorry-combo-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.lorry-combo.is-open .lorry-combo-toggle {
    color: var(--accent-blue, #38bdf8);
}
.lorry-combo-list {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 6px 0;
    list-style: none;
    max-height: 240px;
    overflow: auto;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.lorry-combo-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 0.92rem;
}
.lorry-combo-option:hover,
.lorry-combo-option.is-active,
.lorry-combo-option.is-selected {
    background: rgba(56, 189, 248, 0.12);
}
.lorry-combo-option-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lorry-combo-option--add {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    color: #fde68a;
}
.lorry-combo-add-badge {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0f172a;
    background: #fbbf24;
    border-radius: 4px;
    padding: 2px 6px;
}
.lorry-combo-add-hint {
    flex: 0 0 auto;
    font-size: 0.78rem;
    color: #94a3b8;
}
.lorry-combo-empty {
    padding: 12px;
    color: #94a3b8;
    font-size: 0.85rem;
}
.lorry-combo.is-uncommitted .lorry-combo-input {
    border-color: rgba(251, 191, 36, 0.55);
}
.lorry-combo.is-committed .lorry-combo-input {
    border-color: rgba(14, 165, 233, 0.45);
}

.btn-submit, .btn-primary {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    background: var(--accent-blue);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-submit:disabled, .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    cursor: pointer;
}
.btn-ghost {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font: inherit; padding: 8px 12px;
}

.message-box {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
    font-size: 0.9rem;
}
.message-box.ok {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}
.loader {
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}
.auth-wrapper { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px 24px 24px;
    backdrop-filter: blur(16px);
}
.card-header { text-align: center; margin-bottom: 24px; }
.logo-circle {
    width: 100px; height: 100px; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
}
.auth-logo {
    width: 100%; height: 100%; object-fit: contain;
    mix-blend-mode: lighten;
    filter: contrast(1.5) brightness(0.9) saturate(1.1);
    -webkit-mask-image: radial-gradient(circle, black 60%, transparent 70%);
    mask-image: radial-gradient(circle, black 60%, transparent 70%);
    transform: scale(1.35);
}
.card-header h1 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 800; letter-spacing: 0.04em; }
.card-header p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.4; }
.input-group { position: relative; margin-bottom: 18px; }
.input-group label {
    position: absolute; left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: 0.15s ease;
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 0; font-size: 0.72rem; padding: 0 6px;
    background: #0b1224; color: var(--accent-blue);
}
.copyright { text-align: center; color: var(--text-muted); font-size: 0.78rem; margin-top: 18px; }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(2, 6, 23, 0.72);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal {
    width: 100%;
    max-width: 440px;
    background: #0b1224;
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 22px;
}
.modal h3 { margin: 0 0 8px; }
.modal p { margin: 0 0 16px; color: var(--text-secondary); font-size: 0.9rem; }
.modal .field select {
    color-scheme: light;
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.15);
}
.modal .field select:focus {
    border-color: var(--accent-blue);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hidden { display: none !important; }

.freq-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.freq-tabs button {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent; color: var(--text-secondary);
    border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; font-size: 0.85rem;
}
.freq-tabs button.active {
    background: rgba(14, 165, 233, 0.2); color: #fff; border-color: rgba(14, 165, 233, 0.45);
}
.checklist-item {
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.02);
}
.checklist-item .item-text { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.4; }
.answer-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ans-btn {
    flex: 1; min-width: 64px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent; color: var(--text-secondary);
    border-radius: 10px; padding: 10px; font: inherit; font-weight: 700; cursor: pointer;
}
.ans-btn.yes.active { background: rgba(14, 165, 233, 0.25); border-color: var(--accent-blue); color: #7dd3fc; }
.ans-btn.no.active { background: rgba(239, 68, 68, 0.2); border-color: var(--accent-red); color: #fca5a5; }
.ans-btn.na.active { background: rgba(251, 191, 36, 0.18); border-color: var(--accent-amber); color: #fde68a; }
.sub-fields { margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.sub-fields .hint { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.sub-item-set-note {
    font-size: 0.74rem;
    color: #c4b5fd;
    margin: 0 0 8px;
    line-height: 1.4;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(168, 85, 247, 0.1);
    border-left: 2px solid rgba(168, 85, 247, 0.45);
}
.open-safety-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #fde68a;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(251, 191, 36, 0.12);
    border-left: 3px solid rgba(251, 191, 36, 0.5);
}

.findings-row, .delivery-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-btn {
    flex: 1; min-width: 120px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent; color: var(--text-secondary);
    border-radius: 12px; padding: 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.chip-btn.active.with { border-color: var(--accent-orange); background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.chip-btn.active.without { border-color: var(--accent-green); background: rgba(34, 197, 94, 0.12); color: #86efac; }
.chip-btn.active.del { border-color: var(--accent-blue); background: rgba(14, 165, 233, 0.15); color: #7dd3fc; }

.sig-box {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    position: relative;
    min-height: 160px;
}
.sig-box.is-locked {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.12);
}
.sig-box canvas { width: 100%; height: 160px; display: block; touch-action: none; cursor: crosshair; }
.sig-box canvas.hidden,
.sig-display.hidden,
.sig-actions.hidden { display: none !important; }
.sig-display {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #fff;
    padding: 8px;
    box-sizing: border-box;
}

/* Checklist form: compact portrait pads; responsive grid (no huge empty gap) */
.form-signatures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    align-items: start;
}
.form-signatures .sig-box--portrait {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 5 / 6;
    min-height: 0;
    margin: 0;
}
.form-signatures .sig-box--portrait canvas {
    width: 100%;
    height: 100%;
    min-height: 260px;
}
.form-signatures .sig-box--portrait .sig-display {
    width: 100%;
    height: 100%;
    min-height: 260px;
}
.form-signatures .sig-actions {
    max-width: 400px;
}
@media (max-width: 640px) {
    .form-signatures-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .form-signatures .sig-box--portrait {
        max-width: min(100%, 400px);
        margin: 0 auto;
    }
    .form-signatures .field {
        text-align: center;
    }
    .form-signatures .field > label {
        display: block;
        text-align: left;
        max-width: min(100%, 400px);
        margin-left: auto;
        margin-right: auto;
    }
    .form-signatures .sig-hint {
        max-width: min(100%, 400px);
        margin-left: auto;
        margin-right: auto;
        text-align: left;
    }
    .form-signatures .sig-actions {
        max-width: min(100%, 400px);
        margin-left: auto;
        margin-right: auto;
    }
}
.sig-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; position: relative; z-index: 2; }
.sig-actions .btn-secondary,
.sig-actions .btn-primary { position: relative; z-index: 2; pointer-events: auto; }
.sig-hint { margin-top: 10px; font-size: 0.8rem; line-height: 1.4; }
.sig-preview {
    max-width: 220px; max-height: 80px; background: #fff; border-radius: 8px; padding: 4px;
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar input[type="date"] { flex: 1; min-width: 120px; }

.record-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}
.record-card:hover { border-color: rgba(14, 165, 233, 0.45); }
.priority-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 10px;
}
.priority-row .record-card {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.priority-card.has-draft {
    border-color: rgba(249, 115, 22, 0.65);
    background: rgba(249, 115, 22, 0.06);
}
.priority-card.has-draft:hover {
    border-color: rgba(249, 115, 22, 0.9);
}
.priority-clear-btn {
    width: auto;
    align-self: center;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.55);
}
.priority-clear-btn:hover {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}
.record-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.record-card-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    min-width: 0;
}
.record-card-right {
    flex-shrink: 0;
    margin-left: auto;
    text-align: right;
}
.record-card-right .badge {
    margin-left: 0;
}
.record-card .series { color: var(--accent-blue); font-weight: 800; font-size: 1.05rem; }
.record-meta { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }
.badge {
    display: inline-block; padding: 3px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; margin-left: 8px;
}
.badge.findings { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.badge.ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }

.detail-grid {
    display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 0.9rem;
}
@media (max-width: 480px) {
    .detail-grid { grid-template-columns: 100px 1fr; }
}
.detail-grid .k { color: var(--text-muted); }

.detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    font-size: 0.9rem;
}
.detail-meta-item .k {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.detail-meta-item .v {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}
.detail-meta-item--full {
    grid-column: 1 / -1;
}
@media (max-width: 520px) {
    .detail-meta { grid-template-columns: 1fr; }
}

.sig-driver-name {
    margin: 6px 0 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    word-break: break-word;
}
.sig-caption {
    margin: 8px 0 0;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.sig-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}
.sig-pair-col .sig-box {
    min-height: 120px;
}
.sig-pair-col .sig-display {
    height: 120px;
}
.sig-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    color: #94a3b8;
    font-size: 0.85rem;
    background: #fff;
}
@media (max-width: 520px) {
    .sig-pair { grid-template-columns: 1fr; }
}

.answer-line {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 0.88rem;
}
.answer-line .val.yes { color: #7dd3fc; font-weight: 700; }
.answer-line .val.no { color: #fca5a5; font-weight: 700; }
.answer-line .val.na { color: #fde68a; font-weight: 700; }

/* Turn-over detail checklist — matches app (Item/Answer/Quantity + Remarks below) */
.to-checklist-table {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin: 8px 0 16px;
}
.to-checklist-head,
.to-checklist-main {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(56px, 2fr) minmax(56px, 2fr);
    gap: 8px;
    align-items: start;
}
.to-checklist-head {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.to-checklist-row {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.to-col-item {
    color: #e2e8f0;
    font-size: 0.88rem;
    line-height: 1.35;
}
.to-col-answer {
    font-size: 0.88rem;
    font-weight: 700;
}
.to-col-qty {
    color: var(--text-muted);
    font-size: 0.82rem;
}
.to-checklist-remarks {
    margin-top: 8px;
}
.to-remarks-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.to-remarks-text {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.sticky-actions {
    position: sticky; bottom: 0;
    padding: 14px 0 8px;
    background: linear-gradient(transparent, rgba(2, 6, 23, 0.95) 28%);
}
.empty { text-align: center; color: var(--text-muted); padding: 40px 12px; }
.muted { color: var(--text-muted); font-size: 0.85rem; }

/* Safety menus / badges */
.menu-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.25);
    border: 1px solid rgba(249, 115, 22, 0.45);
    color: #fdba74;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#priorityBadge.menu-badge {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fecaca;
}
.badge.status-draft { background: rgba(249, 115, 22, 0.18); color: #fdba74; }
.badge.status-reinspect { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.badge.status-pending { background: rgba(251, 191, 36, 0.18); color: #fde68a; }
.badge.status-ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }

.record-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.record-actions .btn-primary,
.record-actions .btn-secondary {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-save-draft {
    background: rgba(249, 115, 22, 0.9) !important;
    border-color: rgba(249, 115, 22, 0.9) !important;
}

/* Finding / repair photos on form + detail */
.no-photo-section,
.repair-photo-section,
.detail-photo {
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.07);
}
.repair-photo-section {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}
.no-photo-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fca5a5;
}
.repair-photo-section .no-photo-head { color: #86efac; }
.no-photo-retake,
.no-photo-capture {
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-radius: 6px;
    padding: 4px 10px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}
.no-photo-capture {
    display: flex;
    width: 100%;
    min-height: 80px;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.no-photo-img,
.detail-photo img {
    display: block;
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}
.answer-block { margin-bottom: 8px; }

.review-actions {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.review-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.review-btns .btn-primary,
.review-btns .btn-secondary {
    width: auto;
    min-width: 140px;
}

.turnover-legend {
    font-weight: 600;
}
.turnover-legend-sep {
    margin: 0 6px;
    color: var(--text-muted);
    font-weight: 400;
}
.turnover-yes-hint {
    color: var(--text-secondary);
}
.turnover-no-hint {
    color: #ef4444;
}
.turnover-item-title {
    font-size: 0.92rem;
    line-height: 1.4;
    font-weight: 600;
    margin-bottom: 8px;
}
.turnover-item.is-yes .turnover-item-title {
    color: var(--text-primary, inherit);
}
.turnover-item.is-no .turnover-item-title {
    color: #ef4444;
}
.turnover-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 4px;
}
.turnover-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.3;
    user-select: none;
}
.turnover-choice input {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
}
.turnover-choice-yes input {
    accent-color: #22c55e;
}
.turnover-choice-no input {
    accent-color: #ef4444;
}
.turnover-choice-yes {
    color: var(--text-secondary);
}
.turnover-choice-no {
    color: #ef4444;
}
.turnover-no-panel {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border, rgba(148, 163, 184, 0.25));
}
.turnover-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.4;
}
.turnover-check input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #ef4444;
}
.turnover-item.is-no .turnover-check,
.turnover-item.is-no .turnover-check span {
    color: #ef4444;
}
.turnover-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.turnover-status.is-standby {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.55);
}
.turnover-status.is-dispatched {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.55);
}
.modal-wide {
    max-width: 720px;
    max-height: 90vh;
    overflow: auto;
}

/* Live camera capture modal (safety NO photo — no file upload) */
.camera-modal {
    max-width: 560px;
}
.camera-hint {
    margin: 0 0 12px !important;
    color: #fdba74 !important;
    font-size: 0.85rem !important;
}
.camera-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.camera-viewport video,
.camera-viewport .camera-preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.camera-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.camera-modal-backdrop {
    z-index: 120;
}

@media print {
    .background-mesh, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .panel { border: none; background: #fff; }
}
