/* ── FEAT-074 Waybill Records — wbr-* prefix ──────────────────── */

/* Page root */
.wbr-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
}

/* Header */
.wbr-header {
    margin-bottom: 20px;
}
.wbr-page-title {
    margin: 0 0 4px 0;
    font-size: 1.35rem;
    font-weight: 700;
}
.wbr-page-subtitle {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.65;
}
body[data-theme="dark"]  .wbr-page-title    { color: #e8e8f0; }
body[data-theme="dark"]  .wbr-page-subtitle { color: #888; }
body[data-theme="light"] .wbr-page-title    { color: #1a1a2e; }
body[data-theme="light"] .wbr-page-subtitle { color: #666; }

/* Panel card (shared by list + detail) */
.wbr-panel-card {
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid;
}
body[data-theme="dark"]  .wbr-panel-card { background: #1e1e2e; border-color: #333; }
body[data-theme="light"] .wbr-panel-card { background: #fff;    border-color: #dce3ef; }

/* ── Filter bar ─────────────────────────────────────────────── */
.wbr-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.wbr-filter-input {
    padding: 7px 12px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.88rem;
    min-width: 160px;
    max-width: 220px;
    flex: 1 1 160px;
}
.wbr-filter-dropdown {
    min-width: 180px;
    max-width: 220px;
    flex: 1 1 180px;
    font-size: 0.88rem;
}
body[data-theme="dark"]  .wbr-filter-input {
    background: #16162a; border-color: #3a3a55; color: #e0e0f0;
}
body[data-theme="light"] .wbr-filter-input {
    background: #f8faff; border-color: #c8d4e8; color: #1a1a2e;
}
.wbr-filter-input:focus { outline: none; border-color: #4a9eff; }

/* Date picker (replaces plain text inputs for date-from/date-to) */
.wbr-date-picker {
    flex: 1 1 160px;
}
.wbr-date-picker .DateInput_input {
    border-radius: 6px;
    font-size: 0.82rem;
    padding: 6px 10px;
}
body[data-theme="dark"]  .wbr-date-picker .DateInput_input {
    background: #16162a;
    border-color: #3a3a55;
    color: #e0e0f0;
}
body[data-theme="light"] .wbr-date-picker .DateInput_input {
    background: #f8faff;
    border-color: #c8d4e8;
    color: #1a1a2e;
}
body[data-theme="dark"]  .wbr-date-picker .DayPickerNavigation_button { border-color: #3a3a55; }
body[data-theme="dark"]  .wbr-date-picker .CalendarDay__default { color: #c5cad6; }

/* ── List table ──────────────────────────────────────────────── */
.wbr-list-table-wrap { overflow-x: auto; }
.wbr-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.wbr-th {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    border-bottom: 2px solid;
    white-space: nowrap;
    opacity: 0.75;
}
.wbr-td {
    padding: 9px 12px;
    vertical-align: middle;
    border-bottom: 1px solid;
}
body[data-theme="dark"]  .wbr-th { border-color: #3a3a55; color: #a0a0c0; }
body[data-theme="dark"]  .wbr-td { border-color: #2a2a40; color: #d0d0e8; }
body[data-theme="dark"]  .wbr-list-table tbody tr:hover { background: #25253a; }
body[data-theme="light"] .wbr-th { border-color: #c8d4e8; color: #556; }
body[data-theme="light"] .wbr-td { border-color: #e8eef8; color: #334; }
body[data-theme="light"] .wbr-list-table tbody tr:hover { background: #f4f7ff; }

/* Status chips */
.wbr-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.wbr-chip-verified {
    background: rgba(67, 201, 122, 0.15);
    color: #43c97a;
    border: 1px solid rgba(67, 201, 122, 0.4);
}
.wbr-chip-review {
    background: rgba(255, 140, 0, 0.12);
    color: #ff8c00;
    border: 1px solid rgba(255, 140, 0, 0.4);
}

/* Review button */
.wbr-review-btn {
    padding: 5px 14px;
    border-radius: 5px;
    border: 1px solid;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
body[data-theme="dark"]  .wbr-review-btn {
    background: #252540; border-color: #4a9eff; color: #4a9eff;
}
body[data-theme="dark"]  .wbr-review-btn:hover { background: #1a2a4a; }
body[data-theme="light"] .wbr-review-btn {
    background: #e8f0ff; border-color: #4a9eff; color: #2255cc;
}
body[data-theme="light"] .wbr-review-btn:hover { background: #d0e4ff; }

/* Empty state */
.wbr-empty-msg {
    font-size: 0.88rem;
    opacity: 0.55;
    font-style: italic;
    padding: 16px 0;
}

/* ── Detail panel ─────────────────────────────────────────────── */
.wbr-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.wbr-back-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
body[data-theme="dark"]  .wbr-back-btn {
    background: #252535; border-color: #444; color: #c0c0d0;
}
body[data-theme="dark"]  .wbr-back-btn:hover { background: #303045; }
body[data-theme="light"] .wbr-back-btn {
    background: #f0f4ff; border-color: #c0cce8; color: #334;
}
body[data-theme="light"] .wbr-back-btn:hover { background: #e0e8ff; }

/* Side-by-side layout */
.wbr-side-by-side {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
@media (max-width: 760px) {
    .wbr-side-by-side { flex-direction: column; }
}
.wbr-panel-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 12px 0;
    opacity: 0.6;
}

/* Image panel */
.wbr-image-panel {
    flex: 0 0 auto;
    width: 320px;
    max-width: 100%;
}
@media (max-width: 760px) { .wbr-image-panel { width: 100%; } }
.wbr-detail-img-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block;
    width: 100%;
}
.wbr-detail-img-btn:hover .wbr-result-img { opacity: 0.82; }

.wbr-result-img {
    width: 100%;
    border-radius: 8px;
    border: 2px solid;
    object-fit: contain;
    max-height: 540px;
    transition: opacity 0.15s;
}
body[data-theme="dark"]  .wbr-result-img { border-color: #333; }
body[data-theme="light"] .wbr-result-img { border-color: #dce3ef; }
.wbr-no-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border-radius: 8px;
    border: 2px dashed;
    font-size: 0.85rem;
    opacity: 0.45;
    font-style: italic;
}
body[data-theme="dark"]  .wbr-no-img-placeholder { border-color: #3a3a55; color: #888; }
body[data-theme="light"] .wbr-no-img-placeholder { border-color: #c8d4e8; color: #778; }

/* Form panel */
.wbr-form-panel { flex: 1 1 0; min-width: 0; }

/* ── Field rows ───────────────────────────────────────────────── */
.wbr-field-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}
.wbr-field-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.wbr-field-label {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.75;
}
.wbr-field-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
body[data-theme="dark"]  .wbr-field-label { color: #a0a0c0; }
body[data-theme="light"] .wbr-field-label { color: #445; }

/* Confidence badges */
.wbr-conf-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid;
    white-space: nowrap;
    cursor: default;
}
.wbr-conf-high {
    color: #43c97a;
    border-color: rgba(67, 201, 122, 0.4);
    background: rgba(67, 201, 122, 0.1);
}
.wbr-conf-low {
    color: #ff8c00;
    border-color: rgba(255, 140, 0, 0.4);
    background: rgba(255, 140, 0, 0.1);
}
.wbr-conf-unlocked {
    color: #4a9eff;
    border-color: rgba(74, 158, 255, 0.4);
    background: rgba(74, 158, 255, 0.1);
}

/* Inputs */
.wbr-field-input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid;
    font-size: 0.92rem;
    box-sizing: border-box;
    transition: border-color 0.15s;
    min-width: 0;
}
.wbr-field-input:focus { outline: none; border-color: #4a9eff; }

/* Locked (HIGH confidence) — subtle, muted */
.wbr-field-locked {
    cursor: default;
    opacity: 0.7;
}
body[data-theme="dark"]  .wbr-field-locked {
    background: #16162a; border-color: #2a2a45; color: #b0b0cc;
}
body[data-theme="light"] .wbr-field-locked {
    background: #f4f6fc; border-color: #d8e0f0; color: #667;
}

/* LOW confidence — editable, amber highlight */
.wbr-field-low {
    border-color: #e07800 !important;
}
body[data-theme="dark"]  .wbr-field-low {
    background: #251800; color: #f0c060;
}
body[data-theme="light"] .wbr-field-low {
    background: #fffbf0; color: #5a3000;
}
body[data-theme="dark"]  .wbr-field-low:focus  { border-color: #ff8c00 !important; }
body[data-theme="light"] .wbr-field-low:focus  { border-color: #ff8c00 !important; }

/* Unlocked (was HIGH, now editable via "edit anyway") — blue tint */
.wbr-field-unlocked {
    border-color: #4a9eff !important;
}
body[data-theme="dark"]  .wbr-field-unlocked { background: #10182a; color: #a0ccff; }
body[data-theme="light"] .wbr-field-unlocked { background: #f0f6ff; color: #1a2a5a; }

/* Generic field input themes */
body[data-theme="dark"]  .wbr-field-input:not(.wbr-field-locked):not(.wbr-field-low):not(.wbr-field-unlocked) {
    background: #16162a; border-color: #3a3a55; color: #e0e0f0;
}
body[data-theme="light"] .wbr-field-input:not(.wbr-field-locked):not(.wbr-field-low):not(.wbr-field-unlocked) {
    background: #f8faff; border-color: #c8d4e8; color: #1a1a2e;
}

/* "Edit anyway" link-style button */
.wbr-edit-anyway-btn {
    background: none;
    border: none;
    padding: 0 4px;
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.6;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.wbr-edit-anyway-btn:hover { opacity: 1; }
body[data-theme="dark"]  .wbr-edit-anyway-btn { color: #a0a0d0; }
body[data-theme="light"] .wbr-edit-anyway-btn { color: #445; }

/* Field hint (LOW confidence explanation) */
.wbr-field-hint {
    font-size: 0.75rem;
    margin: 3px 0 0 0;
    font-style: italic;
    color: #cc7000;
    opacity: 0.9;
}
body[data-theme="dark"]  .wbr-field-hint { color: #c07030; }

/* ── Trips table ──────────────────────────────────────────────── */
.wbr-trips-container { margin: 18px 0 6px 0; }
.wbr-trips-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 8px 0;
    opacity: 0.6;
}
.wbr-trips-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}
.wbr-trip-header-row th {
    padding: 6px 8px;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid;
    text-align: left;
    opacity: 0.7;
}
.wbr-trips-table td {
    padding: 5px 8px;
    border-bottom: 1px solid;
    vertical-align: middle;
}
body[data-theme="dark"]  .wbr-trip-header-row th { border-color: #3a3a55; }
body[data-theme="dark"]  .wbr-trips-table td     { border-color: #2a2a40; }
body[data-theme="light"] .wbr-trip-header-row th { border-color: #c8d4e8; }
body[data-theme="light"] .wbr-trips-table td     { border-color: #e8eef8; }
.wbr-trip-no { width: 48px; font-weight: 600; font-size: 0.82rem; }

/* Trip cell inputs */
.wbr-trip-input {
    width: 90px;
    padding: 4px 7px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 0.84rem;
    font-family: monospace;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.wbr-trip-input:focus { outline: none; border-color: #4a9eff; }
.wbr-trip-locked {
    cursor: default;
    opacity: 0.65;
}
.wbr-trip-low { border-color: #e07800 !important; }
body[data-theme="dark"]  .wbr-trip-input  { background: #16162a; border-color: #3a3a55; color: #e0e0f0; }
body[data-theme="dark"]  .wbr-trip-locked { background: #16162a; border-color: #2a2a45; color: #b0b0cc; }
body[data-theme="dark"]  .wbr-trip-low    { background: #251800; color: #f0c060; }
body[data-theme="light"] .wbr-trip-input  { background: #f8faff; border-color: #c8d4e8; color: #1a1a2e; }
body[data-theme="light"] .wbr-trip-locked { background: #f4f6fc; border-color: #d8e0f0; color: #667; }
body[data-theme="light"] .wbr-trip-low    { background: #fffbf0; color: #5a3000; }

.wbr-no-trips { font-size: 0.85rem; opacity: 0.55; font-style: italic; }

/* ── Save row ────────────────────────────────────────────────── */
.wbr-save-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid;
    flex-wrap: wrap;
}
body[data-theme="dark"]  .wbr-save-row { border-color: #333; }
body[data-theme="light"] .wbr-save-row { border-color: #dce3ef; }

.wbr-save-btn {
    padding: 10px 28px;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    background: #43c97a;
    color: #fff;
}
.wbr-save-btn:hover { background: #34b86b; }
.wbr-save-status { font-size: 0.88rem; }
.wbr-save-ok     { display: flex; align-items: center; gap: 4px; color: #43c97a; font-weight: 600; }
.wbr-save-ok-icon { font-size: 1.1rem; }
.wbr-save-error  { color: #ff5757; }
.wbr-save-info   { color: #888; font-style: italic; }

/* ── Pagination bar ───────────────────────────────────────────── */
.wbr-pagination-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid;
    font-size: 0.85rem;
}
body[data-theme="dark"]  .wbr-pagination-bar { border-color: #2a2a40; }
body[data-theme="light"] .wbr-pagination-bar { border-color: #e0e8f0; }

.wbr-page-btn {
    padding: 5px 14px;
    border-radius: 5px;
    border: 1px solid;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.wbr-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
body[data-theme="dark"]  .wbr-page-btn {
    background: #252540; border-color: #4a4a65; color: #c0c0d8;
}
body[data-theme="dark"]  .wbr-page-btn:not(:disabled):hover { background: #303050; }
body[data-theme="light"] .wbr-page-btn {
    background: #f0f4ff; border-color: #c0cce8; color: #334;
}
body[data-theme="light"] .wbr-page-btn:not(:disabled):hover { background: #e0e8ff; }

.wbr-page-info {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    opacity: 0.7;
    font-size: 0.82rem;
}
body[data-theme="dark"]  .wbr-page-info { color: #a0a0c0; }
body[data-theme="light"] .wbr-page-info { color: #556; }

.wbr-page-size-dropdown {
    min-width: 120px;
    max-width: 140px;
    font-size: 0.82rem;
}

/* Mobile tweaks */
@media (max-width: 500px) {
    .wbr-page { padding: 12px; }
    .wbr-panel-card { padding: 14px; }
}

/* ── Image pin button ─────────────────────────────────────────────── */
/* Visible labeled "View image" button (was a faint bare emoji — Jack 20260624) */
.wbr-img-pin-btn {
    background: rgba(74,158,255,0.12);
    border: 1px solid #4a9eff;
    color: #4a9eff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.2;
}
.wbr-img-pin-btn:hover { background: #4a9eff; color: #fff; }
.wbr-td-pin { width: 84px; padding: 6px 4px; text-align: center; }

/* ── Lightbox backdrop ────────────────────────────────────────────── */
.wbr-lightbox-hidden { display: none !important; }
.wbr-lightbox-open {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ── Lightbox dialog ──────────────────────────────────────────────── */
.wbr-lightbox-dialog {
    background: #1e2537;
    border: 1px solid #2d3548;
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

/* ── Lightbox header ──────────────────────────────────────────────── */
.wbr-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #2d3548;
    flex-shrink: 0;
}
.wbr-lightbox-close {
    background: none;
    border: none;
    color: #6b7899;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.12s;
    flex-shrink: 0;
}
.wbr-lightbox-close:hover { background: rgba(255, 255, 255, 0.1); color: #c8d0e0; }

/* ── Lightbox zoom controls ───────────────────────────────────────── */
.wbr-zoom-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.wbr-zoom-btn {
    background: none;
    border: 1px solid #3a4a68;
    color: #8090b8;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    min-width: 28px;
}
.wbr-zoom-btn:hover { background: rgba(255,255,255,0.1); color: #c8d0e0; }
.wbr-zoom-reset-btn { font-size: 0.8rem; padding: 3px 8px; }
.wbr-zoom-label {
    font-size: 0.8rem;
    color: #8090b8;
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    user-select: none;
}
.wbr-lb-zoomed { justify-content: flex-start !important; }
body[data-theme="light"] .wbr-zoom-btn { border-color: #b0bcd0; color: #4a5a78; }
body[data-theme="light"] .wbr-zoom-btn:hover { background: rgba(0,0,0,0.06); color: #1a2540; }
body[data-theme="light"] .wbr-zoom-label { color: #4a5a78; }

/* ── Lightbox body ────────────────────────────────────────────────── */
.wbr-lightbox-body {
    flex: 1;
    min-height: 0;
    max-height: calc(90vh - 60px);
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #10141f;
}
.wbr-lightbox-main-img {
    max-width: 95vw;
    object-fit: contain;
    display: block;
}
.wbr-lightbox-no-img {
    color: #4a5a78;
    font-size: 0.9rem;
    font-style: italic;
    padding: 32px;
}

/* ── Light theme overrides ────────────────────────────────────────── */
body[data-theme="light"] .wbr-lightbox-open   { background: rgba(0, 0, 0, 0.6); }
body[data-theme="light"] .wbr-lightbox-dialog { background: #fff; border-color: #cdd5e0; box-shadow: 0 12px 48px rgba(0,0,0,0.2); }
body[data-theme="light"] .wbr-lightbox-header { border-bottom-color: #cdd5e0; }
body[data-theme="light"] .wbr-lightbox-close:hover { background: rgba(0,0,0,0.07); color: #1a2540; }
body[data-theme="light"] .wbr-lightbox-body   { background: #f0f0f0; }
body[data-theme="light"] .wbr-lightbox-no-img { color: #8090b0; }

/* ── Remarks section ──────────────────────────────────────────── */
.wbr-remarks-section { margin: 18px 0 0 0; }
.wbr-remarks-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid;
    font-size: 0.92rem;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
    transition: border-color 0.15s;
}
.wbr-remarks-textarea:focus { outline: none; border-color: #4a9eff; }
body[data-theme="dark"]  .wbr-remarks-textarea {
    background: #16162a; border-color: #3a3a55; color: #e0e0f0;
}
body[data-theme="light"] .wbr-remarks-textarea {
    background: #f8faff; border-color: #c8d4e8; color: #1a1a2e;
}

/* 390px mobile */
@media (max-width: 430px) {
    .wbr-lightbox-open   { padding: 0; align-items: flex-end; }
    .wbr-lightbox-dialog { max-height: 90vh; border-radius: 12px 12px 0 0; }
    .wbr-lightbox-body   { max-height: calc(90vh - 70px); }
}
