/* ==========================================================================
   UNIFIED STYLES FOR ALL PAGES
   Consolidates all inline styles from PHP files into one central location
   ========================================================================== */

/* ==========================================================================
   ROOT VARIABLES
   ========================================================================== */
:root {
    --login-primary-background: #ffffff;
    --login-text-color: #5b6574;
    --login-border-bottom: #dee0e4;
    --login-links: #adb2ba;
    --login-links-hoover: #9da3ac;
    --login-link-active: #4a5568;
    --login-form-label: #ffffff;
    --login-submit-hoover: #2d3748;
    --login-remeber-me: #000;
    --login-form-a: #5b6574;
    --login-form-a-hover: #394049;
    --bacground-color: #f2f2f2;
    --table-header-bg: #2f3947;
    --table-stripe-bg: #f9f9f9;
    --success-color: #48bb78;
    --success-hover: #38a169;
    --danger-color: #f56565;
    --danger-hover: #e53e3e;
    --primary-color: #4a5568;
    --primary-hover: #2d3748;
    --secondary-color: #718096;
    --secondary-hover: #4a5568;
    --warning-color: #ed8936;
    --warning-hover: #dd6b20;
}

/* ==========================================================================
   GLOBAL STYLES
   ========================================================================== */
body {
    font-family: Arial, sans-serif;
    background-color: var(--bacground-color);
    margin: 0;
    padding: 0;
}

h1 {
    font-size: 24px;
    color: #333;
}

h2 {
    font-size: 20px;
    color: #333;
}

label {
    font-weight: bold;
    color: #333;
}

/* ==========================================================================
   LOGIN/REGISTER PAGES
   ========================================================================== */
.login, .register {
    width: 400px;
    background-color: var(--login-primary-background);
    box-shadow: 0 0 9px 0 rgba(0, 0, 0, 0.3);
    margin: 100px auto;
}

.login h1, .register h1 {
    text-align: center;
    color: var(--login-text-color);
    font-size: 24px;
    padding: 20px 0 20px 0;
    border-bottom: var(--login-border-bottom);
}

.login .links, .register .links {
    display: flex;
    padding: 0 15px;
}

.login .links a, .register .links a {
    color: var(--login-links);
    text-decoration: none;
    display: inline-flex;
    padding: 0 10px 10px 10px;
    font-weight: bold;
}

.login .links a:hover, .register .links a:hover {
    color: var(--login-links-hoover);
}

.login .links a.active, .register .links a.active {
    border-bottom: 3px solid var(--login-link-active);
    color: var(--login-link-active);
}

.login form, .register form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 20px;
}

.login form label, .register form label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 12%;
    height: 50px;
    background-color: var(--login-link-active);
    color: var(--login-form-label);
    vertical-align: middle;
}

.login form input[type="password"],
.login form input[type="text"],
.login form input[type="email"],
.register form input[type="password"],
.register form input[type="text"],
.register form input[type="email"] {
    width: 70%;
    height: 50px;
    border: 1px solid var(--login-border-bottom);
    margin-bottom: 20px;
    padding: 0 15px;
    vertical-align: middle;
}

.login form input[type="submit"],
.register form input[type="submit"] {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background-color: var(--login-link-active);
    border: 0;
    cursor: pointer;
    font-weight: bold;
    color: var(--login-form-label);
    transition: background-color 0.2s;
    border-radius: 0;
    -webkit-border-radius: 0;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
}

.login form input[type="submit"]:hover,
.register form input[type="submit"]:hover {
    background-color: var(--login-submit-hoover);
    transition: background-color 0.2s;
}

.login form #rememberme, .register form #rememberme {
    width: 100%;
    height: auto;
    padding: 5px 20px;
    background-color: transparent;
    color: var(--login-remeber-me);
    justify-content: flex-start;
}

.login form #rememberme input, .register form #rememberme input {
    transform: scale(1.3);
    margin-right: 7px;
}

.login form .msg, .register form .msg {
    padding: 0 20px;
    width: 100%;
}

.login form > a, .register form > a {
    text-decoration: none;
    color: var(--login-form-a);
    width: 100%;
    padding: 5px 20px;
}

.login form > a:hover, .register form > a:hover {
    color: var(--login-form-a-hover);
}

/* ==========================================================================
   TABLES
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    table-layout: auto; /* Let columns size naturally */
}

/* Profile page tables - auto width */
.profile .block table {
    width: auto;
    min-width: 50%;
}

/* Profile page styling */
.profile-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    padding: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-avatar {
    font-size: 80px;
    color: white;
    line-height: 1;
}

