:root {
    --sidebar-width: 50px;
}

body {
    background-color: #f8f9fa;
}

/* Top Navigation Bar */
.icon-bar {
    background-color: #343a40;
    z-index: 100;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--sidebar-width);
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.main-content {
    margin-top: calc(var(--sidebar-width) + 0.5rem);
    padding: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    background: transparent;
    border: none;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.icon-btn:hover,
.icon-btn:focus {
    background-color: #495057;
    color: #fff;
}

/* Gear Table */
.gear-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gear-table {
    font-size: 0.8rem;
    margin: 0 auto;
}

.gear-table th {
    background-color: #343a40;
    color: white;
    text-align: center;
    padding: 0.4rem;
}

.gear-table td {
    text-align: center;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
}

.gear-table .row-header {
    background-color: #343a40;
    color: white;
    font-weight: bold;
    position: sticky;
    left: 0;
}

.gear-table tbody tr:nth-child(odd) {
    background-color: #fff;
}

.gear-table tbody tr:nth-child(even) {
    background-color: #f1f3f5;
}

.gear-table td:not(.row-header) {
    cursor: pointer;
    transition: all 0.15s;
}

.gear-table td:not(.row-header):hover {
    background-color: #e9ecef !important;
}

/* Cell Selection Highlighting */
.gear-selected {
    background-color: #fff5f5 !important;
    outline: 3px solid #0d6efd;
    outline-offset: -3px;
    font-weight: bold;
}

.gear-close {
    background-color: #d3f9d8 !important;
}

.gear-near {
    background-color: #fff3bf !important;
}

/* Reference Comparison Highlighting */
.gear-below-ref {
    background-color: #74c0fc !important;
}

.gear-in-ref {
    background-color: #a5d8ff !important;
}

.gear-above-ref {
    background-color: #ffa8a8 !important;
}

/* Modal Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
}

.checkbox-grid .form-check {
    margin: 0;
    padding: 0;
}

.checkbox-grid .form-check-input {
    display: none;
}

.checkbox-grid .form-check-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.4rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.15s;
    background: #fff;
}

.checkbox-grid .form-check-input:checked + .form-check-label {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.checkbox-grid .form-check-label:hover {
    border-color: #0d6efd;
}

/* Preset Buttons */
.preset-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}