:root {
    --hlab-green: #369318;
    --hlab-green-dark: #2d7a14;
    --hlab-bg: #f5f5f5;
    --hlab-text: #34412f;
    --hlab-muted: #6c757d;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    color: #838383;
    background: var(--hlab-bg);
    font-family: "Nunito", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}
#history-date-field {
    height: 48px !important;
}
.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    z-index: 90;
    top: 0;
    min-height: 72px;
    border-bottom: 2px solid #d9ead3;
    background: linear-gradient(90deg, #edf7e9 0%, #f7fbf5 62%, #fff 100%);
}

.app-nav {
    width: 100%;
    min-height: 70px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--hlab-text);
    text-decoration: none;
}

.brand img {
    width: auto;
    height: 44px;
}

.brand-title {
    margin: 0;
    padding-left: 14px;
    border-left: 1px solid #e2e5e1;
    color: var(--hlab-text);
    font-size: .96rem;
    font-weight: 650;
}

.brand-title:focus {
    outline: none;
}

.header-lookup {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-lookup label {
    margin: 0;
    color: #6c757d;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.header-lookup .form-select {
    width: 250px;
    min-height: 42px;
    border-color: #dfe3df;
    cursor: pointer;
    font-size: .9rem;
}

.page-content {
    width: 100%;
    margin: 0 auto;
    padding: 8px 24px 28px;
    flex: 1;
}

footer {
    min-height: 50px;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #ececec;
    background: #fff;
    color: #666;
    font-size: .7rem;
    font-weight: 600;
}

.home-container {
    margin: 0 auto;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--hlab-muted);
    font-size: .875rem;
}

.lookup-card {
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: .5rem;
    background: #fff;
}

.field-group label {
    margin-bottom: 6px;
    display: block;
    color: #495057;
    font-size: .84rem;
    font-weight: 600;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hlab-green);
    box-shadow: 0 0 0 .2rem rgba(54, 147, 24, .18);
}

.lookup-section {
    padding: 20px;
}

