* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    background: #4f4f4f url('../images/38e9206f.png') repeat;
    overflow-x: hidden;
}

button, input, select, textarea {
    font: inherit;
}

.legacy-page {
    width: 1290px;
    margin: 14px auto 24px;
}

.legacy-notice {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid #000;
    background: #fbfbfb;
    box-shadow: -8px 4px 8px rgba(0,0,0,.45);
}
.legacy-notice.success { border-color: #2f6d2f; }
.legacy-notice.error { border-color: #8a1d1d; }
.legacy-notice ul { margin: 8px 0 0 16px; padding: 0; }


.legacy-top-header {
    position: relative;
    height: 158px;
    margin: 0 0 12px;
    background: transparent;
    border: 1px solid #000;
    border-radius: 1px;
    box-shadow: -24px 5px 7px rgba(0,0,0,.95);
    overflow: hidden;
}

.legacy-top-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #4f4f4f url('../images/38e9206f.png') repeat center center;
}

.legacy-top-header__inner {
    position: relative;
    width: 1276px;
    height: 145px;
    margin: 6px auto 0;
}

.legacy-top-header__banner {
    display: block;
    width: 1276px;
    height: 145px;
    object-fit: contain;
    image-rendering: auto;
}

.legacy-top-header__cartoon {
    left: 5px;
    top: 0;
    width: 152px;
    height: 130px;
    image-rendering: auto;
}

.legacy-top-header__title {
    left: 212px;
    top: 41px;
    width: 620px;
    height: 79px;
}

.legacy-top-header__scrap {
    right: 8px;
    top: 1px;
    width: 249px;
    height: 174px;
    object-fit: contain;
    object-position: top right;
    pointer-events: none;
}


.legacy-shell {
    display: grid;
    grid-template-columns: 898px 337px;
    gap: 22px;
    align-items: start;
}

.legacy-main-frame {
    background: transparent;
}

.legacy-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    border-bottom: 1px solid #444;
    padding: 15px 0 4px 10px;
}

.legacy-tab {
    border: 1px solid #444;
    border-bottom: 0;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    background: #222;
    color: #eee;
    padding: 6px 14px 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}
.legacy-tab:hover {
    background: #003147;
    color: #fff;
    transform: translateY(-3px);
}
.legacy-tab.is-active {
    background: #0972a5;
    color: #fff;
}

.legacy-content-wrap {
    position: relative;
    min-height: 735px;
}

.legacy-panel {
    display: none;
    position: relative;
    min-height: 520px;
    padding: 14px 20px 18px;
    background: #fbfbfb;
    border: 5px solid #000;
    border-radius: 14px;
    box-shadow: -24px 5px 7px rgba(0,0,0,.75);
}
.legacy-panel.is-active { display: block; }

.panel-title-row,
.panel-title {
    font-size: 16px;
    font-weight: 700;
}
.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 2px solid #000;
}
.panel-title.underlined {
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #000;
}
.ticket-number-box {
    width: 154px;
    height: 24px;
    padding: 2px 6px;
    border: 1px solid #777;
    background: #fff;
}

.personal-grid {
    display: grid;
    grid-template-columns: 280px 196px 100px 1fr 150px;
    gap: 8px 12px;
    align-items: end;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.field span {
    line-height: 16px;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #8b8b8b;
    background: #fff;
    color: #000;
    border-radius: 2px;
    padding: 3px 6px;
}
.field input { height: 24px; }
.field select { height: 28px; padding-right: 28px; }
.field textarea { min-height: 46px; resize: vertical; }

.field--idtype { grid-column: 1; }
.field--idnumber { grid-column: 2 / span 1; }
.field--idstate { grid-column: 3 / span 1; }
.field--firstname { grid-column: 1 / span 2; }
.field--lastname { grid-column: 3 / span 2; }
.field--dob { grid-column: 5; }
.field--address1 { grid-column: 1 / span 2; }
.field--address2 { grid-column: 3 / span 2; }
.field--city { grid-column: 1; }
.field--state { grid-column: 2; }
.field--zip { grid-column: 3; }
.field--phone { grid-column: 1 / span 2; }

.subsection-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    margin-top: 18px;
}
.subsection-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}
.subsection-divider {
    height: 2px;
    background: #000;
    margin-bottom: 10px;
}

