/* 新機簽收單系統 — 共用樣式 */

:root {
    --land-header-h: 56px;
    --land-footer-h: 64px;
}

body {
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f6f8;
}

/* 手機版底部固定操作列預留空間 */
body.has-actionbar {
    padding-bottom: calc(var(--land-footer-h) + 12px);
}

/* ---------- 觸控友善 ---------- */
@media (max-width: 767.98px) {
    .btn { min-height: 44px; }
    .form-control, .form-select { min-height: 44px; font-size: 16px; } /* 16px 防 iOS 自動縮放 */
    .form-check-input { width: 1.35em; height: 1.35em; }
    .form-check-label { padding-left: .25rem; }
}

/* ---------- 步驟指示器 ---------- */
.step-bar {
    display: flex;
    gap: .25rem;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: .5rem .75rem;
    overflow-x: auto;
}
.step-bar .step {
    flex: 1 1 0;
    text-align: center;
    font-size: .85rem;
    padding: .35rem .25rem;
    border-radius: .375rem;
    color: #6c757d;
    white-space: nowrap;
}
.step-bar .step.active { background: #0d6efd; color: #fff; font-weight: 600; }
.step-bar .step.done   { color: #198754; }
.step-bar .step a { color: inherit; text-decoration: none; display: block; }

/* ---------- 底部固定操作列 ---------- */
.action-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: .6rem .75rem;
    display: flex;
    gap: .5rem;
    z-index: 1030;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.action-bar .btn { flex: 1 1 0; }

/* ---------- AI 辨識帶入的欄位 ---------- */
.ai-filled {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
}
.ai-hint {
    font-size: .8rem;
    color: #997404;
}

/* ---------- 未核對標示 ---------- */
.unverified {
    color: #dc3545;
    font-weight: 600;
}

/* ---------- 機器資料欄位群 ---------- */
.field-row { margin-bottom: 1rem; }
.field-row .form-label { margin-bottom: .25rem; }
.field-row .verify-check {
    font-size: .85rem;
    white-space: nowrap;
}

/* ---------- 照片九宮格 ---------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .5rem;
}
.photo-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: .375rem;
    overflow: hidden;
    background: #e9ecef;
    border: 1px solid #dee2e6;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .del {
    position: absolute; top: 2px; right: 2px;
    background: rgba(220,53,69,.9); color: #fff;
    border: 0; border-radius: 50%;
    width: 26px; height: 26px; line-height: 1;
    font-size: .9rem;
}
.photo-add {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    aspect-ratio: 1 / 1;
    border: 2px dashed #adb5bd;
    border-radius: .375rem;
    color: #6c757d;
    background: #fff;
    cursor: pointer;
    font-size: .8rem;
    gap: .2rem;
}
.photo-add:hover { border-color: #0d6efd; color: #0d6efd; }

/* ---------- 簽名 ---------- */
.sign-box {
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    background: #fff;
    min-height: 140px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.sign-box img { max-width: 100%; max-height: 180px; }

.sign-overlay {
    position: fixed; inset: 0;
    background: #fff;
    z-index: 2000;
    display: none;
    flex-direction: column;
}
.sign-overlay.show { display: flex; }
.sign-overlay .sign-head,
.sign-overlay .sign-foot {
    padding: .6rem .9rem;
    border-bottom: 1px solid #dee2e6;
    display: flex; align-items: center; gap: .5rem;
}
.sign-overlay .sign-foot { border-bottom: 0; border-top: 1px solid #dee2e6; }
.sign-overlay .sign-canvas-wrap { flex: 1 1 auto; position: relative; }
.sign-overlay canvas { width: 100%; height: 100%; touch-action: none; display: block; }
.sign-overlay .baseline {
    position: absolute; left: 5%; right: 5%; bottom: 22%;
    border-bottom: 1px dashed #ced4da;
    pointer-events: none;
}
.rotate-hint {
    display: none;
    padding: .5rem .9rem;
    background: #fff3cd;
    color: #664d03;
    font-size: .85rem;
}
@media (max-width: 767.98px) and (orientation: portrait) {
    .rotate-hint { display: block; }
}

/* ---------- 掃碼 ---------- */
#scanner-box { width: 100%; max-width: 480px; margin: 0 auto; }

/* ---------- 清單 ---------- */
.table-receipts td, .table-receipts th { vertical-align: middle; }
.receipt-card { border-left: 4px solid #dee2e6; }
.receipt-card.st-completed { border-left-color: #198754; }
.receipt-card.st-draft     { border-left-color: #6c757d; }
.receipt-card.st-voided    { border-left-color: #dc3545; }

/* ---------- 其他 ---------- */
.required::after { content: " *"; color: #dc3545; }
.text-tiny { font-size: .78rem; }
.card-stat .num { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.autocomplete-list {
    position: absolute; z-index: 1050;
    background: #fff; border: 1px solid #dee2e6;
    border-radius: .375rem; width: 100%;
    max-height: 220px; overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.autocomplete-list div { padding: .5rem .75rem; cursor: pointer; }
.autocomplete-list div:hover { background: #f1f3f5; }
