:root {
    --page-background: #eef1f5;
    --panel-background: #ffffff;
    --header-background: #183b5b;
    --header-border: #102d47;
    --primary: #1f6fa9;
    --primary-hover: #195d8d;
    --border: #d6dde5;
    --border-dark: #bec8d3;
    --text-primary: #1f2933;
    --text-secondary: #637282;
    --table-header: #edf3f8;
    --table-row-hover: #f7fafc;
    --error-background: #fff1f1;
    --error-text: #a12626;
    --shadow: 0 2px 10px rgba(25, 45, 65, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page-background);
    color: var(--text-primary);
}

/*
 * Author CSS rules such as `.results-state { display: grid; }` can override the
 * browser's default handling of the hidden attribute. This guarantees that
 * loading, empty, table, and pagination states are mutually exclusive.
 */
[hidden] {
    display: none !important;
}

button,
input {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    min-height: 82px;
    padding: 18px 30px;
    background: var(--header-background);
    border-bottom: 1px solid var(--header-border);
    color: #ffffff;
}

.app-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.app-header p {
    margin: 5px 0 0;
    font-size: 13px;
    color: #c9d8e5;
}

/* Tabs share one shell so future workflows can replace only the content area. */
.tab-navigation {
    display: flex;
    gap: 2px;
    padding: 0 30px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.tab-button {
    min-width: 150px;
    padding: 15px 22px 13px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.tab-button.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.tab-button:disabled {
    color: #a5afb8;
    cursor: not-allowed;
}

.tab-content {
    padding: 24px 30px 30px;
}

.tab-heading {
    margin-bottom: 18px;
}

.tab-heading h2 {
    margin: 0;
    font-size: 22px;
}

.tab-heading p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.report-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.filter-panel,
.results-panel {
    background: var(--panel-background);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.filter-panel {
    padding: 20px;
}

.panel-heading {
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h3,
.results-header h3 {
    margin: 0;
    font-size: 17px;
}

.panel-heading p,
.results-header p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    color: var(--text-primary);
    background: #ffffff;
}

.form-field input:focus {
    outline: 2px solid rgba(31, 111, 169, 0.2);
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.button {
    min-height: 38px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-weight: 600;
    cursor: pointer;
}

.button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.button-primary {
    background: var(--primary);
    color: #ffffff;
}

.button-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.button-secondary {
    background: #ffffff;
    border-color: var(--border-dark);
    color: var(--text-primary);
}

.results-panel {
    min-width: 0;
    overflow: hidden;
}

.results-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.results-state {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
}

.results-state.error {
    min-height: 54px;
    margin: 14px 20px;
    border: 1px solid #efb9b9;
    border-radius: 3px;
    background: var(--error-background);
    color: var(--error-text);
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    table-layout: auto;
}

th,
td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: var(--table-header);
    color: #34495e;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

td {
    font-size: 13px;
}

tbody tr:hover {
    background: var(--table-row-hover);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.numeric-column {
    text-align: right;
}

@media (max-width: 850px) {
    .app-header,
    .tab-navigation,
    .tab-content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .report-layout {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .tab-navigation {
        overflow-x: auto;
    }

    .tab-button {
        min-width: 130px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }
}

/*Date and Pagination CSS */
.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.date-range-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.date-range-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.date-range-item input {
    width: 100%;
    height: 38px;
    padding: 6px 7px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    background: #ffffff;
}

.table-container {
    width: 100%;
    max-height: calc(100vh - 330px);
    min-height: 220px;
    overflow: auto;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-height: 58px;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    background: #ffffff;
}

.pagination-button {
    min-width: 82px;
    height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
    background: var(--table-header);
}

.pagination-button:disabled {
    color: #9aa5af;
    background: #f4f6f8;
    cursor: not-allowed;
}

.pagination-info {
    min-width: 105px;
    text-align: center;
    font-size: 13px;
}
/*
 * The upper pagination separates itself from the table with a bottom border.
 * The lower pagination uses a top border to close the results grid.
 */
.pagination-bottom {
    border-top: 1px solid var(--border);
    border-bottom: 0;
}
/* end of date and pagination setup */
