body {
    font-family: Arial, sans-serif !important;
    margin: 0;
    padding: 0;
    height: auto;
    display: flex;
    flex-direction: column;
}

#header, #menu {
    padding-left: 4px;
    flex-shrink: 0;
    margin: 0;
    padding-top: 0;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: -1px;
    width: 100%;
    flex-shrink: 0;
}

.left-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.right-header {
    position: relative;
}

.report-container {
    width: 100%;
    max-width: var(--grid-max-width, 1800px);
    margin-left: 0;
    display: flex;
    flex-direction: column;
    height: auto;
}

#data {
    padding: 0 0 0 4px;
    display: flex;
    flex-direction: column;
    height: auto;
}

.form-section {
    margin-top: 20px;
}

.grid-container {
    flex: none;
    overflow-y: auto;
    position: relative;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 11pt;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif !important;
}

.report-table thead th {
    position: sticky;
    top: 0;
    z-index: 99;
    background-color: #E85D04;
}

.report-title {
    font-size: 11pt;
    font-weight: bold;
    color: white;
    background-color: #E85D04;
    margin: 15px 0 0 0;
    font-family: Arial, sans-serif;
    border: 1px solid #E85D04;
    padding: 0 4px;
    display: inline-block;
    border-radius: 4px 4px 0 0;
}

.report-table th {
    background-color: #E85D04;
    color: white;
    padding: 7.6px 8px;
    text-align: left;
    border: 1px solid #F48C06;
    font-weight: 600;
    font-family: Arial, sans-serif !important;
    cursor: pointer;
    position: relative;
    padding-right: 25px;  /* Make room for sort indicator */
}

.report-table th::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 14px;
    color: #F0E68C;
}

.report-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #F0E68C;
}

.report-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #F0E68C;
}

.report-table th.sort-none::after {
    content: '⇅';
    opacity: 0.3;
    color: #F0E68C;
}

.report-table th:first-child {
    cursor: default;
    padding-right: 8px;
}

.report-table th:hover:not(:first-child)::after {
    opacity: 0.8;
}

.sort-direction {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 11pt;
    font-weight: bold;
    color: #E85D04;
    background-color: white;
    padding: 2px 8px;
    border: 1px solid #E85D04;
    border-radius: 3px;
    min-width: 45px;
    text-align: center;
    display: none;
}

.sortable-fields li.selected .sort-direction {
    display: block;
}

.sort-direction:empty {
    display: none !important;
}

.report-table td {
    padding: 5.7px 8px;
    border: 1px solid #FFE5D9;
    font-family: Arial, sans-serif !important;
    line-height: 1.2;
    vertical-align: top;
}

.report-table tr:nth-child(even) {
    background-color: #F5F0E7;
}

.report-table tr:nth-child(odd) {
    background-color: #fff;
}

.report-table tr:hover {
    background-color: #FFE5D9;
    transition: background-color 0.2s ease;
}

.report-table a {
    color: #0000FF;
    text-decoration: none;
    font-weight: 500;
    font-family: Arial, sans-serif !important;
}

.report-table a.report-link {
    color: #E85D04;
    text-decoration: none;
}

.report-table a.report-link:hover {
    color: #E85D04;
    text-decoration: underline;
}

@media print {
    .report-link {
        color: inherit !important;
        text-decoration: none !important;
        font-weight: normal !important;
    }
}

.report-table a:hover {
    color: #0066FF;
    text-decoration: underline;
}

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

.text-center {
    text-align: center;
}

/* Right alignment for specific column types */
.report-table td[data-type="date"],
.report-table td[data-type="number"],
.report-table td[data-type="$"],
.report-table td[data-type="%"] {
    text-align: right;
}

/* Right alignment for footer sums */
.report-table tfoot td {
    text-align: right;
}

/* High percentage styling */
.high-percentage {
    background-color: #F0E68C;
    font-weight: normal;
}

.report-table th:first-child,
.report-table td:first-child {
    border-left: none;
}

.report-table th:last-child,
.report-table td:last-child {
    border-right: none;
}

.report-table tr:last-child td {
    border-bottom: none;
}

.email-form-table {
    width: 100% !important;
    table-layout: fixed !important;
}

.email-form-table td:first-child {
    width: 30% !important;
    min-width: 300px !important;
}

