/* HR Operations CSS - Consistent with system_setup.css style */

/* ===================================================================
   OVERLAY AND CONTAINER
   =================================================================== */

.hr-ops-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.hr-ops-overlay * {
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
}

.hr-ops-popup {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: fit-content;
    max-width: 90%;
    /* Cap to viewport so the bottom button row stays reachable on short
       screens (1366x768 laptops, 125-150% display scaling); panels scroll
       instead of overflowing the fixed overlay */
    max-height: calc(100vh - 40px);
    height: fit-content;
    overflow: visible;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
    position: relative;
}

.hr-ops-popup.dragging {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    cursor: move;
    user-select: none;
}

/* ===================================================================
   HEADER
   =================================================================== */

.hr-ops-header {
    background-color: #3b82f6;
    color: white;
    padding: 15px 20px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.hr-ops-header:hover {
    background-color: #2563eb;
}

.hr-ops-popup.dragging * {
    user-select: none !important;
    pointer-events: none;
}

.hr-ops-popup.dragging .close-btn {
    pointer-events: auto;
}

.hr-ops-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hr-ops-header h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

.version_info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    padding: 4px 8px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ===================================================================
   CONTENT LAYOUT - Two column design
   =================================================================== */

.hr-ops-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: #f8f9fa;
}

.hr-ops-menu {
    width: fit-content;
    min-width: 200px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.hr-ops-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    color: #495057;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hr-ops-menu-item:hover {
    background: #e9ecef;
    color: #3b82f6;
}

.hr-ops-menu-item.active {
    background: #dbeafe;
    color: #3b82f6;
    font-weight: bold;
    border-left: 3px solid #3b82f6;
}

.menu-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* ===================================================================
   PANELS - Right side content area
   =================================================================== */

.hr-ops-panels {
    flex: 0 1 auto;
    width: fit-content;
    min-width: 600px;
    padding: 16px;
    /* Scrolls only when the popup hits its viewport cap; no scrollbar
       when content fits. NOTE: if the commented-out td:hover tooltip
       below is ever enabled, this scroll container will clip it. */
    overflow-y: auto;
    background-color: #f8f9fa;
}

.hr-ops-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 16px;
}

.hr-ops-panel.hidden {
    display: none;
}

.hr-ops-panel h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: bold;
    color: #495057;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

/* ===================================================================
   OFF-DAYS PANEL - Calendar and form
   =================================================================== */

.off-days-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: fit-content;
    min-width: 400px;
}

/* Two-column row: calendar (left) + the short controls (right), so the panel
   is wider but much shorter. The controls are far shorter than the calendar,
   so they sit centered against it. */
.off-days-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.calendar-container {
    background: white;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: fit-content;
    flex: 0 0 auto;
}

.date-selection-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Size to its own content beside the calendar rather than stretching. */
    flex: 0 1 auto;
    min-width: 260px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 6px;
}

.form-select,
.form-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    color: #495057;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

.info-message {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #1e40af;
}

/* Subject label for existing events */
.subject-label {
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    color: #059669;
    font-size: 13px;
    font-weight: 600;
}

.subject-display {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: #f0fdf4;
    color: #059669;
    font-weight: 600;
    box-sizing: border-box;
}

/* ===================================================================
   PAYROLL CALCULATOR PANEL
   =================================================================== */

.payroll-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 600px;
}

.payroll-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payroll-controls .button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.payroll-controls .btn {
    width: fit-content;
    min-width: fit-content;
    flex: 0 0 auto;
    padding: 6px 16px;
}

.payroll-message-box {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    color: #495057;
    resize: vertical;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
}

.payroll-message-box:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* ===================================================================
   EMPLOYEE PANEL - Compact 4-row layout
   =================================================================== */

.employee-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ROW 1: Employee lists side by side */
.employee-lists-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.employee-list-section {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.employee-list-header {
    background: #f8f9fa;
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
    font-weight: bold;
    font-size: 13px;
    color: #495057;
}

.employee-list {
    max-height: 180px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.tbd-employee-list {
    max-height: 180px;
}

/* ===================================================================
   EMPLOYEE TABLES - Single line rows with proper column sizing
   =================================================================== */

/* ===================================================================
   EMPLOYEE TABLES - Single line rows with proper column sizing
   =================================================================== */

.employee-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto;
}

.employee-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.employee-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: bold;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

.employee-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.employee-table tbody tr:hover {
    background-color: #f8f9fa;
}

.employee-table tbody tr.selected {
    background-color: #dbeafe;
}

/* Current/Separated Employees (5 columns): OUCare ID, Card No, Username, Name, Department */
#current-employees-tbody td:nth-child(1),
#separated-employees-tbody td:nth-child(1) {
    min-width: 70px;
    max-width: 90px;
}

#current-employees-tbody td:nth-child(2),
#separated-employees-tbody td:nth-child(2) {
    min-width: 70px;
    max-width: 90px;
}

#current-employees-tbody td:nth-child(3),
#separated-employees-tbody td:nth-child(3) {
    min-width: 150px;
    max-width: 250px;
}

#current-employees-tbody td:nth-child(4),
#separated-employees-tbody td:nth-child(4) {
    min-width: 60px;
    max-width: 120px;
}

#current-employees-tbody td:nth-child(5),
#separated-employees-tbody td:nth-child(5) {
    min-width: 100px;
    max-width: 300px;
}

/* TBD Employees (4 columns): Card ID, Name, Device Name, Date Range */
#tbd-employees-tbody td:nth-child(1) {
    min-width: 70px;
    max-width: 90px;
}

#tbd-employees-tbody td:nth-child(2) {
    min-width: 60px;
    max-width: 120px;
}

