/* Global Styles */
body {
    font-family: 'Prompt', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f6f9;
    color: #333;
}

/* Force Scrollbar Visibility for Webkit (Chrome/Edge/Safari) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}


.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    transition: background-color 0.3s ease;
    text-align: center;
    opacity: 1 !important;
    /* Ensure always visible */
}

/* Solid Buttons - White Text */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-info,
.btn-warning,
.btn-login,
.btn-upload {
    color: white !important;
}

/* Outline Buttons - Colored Text */
.btn-outline-danger {
    color: #dc3545 !important;
    background-color: transparent;
    border: 1px solid #dc3545 !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:active,
.btn-outline-danger.active {
    color: white !important;
    background-color: #dc3545;
}

.btn-outline-info {
    color: #17a2b8 !important;
    /* Info Color */
    background-color: transparent;
    border: 1px solid #17a2b8 !important;
}

.btn-outline-info:hover,
.btn-outline-info:active,
.btn-outline-info.active {
    color: white !important;
    background-color: #17a2b8;
}

.btn-outline-primary {
    color: #007bff !important;
    background-color: transparent;
    border: 1px solid #007bff !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary.active {
    color: white !important;
    background-color: #007bff;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0069d9;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    /* Important for padding */
    font-family: 'Prompt', sans-serif;
    min-height: 50px;
    /* Ensure dropdown text isn't cut off */
}

.form-control:focus {
    border-color: #0055a5;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 85, 165, 0.2);
}

/* Registration Page Specifics */
.registration-container {
    max-width: 1200px;
    margin: 40px auto;
}

.registration-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background: white;
}