.email-form-table td:last-child {
    width: 70% !important;
    min-width: 600px !important;
}

.packages-email-table {
    width: 900px;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif !important;
    table-layout: fixed;
}

.packages-email-table th {
    background-color: #E85D04;
    color: white;
    padding: 12px 8px;
    text-align: left;
    border: 1px solid #F48C06;
    font-weight: 600;
}

.packages-email-table td {
    padding: 10px 8px;
    border: 1px solid #FFE5D9;
}

.packages-email-table tr:nth-child(even) {
    background-color: #F5F0E7;
}

.packages-email-table tr:nth-child(odd) {
    background-color: #fff;
}

/* Fixed pixel widths for columns - narrower version */
.packages-email-table th:nth-child(1), .packages-email-table td:nth-child(1) { width: 120px; }  /* Tutor */
.packages-email-table th:nth-child(2), .packages-email-table td:nth-child(2) { width: 140px; }  /* Name */
.packages-email-table th:nth-child(3), .packages-email-table td:nth-child(3) { width: 200px; }  /* Product */
.packages-email-table th:nth-child(4), .packages-email-table td:nth-child(4) { width: 100px; }  /* Start */
.packages-email-table th:nth-child(5), .packages-email-table td:nth-child(5) { width: 80px; }   /* Sessions */
.packages-email-table th:nth-child(6), .packages-email-table td:nth-child(6) { width: 100px; }  /* Package Fee */
.packages-email-table th:nth-child(7), .packages-email-table td:nth-child(7) { width: 80px; }   /* Paid */
.packages-email-table th:nth-child(8), .packages-email-table td:nth-child(8) { width: 80px; }   /* Minutes left */

/* KoolGrid styling to match report-table */
.kgrRow td {
    font-family: Arial, sans-serif !important;
    padding: 6px 8px;
    border: 1px solid #FFE5D9;
}

.kgrHeaderRow th {
    background-color: #E85D04;
    color: white;
    padding: 8px 8px;
    text-align: left;
    border: 1px solid #F48C06;
    font-weight: 600;
    font-family: Arial, sans-serif !important;
}

.kgrAltRow td {
    background-color: #F5F0E7;
}

.report-add {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    margin: 15px 0 0 0;
    font-family: Arial, sans-serif;
    border: 1px solid #E85D04;
    padding: 0 4px;
    display: inline-block;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
}

.report-add:hover {
    background-color: #E85D04;
    color: white;
}

.print-button {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    border: 1px solid #E85D04;
    padding: 0 4px;
    cursor: pointer;
    display: inline-block;
    border-radius: 4px 4px 0 0;
    margin-top: 15px;
}

.print-button:hover {
    background-color: #E85D04;
    color: white;
}

.refresh-button {
    display: none;  /* Hide the refresh button */
}

.sortable-fields {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sortable-fields li {
    padding: 8px;
    margin: 4px 0;
    background: #F5F0E7;
    border: 1px solid #FFE5D9;
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    transition: all 0.2s ease;
    position: relative;
    padding-right: 60px;  /* Make room for sort indicator */
}

.sortable-fields li:hover {
    background: #FFE5D9;
}

.sortable-fields li.selected {
    background: #E85D04;
    border-color: #E85D04;
    color: white;
}

.sortable-fields li.selected .sort-direction {
    background-color: white;
    color: #E85D04;
    border-color: white;
}

.sortable-fields li.selected .sort-direction:hover {
    background-color: #FFE5D9;
    color: #E85D04;
}

.sortable-fields li.dragging {
    opacity: 0.5;
}

.sortable-fields li label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.sortable-fields li input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.sort-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #FFE5D9;
}

/* Search box layout */
.search-container {
    position: relative;
    margin-top: 15px;
}

.search-box {
    position: absolute;
    top: 100%;
    left: 0;
    width: 800px;
    background: white;
    border: 1px solid #E85D04;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 100;
    margin-top: 0px;
    border-radius: 4px;
}

.search-box.show {
    display: block;
}

/* Search field rows */
.search-field-row {
    padding: 8px;
    margin: 4px 0;
    background: #F5F0E7;
    border: 1px solid #FFE5D9;
    border-radius: 3px;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
}

.search-field-name {
    width: 150px;
    font-size: 10pt;
    color: #666;
    font-weight: bold;
}

