body, html {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", sans-serif;
    font-size: 10px;
    background-color: #f0f0f0;
}

#root {
    display: flex;
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#left-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: auto;
    padding: 10px;
}

#grid-container {
    overflow: auto;
    flex-grow: 1;
}

#grid-table {
    border-collapse: collapse;
    font-size: 12px;
}

#grid-table th, #grid-table td {
    border: 1px solid #ccc;
    padding: 2px;
    text-align: left;
}

#grid-table th {
    background-color: lightblue;
    position: sticky;
    top: 0;
    z-index: 2;
}

#grid-table tbody th {
     position: sticky;
     left: 0;
     background: white;
     z-index: 1;
}

#grid-table input {
    width: 120px;
    border: 1px solid #ccc;
    padding: 4px;
    font-size: 12px;
}

.analyte-section-header {
    background-color: orange;
    text-align: center;
    font-weight: bold;
    grid-column: 1 / -1;
}

#right-panel {
    width: 250px;
    min-width: 250px;
    background-color: #f0f0f0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 1px solid #ccc;
    overflow-y: auto;
}

.panel-frame {
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fafafa;
}

.frame-header {
    font-weight: bold;
    padding: 4px 6px;
    background-color: #e0e0e0;
    border-bottom: 1px solid #ccc;
}

.frame-content {
    padding: 6px;
}

#actions-frame .frame-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#actions-frame button {
    width: 100%;
    padding: 3px;
    font-size: 10px;
    color: white;
    border: none;
    cursor: pointer;
}

#btn-update-json { background-color: green; }
#btn-save-json-as { background-color: #2e7d32; }
#btn-save-excel { background-color: blue; }
#btn-save-excel-as { background-color: #1565c0; }
#btn-load-json { background-color: orange; }
#btn-autofill-dates { background-color: #00838f; }
#btn-weekly-xlsx { background-color: #455a64; }
#btn-weekly-pdf { background-color: #5d4037; }
#btn-show-graphs { background-color: #004d40; }
#btn-analyte-tally { background-color: #6a1b9a; }
#btn-per-day-tally { background-color: #8e24aa; }
#btn-clear-all { background-color: red; }

#legend-content {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 2px 8px;
    font-size: 10px;
}
.legend-chip {
    width: 16px;
    height: 16px;
    border: 1px solid #333;
}

#notes-text {
    width: 100%;
    height: 100px;
    resize: vertical;
}

#toggle-panel-button {
    position: fixed;
    top: 6px;
    right: 6px;
    z-index: 10;
    font-size: 12px;
    padding: 4px 8px;
}

#side-tally-container {
    width: 500px;
    padding: 10px;
    overflow-y: auto;
    font-size: 10px;
}

#side-tally-table {
    border-collapse: collapse;
    width: 100%;
}

#side-tally-table th, #side-tally-table td {
    border: 1px solid #ccc;
    padding: 2px;
    text-align: center;
    white-space: nowrap;
}

#side-tally-table th {
    background-color: #e6e6e6;
}

#bottom-tally-container {
    padding-top: 10px;
}

#bottom-tally-table {
     border-collapse: collapse;
}

#bottom-tally-table th, #bottom-tally-table td {
    border: 1px solid #ccc;
    padding: 2px;
    width: 128px;
    text-align: left;
}

#bottom-tally-table th {
    background-color: #e6e6e6;
}
#bottom-tally-table td[colspan="2"] {
    width: 180px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 400px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#detail-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#detail-form div {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
}

#detail-action {
    height: 80px;
}


/* Context Menu */
.context-menu {
    position: absolute;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 5px 0;
}

.context-menu ul li {
    padding: 8px 12px;
    cursor: pointer;
}

.context-menu ul li:hover {
    background-color: #eee;
}

.context-menu ul li.separator {
    height: 1px;
    background-color: #ccc;
    margin: 4px 0;
    padding: 0;
}

#history-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
}
#history-list li {
    padding: 4px;
    cursor: pointer;
}

#history-list li:hover {
    background-color: #eee;
}

#btn-hist {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

#btn-hist button {
    font-size: 10px;
    padding: 2px 4px;
}

.modal-content h2 {
    margin-top: 0;
}

.tally-view-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.tally-view-table th, .tally-view-table td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: center;
}

.tally-view-table thead th {
    background-color: #e6e6e6;
    position: sticky;
    top: 0;
}

.tally-view-table .section-header {
    background-color: orange;
    text-align: center;
    font-weight: bold;
}

.tally-view-table .total-row {
    font-weight: bold;
    background-color: #f0f0f0;
}