body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
}

nav {
    background-color: #f8f9fa;
    color: #333;
    padding: 1em;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
}

nav ul li {
    margin-right: 20px;
}

nav ul li a {
    color: #495057;
    text-decoration: none;
    font-weight: 500;
}

nav ul li a:hover {
    color: #007bff;
    text-decoration: underline;
}

nav ul li a.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    padding-bottom: 2px;
}

/* Month navigation styles */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.month-navigation h2 {
    margin: 0;
    color: #495057;
    font-size: 1.5em;
    text-align: center;
    flex-grow: 1;
}

.month-nav-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s;
    min-width: 80px;
    text-align: center;
}

.month-nav-btn:hover {
    background-color: #0056b3;
    text-decoration: none;
    color: white;
}

/* Stage filter styles */
.stage-filters {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filter-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
    font-size: 0.9em;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

/* Horizontal filter layout for desktop */
@media (min-width: 769px) {
    .stage-filters form {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        gap: 30px;
        flex-wrap: wrap;
    }

    .filter-group {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        padding: 0 !important;
        border: none !important;
        margin: 0 !important;
        position: relative;
    }

    .filter-group:not(:last-child)::after {
        content: '';
        position: absolute;
        right: -15px;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 30px;
        background-color: #dee2e6;
    }

    .filter-group .filter-label {
        margin: 0 !important;
        font-size: 0.85em !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
        color: #666 !important;
    }

    .filter-group .filter-checkboxes {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        margin: 0 !important;
    }
}

.stage-checkbox {
    display: inline-flex;
    align-items: center;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
}

.stage-checkbox input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

.stage-checkbox span {
    color: #495057;
}

.stage-checkbox:hover span {
    color: #007bff;
}

.designer-checkbox {
    display: inline-flex;
    align-items: center;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
}

.designer-checkbox input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

.designer-checkbox span {
    color: #495057;
}

.designer-checkbox:hover span {
    color: #007bff;
}

.designer-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.status-checkbox {
    display: inline-flex;
    align-items: center;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
}

.status-checkbox input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

.status-checkbox span {
    color: #495057;
}

.status-checkbox:hover span {
    color: #007bff;
}

.clear-filters {
    margin-left: auto;
    font-size: 0.85em;
    color: #6c757d;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #6c757d;
    border-radius: 3px;
    transition: all 0.2s;
}

.clear-filters:hover {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
}

.container {
    width: 95%;
    max-width: 1600px;
    margin: auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1, h2 {
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f0f0f0;
}

.sort-header {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 2px 0;
    position: relative;
}

.sort-header:hover {
    color: #007bff;
    text-decoration: underline;
}

.sort-header::after {
    content: "";
    display: inline-block;
    width: 12px;
    text-align: center;
    margin-left: 5px;
}

.sort-header.sort-asc::after {
    content: "▲";
}

.sort-header.sort-desc::after {
    content: "▼";
}

.actions a, .actions button {
    margin-right: 5px;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    display: inline-block;
    text-align: center;
    min-width: 50px;
    vertical-align: top;
    box-sizing: border-box;
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    line-height: 1.2;
    font-family: inherit;
}

.actions a:hover, .actions button:hover {
    opacity: 1;
}

.actions {
    white-space: nowrap;
}

.actions .delete-btn {
    cursor: pointer;
}

.btn-add {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 20px;
}

.color-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    vertical-align: middle;
    margin-left: 5px;
}

.designer-color-square {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 3px;
    border: 1px solid #eee;
}

.days-until-due {
    font-weight: normal;
}

.days-overdue {
    color: #dc3545;
    font-weight: bold;
}

.due-today {
    color: #ffc107;
    font-weight: bold;
}

.due-soon {
    color: #fd7e14;
    font-weight: bold;
}

.designer-cell {
    text-align: center;
    vertical-align: middle;
}

.flashes {
    list-style-type: none;
    padding: 0;
    margin-bottom: 1em;
}
.flashes li {
    padding: 0.75em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}
.flashes li.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.flashes li.danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.flashes li.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

form div {
    margin-bottom: 15px;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

form input[type="text"],
form input[type="date"],
form select,
form textarea {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

form input[type="color"] { /* Basic styling for color input if used, though we use text for hex */
    padding: 5px;
    height: 40px;
}

form input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
form input[type="submit"]:hover {
    background-color: #0056b3;
}

form ul { /* For SelectMultipleField */
    list-style-type: none;
    padding: 0;
}
form ul li {
    margin-bottom: 5px;
}
form ul li label { /* Label for checkbox */
    font-weight: normal;
    margin-left: 5px;
}
form ul li input[type="checkbox"] {
    margin-right: 5px;
}

.designer-checkbox-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.designer-checkbox-item {
    margin-bottom: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.designer-checkbox-label {
    margin-left: 8px;
    font-weight: normal;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
}

/* ============================================================
   RESPONSIVE DESIGN - MOBILE FIRST APPROACH
   ============================================================ */

/* Mobile Navigation */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #495057;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0.5em;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.mobile-nav-toggle:hover {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.nav-brand {
    display: none;
}

.nav-brand h3 {
    font-size: 1.2em;
    font-weight: normal;
}

/* Mobile breakpoint - up to 768px */
@media screen and (max-width: 768px) {
    /* Mobile Navigation */
    .mobile-nav-toggle {
        display: block;
    }

    .nav-brand {
        display: block;
    }

    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #f8f9fa;
        padding: 0;
        margin: 0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        z-index: 1000;
        border: 1px solid #dee2e6;
        border-top: none;
    }

    nav ul.show {
        display: flex;
    }

    nav ul li {
        margin-right: 0;
        border-bottom: 1px solid #dee2e6;
    }

    nav ul li:last-child {
        border-bottom: none;
    }

    nav ul li a {
        display: block;
        padding: 15px 20px;
        border-bottom: none;
        transition: background-color 0.3s ease;
    }

    nav ul li a:hover {
        background-color: rgba(0, 123, 255, 0.1);
        text-decoration: none;
        color: #007bff;
    }

    nav {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Container adjustments */
    .container {
        width: 95%;
        padding: 15px;
    }

    /* Typography scaling */
    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 1.4em;
        margin-bottom: 12px;
    }

    /* Touch-friendly buttons */
    .btn-add,
    .actions a,
    .actions button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
        margin-bottom: 8px;
        display: inline-block;
        text-align: center;
        box-sizing: border-box;
    }

    .actions {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
    }

    /* Responsive tables - card layout for mobile */
    .table-responsive {
        display: block;
    }

    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }

    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive tr {
        background-color: white;
        border: 1px solid #ddd;
        margin-bottom: 15px;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .table-responsive td {
        border: none;
        padding: 8px 0;
        position: relative;
        padding-left: 35%;
        word-wrap: break-word;
    }

    .table-responsive td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 30%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #666;
    }

    .table-responsive .actions {
        padding-left: 0;
        margin-top: 10px;
    }

    .table-responsive .actions:before {
        content: none;
    }

    /* Form improvements for mobile */
    form input[type="text"],
    form input[type="date"],
    form select,
    form textarea {
        width: 100%;
        padding: 15px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
    }

    form input[type="submit"] {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        border-radius: 8px;
        margin-top: 10px;
    }

    /* Checkbox lists - better spacing */
    form ul li {
        margin-bottom: 12px;
        padding: 8px;
        background-color: #f8f9fa;
        border-radius: 4px;
    }

    form ul li label {
        font-size: 16px;
        line-height: 1.4;
    }

    /* Color swatches - larger for touch */
    .color-swatch {
        width: 30px;
        height: 30px;
    }

    .designer-color-square {
        width: 20px;
        height: 20px;
        margin-right: 5px;
    }

    /* Flash messages */
    .flashes li {
        padding: 15px;
        margin-bottom: 10px;
        font-size: 16px;
        border-radius: 8px;
    }
}

