/* RECORDS, BATCH ENTRY AND HISTORY */
.record-navigation { display:flex; gap:8px; margin-bottom:18px; border-bottom:1px solid #e8e4ef; }
.record-tab { border:0; background:transparent; color:#6f687d; padding:12px 16px; cursor:pointer; font:inherit; font-size:14px; border-bottom:3px solid transparent; }
.record-tab.active { color:#51416f; border-bottom-color:#8065a9; font-weight:700; }
.record-view { display:none; }
.record-view.active { display:block; }
.record-panel { background:#fff; border:1px solid #eceaf1; border-radius:8px; padding:20px; margin-bottom:20px; min-width:0; }
.panel-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.panel-heading h3 { font-size:16px; margin-bottom:5px; }
.panel-heading p, .form-hint { color:#888; font-size:12px; }
.batch-date { max-width:260px; margin-bottom:16px; }
.batch-date label { display:block; font-size:13px; font-weight:600; margin-bottom:7px; }
.batch-date input, .filter-area input, .filter-area select,
.entry-table input, .entry-table select {
    width:100%; min-width:110px; padding:10px; border:1px solid #ddd9e7;
    border-radius:5px; background:#fff; font:inherit; font-size:13px; color:#292638;
}
.table-wrapper { width:100%; overflow-x:auto; }
.entry-table, .history-table { width:100%; border-collapse:collapse; font-size:12px; }
.entry-table th, .history-table th { text-align:left; background:#f6f4f9; color:#615a70; font-weight:700; white-space:nowrap; padding:12px 10px; }
.entry-table td, .history-table td { border-bottom:1px solid #efedf3; padding:9px 10px; white-space:nowrap; }
.entry-table input.material-entry-input { min-width:175px; }
.entry-table td.material-category, .entry-table td.material-unit { color:#6f687d; }
.form-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
.save-btn, .secondary-btn { border:0; border-radius:5px; padding:11px 16px; cursor:pointer; font-weight:600; font-size:13px; }
.save-btn { background:#51416f; color:white; }
.save-btn:hover { background:#403257; }
.secondary-btn { background:#eee9f5; color:#51416f; }
.remove-row { border:0; background:#fbecec; color:#a33; border-radius:5px; width:30px; height:30px; font-size:20px; cursor:pointer; }
.form-hint { margin-top:12px; line-height:1.5; }
.filter-area { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.filter-area input, .filter-area select { flex:1 1 170px; }
.empty-cell { text-align:center; color:#999; padding:24px !important; }
.dashboard-section { margin-bottom:20px; }
.dashboard-section h3 { margin-bottom:16px; }
@media(max-width:600px) {
    .record-panel { padding:14px; }
    .record-tab { padding:11px 12px; }
    .form-actions { flex-direction:column; }
    .form-actions button { width:100%; }
}


/* Mobile-friendly material autocomplete */
.material-picker {
    position: relative;
    min-width: 175px;
}
.material-picker .material-entry-input {
    display: block;
    width: 100%;
    min-width: 175px;
}
.material-suggestions {
    position: static;
    display: block;
    width: 100%;
    max-height: 170px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-top: 5px;
    border: 1px solid #ddd9e7;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.material-suggestions[hidden] {
    display: none;
}
.material-suggestion {
    display: block;
    width: 100%;
    padding: 10px;
    border: 0;
    border-bottom: 1px solid #eee;
    background: #fff;
    color: #292638;
    text-align: left;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
}
.material-suggestion:last-child {
    border-bottom: 0;
}
.material-suggestion:active,
.material-suggestion:focus {
    background: #f3f0f8;
    outline: none;
}
.material-suggestion strong,
.material-suggestion small {
    display: block;
}
.material-suggestion small {
    margin-top: 3px;
    color: #777;
    font-size: 11px;
}
.material-suggestion-empty {
    padding: 10px;
    color: #777;
    font-size: 12px;
    white-space: normal;
}


/* Transaction and catalogue management */
.bt-actions-cell { white-space:nowrap; min-width:116px; }
.bt-action-btn { border:1px solid #ded8e8; background:#f5f2f9; color:#51416f; border-radius:5px; padding:6px 9px; margin:2px; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
.bt-action-btn.bt-danger { color:#a33; background:#fff2f2; border-color:#f0d1d1; }
.bt-voided-row { opacity:.58; background:#fafafa; text-decoration:line-through; }
.bt-voided-label { display:inline-block; color:#9b3333; font-size:11px; font-weight:700; margin:2px 5px; text-decoration:none; }
.bt-modal[hidden] { display:none; }
.bt-modal { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; padding:16px; }
.bt-modal-backdrop { position:absolute; inset:0; background:rgba(22,17,31,.55); }
.bt-modal-card { position:relative; z-index:1; width:min(100%,460px); max-height:88vh; overflow-y:auto; background:#fff; border-radius:12px; padding:20px; box-shadow:0 16px 50px rgba(0,0,0,.22); }
.bt-modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.bt-modal-head h3 { margin:0; font-size:17px; }
.bt-modal-close { border:0; background:#f1eef5; color:#51416f; width:34px; height:34px; border-radius:50%; font-size:22px; cursor:pointer; }
.bt-editor-fields { display:grid; gap:12px; }
.bt-editor-field { display:grid; gap:6px; font-size:13px; font-weight:600; color:#51416f; }
.bt-editor-field input, .bt-editor-field select { width:100%; min-height:42px; padding:10px; border:1px solid #ddd9e7; border-radius:6px; background:#fff; color:#292638; font:inherit; }
.bt-editor-field input:read-only { background:#f5f3f8; }
.bt-modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
@media(max-width:600px) { .bt-modal-card { padding:16px; } .bt-modal-actions { flex-direction:column-reverse; } .bt-modal-actions button { width:100%; min-height:42px; } }

/* Combined dashboard and history filters */
.dashboard-filters, .record-history-filters { align-items:end; }
.dashboard-filters select, .record-history-filters select,
.dashboard-filters input, .record-history-filters input {
    flex: 1 1 155px;
    min-width: 135px;
    padding: 10px;
    border: 1px solid #ddd9e7;
    border-radius: 5px;
    background: #fff;
    color: #292638;
    font: inherit;
    font-size: 13px;
}
.date-filter-label {
    display: flex;
    flex: 1 1 165px;
    min-width: 145px;
    align-items: center;
    gap: 7px;
    color: #615a70;
    font-size: 12px;
    font-weight: 600;
}
.date-filter-label input { min-width: 0; width: 100%; }
.section-catalogue-form {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}
.section-catalogue-form .form-field { flex: 1; }
.section-catalogue-form .save-btn { min-height: 42px; white-space: nowrap; }
@media(max-width:600px) {
    .dashboard-filters, .record-history-filters { display: grid; grid-template-columns: 1fr 1fr; }
    .dashboard-filters > *, .record-history-filters > * { min-width: 0; width: 100%; }
    .date-filter-label { display: block; }
    .date-filter-label input { display: block; margin-top: 5px; }
    .section-catalogue-form { display: grid; grid-template-columns: 1fr; }
    .section-catalogue-form .save-btn { width: 100%; }
}

/* Premium transaction date fields */

.batch-date {
    max-width: 280px;
    margin-bottom: 20px;
}

.batch-date label {
    display: block;
    margin-bottom: 8px;
    color: #51416f;
    font-size: 13px;
    font-weight: 650;
}

.batch-date input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ded9e8;
    border-radius: 8px;
    background: #fcfbfd;
    color: #292638;
    font: inherit;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.batch-date input:focus {
    outline: none;
    border-color: #8065a9;
    box-shadow: 0 0 0 3px rgba(128, 101, 169, .10);
}

.date-format-hint {
    display: block;
    margin-top: 6px;
    color: #918a9e;
    font-size: 11px;
    letter-spacing: .3px;
}

.batch-date input.date-required-error {
    border-color: #bd5555;
    box-shadow: 0 0 0 3px rgba(189, 85, 85, .09);
}

/* BUILDTRACK premium entry popups */

.bt-modal {
    padding: 18px;
    opacity: 0;
    transition: opacity .22s ease;
}

.bt-modal:not([hidden]) {
    opacity: 1;
}

.bt-modal-backdrop {
    background: rgba(25, 20, 35, .58);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.bt-modal-card {
    width: min(100%, 440px);
    padding: 22px;
    border: 1px solid #eeeaf3;
    border-radius: 16px;
    box-shadow: 0 20px 55px rgba(30, 22, 45, .20);
}

.bt-modal-head {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0edf4;
}

.bt-modal-head h3 {
    color: #403451;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.2px;
}

.bt-modal-close {
    width: 32px;
    height: 32px;
    background: #f5f2f8;
    color: #625274;
    transition: background .2s ease, transform .2s ease;
}

.bt-modal-close:hover {
    background: #ebe5f2;
    transform: rotate(90deg);
}

.bt-editor-fields {
    gap: 15px;
}

.bt-editor-field {
    gap: 7px;
    color: #51416f;
    font-size: 12px;
    font-weight: 650;
}

.bt-editor-field input,
.bt-editor-field select {
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #e2ddea;
    border-radius: 8px;
    background: #fcfbfd;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.bt-editor-field input:focus,
.bt-editor-field select:focus {
    outline: none;
    border-color: #8065a9;
    box-shadow: 0 0 0 3px rgba(128, 101, 169, .09);
}

.bt-entry-total {
    padding: 13px 15px;
    border: 1px solid #eee9f4;
    border-radius: 9px;
    background: #f8f6fa;
}

.bt-modal-actions {
    margin-top: 22px;
    gap: 10px;
}

@media(max-width:600px) {
    .bt-modal {
        padding: 14px;
    }
    
    .bt-modal-card {
        padding: 19px;
        border-radius: 14px;
    }
}

/* BUILDTRACK save confirmation toast */

.bt-toast {
    position: fixed;
    left: 50%;
    top: 38%;
    transform: translate(-50%, 15px);
    z-index: 10000;
    padding: 12px 22px;
    border: 1px solid #e4dced;
    border-radius: 10px;
    background: #f8f5fb;
    color: #51416f;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: .2px;
    box-shadow: 0 8px 25px rgba(45, 32, 65, .14);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.bt-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.bt-toast .toast-tick {
    color: #35234f;
    margin-left: 4px;
    font-weight: 800;
}