#tbd-employees-tbody td:nth-child(3) {
    min-width: 80px;
    max-width: 150px;
}

#tbd-employees-tbody td:nth-child(4) {
    min-width: 150px;
    max-width: 250px;
}

/* Missing Profile Employees (5 columns): OUCare ID, Card ID, Name, Device Name, Date Range */
#missing-profile-employees-tbody td:nth-child(1) {
    min-width: 70px;
    max-width: 90px;
}

#missing-profile-employees-tbody td:nth-child(2) {
    min-width: 70px;
    max-width: 90px;
}

#missing-profile-employees-tbody td:nth-child(3) {
    min-width: 60px;
    max-width: 120px;
}

#missing-profile-employees-tbody td:nth-child(4) {
    min-width: 80px;
    max-width: 150px;
}

#missing-profile-employees-tbody td:nth-child(5) {
    min-width: 150px;
    max-width: 250px;
}

/* OPTIONAL: Uncomment to enable tooltips on hover
.employee-table td {
    position: relative;
}

.employee-table td:hover {
    overflow: visible;
    z-index: 10;
}

.employee-table td:hover::after {
    content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    background: #343a40;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-top: 4px;
    pointer-events: none;
}

.employee-table td:not([title])::after {
    display: none;
}
*/

.no-data {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    white-space: normal;
}

/* ROW 2-4: Employee Profile Form - Condensed Layout */
.employee-profile-section {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 16px;
}

.employee-profile-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: bold;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
}

.profile-form-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Profile rows */
.profile-row {
    display: grid;
    gap: 12px;
}

/* ROW 1: Basic info (5 columns - condensed) */
.profile-row:first-child {
    grid-template-columns: 100px 100px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
}

/* ROW 2: Supervisors (4 columns) */
.profile-row:nth-child(2) {
    grid-template-columns: repeat(4, 1fr);
}

/* ROW 3: Schedule and options (2 sections) */
.profile-row.schedule-row {
    grid-template-columns: 200px 160px 1fr;
    align-items: end;
}

.profile-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-group-inline {
    display: flex;
    gap: 16px;
    align-items: center;
}

.profile-form-compact .form-group {
    margin-bottom: 0;
}