.physical-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
}
.vehicle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.field--notes { grid-column: 1 / span 2; }
.compact-pair {
    display: flex;
    align-items: center;
    gap: 6px;
}
.compact-pair input { width: 48px; }
.compact-pair--weight input { width: 74px; }
.compact-pair em {
    font-style: normal;
    color: #222;
}

.personal-actions,
.tab-action-row,
.report-filter-row,
.daily-filter-row,
.report-range-row,
.metal-actions-row,
.metal-footer-row,
.receipt-filters {
    display: flex;
    align-items: center;
}
.personal-actions {
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.legacy-btn {
    min-width: 96px;
    height: 25px;
    padding: 0 12px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    background: #4f4f4f;
    color: #fff;
    cursor: pointer;
    text-align: center;
}
.legacy-btn:hover {
    background: #87ceeb;
    color: #111;
}
.legacy-btn.primary {
    height: 30px;
    min-width: 107px;
}
.legacy-btn.small {
    min-width: 59px;
    height: 22px;
}

.metal-table-wrap,
.receipt-table-wrap,
.price-table-wrap {
    border: 1px solid #8c8c8c;
    background: #fff;
    padding: 10px;
    min-height: 338px;
    overflow: auto;
}
.metal-table-wrap { min-height: 338px; }
.receipt-table-wrap { min-height: 338px; }
.price-table-wrap { min-height: 470px; }

.legacy-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.legacy-table th,
.legacy-table td {
    border: 1px solid #666;
    padding: 7px 8px;
    vertical-align: middle;
}
.legacy-table th {
    background: #dcdcdc;
    font-weight: 700;
    text-align: left;
}
.legacy-table td {
    background: #fff;
}
.legacy-table tr.clickable-row { cursor: pointer; }
.legacy-table tr.clickable-row:hover td { background: #eef7fc; }
.table-action {
    border: 1px solid #999;
    background: #f3f3f3;
    border-radius: 3px;
    height: 24px;
    padding: 0 8px;
    cursor: pointer;
}
.table-action:hover { background: #ddd; }

.metal-actions-row {
    justify-content: flex-start;
    gap: 14px;
    margin-top: 18px;
}
.step-arrow img {
    width: 21px;
    height: 39px;
}
.metal-step-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 10px;
    text-align: center;
}
.metal-step-labels strong,
.metal-step-labels span {
    display: block;
}
.metal-step-labels span { font-size: 13px; }
.metal-footer-row {
    justify-content: space-between;
    margin-top: 16px;
}
.subtotal-box {
    font-size: 16px;
    font-weight: 700;
}

.receipt-filters {
    gap: 12px;
    margin-bottom: 16px;
}
.receipt-filters input,
.receipt-filters select {
    height: 26px;
    border: 1px solid #8b8b8b;
    padding: 3px 6px;
    background: #fff;
}
.receipt-filters [data-receipt-date] { width: 173px; }
.receipt-filters [data-receipt-query] { width: 240px; }
.receipt-filters [data-receipt-part] { width: 150px; }

.price-status {
    margin-bottom: 12px;
}
.price-table input {
    width: 100%;
    height: 26px;
    border: 1px solid #8b8b8b;
    padding: 3px 6px;
}
.tab-action-row,
.daily-filter-row,
.report-range-row { gap: 12px; margin-top: 14px; }
.report-filter-row { gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.report-range-row label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.report-range-row input,
.daily-filter-row input {
    height: 26px;
    border: 1px solid #8b8b8b;
    padding: 3px 6px;
    background: #fff;
}
.settings-card {
    width: 825px;
    min-height: 418px;
    padding: 18px;
    border: 1px solid #888;
    background: #fff;
}
.settings-title {
    font-weight: 700;
    margin-bottom: 16px;
}
.settings-grid {
    display: grid;
    grid-template-columns: 320px 320px;
    gap: 18px;
}
.settings-grid label { display: flex; flex-direction: column; gap: 6px; }
.settings-grid select {
    height: 26px;
    border: 1px solid #8b8b8b;
    background: #fff;
}

.capture-sidebar {
    position: relative;
    min-height: 529px;
    padding: 12px 0 0;
    background: #4f4f4f;
    border: 5px solid #000;
    border-radius: 12px;
    box-shadow: -24px 5px 7px rgba(0,0,0,.75);
}
.capture-box {
    position: relative;
    padding: 0 18px;
    cursor: pointer;
}
.capture-box--photo { margin-top: 4px; }
.capture-box--id { margin-top: 12px; }
.capture-box--thumb { margin-top: 8px; }
.capture-box--signature { margin-top: 12px; }
.capture-heading {
    text-align: center;
    font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    font-size: 24px;
    color: #000;
    margin-bottom: 10px;
}
.capture-frame {
    width: 208px;
    height: 87px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 14px;
    border: 5px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.capture-frame.white { background: #fbfbfb; }
.capture-frame img {
    max-width: 140px;
    max-height: 70px;
    object-fit: contain;
}
.capture-thumb-pad {
    width: 142px;
    height: 77px;
    margin: 0 auto -82px;
    border-radius: 14px;
    border: 5px solid #000;
    background: #fbfbfb;
}
.thumbprint-image {
    position: relative;
    display: block;
    width: 99px;
    height: 86px;
    margin: 0 auto;
    object-fit: contain;
}
.signature-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 36px;
    color: #fff8dc;
    font-size: 19px;
    font-weight: 700;
    font-family: 'Bookman Old Style', Georgia, serif;
}
.signature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .2);
}
.signature-status.is-success .signature-text,
.signature-status.is-success .signature-icon {
    color: #dff7d6;
}
.signature-status.is-missing .signature-text,
.signature-status.is-missing .signature-icon {
    color: #fff8dc;
}

.legacy-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.legacy-modal.is-open { display: flex; }
.legacy-modal-dialog {
    background: #fbfbfb;
    border: 1px solid #8c8c8c;
    border-radius: 8px;
    box-shadow: 0 16px 38px rgba(0,0,0,.45);
    overflow: hidden;
}
.item-dialog { width: 740px; }
.receipt-dialog { width: 885px; max-width: calc(100vw - 40px); }
.legacy-modal-header,
.legacy-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(#ffffff, #d6d6d6);
    border-bottom: 1px solid #b4b4b4;
}
.legacy-modal-footer {
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #b4b4b4;
    border-bottom: 0;
}
.legacy-modal-body { padding: 14px; background: #fbfbfb; }
.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid #888;
    border-radius: 8px;
    background: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.item-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.item-modal-grid .full-width { grid-column: 1 / span 2; }
.receipt-meta-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 10px;
    margin-bottom: 8px;
}
.meta-label { font-weight: 700; }
.receipt-detail-table { margin-top: 12px; }
.receipt-total-line {
    margin-top: 12px;
    text-align: right;
    font-size: 18px;
    font-weight: 700;
}

@media (max-width: 1360px) {
    .legacy-page { width: calc(100vw - 40px); }
    .legacy-shell { grid-template-columns: minmax(0, 1fr) 337px; }
    .subsection-row { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
    .legacy-shell { grid-template-columns: 1fr; }
    .capture-sidebar { width: 337px; margin: 0 auto; }
    .settings-card { width: auto; }
}

@media (max-width: 920px) {
    .legacy-tabs-bar { overflow-x: auto; flex-wrap: nowrap; }
    .personal-grid,
    .physical-grid,
    .vehicle-grid,
    .settings-grid,
    .metal-step-labels,
    .item-modal-grid {
        grid-template-columns: 1fr !important;
    }
    .field--notes,
    .item-modal-grid .full-width { grid-column: auto; }
    .metal-actions-row,
    .receipt-filters,
    .daily-filter-row,
    .report-range-row { flex-wrap: wrap; }
    .receipt-filters [data-receipt-date],
    .receipt-filters [data-receipt-query],
    .receipt-filters [data-receipt-part] { width: 100%; }
}