.registration-header {
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

.registration-header h2 {
    margin: 0;
    font-weight: 600;
}

.registration-header p {
    margin: 5px 0 0;
    opacity: 0.9;
}

.registration-body {
    padding: 40px;
}

.section-title {
    color: #003366;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 25px;
    margin-top: 30px;
}

.section-title:first-of-type {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
    /* Override default */
}

/* Profile Photo Upload */
.profile-upload-container {
    text-align: center;
    margin-bottom: 30px;
}

.profile-preview-wrapper {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: #f0f0f0;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #003366;
}

.profile-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-placeholder-icon {
    color: #ccc;
    font-size: 40px;
}

.btn-upload {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    display: inline-block;
}

.btn-upload:hover {
    background-color: #5a6268;
}

/* Contractor / Subordinates */
.contractor-group-field {
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.subordinate-item {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.remove-sub {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #dc3545;
    cursor: pointer;
    font-weight: bold;
    font-size: 20px;
    line-height: 1;
}

.remove-sub:hover {
    color: #a71d2a;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-muted {
    color: #6c757d;
    font-size: 0.875em;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 20px;
    }

    .registration-body {
        padding: 20px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Page Styles */
.login-page {
    background-image: url('../images/background.png');
    background-size: 100% 100%;
    /* Force fit to screen */
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(5px);
    margin: auto;
}

.login-page .logo {
    max-width: 150px;
    margin-bottom: 20px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    border: none;
    color: white;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: scale(1.02);
}

.login-links {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.login-links a {
    color: #003366;
    text-decoration: none;
}

/* Dashboard Styles */
.dashboard-header {
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.2);
    flex-wrap: wrap;
    /* Responsive wrap */
    gap: 15px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.user-info-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-welcome-text {
    font-weight: 500;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 80px 80px;
    /* Increased row-gap to 80px as requested */
    padding-bottom: 40px;
    /* Add bottom padding */
}

.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    /* Equal height cards */
    text-decoration: none;
    /* If whole card is link */
    color: inherit;
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #0055a5;
}

.dashboard-card-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #0055a5;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.dashboard-card:hover .dashboard-card-icon {
    transform: scale(1.1);
    opacity: 1;
}

.dashboard-card h3 {
    color: #003366;
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.dashboard-card p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.dashboard-card .btn-link-action {
    align-self: flex-start;
    padding: 8px 16px;
    background-color: transparent;
    border: 1px solid #0055a5;
    color: #0055a5;
    border-radius: 20px;
    transition: all 0.3s;
    font-size: 0.9rem;
    text-align: center;
    margin-top: auto;
}

/* Attendance / Table Styles */
.page-header-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* For rounded corners on table */
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.95rem;
}

.modern-table thead {
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    color: white;
}

.modern-table th,
.modern-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.modern-table th {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table tbody tr:hover {
    background-color: #f8f9fa;
}

.clock-widget {
    background: #f1f3f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.clock-time {
    font-size: 2.5rem;
    font-weight: bold;
    color: #003366;
    font-variant-numeric: tabular-nums;
}

/* --- Global UI Standardization --- */
/* Ensure list items always handle action buttons gracefully without hiding them */
.ui-list-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.ui-list-content {
    flex-grow: 1 !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    min-width: 0;
    /* Prevent flex overflow */
}

.ui-list-actions {
    flex-shrink: 0 !important;
    margin-left: 15px !important;
    display: flex !important;
    align-items: center !important;
    opacity: 1 !important;
    /* Force visibility */
    visibility: visible !important;
}

/* Ensure buttons inside actions are always visible and spacing is correct */
.ui-list-actions .btn {
    opacity: 1 !important;
    visibility: visible !important;
    margin-left: 5px;
}

/* --- Document / A4 Paper Styles --- */
.a4-paper {
    width: 210mm;
    min-height: 297mm;
    background: white;
    padding: 20mm;
    position: relative;
    font-family: 'Sarabun', 'Prompt', sans-serif;
    margin: 0 auto;
    /* Center it */
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.doc-logo {
    height: 60px;
}

.doc-address small {
    font-size: 0.7rem;
    line-height: 1.2;
}

.header-line {
    border-top: 2px solid #003366;
    margin-top: 10px;
}

.doc-title {
    margin-top: 3rem !important;
    /* Spacing */
    text-align: center;
}

.doc-content {
    margin-top: 3rem !important;
    padding-left: 3rem;
    padding-right: 3rem;
}

.holiday-item {
    break-inside: avoid;
}

.holiday-name {
    font-size: 1.1rem;
}

.holiday-date {
    margin-top: 0.25rem;
    padding-left: 1rem;
}

.doc-footer {
    margin-top: 50px;
    margin-left: auto;
    width: 300px;
    text-align: center;
    padding-right: 3rem;
}

/* ========== OT Modal Shared Styles ========== */

/* Modal header gradient styles */
.ot-modal .modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.ot-modal .modal-header {
    padding: 16px 24px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ot-modal .modal-header .modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    flex-grow: 1;
    text-align: left;
}

.ot-modal .modal-header .close,
.ot-modal .modal-header .close-btn-right {
    color: white;
    opacity: 0.9;
    text-shadow: none;
}

.ot-modal .modal-body {
    padding: 24px;
}

.ot-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    background: #fafbfc;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Header color variations */
.ot-header-request {
    background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
    color: white;
}

.ot-header-approved {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.ot-header-reject {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
    color: white;
}

.ot-header-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
    color: white;
}

.ot-header-primary {
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    color: white;
}

.ot-header-edit {
    background: linear-gradient(135deg, #fd7e14 0%, #e8590c 100%);
    color: white;
}

/* Applied on top of the normal header when the chosen OT date is in the future */
.ot-modal .modal-header.ot-header-danger {
    background: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%);
    color: white;
}

/* Approval table: flags an OT row whose work date has not happened yet */
.ot-date-future {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    background: #dc3545;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.ot-date-thai {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

/* Info cards inside modals */
.ot-info-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.ot-info-card.ot-info-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #b1dfbb;
}

.ot-info-card.ot-info-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffd93d;
}

.ot-info-card.ot-info-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #f1b0b7;
}

.ot-info-card.ot-info-primary {
    background: linear-gradient(135deg, #cce5ff 0%, #b8daff 100%);
    border-color: #9fcdff;
}

.ot-info-card .ot-info-label {
    font-size: 0.78rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.ot-info-card .ot-info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

/* Form field styling inside OT modals */
.ot-modal .ot-form-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
    display: block;
}

.ot-modal .ot-form-label .text-danger {
    margin-left: 2px;
}

.ot-modal .form-control {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 42px;
    font-size: 0.95rem;
}

.ot-modal .form-control:focus {
    border-color: #0055a5;
    box-shadow: 0 0 0 3px rgba(0, 85, 165, 0.12);
}

/* Status badges */
.ot-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
}

.ot-badge-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.ot-badge-approved {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.ot-badge-rejected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.ot-badge-completed {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #007bff;
}

.ot-badge-payment {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #6c757d;
}

/* Type badges */
.ot-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}

.ot-type-badge.ot-type-normal { background: #fff3cd; color: #856404; border-color: #ffc107; }
.ot-type-badge.ot-type-sunday { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.ot-type-badge.ot-type-holiday { background: #cce5ff; color: #004085; border-color: #007bff; }

/* Employee row in modals */
.ot-employee-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.ot-employee-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
    flex-shrink: 0;
}

.ot-employee-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.ot-employee-name {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.ot-employee-sub {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Hours display */
.ot-hours-display {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    border: 1.5px solid #dee2e6;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    margin-top: 12px;
}

.ot-hours-display label {
    font-size: 0.82rem;
    color: #6c757d;
    margin-bottom: 4px;
    display: block;
}

.ot-hours-display input,
.ot-hours-display .ot-hours-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #003366;
    background: transparent;
    border: none;
    text-align: center;
    width: 100%;
}

/* Photo upload area */
.ot-photo-upload {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    background: #fafbfc;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.ot-photo-upload:hover {
    border-color: #0055a5;
    background: #f0f4f8;
}

.ot-photo-upload .ot-upload-icon {
    font-size: 2rem;
    color: #adb5bd;
    margin-bottom: 8px;
}

.ot-photo-upload .ot-upload-text {
    font-size: 0.88rem;
    color: #6c757d;
}

.ot-photo-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-top: 10px;
    display: none;
    cursor: pointer;
    transition: transform 0.2s;
    margin-left: auto;
    margin-right: auto;
}

.ot-photo-preview:hover {
    transform: scale(1.02);
}

/* Fix select dropdown text overflow for long project names */
.ot-modal select.form-control,
.modal select.form-control {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    padding-right: 28px;
    font-size: 0.85rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* Action buttons row */
.ot-action-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Modern table for OT lists */
.ot-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.ot-table thead {
    background: linear-gradient(135deg, #003366 0%, #0055a5 100%);
    color: white;
}

.ot-table thead th {
    padding: 12px 16px;
    font-weight: 500;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: none;
    white-space: nowrap;
}

.ot-table thead th:first-child {
    border-radius: 8px 0 0 0;
    min-width: auto;
}

.ot-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.ot-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.ot-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ot-table tbody tr:last-child td {
    border-bottom: none;
}

/* Expandable group row */
.ot-group-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.ot-group-row:hover {
    background-color: #e8f4fd !important;
}

.ot-group-row .ot-expand-icon {
    transition: transform 0.3s;
    color: #6c757d;
}

.ot-group-row[aria-expanded="true"] .ot-expand-icon {
    transform: rotate(90deg);
}

/* Detail panel */
.ot-detail-panel {
    padding: 16px;
    background: #f8f9fa;
    border-left: 4px solid #0055a5;
    border-radius: 0 0 8px 8px;
}

/* Duration selector */
.ot-duration-selector {
    background: #f8f9fa;
    border: 1.5px solid #e9ecef;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.ot-duration-selector .btn-group .btn {
    border-radius: 8px !important;
    margin: 0 3px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 500;
}

/* Time display pair */
.ot-time-pair {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.ot-time-pair > div {
    flex: 1;
}

/* Action menu buttons */
.ot-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
    margin-bottom: 8px;
    border: 1.5px solid transparent;
}

.ot-menu-btn:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ot-menu-btn i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Section divider */
.ot-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #003366;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive scaling for smaller screens (Dashboard specific overrides can go in template or here) */
@media (max-width: 1200px) {
    .a4-paper {
        transform: scale(0.8);
        transform-origin: top center;
    }
}

@media (max-width: 768px) {
    .a4-paper {
        width: 100%;
        /* Fallback for mobile if we dont want fixed mm */
        min-height: auto;
        padding: 20px;
        transform: none;
        /* Disable scale on very small screens, let it flow? Or scale smaller */
    }

    .doc-content {
        padding-left: 0;
        padding-right: 0;
    }

    .doc-footer {
        width: 100%;
        padding-right: 0;
        text-align: left;
        /* Adjust for mobile? */
    }
}

/* ==== Flatpickr calendar theme (DAS) — ปฏิทินเลือกวันที่ให้เข้ากับธีมระบบ ==== */
.flatpickr-calendar {
    border-radius: 14px;
    border: 1px solid #e8edf3;
    box-shadow: 0 12px 32px rgba(15, 42, 77, 0.18), 0 2px 8px rgba(15, 42, 77, 0.10);
    font-family: 'Prompt', sans-serif;
    padding-bottom: 4px;
    overflow: hidden;
}

.flatpickr-months {
    background: linear-gradient(135deg, #0f2a4d, #1e4976);
    padding: 8px 0 6px;
}

.flatpickr-months .flatpickr-month {
    color: #fff;
    fill: #fff;
}

.flatpickr-current-month {
    font-weight: 600;
    font-size: 1.02rem;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #fff;
    font-weight: 600;
    background: transparent;
    border-radius: 6px;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: rgba(255, 255, 255, 0.12);
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
    color: #0f2a4d;
    font-weight: 500;
}

.flatpickr-current-month input.cur-year {
    color: #fff;
    font-weight: 600;
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after {
    border-bottom-color: #fff;
}

.flatpickr-current-month .numInputWrapper span.arrowDown:after {
    border-top-color: #fff;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: #bcd0e8;
    top: 4px;
    padding: 8px 10px;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: #fff;
}

.flatpickr-innerContainer {
    padding: 6px 6px 2px;
}

span.flatpickr-weekday {
    color: #64748b;
    font-weight: 700;
    font-size: 0.74rem;
}

.flatpickr-day {
    border-radius: 9px;
    color: #334155;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: #eff6ff;
    border-color: #eff6ff;
    color: #1d4ed8;
}

.flatpickr-day.today {
    border-color: #2563eb;
    color: #2563eb;
    font-weight: 700;
}

.flatpickr-day.today:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: linear-gradient(135deg, #2563eb, #1e4976);
    border-color: #2563eb;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #cbd5e1;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: #e2e8f0;
}

.flatpickr-calendar.arrowTop:before {
    border-bottom-color: #e8edf3;
}

.flatpickr-calendar.arrowTop:after {
    border-bottom-color: #0f2a4d;
}
/* ============================================================
   ปุ่มเปลี่ยนภาษา (das-lang-bar)
   เดิมเป็นกล่องลอยมุมขวาล่าง ทำให้บังปุ่มอื่นในหลายหน้า
   ย้ายมาอยู่ในโฟลว์ของหน้า ชิดขวาเหนือเนื้อหา จึงไม่ทับอะไรอีก
   ============================================================ */
.das-lang-bar {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0 4px;
}

.das-lang-btn {
    min-height: 40px;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.85rem;
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 3px rgba(15, 42, 77, 0.08);
}

.das-lang-btn:hover,
.das-lang-btn:focus {
    background: #f1f5f9;
    color: #0f2a4d;
}

.das-lang-menu {
    min-width: 170px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 42, 77, 0.18);
    border: 1px solid #e8edf3;
    padding: 6px;
}

.das-lang-menu .dropdown-item {
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.9rem;
}

@media (max-width: 767px) {
    .das-lang-bar {
        padding: 8px 0 2px;
    }

    .das-lang-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