.section-heading {
    margin: -20px -20px 18px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #d9ead3;
    background: linear-gradient(90deg, #edf7e9 0%, #f7fbf5 62%, #fff 100%);
}

.section-heading h2 {
    margin: 0;
    color: #333;
    font-size: 1.05rem;
    font-weight: 600;
}

.section-heading > span {
    padding: 4px 8px;
    border: 1px solid #d4f0ca;
    border-radius: 1rem;
    background: #f0f8ec;
    color: var(--hlab-green);
    font-size: .69rem;
    font-weight: 650;
}

.input-group-compact {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.input-group-compact .form-control {
    height: 56px;
    padding: 14px 20px;
    flex: 1;
    border-color: #dee2e6;
    font-size: 1.12rem;
}

.input-group-compact .form-control::placeholder,
.field-group .form-control::placeholder {
    color: #adb5bd;
}

.input-group-compact .btn {
    height: 56px;
}

.lookup-submit {
    min-width: 170px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    border-radius: .5rem;
}

.btn-primary {
    border-color: var(--hlab-green) !important;
    background: var(--hlab-green) !important;
}

.btn-primary:hover:not(:disabled) {
    border-color: #296f12 !important;
    background: var(--hlab-green-dark) !important;
    box-shadow: 0 4px 12px rgba(54, 147, 24, .25);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    border-color: var(--hlab-green) !important;
    background: var(--hlab-green) !important;
    color: #fff !important;
    opacity: .55;
}

.search-options {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #838383;
    font-size: .78rem;
}

.search-options label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
}

.form-check-input {
    margin: 0;
    cursor: pointer;
}

.form-check-input:checked {
    border-color: var(--hlab-green);
    background-color: var(--hlab-green);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.field-grid.one-column {
    grid-template-columns: minmax(240px, 620px);
}

.field-group .form-control,
.field-group .form-select {
    min-height: 48px;
}

.analysis-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.analysis-actions > span {
    color: #8a918b;
    font-size: .8rem;
}

.status-message {
    margin: 16px 0;
    padding: 20px;
    border: 1px dashed #dee2e6;
    border-radius: .5rem;
    background: #fff;
    color: var(--hlab-muted);
    text-align: center;
    font-size: .88rem;
}

.error-message {
    margin: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.error-message > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.results-card {
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: .5rem;
    background: #fff;
}

.result-limit-warning {
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid #e3c76a;
    background: #fff3cd;
    color: #664d03;
    font-size: .88rem;
}

.result-limit-warning i {
    margin-top: 2px;
    color: #997404;
    font-size: 1rem;
}

.result-limit-warning strong {
    display: block;
    margin-bottom: 2px;
}

.results-header {
    min-height: 48px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    color: var(--hlab-muted);
    font-size: .8rem;
}

.results-header strong {
    margin-right: 4px;
    color: var(--hlab-green);
}

.results-summary {
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-summary > span {
    color: #7b827c;
    font-size: .72rem;
}

.results-header > span {
    font-size: .72rem;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-actions > span {
    font-size: .72rem;
}

.results-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.data-table {
    min-width: 1420px;
    font-size: .78rem;
}

.data-table th,
.data-table td {
    padding: 9px 11px;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    height: 48px;
    background: #f8f9fa;
    color: #596159;
    font-size: .68rem;
}

.data-table tbody tr:hover td {
    background: #f3f6f9;
    color: #222;
}

.data-table th:first-child,
.data-table td:first-child {
    position: sticky;
    left: 0;
}

.data-table th:first-child {
    z-index: 3;
}

.data-table td:first-child {
    z-index: 1;
    background: #fff;
}

.customer-table {
    min-width: 1650px;
}

.history-table {
    min-width: 2600px;
}

.history-table .draggable-column {
    cursor: grab;
    user-select: none;
}

.history-table .draggable-column:active {
    cursor: grabbing;
}

.history-table .draggable-column i {
    margin-right: 3px;
    color: #d5ebd0;
}

.name-cell {
    color: var(--hlab-green-dark);
    font-weight: 700;
}

.description-cell {
    min-width: 300px;
    max-width: 440px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.removed-row {
    color: #999;
}

.startup-loader {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--hlab-green);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    z-index: 1000;
    right: 0;
    bottom: 0;
    left: 0;
    padding: .75rem 1.25rem;
    border-top: 1px solid #ffe69c;
    background: #fff3cd;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 1rem;
    cursor: pointer;
}

@media (max-width: 767.98px) {
    .brand-title,
    .header-lookup label {
        display: none;
    }

    .brand img {
        height: 38px;
    }

    .header-lookup .form-select {
        width: min(220px, 52vw);
    }

    .app-nav,
    .page-content {
        padding-right: 10px;
        padding-left: 10px;
    }

    .input-group-compact,
    .section-heading,
    .search-options,
    .results-header,
    .results-actions,
    .error-message,
    .analysis-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .lookup-section {
        padding: 16px 12px;
    }

    .section-heading {
        margin: -16px -12px 16px;
        padding: 12px;
    }

    .input-group-compact .form-control {
        font-size: 1rem;
    }

    .input-group-compact .btn {
        width: 100%;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

}

/* Keep lookup context in the main header instead of a separate card heading. */
.brand > a { flex-shrink: 0; }
.brand-title { line-height: 1.5; padding-top: 8px; padding-bottom: 8px; }
.app-title { white-space: nowrap; }
.lookup-description { color: var(--hlab-muted); font-size: .875rem; font-weight: 400; }
@media (max-width: 1000px) {
    .app-nav { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
    .brand { flex-basis: 100%; }
    .header-lookup { margin-left: auto; }
}

.login-user { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.header-lookup { flex-wrap: wrap; justify-content: flex-end; }