.search-field-row:hover {
    background: #FFE5D9;
}

.search-field-row.selected {
    background: #E85D04;
    border-color: #E85D04;
    color: white;
}

.search-field-row.selected .search-field-name {
    color: white !important;
}

.search-field-row.selected .search-select,
.search-field-row.selected .search-input {
    border-color: white;
}

.search-field-row.selected .search-select {
    color: #333;
}

/* Input and select styles */
.search-operator {
    width: 150px;
    margin: 0 10px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    min-width: 200px;
    margin-right: 10px;
}

.search-select, .search-input {
    padding: 4px 8px;
    border: 1px solid #FFE5D9;
    border-radius: 3px;
    font-size: 10pt;
    background: white;
    color: #333;
    transition: all 0.2s ease;
}

.search-select:hover, .search-input:hover {
    border-color: #E85D04;
}

.search-select:focus, .search-input:focus {
    border-color: #E85D04;
    outline: none;
    box-shadow: 0 0 0 2px rgba(232, 93, 4, 0.1);
}

/* Search actions */
.search-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #FFE5D9;
}

.search-cancel, .search-apply {
    font-size: 10pt;
    font-weight: bold;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 3px;
    border: 1px solid #E85D04;
}

.search-cancel {
    color: #E85D04;
    background-color: white;
}

.search-cancel:hover {
    background-color: #FFE5D9;
}

.search-apply {
    color: white;
    background-color: #E85D04;
}

.search-apply:hover {
    background-color: #F48C06;
}

/* Search button */
.search-button {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    border: 1px solid #E85D04;
    padding: 0 4px;
    cursor: pointer;
    display: inline-block;
    border-radius: 4px 4px 0 0;
}

.search-button:hover {
    background-color: #E85D04;
    color: white;
}

.search-button.active {
    background-color: #E85D04;
    color: white;
    border-color: #E85D04;
}

/* Search header */
.search-header {
    display: flex;
    margin-bottom: 15px;
    padding-right: 30px; /* Make room for close button */
}

.search-title {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    margin-bottom: 15px;
}

.search-fields {
    margin-bottom: 15px;
    clear: both;
}

.toggle-button {
    font-size: 10pt;
    font-weight: bold;
    padding: 4px 12px;
    border: 1px solid #E85D04;
    border-radius: 3px;
    background-color: white;
    color: #E85D04;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;  /* Hide by default */
    margin-bottom: 10px;
}

.toggle-button.show {
    display: inline-block;  /* Show when needed */
}

.toggle-button.active {
    background-color: #E85D04;
    color: white;
}

.toggle-button:hover {
    background-color: #E85D04;
    color: white;
}

.search-button.active {
    background-color: #E85D04 !important;
    color: white !important;
    border-color: #E85D04 !important;
}

.search-apply.active {
    background-color: #E85D04 !important;
    color: white !important;
    border-color: #E85D04 !important;
}

.search-mode {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 15px;
}

.toggle-button {
    font-size: 10pt;
    font-weight: bold;
    padding: 4px 12px;
    border: 1px solid #E85D04;
    border-radius: 3px;
    background-color: white;
    color: #E85D04;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;  /* Hide by default */
}

.search-fields {
    margin-bottom: 15px;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #FFE5D9;
}

.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.progress-indicator {
    background: white;
    padding: 20px 40px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #E85D04;
    color: #E85D04;
    font-weight: bold;
    font-size: 14px;
}

.progress-overlay.show {
    display: flex !important;
}

.search-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    border: none;
    background: none;
}

.search-close:hover {
    color: #E85D04;
}

.export-button {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    border: 1px solid #E85D04;
    padding: 0 4px;
    cursor: pointer;
    display: inline-block;
    border-radius: 4px 4px 0 0;
    margin-top: 15px;
    margin-left: 5px;
}

.export-button:hover {
    background-color: #E85D04;
    color: white;
}

.export-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border: 1px solid #E85D04;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 400px;
    display: none;
}

.export-dialog.show {
    display: block;
}

.export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.export-overlay.show {
    display: block;
}

/* Remove the container since we're using modal */
.export-container {
    display: none;
}

.export-title {
    font-size: 10pt;
    font-weight: bold;
    color: #E85D04;
    margin-bottom: 15px;
    padding-right: 30px;
}

.export-fields {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 4px;
    position: relative;
}