.profile-info h1,
.profile-info h2 {
    color: white;
    margin: 0 0 5px 0;
    font-size: 28px;
}

.profile-role {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 16px;
}

.profile-role i {
    margin-right: 5px;
}

.profile-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .header-actions .profile-btn {
        width: 100%;
        justify-content: center;
    }
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h3 i {
    color: var(--primary-color);
}

.profile-btn {
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.profile-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.profile-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.profile-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-label i {
    color: var(--primary-color);
    font-size: 14px;
}

.profile-value {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
}

.toggle-btn i {
    font-size: 24px;
}

.download-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.download-link:hover {
    color: var(--primary-hover);
    gap: 8px;
}

.download-link i {
    font-size: 14px;
}

table, th, td {
    border: 1px solid #ccc;
}

th, td {
    padding: 10px;
    text-align: left;
}

th {
    background-color: var(--table-header-bg);
    color: #fff;
}

tbody tr:nth-child(odd) {
    background-color: var(--bacground-color);
}

tbody tr:hover {
    background-color: #ffffcc;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    table-layout: auto; /* Let columns size naturally */
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: var(--table-header-bg);
    color: white;
}

.table-striped tbody tr:nth-child(odd) {
    background-color: var(--table-stripe-bg);
}

/* Table wrapper for responsive scrolling */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 10px 0;
}

/* Cell styles for various pages */
td[style*="text-align: center"],
td.center {
    text-align: center;
}

td[style*="white-space: pre-wrap"] {
    white-space: pre-wrap;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="submit"],
button[type="submit"] {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
}