/* Tablet breakpoint - 769px to 1024px */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        width: 92%;
        padding: 18px;
    }

    /* Slightly smaller table padding for tablets */
    th, td {
        padding: 10px 6px;
        font-size: 0.95em;
    }

    /* Button adjustments */
    .actions a, .actions button {
        padding: 8px 12px;
        font-size: 0.85em;
    }
}

/* Large screens - enhance readability */
@media screen and (min-width: 1200px) {
    .container {
        max-width: 1800px;
    }

    table {
        font-size: 1.05em;
    }

    th, td {
        padding: 12px 10px;
    }
}

/* Inline editing styles */
.editable {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.editable:hover {
    background-color: rgba(0, 123, 255, 0.1);
    outline: 1px dashed #007bff;
}

.designers-edit {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.designers-edit:hover {
    text-decoration: underline;
}

.inline-editor {
    border: 1px solid #007bff;
    border-radius: 3px;
    font-size: inherit;
    font-family: inherit;
    background-color: white;
    z-index: 1000;
}

.inline-text, .inline-date {
    padding: 4px 6px;
    width: 200px;
    min-width: 100px;
}

.inline-select {
    padding: 4px 6px;
    width: auto;
    min-width: 120px;
}

.inline-designers {
    background-color: white;
    border: 1px solid #007bff;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: absolute;
    z-index: 1000;
    max-width: 300px;
    max-height: 300px;
    overflow-y: auto;
}

.designer-checkbox-inline {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
}

.designer-checkbox-inline:hover {
    background-color: #f8f9fa;
}

.designer-checkbox-inline input {
    margin-right: 8px;
}

.designer-checkbox-inline .designer-color-dot {
    margin-right: 8px;
}

.inline-editor-buttons {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}

.btn-save-inline, .btn-cancel-inline {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.btn-save-inline {
    background-color: #28a745;
    color: white;
}

.btn-save-inline:hover {
    background-color: #218838;
}

.btn-cancel-inline {
    background-color: #6c757d;
    color: white;
}

.btn-cancel-inline:hover {
    background-color: #545b62;
}

.inline-feedback {
    position: fixed;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    z-index: 2000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.inline-feedback-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.inline-feedback-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.designer-unassigned {
    color: #6c757d;
    font-style: italic;
    opacity: 0.7;
}

.designer-cell.editable:hover .designer-unassigned {
    color: #007bff;
    opacity: 1;
}

/* ============================================================
   TIMESHEET STYLES
   ============================================================ */

.timesheet-grid {
    border-collapse: collapse;
}

.timesheet-grid th {
    text-align: center;
    padding: 8px 4px;
    white-space: nowrap;
}

.timesheet-grid td {
    padding: 6px 4px;
}

.timesheet-cell-td {
    text-align: center;
}

.timesheet-cell {
    width: 65px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.95em;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.timesheet-cell:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.timesheet-cell-saving {
    border-color: #ffc107;
}

.timesheet-cell-saved {
    border-color: #28a745;
    background-color: #f0fff0;
}

.timesheet-cell-error {
    border-color: #dc3545;
    background-color: #fff0f0;
}

.timesheet-today {
    background-color: rgba(0, 123, 255, 0.06);
}

.row-total,
.col-total,
.grand-total {
    font-weight: 600;
    text-align: center;
    background-color: #f8f9fa;
}

.grand-total {
    font-weight: 700;
}

.project-client-label {
    font-size: 0.8em;
    color: #888;
    display: block;
    line-height: 1.2;
}

/* Hide number input spinners for cleaner look */
.timesheet-cell::-webkit-outer-spin-button,
.timesheet-cell::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.timesheet-cell {
    -moz-appearance: textfield;
}