.export-field-row {
    padding: 8px;
    margin: 4px 0;
    background: #FFE5D9;
    border: 1px solid #FFE5D9;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    user-select: none;
}

.export-field-row:hover {
    background: #FFD1B9;
}

.export-field-row.disabled {
    background: #f5f5f5;
    border-color: #eeeeee;
    color: #999;
}

.export-field-row.disabled:hover {
    background: #eeeeee;
}

.export-field-name {
    font-size: 10pt;
    color: #666;
    font-weight: bold;
}

.export-field-icon {
    color: #E85D04;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.export-field-row.disabled .export-field-icon {
    opacity: 0.6;
}

.export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #FFE5D9;
}

.export-cancel, .export-apply {
    font-size: 10pt;
    font-weight: bold;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 3px;
    border: 1px solid #E85D04;
}

.export-cancel {
    color: #E85D04;
    background-color: white;
}

.export-cancel:hover {
    background-color: #FFE5D9;
}

.export-apply {
    color: white;
    background-color: #E85D04;
}

.export-apply:hover {
    background-color: #F48C06;
}

.export-field-row.dragging {
    opacity: 0.9;
    position: absolute;
    z-index: 2;
    background: #FFD1B9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: calc(100% - 8px);
    pointer-events: none;
}

.export-field-row:not(.dragging) {
    transition: transform 200ms ease;
}

.export-fields {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 4px;
    position: relative;
}

.export-field-row {
    padding: 8px;
    margin: 4px 0;
    background: #FFE5D9;
    border: 1px solid #FFE5D9;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    user-select: none;
}

.export-field-row:hover {
    background: #FFD1B9;
}

.export-field-row.dragging {
    opacity: 0.5;
    background: #FFD1B9;
    cursor: grabbing;
}

.export-field-row.drag-over {
    border-top: 2px solid #E85D04;
    margin-top: 10px;
}

.export-fields {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 4px;
    position: relative;
}

.drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #E85D04;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.drop-indicator.show {
    opacity: 1;
}

.drop-indicator::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    background-color: #E85D04;
    border-radius: 50%;
}

.drop-indicator::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    background-color: #E85D04;
    border-radius: 50%;
}

.sort-button {
    display: none;
}

.page-content {
    margin-top: 20px;
}

/* Hide UI elements when printing */
@media print {
    .report-add,
    .search-button,
    .print-button,
    .export-button,
    button,
    input[type="button"],
    input[type="submit"],
    .button,
    #cancel,
    #save,
    .form-buttons,
    .form-actions {
        display: none !important;
        visibility: hidden !important;
    }

    .grid-container {
        border: none !important;
    }

    /* Page number styling */
    @page {
        margin: 1.5cm;
    }

    /* Control rows per page */
    .report-table {
        margin-bottom: 40px !important;
    }

    .report-table tr {
        page-break-inside: avoid;
        height: 30px !important;
    }

    .report-table td {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        line-height: 1.3 !important;
    }

    /* Footer with page numbers */
    .print-footer {
        position: fixed;
        bottom: 20px;
        left: 0;
        right: 0;
        width: 100%;
        text-align: center;
        font-size: 12px;
        color: #666;
    }

    /* Use running page counter */
    body {
        counter-reset: page;
    }

    .print-footer {
        counter-increment: page;
    }

    .print-footer:after {
        content: "Page " counter(page) " | " attr(data-date);
    }
}

.report-table th.hidden,
.report-table td.hidden {
    display: none;
}

.bool-toggle {
    text-align: center;
}

.bool-toggle input[type="checkbox"] {
    display: none;
}

.bool-toggle input[type="checkbox"]:checked + label:after {
    content: '✔';
    color: #E85D04;
    font-size: 14px;
    font-weight: bold;
}

/* Print media query to ensure hidden columns stay hidden when printing */

.report-table td:has(+ td[data-field="needs" i]),
.report-table td[data-field="needs" i] {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.report-table td[data-field="needs" i] {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word !important;
}

.report-table td[data-field="needs" i],
.report-table td[data-field="email" i] {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word !important;
}

.search-match {
    background-color: #FFE5D9;
    font-weight: bold;
    color: #E85D04;
}

@media print {
    .search-match {
        background-color: transparent !important;
        font-weight: normal !important;
        color: inherit !important;
    }
}