input[type="submit"]:hover,
button[type="submit"]:hover {
    background-color: var(--success-hover);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.mb-3 {
    margin-bottom: 15px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    vertical-align: middle;
    box-sizing: border-box;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.btn-warning:hover {
    background-color: var(--warning-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline-secondary:hover {
    background-color: var(--secondary-color);
    color: white;
}

.btn-outline-danger {
    background-color: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.btn-outline-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Specific button styles */
.delete-button,
.poista-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
}

.delete-button:hover,
.poista-btn:hover {
    background-color: var(--danger-hover);
}

.edit-btn,
.lataa-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

.edit-btn:hover,
.lataa-btn:hover {
    background-color: var(--primary-hover);
}

.preview-btn {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

.preview-btn:hover {
    background-color: #218838;
}

.add-price-btn {
    background-color: var(--success-color);
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.add-price-btn:hover {
    background-color: var(--success-hover);
}

/* ==========================================================================
   MODALS / POPUPS
   ========================================================================== */
.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);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    position: relative;
    width: fit-content;
    max-width: 700px;
    min-width: 400px;
    margin: 1.75rem auto;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 20px;
    pointer-events: auto;
    margin: 0 auto;
    width: fit-content;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 15px 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    min-height: 50px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 15px;
    color: #000;
}

.btn-close:hover {
    color: #666;
}

.modal-body {
    padding: 15px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    margin-top: 15px;
}

.modal-footer .btn {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 10px 20px;
    margin: 0;
    line-height: 1.5;
    vertical-align: baseline;
}

/* Compact modal variant - used for confirmations */
.modal-compact .modal-dialog {
    width: 90% !important;
    max-width: 550px !important;
    min-width: 300px !important;
    margin: 0 auto !important;
}

.modal-compact .modal-content {
    width: 100% !important;
    padding: 0 !important;
}

.modal-compact .modal-header {
    padding: 18px 24px !important;
    margin-bottom: 0;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-compact .modal-title {
    font-weight: 600;
    color: #2c2f36;
    padding-left: 0 !important;
}

.modal-compact .modal-body {
    padding: 24px;
    background-color: #fff;
}

.modal-compact .modal-footer {
    padding: 18px 24px;
    margin-top: 0;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.modal-compact .btn-close {
    font-size: 1.5rem;
    opacity: 0.5;
}

.modal-compact .btn-close:hover {
    opacity: 0.75;
}

/* Desktop: Large modals */
@media screen and (min-width: 1001px) {
    .modal-xl .modal-dialog {
        max-width: 95vw !important;
        width: 1800px !important;
    }
    
    /* Ensure modal header works properly */
    .modal-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 0 15px 0 !important;
        border-bottom: 2px solid #dee2e6 !important;
        margin-bottom: 20px !important;
    }
    
    .modal-title {
        flex: 1 !important;
    }
    
    .btn-close {
        margin-left: 15px !important;
    }
    
    /* Reset mobile styles for desktop */
    .modal table {
        display: table !important;
        width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
    }
    
    .modal table tbody {
        display: table-row-group !important;
    }
    
    .modal table tr {
        display: table-row !important;
        border: none !important;
    }
    
    .modal table td {
        display: table-cell !important;
        padding: 10px 12px !important;
        vertical-align: middle !important;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
    }
    
    .modal table input[type="text"],
    .modal table input[type="date"],
    .modal table input[type="time"],
    .modal table input[type="number"],
    .modal table select,
    .modal table textarea {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
    
    .modal table textarea {
        min-height: 60px !important;
        resize: vertical !important;
    }
    
    .modal table label {
        display: inline-block !important;
        font-weight: 600 !important;
        margin-right: 8px !important;
    }
}

/* Legacy popup styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.popup[style*="display: block"] {
    display: flex !important;
}

.popup-content {
    position: relative; /* Changed from absolute */
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    max-width: 80%;
    max-height: 90vh;
    overflow-y: auto;
}

.close-popup {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    color: #666;
}

.close-popup:hover {
    color: #000;
}

/* Simple centered popup */
.popup2 {
    font-weight: bold;
    font-size: 18px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 5px;
    z-index: 1000;
}

.popup_error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ==========================================================================
   OVERLAYS
   ========================================================================== */
.overlay,
#overlay,
#edit-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000000;
}

#edit-overlay {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ==========================================================================
   NOTIFICATIONS
   ========================================================================== */
.centered-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #4e5c70;
    color: #FFFFFF;
    padding: 20px;
    border-radius: 5px;
    z-index: 9999;
    display: none;
    box-shadow: none;
    text-align: center;
    font-size: 16px;
}

.message-box {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.message-box.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Notification with animation */
.notification {
    position: fixed;
    top: 20px;
    right: -300px;
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    font-size: 16px;
    font-weight: bold;
    animation: slideFromRight 0.5s forwards, slideToRight 0.5s 2.5s forwards;
}

@keyframes slideFromRight {
    from { right: -300px; }
    to { right: 20px; }
}

@keyframes slideToRight {
    from { right: 20px; }
    to { right: -300px; }
}

/* ==========================================================================
   LOADING SPINNER
   ========================================================================== */
#loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1001;
}

/* ==========================================================================
   CONTENT BLOCKS / CONTAINERS
   ========================================================================== */
.content-block {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.edit-form-container {
    background-color: white;
    padding: 20px;
    width: 400px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.edit-form-container input,
.edit-form-container textarea {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.edit-form-container button {
    padding: 10px 15px;
    margin: 5px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    border-radius: 4px;
}

.edit-form-container button[type="button"] {
    background-color: var(--danger-color);
}

.edit-form-container button:hover {
    opacity: 0.9;
}

/* ==========================================================================
   NAVIGATION & HEADER
   ========================================================================== */
.header-with-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.5em;
    margin: 20px 0;
    padding: 0;
    position: relative;
}

.header-text {
    flex: 1;
    text-align: left;
    font-weight: bold;
    color: #333;
}

.month-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex: 1;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.month-nav a {
    text-decoration: none;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2em;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

.month-nav a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   IMAGE PREVIEW / GALLERY
   ========================================================================== */
.preview-container {
    position: relative;
    width: 90vw;
    height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.preview-container.dragging {
    cursor: grabbing;
}

#preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.2s ease;
    position: relative;
    will-change: transform;
    display: none;
}

#preview-pdf {
    position: fixed;
    z-index: 1000001;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    border: none;
    display: none;
    background: #fff;
}

#close-pdf {
    position: fixed;
    z-index: 1000002;
    top: 12px;
    right: 12px;
    display: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
}

.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    display: none;
    gap: 10px;
    z-index: 1000;
}

.preview-controls-image,
.preview-controls-pdf {
    display: none;
}

.control-btn {
    background: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.control-btn:hover {
    background-color: #f0f0f0;
}

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

.image-item {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    background-color: white;
}

.image-item img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 5px;
    justify-content: center;
}

/* ==========================================================================
   HINNAT (PRICES) PAGE SPECIFIC
   ========================================================================== */
.prices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.prices-table th,
.prices-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.prices-table thead th {
    background-color: var(--table-header-bg);
    color: white;
    font-weight: bold;
}

.prices-table tbody tr:hover {
    background-color: #f5f5f5;
}

.current-price-row {
    background-color: #e7f3ff;
}

.current-price-badge {
    background-color: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

/* ==========================================================================
   AJAT (TIMES) PAGE SPECIFIC
   ========================================================================== */
.weekend-row {
    background-color: #e6f2ff !important;
}

.footer-row {
    font-weight: bold;
    background-color: #f0f0f0 !important;
}

.holiday-cell {
    background-color: #ffcccc !important;
}

/* ==========================================================================
   ERITTELY (BREAKDOWN) PAGE SPECIFIC
   ========================================================================== */
.holiday-42 {
    background-color: #ffe0b3; /* vaalea oranssi */
    cursor: pointer; /* Indicates clickable cell */
}

/* Erittely table specific styles - tighter spacing */
body.loggedin main table td,
body.loggedin main table th {
    padding: 2px 6px;
    line-height: 1.2;
    margin: 0;
    text-align: center; /* Keskitä kaikki solut */
}

/* Left align specific columns that need it (like description/kuvaus) */
body.loggedin main table:not(.ts):not(.year-total) td:nth-child(4),
body.loggedin main table:not(.ts):not(.year-total) th:nth-child(4) {
    text-align: left;
}

/* Enhanced hover effect for erittely table rows */
body.loggedin main table tbody tr:hover {
    background-color: #ffeb3b !important; /* Bright yellow for better visibility */
    color: #000 !important; /* Ensure text color is black for contrast */
    cursor: pointer; /* Indicates row is interactive */
    transition: background-color 1.0s ease, color 1.0s ease; /* Smooth transition */
}

/* Footer row styles for erittely */
body.loggedin main tr.footer:first-of-type {
    background-color: #e9e9e9;
    font-weight: bold;
}

body.loggedin main tr.footer:last-of-type {
    font-weight: bold;
    background-color: #e0e0e0;
}

/* Weekend rows - light pastel blue */
body.loggedin main table tbody tr.weekend-row {
    background-color: #DEEFF5 !important;
}

/* Notification styles with animations */
.notification {
    position: fixed;
    width: fit-content;
    min-width: 300px;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    top: 20px;
    right: 20px;
    padding: 5px 10px;
    background: linear-gradient(135deg, #3a7bd5, #00d2ff);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: 500;
    font-family: 'Arial', sans-serif;
    z-index: 1000;
    text-align: center;
    border-left: 4px solid #3a7bd5;
    opacity: 0;
    transform: translateX(50px);
    animation: slideFromRight 0.4s ease-out forwards;
}

@keyframes slideFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideToRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.notification.fade-out {
    animation: slideToRight 0.5s ease forwards;
}

.tax-table {
    margin-top: 30px;
}

.current-bracket {
    background-color: #ffffcc;
    font-weight: bold;
}

.source-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

.source-api {
    background-color: #28a745;
    color: white;
}

.source-default {
    background-color: #6c757d;
    color: white;
}

.tupla-badge {
    background-color: #ffc107;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

/* ==========================================================================
   LASKUT (INVOICES) PAGE SPECIFIC
   ========================================================================== */
#pdf-container {
    width: 100%;
    height: 600px;
}

#pdf-render {
    width: 100%;
    height: auto;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: var(--danger-color);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.show-comment,
.edit-comment,
.edit-trip {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: underline;
}

.show-comment:hover,
.edit-comment:hover,
.edit-trip:hover {
    color: var(--primary-hover);
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

/* ==========================================================================
   Z-INDEX MANAGEMENT
   ========================================================================== */
header, aside {
    z-index: 1;
}

/* ==========================================================================
   BASIC LAYOUT - DESKTOP ONLY
   ========================================================================== */

/* Aside sidebar - styled like profile-header */
aside {
    position: fixed;
    left: 30px;
    top: 30px;
    width: 250px;
    height: auto;
    max-height: calc(100vh - 60px);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Stronger, specific rule for the sidebar element to be authoritative
   Keeps desktop placement and scrolling behavior stable without JS inline styles */
#sidebar {
    top: 30px !important;
    left: 30px !important;
    position: fixed !important;
    width: 250px !important;
    height: auto !important;
    max-height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    border-radius: 8px !important;
}

/* Aside links styling */
aside a {
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    padding: 15px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

aside a i {
    padding-right: 0;
    font-size: 18px;
}

aside a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 20px;
    border-left: 4px solid white;
}

aside a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0;
    border-left: 4px solid white;
    padding-left: 30px;
}

aside a.active:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Main content - leave space for sidebar */
main {
    margin-left: 310px;
    padding: 30px;
    min-height: 100vh;
    background-color: #f2f2f2;
}

/* Hide hamburger completely for now */
.responsive-toggle {
    display: none !important;
}

    th, td {
        padding: 6px 8px;
        white-space: normal; /* Allow text wrapping to avoid wide columns */
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Form tables in modals - stack cells vertically on mobile */
    .modal table,
    main form table,
    main .block table,
    form table {
        display: block !important;
        width: 100%;
        overflow: visible;
        table-layout: auto;
    }

    .modal table thead,
    main form table thead,
    main .block table thead,
    form table thead {
        display: none; /* Hide thead in form tables */
    }

    /* Modal tables remain as normal tables for better layout */
    .modal table {
        width: auto;
        border-collapse: collapse;
        display: table;
    }
    
    .modal table tbody {
        display: table-row-group;
    }
    
    .modal table tr {
        display: table-row;
    }
    
    .modal table td {
        display: table-cell;
        padding: 8px;
        vertical-align: middle;
    }
    
    .modal table td:first-child {
        font-weight: 600;
        white-space: nowrap;
    }
    
    .modal table td:last-child {
        width: 300px;
    }
    
    .modal table input,
    .modal table select,
    .modal table textarea {
        width: 100%;
    }

    /* Label cells - fixed width based on longest label */
    .modal table td:nth-child(odd),
    main form table td:nth-child(odd),
    main .block table td:nth-child(odd),
    form table td:nth-child(odd) {
        flex: 0 0 160px !important;
        width: 160px !important;
        min-width: 160px;
        max-width: 160px;
        padding-right: 8px !important;
    }

    /* Input cells - take remaining space and force next label to new line */
    .modal table td:nth-child(even),
    main form table td:nth-child(even),
    main .block table td:nth-child(even),
    form table td:nth-child(even) {
        flex: 1 1 calc(100% - 168px) !important;
        max-width: calc(100% - 168px);
    }

    /* Make all inputs same width */
    .modal table input,
    .modal table select,
    main form table input,
    main form table select,
    form table input,
    form table select {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Center checkboxes */
    .modal table input[type="checkbox"],
    main form table input[type="checkbox"],
    form table input[type="checkbox"] {
        width: auto !important;
        margin: 0 auto;
        display: block;
    }

    .modal table td label,
    main form table td label,
    form table td label {
        font-weight: bold;
        display: inline;
        margin: 0;
        color: #333;
    }

    /* Make inputs full width in forms on mobile */
    .modal table input,
    .modal table select,
    .modal table textarea,
    main form table input,
    main form table select,
    main form table textarea,
    form table input,
    form table select,
    form table textarea {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Data tables (non-form tables) - keep normal table structure */
    .content-block > table:not(form table),
    main > table:not(form table),
    table.table,
    table.table-striped,
    table.prices-table {
        display: table !important;
        width: auto !important;
        min-width: 100%;
        border-collapse: collapse;
        table-layout: auto; /* Columns size based on content */
    }

    /* Don't override default table display behavior - let browser handle it naturally */
    .content-block > table:not(form table) thead,
    main > table:not(form table) thead,
    table.table thead,
    table.table-striped thead {
        display: table-header-group;
    }

    .content-block > table:not(form table) tbody,
    main > table:not(form table) tbody,
    table.table tbody,
    table.table-striped tbody {
        display: table-row-group;
    }

    .content-block > table:not(form table) tfoot,
    main > table:not(form table) tfoot,
    table.table tfoot,
    table.table-striped tfoot {
        display: table-footer-group;
    }

    .content-block > table:not(form table) tr,
    main > table:not(form table) tr,
    table.table tr,
    table.table-striped tr {
        display: table-row;
    }

    .content-block > table:not(form table) th,
    .content-block > table:not(form table) td,
    main > table:not(form table) th,
    main > table:not(form table) td,
    table.table th,
    table.table td,
    table.table-striped th,
    table.table-striped td {
            display: table-cell;
            white-space: nowrap; /* Do not wrap headers/data for data tables */
            overflow: visible;
        }

    /* Wrapper helper: use .table-scroll around a table to enable horizontal scrolling */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .table-scroll > table {
        width: max-content; /* allow table be wider than container */
        min-width: 100%;
    }

    /* Ensure headers inside .table-scroll stay horizontal and don't rotate */
    .table-scroll th {
        writing-mode: horizontal-tb !important;
        transform: none !important;
        white-space: nowrap;
    }

    /* Modal adjustments for mobile */
    .modal {
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }

    .modal-dialog {
        margin: 0 auto;
        max-width: calc(100% - 1rem) !important;
        width: 100%;
    }
    
    /* Convert 4-column modal tables to 2-column on mobile */
    .modal-xl table tr {
        display: flex;
        flex-wrap: wrap;
    }
    
    .modal-xl table td {
        display: block;
        width: 50% !important;
        box-sizing: border-box;
        padding: 8px !important;
    }
    
    .modal-xl table td[colspan="3"] {
        width: 100% !important;
    }
    
    .modal-xl table td:nth-child(odd) {
        padding-right: 4px !important;
    }
    
    .modal-xl table td:nth-child(even) {
        padding-left: 4px !important;
    }
    
    /* Ensure modal header works properly on mobile */
    .modal-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 0 15px 0 !important;
        border-bottom: 2px solid #dee2e6 !important;
        margin-bottom: 20px !important;
    }
    
    .modal-title {
        flex: 1 !important;
    }
    
    .btn-close {
        margin-left: 15px !important;
        flex-shrink: 0 !important;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
        width: fit-content;
        max-width: 95%;
    }

    .modal-xl .modal-dialog {
        max-width: calc(100% - 1rem) !important;
    }

    /* Modal forms without tables - label:value on same line */
    .modal-body form > div {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 10px !important;
    }

    .modal-body form > div label {
        flex: 0 0 125px !important;
        width: 125px !important;
        min-width: 125px;
        max-width: 125px;
        padding-right: 8px !important;
        font-weight: bold !important;
        margin: 0 !important;
    }

    .modal-body form > div input,
    .modal-body form > div select,
    .modal-body form > div textarea {
        flex: 1 !important;
        width: auto !important;
        margin: 0 !important;
    }

    /* Form inputs on mobile */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Button adjustments */
    .btn {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Month navigation on mobile */
    .month-nav {
        font-size: 18px;
        padding: 10px 0;
    }

    .month-nav a {
        font-size: 1.5em;
        padding: 0 15px;
    }

    /* Image grid on mobile */
    .image-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    /* Edit form container on mobile */
    .edit-form-container {
        width: 90%;
        max-width: 350px;
    }

    /* Login/Register forms on mobile */
    .login, .register {
        width: 90%;
        max-width: 400px;
        margin: 50px auto;
    }

    /* Preview container on mobile */
    .preview-container {
        width: 95vw;
        height: 80vh;
    }

    /* Controls on mobile */
    .controls {
        bottom: 10px;
        padding: 8px;
        gap: 5px;
    }

    .control-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* Notification on mobile */
    .notification {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        min-width: auto;
    }

    /* Centered notification on mobile */
    .centered-notification {
        width: 90%;
        max-width: 300px;
        font-size: 14px;
        padding: 15px;
    }

    /* PDF container on mobile */
    #pdf-container {
        height: 400px;
    }

    /* Header adjustments */
    header h1 {
        font-size: 14px;
    }

    /* Popup adjustments */
    .popup {
        padding: 0.5rem;
    }

    .popup-content {
        max-width: 95%;
        padding: 15px;
        max-height: 90vh;
    }

    /* Form group spacing on mobile */
    .form-group {
        margin-bottom: 10px;
    }
}

/* ==========================================================================
   MOBILE NAVIGATION
   ========================================================================== */
/* Hide hamburger by default (desktop) */
.responsive-toggle {
    display: none;
    border: 0;
}

@media screen and (max-width: 1000px) {
    /* Show hamburger on mobile */
    .responsive-toggle {
        display: flex !important;
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 900;
        background: white;
        color: #2f3947;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        cursor: pointer;
        text-decoration: none;
        font-size: 20px;
        padding: 0;
    }

    /* A modal owns the viewport: keep navigation away from its close control. */
    body:has(.modal.show) .responsive-toggle {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    
    /* Aside hidden by default on mobile */
    aside {
        left: 0;
        top: 30;
        border-radius: 0;
        max-height: 100vh;
        width: 250px;
        transform: translateX(-115%);
        transition: transform 0.3s ease;
    }
    
    /* Aside visible when responsive-hidden is toggled off */
    aside.menu-open {
        transform: translateX(0);
    }
    
    /* Main full width on mobile */
    main {
        margin-left: 0;
        padding: 70px 15px 20px 15px;
    }
}

/* Shared accessibility and compact responsive helpers */
.field-hint {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.82rem;
}

.page-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.page-status-card {
    display: block;
    min-width: 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #dde3e8;
    border-top: 3px solid #00a0b5;
    border-radius: 6px;
    color: #27313d;
    text-decoration: none;
}

.page-status-card:hover {
    border-color: #00a0b5;
    box-shadow: 0 3px 10px rgba(30, 58, 75, 0.08);
}

.page-status-value {
    display: block;
    margin-top: 5px;
    font-size: 1.45rem;
    font-weight: 700;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media screen and (max-width: 1000px) {
    .profile-header {
        padding: 18px;
    }

    .profile-avatar {
        width: 48px;
        height: 48px;
        min-width: 48px;
    }

    .profile-info h1,
    .profile-info h2 {
        font-size: 1.35rem;
    }

    .page-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .btn,
    .profile-btn,
    .modal button,
    .section-header button,
    .section-header select {
        min-height: 44px;
    }
}

@media screen and (max-width: 480px) {
    .page-status-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .page-status-card {
        padding: 12px;
    }

    .page-status-value {
        font-size: 1.2rem;
    }
}

/* Consistent touch controls and header proportions across mobile pages. */
@media screen and (max-width: 1000px) {
    .profile-header {
        min-height: 72px;
        margin-bottom: 16px;
        padding: 14px 64px 14px 14px;
        gap: 12px;
        box-sizing: border-box;
    }

    .profile-avatar {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 24px;
        line-height: 1;
    }

    .profile-avatar i {
        font-size: 24px;
        line-height: 1;
    }

    .profile-info {
        min-width: 0;
    }

    .profile-info h1,
    .profile-info h2,
    .profile-info p {
        overflow-wrap: anywhere;
    }

    .responsive-toggle {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .responsive-toggle i {
        font-size: 18px;
        line-height: 1;
    }

    main button,
    main .btn,
    main .profile-btn,
    main .action-btn,
    main .preview-btn,
    main .poista-btn,
    main .edit-btn,
    main .download-link,
    main .attachment-download,
    main .lang-btn,
    main .icon-btn,
    main .control-btn {
        min-height: 44px !important;
        height: auto !important;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 9px 14px !important;
        font-size: 14px !important;
        line-height: 1.25;
        text-align: center;
    }

    main button i,
    main .btn i,
    main .profile-btn i,
    main .action-btn i,
    main .preview-btn i,
    main .poista-btn i,
    main .edit-btn i,
    main .download-link i,
    main .attachment-download i,
    main .lang-btn i,
    main .icon-btn i,
    main .control-btn i {
        font-size: 14px;
        line-height: 1;
    }

    .quick-actions .profile-btn {
        min-height: 44px !important;
    }
}

/* End of unified-styles.css */

/* Time Entries List Styles */
.time-entries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 769px) {
    .time-entries-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .time-entries-list {
        padding: 10px;
        overflow-x: hidden;
    }
}

/* Time Entries List Styles */
.time-entries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

.time-entry-row {
    display: grid;
    grid-template-columns: 140px 130px 110px 150px auto 90px;
    gap: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    align-items: center;
    transition: box-shadow 0.2s;
    box-sizing: border-box;
}

.time-entry-row > div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1200px) {
    .time-entries-list {
        padding: 10px;
    }
    
    .time-entry-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .time-entry-row.header {
        display: none !important;
    }
    
    .time-entry-row > div {
        display: flex;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        white-space: normal;
    }
    
    .time-entry-row > div::before {
        content: attr(data-label);
        font-weight: 600;
        color: #4a5568;
        font-size: 0.85em;
        margin-bottom: 4px;
    }
    
    .entry-date::before {
        content: 'Päivä';
    }
    
    .entry-time::before {
        content: 'Aika';
    }
    
    .entry-breakdown::before {
        content: 'Erittely';
    }
    
    .entry-earnings::before {
        content: 'Kulut';
    }
    
    .entry-details::before {
        content: 'Tiedot';
    }
    
    .entry-actions::before {
        content: 'Toiminnot';
    }
    
    .entry-earnings {
        justify-self: start !important;
        text-align: left !important;
        width: auto !important;
    }
}

.time-entry-row:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.entry-date {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: #2d3748;
}

.entry-date .day-name {
    font-size: 0.85em;
    color: #718096;
    font-weight: normal;
}

.entry-date.weekend {
    color: #e53e3e;
}

.entry-time {
    display: flex;
    flex-direction: column;
    font-size: 0.95em;
    color: #4a5568;
}

.entry-time .travel-time {
    font-size: 0.85em;
    color: #718096;
}

.entry-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85em;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breakdown-label {
    width: 45px;
    font-weight: 600;
}

.label-norm { color: #38a169; }
.label-50 { color: #3182ce; }
.label-100 { color: #805ad5; }
.label-travel { color: #dd6b20; }

.entry-earnings {
    font-weight: bold;
    color: #2d3748;
    text-align: left;
    padding-right: 10px;
}

.entry-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.95em;
    color: #4a5568;
}

.detail-tags {
    display: flex;
    gap: 8px;
}

.tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.tag-km { background: #edf2f7; color: #4a5568; }
.tag-alarm { background: #fed7d7; color: #c53030; }

.entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.action-icon {
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #4a5568;
}

.action-icon.delete:hover {
    color: #e53e3e;
}

/* Disabled - causes layout issues on mobile
@media (max-width: 1000px) {
    .time-entry-row {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .entry-details {
        grid-column: 1 / -1;
    }
    
    .entry-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}
*/

/* Time Entry Row Variants */
.time-entry-row.weekend-row {
    background-color: #ebf8ff;
    border-left: 5px solid #4299e1;
}

.time-entry-row.holiday-row {
    background-color: #fff3cd;
    border-left: 5px solid #ed8936;
}

/* ========================================================================== 
   RESPONSIVE MODAL NORMALIZATION
   Keep every form modal inside the viewport without changing its data flow.
   ========================================================================== */
@media screen and (max-width: 1000px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .modal {
        box-sizing: border-box;
        padding: 8px;
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }

    .modal.show {
        inset: 0;
        width: 100%;
        max-width: 100%;
    }

    .modal .modal-dialog,
    .modal .modal-dialog.modal-xl {
        width: 100% !important;
        max-width: 700px !important;
        min-width: 0 !important;
        margin: auto !important;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        padding: 16px;
        overflow-x: hidden;
    }

    .modal .modal-header,
    .modal .modal-body,
    .modal .modal-footer {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .modal .modal-body {
        overflow-x: hidden;
    }

    .modal .modal-title {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .modal .btn-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        font-size: 1.65rem;
    }

    .modal .modal-footer {
        flex-wrap: wrap;
    }

    .modal .modal-footer .btn {
        height: auto;
        min-height: 44px;
        max-height: none;
    }

    .modal .modal-body form,
    .modal .modal-body form table,
    .modal .modal-body form table tbody {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }

    .modal .modal-body form table tr {
        display: grid !important;
        grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        border-bottom: 1px solid #e7eaed;
    }

    .modal .modal-body form table td,
    .modal .modal-body form table td:nth-child(odd),
    .modal .modal-body form table td:nth-child(even),
    .modal .modal-body form table td:first-child,
    .modal .modal-body form table td:last-child {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box;
        padding: 8px !important;
        white-space: normal !important;
    }

    .modal .modal-body form table td[colspan="3"] {
        grid-column: 2;
    }

    .modal .modal-body form table td[colspan="2"]:empty {
        display: none !important;
    }

    /* Ajat.php has a desktop-only 1% label-cell width override. In the
       mobile grid it must fill the label track instead of leaving a thin,
       bordered empty-looking cell at the left edge. */
    #edit-popup .modal-body form table td:first-child,
    #lisaaAikaModal .modal-body form table td:first-child {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        white-space: normal !important;
    }

    .modal .modal-body form table label {
        display: block !important;
        overflow-wrap: anywhere;
    }

    .modal .modal-body form table input:not([type="checkbox"]),
    .modal .modal-body form table select,
    .modal .modal-body form table textarea {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .modal .modal-body form table input[type="checkbox"] {
        width: 24px !important;
        height: 24px;
        margin: 4px 0;
    }

    .holiday-toolbar {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .holiday-toolbar label {
        flex: 1 0 100%;
    }

    .holiday-columns {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    #holidayCheckModal .holiday-list {
        max-height: 280px !important;
        overflow-y: auto;
    }

    #holidayCheckModal .holiday-list table,
    #holidayCheckModal .holiday-list table tbody {
        display: table !important;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        border-collapse: collapse;
    }

    #holidayCheckModal .holiday-list table tbody {
        display: table-row-group !important;
    }

    #holidayCheckModal .holiday-list table tr {
        display: table-row !important;
    }

    #holidayCheckModal .holiday-list table td,
    #holidayCheckModal .holiday-list table td:nth-child(odd),
    #holidayCheckModal .holiday-list table td:nth-child(even),
    #holidayCheckModal .holiday-list table td:first-child,
    #holidayCheckModal .holiday-list table td:last-child {
        display: table-cell !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 8px !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        vertical-align: top;
    }

    #holidayCheckModal .holiday-list table td:first-child {
        width: 92px !important;
    }
}


/* Override Entry Earnings - Removed to use tag style */
/*
.entry-earnings {
    font-weight: 600;
    color: #2d3748;
    background-color: #f8f9fa;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    white-space: nowrap;
    font-size: 0.9em;
    width: fit-content;
    justify-self: center;
}
*/