.form-input:disabled,
.form-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Tabbed interface for TBD employees */
.tabbed-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.tab-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Autocomplete styling */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 150px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.autocomplete-suggestion {
    padding: 6px 10px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: background-color 0.15s;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.selected {
    background-color: #dbeafe;
}

.employee-content .button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.employee-content .btn {
    width: fit-content;
    min-width: fit-content;
    flex: 0 0 auto;
    padding: 6px 16px;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.button-group {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: auto;
    width: fit-content;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

/* Compact button for inline table actions (e.g. Active Corrections "Remove"). */
.btn-sm {
    padding: 2px 10px;
    font-size: 12px;
}

/* Name-repair affordance — amber to read as "caution / maintenance". */
.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Button and error message row */
.button-error-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.button-error-row .button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 1 auto;
    margin-top: 0;
}

.button-error-row .error-message {
    flex: 0 1 auto;
    margin: 0 0 0 16px;
    text-align: left;
    min-height: 20px;
    white-space: nowrap;
}

.button-error-row .error-message:not(.show) {
    opacity: 0;
    height: 20px;
    visibility: hidden;
}

.button-error-row .error-message.show {
    opacity: 1;
    height: auto;
    visibility: visible;
}

/* Hint that a value is a default (not from API) */
.form-input.is-default,
.form-input.is-default::placeholder {
    font-style: italic;
    color: #6c757d;
}

.form-input.is-default:focus {
    font-style: normal;
    color: #495057;
}

/* ===================================================================
   ERROR AND SUCCESS MESSAGES
   =================================================================== */

.error-message {
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 4px 0 0 0;
    padding: 0;
    display: block;
    text-align: left;
    transition: opacity 0.2s ease;
}

.error-message:not(.show) {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.error-message.show {
    opacity: 1;
    height: auto;
}

.success-message {
    color: #059669;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 10px 0;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* ===================================================================
   CONFIRMATION DIALOG SPECIFIC STYLES
   =================================================================== */

.hr-confirm-popup {
    max-width: 800px;
    width: fit-content;
}

/* Compact width for simple form overlays (name change / '?'-repair) so a long
   intro sentence or full-width inputs don't stretch the popup toward the 800px
   cap. Two-class selector outranks .hr-confirm-popup's fit-content width. */
.hr-ops-popup.hr-ops-form-popup {
    width: 380px;
}

.hr-confirm-header {
    cursor: move;
    user-select: none;
}

.hr-confirm-header:hover {
    background-color: #2563eb;
}

.confirm-overview {
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    background: white;
}

.confirm-warnings {
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    background: white;
}

.confirm-tab-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.confirm-tab-header .tab-button {
    flex: 0 0 auto;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.confirm-tab-header .tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.confirm-tab-header .tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

.confirm-content {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
    padding: 20px;
    background: white;
}

.confirm-content .tab-content {
    display: none;
}

.confirm-content .tab-content.active {
    display: block;
}

.confirm-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.confirm-section-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: bold;
    color: #495057;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.confirm-section .profile-row {
    display: grid;
    gap: 12px;
}

.confirm-section .form-group {
    margin-bottom: 0;
}

.confirm-section .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 6px;
}

.confirm-section .form-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: #e9ecef;
    color: #495057;
    box-sizing: border-box;
}

.confirm-developer-view {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.developer-table-section {
    margin-bottom: 12px;
}

.developer-changes-list {
    margin: 4px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.developer-changes-list li {
    margin: 2px 0;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-top: 1px solid #dee2e6;
    background: white;
}

.confirm-buttons .btn {
    padding: 6px 16px;
    width: fit-content;
    min-width: fit-content;
    flex: 0 0 auto;
    white-space: nowrap;
}

.hr-confirm-popup.dragging {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    cursor: move;
    user-select: none;
}

.hr-confirm-popup.dragging * {
    user-select: none !important;
    pointer-events: none;
}

.hr-confirm-popup.dragging .close-btn,
.hr-confirm-popup.dragging .tab-button,
.hr-confirm-popup.dragging .btn {
    pointer-events: auto;
}

.confirm-section .form-input:disabled,
.confirm-section .form-select:disabled {
    cursor: default;
}

.confirm-section input[type="checkbox"]:disabled {
    cursor: default;
}

.confirm-section .checkbox-label input[type="checkbox"]:disabled {
    cursor: default;
}

.confirm-section .checkbox-label:has(input[type="checkbox"]:disabled) {
    cursor: default;
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */

@media (max-width: 768px) {
    .hr-ops-popup {
        width: 95%;
        max-height: 90vh;
    }

    .hr-ops-content {
        flex-direction: column;
    }

    .hr-ops-menu {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        max-height: 150px;
    }

    .hr-ops-panels {
        padding: 15px;
        min-width: auto;
    }

    .payroll-content {
        width: 100%;
    }

    .employee-lists-row {
        grid-template-columns: 1fr;
    }

    .profile-row:first-child,
    .profile-row:nth-child(2),
    .profile-row.schedule-row {
        grid-template-columns: 1fr;
    }

    .checkbox-group-inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .button-error-row {
        flex-direction: column;
        align-items: stretch;
    }

    .button-error-row .button-group {
        width: 100%;
    }

    .button-error-row .error-message {
        margin: 8px 0 0 0;
        white-space: normal;
    }

    .hr-confirm-popup {
        max-width: 95%;
    }

    .confirm-section .profile-row {
        grid-template-columns: 1fr !important;
    }

    .confirm-section .checkbox-group-inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .confirm-buttons {
        flex-direction: row;
    }

    .confirm-buttons .btn {
        width: fit-content;
    }
}

@media (max-width: 480px) {
    .hr-ops-popup {
        max-height: 95vh;
    }

    .hr-ops-header,
    .hr-ops-panels {
        padding: 12px;
    }

    .hr-ops-panel {
        padding: 15px;
    }
}

/* ===================================================================
   DARK MODE
   =================================================================== */

@media (prefers-color-scheme: dark) {
    .hr-ops-popup {
        background: #343a40;
        color: #f8f9fa;
    }

    .hr-ops-header {
        background-color: #3b82f6;
    }

    .hr-ops-content {
        background-color: #495057;
    }

    .hr-ops-menu {
        background: #343a40;
        border-right-color: #6c757d;
    }

    .hr-ops-menu-item {
        color: #f8f9fa;
        border-bottom-color: #495057;
    }

    .hr-ops-menu-item:hover {
        background: #495057;
    }

    .hr-ops-menu-item.active {
        background: #1e40af;
        color: white;
    }

    .hr-ops-panels {
        background-color: #495057;
    }

    .hr-ops-panel,
    .calendar-container,
    .employee-list-section,
    .employee-profile-section {
        background: #343a40;
        border-color: #6c757d;
    }

    .hr-ops-panel h3,
    .employee-list-header,
    .employee-profile-section h4 {
        color: #f8f9fa;
        border-bottom-color: #6c757d;
    }

    .form-group label {
        color: #f8f9fa;
    }

    .form-input,
    .form-select {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .form-input:disabled,
    .form-select:disabled {
        background-color: #343a40;
    }

    .form-input.is-default {
        color: #adb5bd;
    }

    .form-input.is-default:focus {
        color: #f8f9fa;
    }

    .payroll-message-box {
        background: #343a40;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .employee-table th {
        background: #495057;
        color: #f8f9fa;
        border-bottom-color: #6c757d;
    }

    .employee-table td {
        color: #f8f9fa;
        border-bottom-color: #495057;
    }

    .employee-table tbody tr:hover {
        background-color: #495057;
    }

    .employee-table tbody tr.selected {
        background-color: #1e40af;
    }

    .info-message {
        background: #1e3a8a;
        border-color: #3b82f6;
        color: #93c5fd;
    }

    .no-data {
        color: #adb5bd;
    }

    .error-message {
        color: #fca5a5;
    }

    .success-message {
        color: #6ee7b7;
        background-color: #064e3b;
        border-color: #047857;
    }

    .autocomplete-suggestions {
        background: #495057;
        border-color: #6c757d;
    }

    .autocomplete-suggestion {
        color: #f8f9fa;
    }

    .autocomplete-suggestion:hover,
    .autocomplete-suggestion.selected {
        background-color: #1e40af;
    }

    .confirm-overview,
    .confirm-warnings,
    .confirm-content,
    .confirm-buttons {
        background: #343a40;
        color: #f8f9fa;
    }

    .confirm-tab-header {
        background: #495057;
        border-bottom-color: #6c757d;
    }

    .confirm-tab-header .tab-button {
        color: #f8f9fa;
    }

    .confirm-tab-header .tab-button.active {
        background: #343a40;
        color: #3b82f6;
    }

    .confirm-section-title {
        color: #f8f9fa;
        border-bottom-color: #6c757d;
    }

    .confirm-section .form-group label {
        color: #f8f9fa;
    }

    .confirm-section .form-input {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .confirm-developer-view {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

}

@media (max-width: 768px) {
    .hr-renewal-buttons {
        justify-content: flex-start;
        flex-direction: row;
    }

    .hr-renewal-buttons .btn {
        width: fit-content;        /* override any global .btn { width: 100% } */
    }
}

/* ===================================================================
   DATA HEALTH PANEL
   =================================================================== */

.data-health-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: fit-content;
    min-width: 800px;
}

.data-health-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-health-controls .form-group {
    margin-bottom: 0;
}

.data-health-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(10 * 30px + 38px); /* 10 rows * 30px per row + header height */
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.data-health-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: auto;
}

.data-health-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-health-table th {
    padding: 6px 8px;
    text-align: left;
    font-weight: bold;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 11px;
}

.data-health-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f3f4f6;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

/* Compact column widths - adjusted for typical content */
.data-health-table th:nth-child(1),
.data-health-table td:nth-child(1) {
    /* Date: "2025-12-25" */
    min-width: 85px;
    max-width: 85px;
}

.data-health-table th:nth-child(2),
.data-health-table td:nth-child(2) {
    /* Attendance States: "07:07~22:50, 08:17~16:29" */
    min-width: 150px;
    max-width: 180px;
}

.data-health-table th:nth-child(3),
.data-health-table td:nth-child(3),
.data-health-table th:nth-child(4),
.data-health-table td:nth-child(4) {
    /* TW9900/Bio: "01:01~23:05" or "08:17~16:29" */
    min-width: 90px;
    max-width: 100px;
}

.data-health-table th:nth-child(5),
.data-health-table td:nth-child(5),
.data-health-table th:nth-child(6),
.data-health-table td:nth-child(6) {
    /* Records/Register: "Yes" or "-" */
    min-width: 50px;
    max-width: 50px;
    text-align: center;
}

.data-health-table th:nth-child(7),
.data-health-table td:nth-child(7) {
    /* Holiday: "Christmas" or longer names */
    min-width: 100px;
    max-width: 130px;
}

/* Cell styling */
.data-cell {
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.availability-cell {
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}

/* Holiday row styling */
.data-health-table tbody tr.holiday-row {
    background-color: #fef3c7;
}

.data-health-table tbody tr.work-exception-row {
    background-color: #dbeafe;
}

.data-health-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-health-table tbody tr.holiday-row:hover {
    background-color: #fde68a;
}

.data-health-table tbody tr.work-exception-row:hover {
    background-color: #bfdbfe;
}

.holiday-label {
    color: #92400e;
    font-weight: 600;
    font-size: 11px;
}

.work-exception-label {
    color: #1e40af;
    font-weight: 600;
    font-size: 11px;
}

/* Button group for data health - left aligned, width constrained */
.data-health-content .button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 0;
}

.data-health-content .btn {
    width: fit-content;
    min-width: fit-content;
    flex: 0 0 auto;
    padding: 6px 16px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .data-health-table-container {
        border-color: #6c757d;
    }

    .data-health-table th {
        background: #495057;
        color: #f8f9fa;
        border-bottom-color: #6c757d;
    }

    .data-health-table td {
        color: #f8f9fa;
        border-bottom-color: #495057;
    }

    .data-health-table tbody tr:hover {
        background-color: #495057;
    }

    .data-health-table tbody tr.holiday-row {
        background-color: #78350f;
    }

    .data-health-table tbody tr.work-exception-row {
        background-color: #1e3a8a;
    }

    .data-health-table tbody tr.holiday-row:hover {
        background-color: #92400e;
    }

    .data-health-table tbody tr.work-exception-row:hover {
        background-color: #1e40af;
    }

    .holiday-label {
        color: #fde68a;
    }

    .work-exception-label {
        color: #93c5fd;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .data-health-content {
        min-width: auto;
        width: 100%;
    }

    .data-health-table-container {
        max-height: calc(8 * 30px + 38px); /* Reduce to 8 rows on mobile */
    }
    
    .data-health-content .button-group {
        flex-direction: column;
    }
    
    .data-health-content .btn {
        width: 100%;
    }
}

/* Attendance States cell with two sub-columns */
.attendance-states-cell {
    padding: 0 !important;
}

.attendance-states-columns {
    display: flex;
    width: 100%;
    height: 100%;
}

.attendance-sub-col {
    flex: 1;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.attendance-sub-col:first-child {
    border-right: 1px solid #e5e7eb;
}

/* Dark mode for sub-columns */
@media (prefers-color-scheme: dark) {
    .attendance-sub-col:first-child {
        border-right-color: #495057;
    }
}

.weekday-label {
    color: #6c757d;
    font-weight: normal;
    font-size: 11px;
    font-style: italic;
}

/* Dark mode for weekday label */
@media (prefers-color-scheme: dark) {
    .weekday-label {
        color: #adb5bd;
    }
}

.employee-table th.sort-asc::after {
    content: ' ▲';
    font-size: 0.7em;
    color: #3b82f6;
}

.employee-table th.sort-desc::after {
    content: ' ▼';
    font-size: 0.7em;
    color: #3b82f6;
}

.employee-table th[data-column]:hover {
    background-color: #f3f4f6;
}

.error-message {
    color: #dc2626;
    text-align: center;
    padding: 20px;
    font-weight: 500;
}

.error-message small {
    display: block;
    margin-top: 8px;
    font-size: 0.875em;
    color: #991b1b;
    font-weight: normal;
}

/* Table-inline error (tbody placeholder row) */
.hr-table-error {
    color: #dc2626;
    text-align: center;
    padding: 20px;
    font-weight: 500;
}

/* If you use <small> inside the table message */
.hr-table-error small {
    display: block;
    margin-top: 8px;
    font-size: 0.875em;
    color: #991b1b;
    font-weight: normal;
}

/* ===================================================================
   MEAL CHARGE LOADER - Payroll Calculator (Inline with Month Picker)
   =================================================================== */

.payroll-month-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.payroll-month-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.meal-charge-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    height: 34px; /* Match the height of form-input */
    box-sizing: border-box;
}

.meal-charge-controls:hover {
    background: #e9ecef;
}

.meal-charge-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    user-select: none;
    white-space: nowrap;
}

.meal-charge-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: default;
    accent-color: #10b981;
    flex-shrink: 0;
    margin: 0;
}

.meal-charge-checkbox-label input[type="checkbox"]:disabled {
    opacity: 0.6;
}

.meal-charge-checkbox-label span {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    line-height: 1;
}

.meal-charge-checkbox-label input[type="checkbox"]:checked ~ span {
    color: #059669;
}

.btn-load-meal-charge {
    padding: 4px 12px;
    font-size: 13px;
    min-width: 70px;
    white-space: nowrap;
    flex-shrink: 0;
    height: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading state */
.meal-charge-controls.loading {
    opacity: 0.6;
    pointer-events: none;
}

.meal-charge-controls.loading .btn-load-meal-charge {
    background: #6c757d;
    cursor: wait;
}

/* Success state animation */
.meal-charge-controls.success {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0%, 100% {
        background: #f8f9fa;
        border-color: #dee2e6;
    }
    50% {
        background: #d1fae5;
        border-color: #10b981;
    }
}

/* Error state */
.meal-charge-controls.error {
    background: #fee;
    border-color: #fca5a5;
    animation: errorShake 0.4s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.meal-charge-controls.error .meal-charge-checkbox-label span {
    color: #dc2626;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .meal-charge-controls {
        background: #343a40;
        border-color: #6c757d;
    }

    .meal-charge-controls:hover {
        background: #495057;
    }

    .meal-charge-checkbox-label span {
        color: #f8f9fa;
    }

    .meal-charge-checkbox-label input[type="checkbox"]:checked ~ span {
        color: #6ee7b7;
    }

    .meal-charge-controls.error {
        background: #450a0a;
        border-color: #991b1b;
    }

    .meal-charge-controls.error .meal-charge-checkbox-label span {
        color: #fca5a5;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .payroll-month-row {
        flex-direction: column;
        align-items: stretch;
    }

    .payroll-month-group {
        width: 100%;
    }

    .meal-charge-controls {
        width: 100%;
        justify-content: space-between;
    }

    .btn-load-meal-charge {
        flex: 1;
        min-width: auto;
    }
}

/* ===================================================================
   EMPLOYEE RENEWAL OVERLAY
   =================================================================== */

.hr-renewal-popup {
    width: 750px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.hr-renewal-header {
    background-color: #3b82f6;
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.hr-renewal-summary {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    color: #495057;
}

/* Wrapper for table with padding */
.hr-renewal-table-wrapper {
    padding: 0 16px;
    background: white;
}

.hr-renewal-table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin: 12px 0;
}

.hr-renewal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.hr-renewal-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.hr-renewal-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: bold;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.hr-renewal-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
    color: #212529;
    vertical-align: middle;
}

.hr-renewal-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Warning row (separation candidates) */
.hr-renewal-table tbody tr.renewal-row-warning {
    background-color: #fff8e6;
}

.hr-renewal-table tbody tr.renewal-row-warning:hover {
    background-color: #fff3cd;
}

/* Disabled row (provisional IDs) */
.hr-renewal-table tbody tr.renewal-row-disabled {
    background-color: #f8f8f8;
    opacity: 0.7;
}

.hr-renewal-table tbody tr.renewal-row-disabled:hover {
    background-color: #f0f0f0;
}

/* Provisional OUCare ID - red text */
.renewal-provisional-id {
    color: #dc2626 !important;
    font-weight: 600;
}

/* Action badges */
.renewal-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    cursor: help;
}

.renewal-badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.renewal-badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.renewal-badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.renewal-badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.renewal-badge-template-warning {
    background-color: #f3e8ff;
    color: #7c3aed;
    border: 1px dashed #a78bfa;
}

.renewal-badge-profile {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #f59e0b;
}

.renewal-badge-verify {
    background-color: #e0e7ff;
    color: #4338ca;
    border: 1px dashed #6366f1;
}

/* Note wrapper with padding */
.hr-renewal-note-wrapper {
    padding: 0 16px;
    background: white;
}

.hr-renewal-note {
    padding: 10px 12px;
    background: #f0f9ff;
    color: #0369a1;
    font-size: 12px;
    border: 1px solid #bae6fd;
    border-radius: 4px;
    margin-bottom: 12px;
}

/* Phase 1: verify_template warning note */
.hr-renewal-note.hr-renewal-note-warning {
    background: #fff3cd;
    color: #92400e;
    border-color: #fcd34d;
}

/* Phase 2: result summary — all actions succeeded */
.hr-renewal-note.hr-renewal-note-result-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
    font-weight: 600;
}

/* Phase 2: result summary — one or more actions failed */
.hr-renewal-note.hr-renewal-note-result-partial {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
    font-weight: 600;
}

/* Phase 2: result icon in checkbox column */
.renew-result-icon {
    font-size: 15px;
    cursor: default;
    display: inline-block;
    line-height: 1;
}

.renew-result-icon.success {
    cursor: default;
}

.renew-result-icon.failed {
    cursor: help;
}

@media (prefers-color-scheme: dark) {
    .hr-renewal-note-wrapper {
        background: #343a40;
    }

    .hr-renewal-note {
        background: #1e3a5f;
        color: #7dd3fc;
        border-color: #1d4ed8;
    }

    .hr-renewal-note.hr-renewal-note-warning {
        background: #78350f;
        color: #fef3c7;
        border-color: #d97706;
    }

    .hr-renewal-note.hr-renewal-note-result-success {
        background: #065f46;
        color: #d1fae5;
        border-color: #059669;
    }

    .hr-renewal-note.hr-renewal-note-result-partial {
        background: #78350f;
        color: #fef3c7;
        border-color: #d97706;
    }
}

.hr-renewal-buttons {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-start;   /* left aligned (was flex-end) */
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: white;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
}

.hr-renewal-buttons .btn {
    width: fit-content;            /* content-sized */
    min-width: fit-content;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Checkbox styling */
.hr-renewal-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.hr-renewal-table input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* =================================================================
   MOBILE SHEET TREATMENT — must live at the very end of this file.
   The earlier @media (max-width: 768px) blocks (around lines 1126,
   1410, 1634, 1902) shrink dimensions and stack inner controls but
   don't go full-screen, and several file-scope rules redeclare the
   same selectors. Putting the full-screen overrides here, after every
   other rule in this file, ensures they win on source order.

   Three overlays share the .hr-ops-overlay backdrop:
     - .hr-ops-popup           — main HR Operations modal
     - .hr-confirm-popup       — confirmation sub-dialog
     - .hr-renewal-popup       — Employee Renewal sub-overlay

   All three get the same conversion: full-viewport sheet, sticky
   header, neutralized .dragging visual. Inner content-width rules
   (.hr-ops-panels min-width: 600px, .data-health-content min-width:
   800px, etc.) are dropped so panels don't overflow the right edge
   like they did in system-setup before that fix.
   ================================================================= */
@media (max-width: 768px) {
    .hr-ops-overlay {
        padding: 0;
    }

    /* Main HR Operations popup. The desktop rule sets
       `max-height: none; overflow: visible` so the modal grows with
       its content; mobile needs the opposite — bound to viewport,
       overflow: hidden, with the inner .hr-ops-content as the
       scrollable middle (already flex-direction: column on mobile). */
    .hr-ops-popup {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        overflow: hidden;
    }

    .hr-ops-header {
        position: sticky;
        top: 0;
        z-index: 1;
        border-radius: 0;
        cursor: default;
        flex-shrink: 0;
    }

    .hr-ops-popup.dragging {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        cursor: default;
    }

    .hr-ops-content {
        flex: 1;
        min-height: 0;
    }

    /* Drop the desktop .hr-ops-panels { min-width: 600px } so the
       right pane doesn't push past the phone viewport's right edge.
       Also make this the vertical scroll region: the desktop rule
       sets `overflow-y: visible` (modal grows with content), but on
       a full-screen mobile sheet we need an actual scroll because
       panels like Employee Management contain four tabbed tables
       PLUS a tall employee-profile-section with its action buttons
       at the bottom — without this, anything below the fold is
       clipped and the buttons are unreachable. */
    .hr-ops-panels {
        min-width: 0;
        max-width: none;
        width: 100%;
        box-sizing: border-box;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: auto;
        /* Inertial scrolling on iOS (older WebKit), no-op elsewhere. */
        -webkit-overflow-scrolling: touch;
    }

    /* Trim the inner per-table scroll caps so the tables don't
       compete with the outer scroll. With four tables stacked
       (Employee Management's two tabbed-containers each holding two
       tabs, only one tab visible at a time per container) the active
       tables get a more breathable height before their inner scroll
       kicks in — and the outer .hr-ops-panels scroll handles
       everything past that. */
    .employee-list,
    .tbd-employee-list {
        max-height: 240px;
    }

    /* The earlier mobile rule (around line 1167) sets
         .button-group { flex-direction: column }  and  .btn { width: 100% }
       which stacks every action button vertically and full-width. For
       Payroll Calculator, Employee Management, and Off-Days Management
       the button captions are short enough to fit on one row across the
       full sheet width — wasting vertical space and burying the action
       buttons under the panel scroll for no good reason. Restore the
       desktop row-wrap behaviour for buttons inside these three
       content wrappers. Specificity (0,2,0) wins over the (0,1,0)
       mobile rule. */
    .payroll-content .button-group,
    .employee-content .button-group,
    .off-days-content .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .payroll-content .btn,
    .employee-content .btn,
    .off-days-content .btn {
        width: fit-content;
        min-width: fit-content;
        flex: 0 0 auto;
    }

    /* Same fix for the Data Health panel which sets its own
       min-width: 800px on desktop. */
    .data-health-content {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* Confirmation sub-dialog (.hr-confirm-popup) shares the .hr-ops
       header / dragging styles via class chain. Same full-screen
       treatment. */
    .hr-confirm-popup {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .hr-confirm-header {
        cursor: default;
    }

    /* Employee Renewal sub-overlay. Desktop sets explicit
       width: 750px; max-height: 80vh — both need to be released. */
    .hr-renewal-popup {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .hr-renewal-header {
        position: sticky;
        top: 0;
        z-index: 1;
        border-radius: 0;
        cursor: default;
        flex-shrink: 0;
    }

    /* The desktop .hr-renewal-table-container caps inner table scroll
       at max-height: 400px, which on a full-screen mobile sheet
       leaves a lot of unused space below. Let it grow with the sheet. */
    .hr-renewal-table-container {
        max-height: none;
    }
}
/* ── Change OUCare ID: field affordance + Check/Set box ───────────────────── */
/* Kept gray like a disabled field (D5), but clickable for HQ HR / admin.
   It's a readonly (not disabled) input so it can receive the click. */
/* Also used by the Name field (#profile-name) for the click-to-edit name
   overlay (rename / '?'-repair), so the selector covers both fields. */
#profile-oucare-id.id-editable,
#profile-name.id-editable {
    background-color: #e9ecef;
    cursor: pointer;
}
#profile-oucare-id.id-editable:hover,
#profile-name.id-editable:hover {
    border-color: #6b7280;   /* subtle hint; never a not-allowed cursor */
}

/* Current ID / New ID / Check — same 16px 20px gutter as .confirm-* sections. */
.id-change-input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #dee2e6;
}
.id-change-input-row .id-change-field {
    margin-bottom: 0;
}
.id-change-input-row .id-change-old-field {
    flex: 0 0 110px;
}
.id-change-input-row .id-change-new-field {
    flex: 1 1 auto;
    min-width: 0;
}
.id-change-input-row label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 6px;
}
.id-change-input-row .form-input {
    width: 100%;
}
.id-change-check-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Verdict banner and Advanced box: match the section gutter. */
.id-change-verdict {
    margin: 16px 20px 0;
}
.id-change-advanced {
    margin: 12px 20px 0;
    padding: 10px 12px;
    border: 1px dashed #ef4444;
    border-radius: 4px;
}
.id-change-advanced-title {
    color: #b91c1c;
}
.id-change-advanced .checkbox-label {
    display: block;
    margin-top: 6px;
}

/* Scrollable result; .confirm-content already supplies the 20px padding. */
.id-change-result {
    max-height: 320px;
}
.id-change-result .dev-id-table th,
.id-change-result .dev-id-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 3px 6px;
    text-align: right;
}
.id-change-result .dev-id-table th:first-child,
.id-change-result .dev-id-table td:first-child {
    text-align: left;
}

/* ── Off-day impact preview (dry run) ─────────────────────────────────────
   Shown before a calendar change is committed, so HR can see which leaves it
   hits. Sits above the HR ops overlay (z-index 1000). */
.impact-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.impact-dialog {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    width: min(760px, 92vw);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.impact-dialog h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
}

.impact-dialog .impact-summary {
    margin: 0 0 10px;
}

/* Site-scope ("Applies to") selector — mirrors .radio-group / .radio-label */
.scope-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.scope-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
}

.scope-label input[type="checkbox"] {
    cursor: pointer;
}

/* Site-list load failure: explicit error text where the checkboxes would be
   (Set/Clear are disabled in this state; retried on next panel opening) */
.scope-load-error {
    font-size: 13px;
    color: #b91c1c;
}

/* Scope line in the impact dialog header */
.impact-dialog .impact-scope {
    margin: 0 0 10px;
    font-weight: 600;
    color: #334155;
}

/* Read-only "existing events on this date" list (per-scope, D2 coexistence) */
.existing-events {
    margin: 6px 0 0;
}

.existing-events .ee-title {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

/* Scrolls once the list grows tall; header stays put while the body scrolls. */
.existing-events .ee-table-wrap {
    max-height: 156px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.existing-events .ee-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.existing-events .ee-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    padding: 4px 8px;
    white-space: nowrap;
}

.existing-events .ee-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.existing-events .ee-table tbody tr:last-child td {
    border-bottom: none;
}

/* Rows are clickable: they load into the editor section above. */
.existing-events .ee-row {
    cursor: pointer;
}

.existing-events .ee-row:hover,
.existing-events .ee-row:focus {
    background: #f1f5f9;
    outline: none;
}

/* The row the editor above is currently showing — highlighted by default (not
   only after a click), so with several events on one date it is obvious which
   one the event-type/subject fields refer to. Left accent + tint so it reads as
   "selected" rather than merely hovered. */
.existing-events .ee-row-active > td {
    background: #e0f2fe;
}

.existing-events .ee-row-active > td:first-child {
    box-shadow: inset 3px 0 0 0 #0284c7;
}

.existing-events .ee-row-active:hover > td {
    background: #d5ecfb;
}

.existing-events .ee-scope {
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.existing-events .ee-kind {
    color: #64748b;
    font-size: 12px;
    margin-left: 6px;
}

.existing-events .ee-portion {
    color: #64748b;
    white-space: nowrap;
}

/* A row superseded by the declared precedence (work-day exception wins over an
   off-day for the same date+scope). Deliberately INFORMATIONAL, not a warning:
   this is a legitimate configuration (e.g. an imported holiday plus a company
   make-up day) and HR decides whether the occurrence is intended. */
.existing-events .ee-shadowed td {
    color: #94a3b8;
}

.existing-events .ee-shadowed .ee-subject {
    text-decoration: line-through;
    text-decoration-color: #cbd5e1;
}

.existing-events .ee-shadowed .ee-scope {
    font-weight: 400;
    color: #94a3b8;
}

.existing-events .ee-note {
    font-size: 12px;
    font-style: italic;
    color: #64748b;
}

/* Panel notice for dates with overlapping off-day/make-up entries (D11).
   INFORMATIONAL (blue), deliberately not a warning: the precedence is declared
   and the configuration may well be intended. Hidden when empty. */
.off-day-notice:empty {
    display: none;
}

.off-day-notice {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: #eff6ff;
    border-left: 3px solid #60a5fa;
    border-radius: 4px;
    font-size: 13px;
    color: #334155;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.off-day-notice .odn-list {
    flex-basis: 100%;
    margin: 0;
    padding-left: 18px;
    overflow-wrap: anywhere;
}

.off-day-notice .odn-date {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 3px;
    color: #1e40af;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    padding: 1px 6px;
}

.off-day-notice .odn-date:hover {
    background: #bfdbfe;
}

.impact-dialog .impact-none {
    margin: 0 0 10px;
    color: #555;
}

.impact-dialog .impact-warning {
    margin: 0 0 12px;
    padding: 8px 10px;
    background: #fff6e5;
    border-left: 3px solid #e6a23c;
    border-radius: 4px;
    font-size: 0.9rem;
}

.impact-table-wrap {
    overflow-x: auto;
}

.impact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.impact-table th,
.impact-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    white-space: nowrap;
}

.impact-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Approved leaves are NOT auto-adjusted — flag them for notification. */
.impact-table tr.impact-row-frozen {
    background: #fff6e5;
}

.impact-table tr.impact-row-frozen td {
    color: #8a5a00;
}

/* Match the other HR ops dialogs: caption-width buttons, left-aligned. */
.impact-dialog .button-group {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.impact-dialog .btn {
    width: fit-content;
}

.impact-dialog .impact-note {
    margin: 0 0 10px;
    color: #555;
    font-size: 0.9rem;
}

/* Employee ID reads as data, not prose. */
.impact-table td.impact-id {
    font-variant-numeric: tabular-nums;
    color: #555;
}

/* Approved leaves on this date that the change does NOT move — reference only. */
.impact-table tr.impact-row-unaffected td {
    color: #888;
}

/* ── Compact off-day form rows ────────────────────────────────────────────
   "Event Type" + its two radios, and "Subject" + its dropdown, each sit on a
   single line. All four elements are short, and stacking them pushed the panel
   past the fold on lower-resolution displays.

   NOTE ON THE CASCADE — these rules must RE-DECLARE flex-direction / flex,
   not just display / width. Three unscoped rules from other stylesheets loaded
   on the same page leak into this panel, and setting only `display` or `width`
   leaves them in force:
     - export_attendance_summary.css  .form-group  { display:flex; flex-direction:column }
     - export_attendance_summary.css / system_setup.css
                                      .radio-group { flex-direction: column }
     - login_ui.css                   .btn         { flex: 1 }   ← stretches buttons
                                                                   even with width:fit-content,
                                                                   because flex-grow beats width.
   Hence the explicit `flex-direction: row` and `flex: 0 0 auto` below. */
.off-days-content .form-group-inline {
    display: flex;
    flex-direction: row;      /* override global .form-group { flex-direction: column } */
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.off-days-content .form-group-inline > label {
    display: inline-block;
    flex: 0 0 auto;
    margin-bottom: 0;
    white-space: nowrap;
    text-align: left;
}

.off-days-content .form-group-inline .radio-group {
    display: flex;
    flex-direction: row;      /* override global .radio-group { flex-direction: column } */
    align-items: center;
    gap: 16px;
    margin: 0;
}

/* Let the dropdown size to its content instead of filling the row. */
.off-days-content .form-group-inline .form-select {
    width: auto;
    min-width: 180px;
    max-width: 100%;
    flex: 0 1 auto;
}

/* The readonly display used for an existing entry, kept on the same line. */
.off-days-content .form-group-inline .subject-display {
    width: auto;
    flex: 0 1 auto;
    margin: 0;
}

/* ── Vertical centering of the inline control rows ───────────────────────
   MUST stay after the .form-group-inline rules above: the label override has
   the same specificity as `> label { display: inline-block }`, so it only wins
   by cascade ORDER. Two independent causes needed fixing:

   1. Section label vs its control group. The label was an inline-block, so the
      flex row centered its BOX while the glyphs inside were placed by
      baseline + half-leading — leaving "Event Type" / "Applies to" sitting a
      few px below the radios/checkboxes. Making the label its own centered
      flex box removes the half-leading offset.
   2. Each input vs its own text. Radio/checkbox inputs carry default UA
      margins (~3px 3px 3px 4px) and baseline alignment, which sat them low
      against their label text; zeroing the margin and centering on the flex
      line fixes it.
   Scoped to .off-days-content so other panels' radio groups are untouched. */
.off-days-content .form-group-inline > label {
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.off-days-content .form-group-inline .radio-group,
.off-days-content .form-group-inline .scope-options {
    align-items: center;
}

.off-days-content .radio-label,
.off-days-content .scope-label {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
    /* The generic `.form-group label` rule adds margin-bottom: 6px, and these
       nested labels ARE <label> elements. In a centered flex row that 6px
       bottom margin is part of the margin box, so centering the margin box
       lifts the visible content ~3px — the residual offset in the screenshot.
       Zero it so the label text centers on the row, not just its margin box. */
    margin: 0;
}

.off-days-content .radio-label input[type="radio"],
.off-days-content .scope-label input[type="checkbox"] {
    margin: 0;
    flex: 0 0 auto;
}

/* Caption-width, left-aligned action buttons (panel + preview dialog).
   `flex: 0 0 auto` is the load-bearing part: it cancels login_ui's global
   `.btn { flex: 1 }`, which otherwise stretches every button to equal width. */
.off-days-content .button-group,
.impact-dialog .button-group {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.off-days-content .button-group .btn,
.impact-dialog .button-group .btn {
    flex: 0 0 auto;
    width: fit-content;
    min-width: auto;
}

/* Mobile keeps the stacked, full-width treatment the rest of this file's
   @media block applies — the desktop overrides above are more specific, so
   they have to be undone explicitly here. */
@media (max-width: 768px) {
    /* Stack the two columns so the calendar + controls don't overflow. Full
       mobile polish is deferred; this just prevents horizontal overflow. */
    .off-days-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .off-days-content .form-group-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .off-days-content .button-group,
    .impact-dialog .button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .off-days-content .button-group .btn,
    .impact-dialog .button-group .btn {
        width: 100%;
        flex: 0 0 auto;
    }
}
