/* CliManage Leave Management Styles */

.climanage-leave-management {
    padding: 0;
    max-width: 100%;
    min-width: 0; /* Allow overflow in flex parents */
}

/* Collapsible rows */
.leave-row-hidden {
    display: none !important;
}

.leave-show-more-wrap {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--cliM-border-color, #e8e8e8);
}

.leave-show-more-btn {
    padding: 10px 24px;
    border: 1px solid var(--cliM-border-color, #ddd);
    border-radius: 8px;
    background: var(--background-color, #fff);
    color: var(--e-global-color-accent, #8672a3);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.leave-show-more-btn:hover {
    background: var(--hover-background, #f5f5f5);
}

/* Mobile FAB */
.leave-fab {
    display: none;
}

/* Bottom sheet (hidden by default) */
.leave-bottom-sheet {
    display: none;
}

.leave-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.leave-page-header h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 400;
    color: var(--color, #1a1a1a);
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-selector label {
    margin: 0;
    font-size: 14px;
    color: var(--sub-color, #666);
}

.year-selector select {
    padding: 8px 12px;
    border: 1px solid var(--cliM-border-color, #ddd);
    border-radius: 4px;
    background: var(--hover-background, #fff);
    color: var(--color, #1a1a1a);
    font-size: 14px;
}

/* Leave Dashboard V2 */
.leave-v2-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.leave-v2-banner {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.leave-v2-banner h3 {
    margin: 0;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.leave-v2-banner .metric {
    margin: 12px 0 4px 0;
    font-size: 2.7rem;
    line-height: 1;
    font-weight: 700;
    color: #1f2937;
}

.leave-v2-banner .metric span {
    font-size: 1.9rem;
    color: #475569;
}

.leave-v2-banner .meta {
    margin: 0 0 12px 0;
    color: #64748b;
    font-size: 0.95rem;
}

.leave-v2-banner-casual .metric,
.leave-v2-banner-casual .metric span {
    color: #2563eb;
}

.leave-v2-banner-sick .metric,
.leave-v2-banner-sick .metric span {
    color: #475569;
}

.leave-v2-banner-rh .metric,
.leave-v2-banner-rh .metric span {
    color: #ea580c;
}

.leave-v2-banner-compoff .metric,
.leave-v2-banner-compoff .metric span {
    color: #7c3aed;
}

.leave-v2-meter {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #dbe7f3;
    overflow: hidden;
}

.leave-v2-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
}

.leave-v2-insights-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 24px;
    margin-bottom: 28px;
}

.leave-v2-card {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
}

.leave-v2-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.leave-v2-card-head h2 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--color, #1a1a1a);
    line-height: 1.3;
}

.leave-v2-calendar-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.leave-v2-calendar-nav button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.leave-v2-calendar-nav span {
    min-width: 132px;
    text-align: center;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 600;
}

.leave-v2-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 20px 10px;
}

.leave-v2-calendar-weekdays span {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.leave-v2-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    padding: 0 20px 20px;
}

.leave-v2-day {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #d5deea;
    background: #fff;
    color: #374151;
    font-weight: 600;
    font-size: 0.95rem;
}

.leave-v2-day-empty {
    border: none;
    background: transparent;
}

.leave-v2-day.is-today {
    border-color: #2563eb;
    box-shadow: inset 0 0 0 1px #2563eb;
    color: #2563eb;
}

.leave-v2-day.has-holiday::after {
    content: '';
    position: absolute;
    bottom: 8px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #16a34a;
}

.leave-v2-day.has-holiday.is-restricted::after {
    background: #ea580c;
}

.leave-v2-upcoming-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 20px 20px;
}

.leave-v2-upcoming-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid #dbe4ee;
    background: #f8fbff;
}

.leave-v2-upcoming-item.is-restricted {
    border-left: 4px solid #ea580c;
}

.leave-v2-upcoming-item.is-general {
    border-left: 4px solid #16a34a;
}

.leave-v2-date-tag {
    min-width: 48px;
    text-align: center;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #dbe4ee;
    font-weight: 700;
    color: #1d4ed8;
    font-size: 0.8rem;
    padding: 7px 8px;
}

.leave-v2-upcoming-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.leave-v2-upcoming-meta strong {
    font-size: 1rem;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leave-v2-upcoming-meta small {
    color: #64748b;
    font-size: 0.82rem;
}

.leave-v2-empty {
    margin: 4px 0;
    font-size: 0.9rem;
    color: #64748b;
}

.leave-v2-team-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 16px 12px;
}

.leave-v2-team-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 2px;
    border-bottom: 1px solid #eef2f7;
}

.leave-v2-team-item:last-child {
    border-bottom: none;
}

.leave-v2-team-item img {
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    object-fit: cover;
    border: 1px solid #dbe4ee !important;
    background: #f8fafc;
}

.leave-v2-team-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.leave-v2-team-meta strong {
    display: block;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leave-v2-team-meta small {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leave-v2-status {
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.leave-v2-status.available {
    background: #dcfce7;
    color: #15803d;
}

.leave-v2-status.on-leave {
    background: #e2e8f0;
    color: #334155;
}

.leave-v2-status.pending {
    background: #fff7ed;
    color: #c2410c;
}

.leave-v2-status.upcoming {
    background: #dbeafe;
    color: #1d4ed8;
}

.leave-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.leave-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "title count"
        "desc count";
    gap: 4px 18px;
    align-items: center;
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-left-width: 4px;
    border-radius: 16px;
    padding: 18px 22px;
}

.leave-card.general {
    border-left: 4px solid #2196F3;
}

.leave-card.restricted {
    border-left: 4px solid #FF9800;
}

.leave-card.casual {
    border-left: 4px solid #4CAF50;
}

.leave-card h3 {
    grid-area: title;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.leave-card .count {
    grid-area: count;
    margin: 0;
    justify-self: end;
    font-size: clamp(1.8rem, 2.2vw, 2.2rem);
    line-height: 1.05;
    font-weight: 700;
    color: var(--not-started-color, #986cb9);
    white-space: nowrap;
}

.leave-card .desc {
    grid-area: desc;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.2;
    color: #9ca3af;
}

.leave-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
    align-items: start;
}

.leave-section {
    background: var(--background-color, #fff);
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 10px;
    padding: 20px;
}

.leave-section h2 {
    margin: 0 0 12px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--color, #1a1a1a);
    line-height: 1.3;
}

.section-note {
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: var(--sub-color, #666);
}

.rh-selection-count {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--not-started-color, #986cb9);
    background: rgba(134, 114, 163, 0.1);
    border-radius: 8px;
}

.rh-list {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
}

.rh-list li {
    margin-bottom: 10px;
}

.rh-list-item {
    background: var(--hover-background, #f8f8f8);
    border-radius: 12px;
}

.rh-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border: 2px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.rh-item:hover:not(.disabled) {
    background: var(--hover-background, #f8f8f8);
}

.rh-item.rh-item-selected {
    border-color: rgba(134, 114, 163, 0.5);
    background: rgba(134, 114, 163, 0.06);
}

.rh-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rh-item input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Desktop sync mode: only RH list scrolls inside fixed-height card */
.climanage-leave-management .restricted-selection.is-scrollable {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.climanage-leave-management .restricted-selection.is-scrollable #rh-selection-form {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.climanage-leave-management .restricted-selection.is-scrollable .rh-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    position: relative;
    padding-right: 4px;
    margin-bottom: 12px;
}

.climanage-leave-management .restricted-selection.is-scrollable .rh-list::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    margin-top: -28px;
    height: 28px;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 78%);
    pointer-events: none;
}

.climanage-leave-management .restricted-selection.is-scrollable .rh-list::before {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    top: 0;
    display: block;
    margin-bottom: -28px;
    height: 28px;
    z-index: 2;
    background: linear-gradient(to top, rgba(255, 255, 255, 0), #fff 78%);
    pointer-events: none;
}

.rh-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rh-name {
    font-weight: 500;
    color: var(--color, #1a1a1a);
    line-height: 1.3;
}

.rh-date {
    font-size: 0.85rem;
    color: var(--sub-color, #666);
}

.climanage-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.climanage-button:hover {
    opacity: 0.9;
}

.climanage-button.primary {
    background: #8672a3;
    color: #fff;
}

.climanage-button.small {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 6px;
}

.climanage-button.small:last-of-type {
    margin-right: 0;
}

.climanage-button.danger {
    background: #d32f2f;
    color: #fff;
}

.form-field.full-width {
    width: 100%;
}

.climanage-leave-management .apply-leave .form-row,
.climanage-leave-management .comp-off-section .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.climanage-leave-management .apply-leave .form-row:last-child,
.climanage-leave-management .comp-off-section .form-row:last-child {
    margin-bottom: 0;
}

.climanage-leave-management .apply-leave .form-field,
.climanage-leave-management .comp-off-section .form-field {
    width: 100%;
    min-width: 0;
}

.climanage-leave-management .apply-leave .form-row:nth-of-type(2) .form-field,
.climanage-leave-management .comp-off-section .form-row:first-of-type .form-field {
    width: calc(50% - 6px);
}

.climanage-leave-management .apply-leave label,
.climanage-leave-management .comp-off-section label {
    display: block;
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.climanage-leave-management .apply-leave input,
.climanage-leave-management .apply-leave select,
.climanage-leave-management .apply-leave textarea,
.climanage-leave-management .comp-off-section input,
.climanage-leave-management .comp-off-section select,
.climanage-leave-management .comp-off-section textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.35;
    padding: 10px 12px;
}

.climanage-leave-management .apply-leave textarea,
.climanage-leave-management .comp-off-section textarea {
    min-height: 92px;
    resize: vertical;
}

.comp-off-balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 12px;
    margin-bottom: 14px;
    background: rgba(124, 58, 237, 0.12);
    color: #6d28d9;
    font-weight: 600;
}

.comp-off-subtitle {
    margin: 16px 0 10px;
    font-size: 1em;
    font-weight: 600;
    color: var(--color, #1a1a1a);
}

.climanage-holiday-table,
.climanage-leave-table {
    margin-top: 12px;
}

/* Leave tabs */
.leave-tabs-container {
    margin-top: 24px;
    overflow: visible;
    min-width: 0; /* Allow flex child to shrink and show overflow */
}

.leave-tabs-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--cliM-border-color, #e0e0e0);
    padding: 0 4px 0 0;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.leave-tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.leave-tab-btn {
    padding: 12px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--sub-color, #666);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
    flex-shrink: 0;
    white-space: nowrap;
}

.leave-tab-btn:hover {
    color: var(--color, #1a1a1a);
}

.leave-tab-btn.active {
    color: #8672a3;
    border-bottom-color: #8672a3;
}

.leave-tab-panel {
    display: none;
    padding: 20px 0 0;
}

.leave-tab-panel.active {
    display: block;
}

.leave-empty-msg {
    padding: 24px;
    text-align: center;
    color: var(--sub-color, #666);
    background: var(--hover-background, #fafafa);
    border-radius: 8px;
    margin: 12px 0 0;
}

/* Styled leave tables (My Leave Applications, Team Leave Overview) */
.leave-table-wrap {
    overflow: auto;
    max-height: 400px;
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 8px;
    margin-top: 12px;
}

.climanage-leave-table-styled {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.climanage-leave-table-styled th,
.climanage-leave-table-styled td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cliM-border-color, #e8e8e8);
    vertical-align: middle;
}

.climanage-leave-table-styled thead th {
    background: var(--hover-background, #f5f5f5);
    font-weight: 600;
    color: var(--color, #1a1a1a);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 var(--cliM-border-color, #e8e8e8);
}

.climanage-leave-table-styled tbody td {
    background: var(--background-color, #fff);
}

.climanage-leave-table-styled tbody tr:nth-child(even) td {
    background: var(--hover-background, #fafafa);
}

.climanage-leave-table-styled tbody tr:last-child td {
    border-bottom: none;
}

.climanage-leave-table-styled .climanage-button.small {
    margin-right: 6px;
}

.climanage-leave-table-styled .climanage-button.small:last-child {
    margin-right: 0;
}

/* Holiday Settings tab - section separators & cards */
.holiday-settings-section {
    background: var(--background-color, #fff);
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
}

.holiday-settings-section:last-child {
    margin-bottom: 0;
}

.holiday-settings-policy h2 {
    border-bottom-color: rgba(76, 175, 80, 0.4);
}

.holiday-settings-calendar h2 {
    border-bottom-color: rgba(33, 150, 243, 0.4);
}

.holiday-settings-custom h3 {
    border-bottom-color: rgba(255, 152, 0, 0.4);
}

/* Holiday Settings tab - match other settings tabs */
.climanage-holiday-settings .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.climanage-holiday-settings .form-row .form-field {
    width: calc(50% - 5px);
    min-width: 150px;
}

.climanage-holiday-settings .form-row .form-field:last-child {
    width: auto;
}

.climanage-holiday-settings h2,
.climanage-holiday-settings h3 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: var(--color, #1a1a1a);
}

.holiday-settings-section h2,
.holiday-settings-section h3 {
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--cliM-border-color, #e8e8e8);
    font-size: 1.15rem;
}

.climanage-holiday-settings .description {
    margin: 0 0 16px 0;
    font-size: 0.9rem;
    color: var(--sub-color, #666);
}

.climanage-holiday-settings .form-control,
.climanage-holiday-list-table select.form-control {
    display: block;
    width: 100%;
    padding: var(--input-padding, 10px);
    border: 1px solid var(--cliM-border-color, #ddd);
    color: var(--sub-color, #666);
    border-radius: 4px;
    font-size: var(--input-font-size, 14px);
    background: var(--hover-background, #fff);
}

.climanage-holiday-list-table {
    margin-top: 16px;
    margin-bottom: 16px;
    border-collapse: collapse;
    width: 100%;
}

.climanage-holiday-list-table th,
.climanage-holiday-list-table td {
    padding: 10px 12px;
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    text-align: left;
}

.climanage-holiday-list-table th {
    background: var(--hover-background, #f5f5f5);
    font-weight: 600;
}

.climanage-holiday-list-table td select {
    min-width: 120px;
}

.holiday-fetch-status {
    padding: 12px 16px;
    margin: 0 0 16px 0;
    border-radius: 4px;
    font-size: 14px;
}

.holiday-fetch-status.updated {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.holiday-fetch-status.error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

#no-holidays-msg {
    margin: 0 0 16px 0;
    padding: 12px 16px;
    background: var(--hover-background, #f9f9f9);
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
    color: var(--sub-color, #666);
}

.climanage-holiday-table tr.restricted {
    background: rgba(255, 152, 0, 0.08);
}

.climanage-holiday-table tr.general {
    background: rgba(33, 150, 243, 0.05);
}

/* Holiday Calendar table (leave page) */
.holiday-calendar-table-wrap {
    overflow: auto;
    max-height: 400px;
    border: 1px solid var(--cliM-border-color, #e0e0e0);
    border-radius: 8px;
    margin-top: 12px;
}

.climanage-holiday-calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.climanage-holiday-calendar-table th,
.climanage-holiday-calendar-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cliM-border-color, #e8e8e8);
    vertical-align: middle;
}

.climanage-holiday-calendar-table thead th {
    background: var(--hover-background, #f5f5f5);
    font-weight: 600;
    color: var(--color, #1a1a1a);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 var(--cliM-border-color, #e8e8e8);
}

.climanage-holiday-calendar-table thead th:nth-child(2),
.climanage-holiday-calendar-table thead th:last-child {
    text-align: left;
}

.climanage-holiday-calendar-table tbody td {
    background: var(--background-color, #fff);
}

.climanage-holiday-calendar-table tbody td:nth-child(1),
.climanage-holiday-calendar-table tbody td:nth-child(3),
.climanage-holiday-calendar-table tbody td:nth-child(4),
.climanage-holiday-calendar-table tbody td:nth-child(5) {
    text-align: center;
}

.climanage-holiday-calendar-table tbody tr:nth-child(even) td {
    background: var(--hover-background, #fafafa);
}

.climanage-holiday-calendar-table tbody tr.restricted td {
    background: rgba(255, 152, 0, 0.12) !important;
}

.climanage-holiday-calendar-table tbody tr.restricted:nth-child(even) td {
    background: rgba(255, 152, 0, 0.18) !important;
}

.climanage-holiday-calendar-table tbody tr:last-child td {
    border-bottom: none;
}

.climanage-holiday-calendar-table tbody td:nth-child(2) {
    font-weight: 500;
    color: var(--color, #1a1a1a);
}

.climanage-holiday-calendar-table tbody td:nth-child(3),
.climanage-holiday-calendar-table tbody td:nth-child(4) {
    color: var(--sub-color, #666);
}

.climanage-holiday-calendar-table tbody td:nth-child(5) {
    font-size: 0.85rem;
}

.climanage-holiday-calendar-table tbody td:nth-child(6) {
    text-align: left;
}

.climanage-holiday-calendar-table .holiday-type-restricted {
    color: #E65100;
    font-weight: 500;
}

/*
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}
*/

.status-badge.pending {
    background: #FFF3E0;
    color: #E65100;
}

.status-badge.approved {
    background: #E8F5E9;
    color: #2E7D32;
}

.status-badge.rejected {
    background: #FFEBEE;
    color: #C62828;
}

.climanage-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.climanage-notice-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

/* Tablet: reduce padding, allow horizontal scroll if needed */
@media (max-width: 1024px) {
    .leave-page-header h1 {
    font-size: 25px;}
    
    .leave-v2-overview-grid {
        grid-template-columns: 1fr;
    }

    .leave-v2-insights-grid {
        grid-template-columns: 1fr;
    }

    .leave-v2-card-head h2 {
        font-size: 1.15em;
    }

    .leave-tabs-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }

    .leave-tab-btn {
        flex-shrink: 0 !important;
        padding: 10px 16px;
        font-size: 13px;
    }

    .holiday-calendar-table-wrap,
    .leave-table-wrap {
        max-height: 350px;
    }

    .climanage-holiday-settings .form-row .form-field {
        width: 100%;
    }

    .climanage-holiday-calendar-table th,
    .climanage-holiday-calendar-table td,
    .climanage-leave-table-styled th,
    .climanage-leave-table-styled td,
    .climanage-holiday-list-table th,
    .climanage-holiday-list-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Mobile: card-style layout (like Projects) */
@media (max-width: 768px) {
    .leave-v2-overview-grid {
        gap: 14px;
    }

    .leave-v2-banner {
        padding: 16px;
        border-radius: 14px;
    }

    .leave-v2-banner .metric {
        font-size: 2rem;
    }

    .leave-v2-banner .metric span {
        font-size: 1.35rem;
    }

    .climanage-leave-management .apply-leave .form-row:nth-of-type(2) .form-field,
    .climanage-leave-management .comp-off-section .form-row:first-of-type .form-field {
        width: 100%;
    }

    .leave-v2-card {
        border-radius: 14px;
    }

    .leave-v2-card-head {
        padding: 14px 14px 10px;
    }

    .leave-v2-card-head h2 {
        font-size: 1.1em;
    }

    .leave-v2-calendar-nav span {
        min-width: 106px;
        font-size: 0.8rem;
    }

    .leave-v2-calendar-weekdays,
    .leave-v2-calendar-days {
        gap: 8px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .leave-v2-day {
        min-height: 38px;
        border-radius: 10px;
        font-size: 0.88rem;
    }

    .leave-v2-upcoming-list {
        grid-template-columns: 1fr;
        padding: 0 14px 14px;
    }

    .leave-v2-upcoming-meta strong {
        font-size: 0.92rem;
    }

    .leave-v2-team-list {
        padding: 8px 12px 12px;
    }

    .leave-v2-status {
        font-size: 0.78rem;
        padding: 4px 10px;
    }

    .climanage-leave-management {
        padding-bottom: 50px; /* Space for FAB above bottom nav */
    }

    .leave-summary-cards {
        grid-template-columns: 1fr;
    }

    .leave-content-grid {
        grid-template-columns: 1fr;
    }

    .leave-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .leave-tabs-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }

    .leave-tab-btn {
        flex-shrink: 0 !important;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Holiday Settings: form fields stack */
    .climanage-holiday-settings .form-row .form-field {
        width: 100%;
        min-width: 0;
    }

    .climanage-holiday-settings .form-row .form-field:last-child {
        width: 100%;
    }

    .holiday-settings-section {
        padding: 16px;
        margin-bottom: 20px;
    }

    /* Admin Holiday List table: card-style */
    #holiday-list-container,
    #fetched-holidays-container {
        overflow: visible;
    }

    .climanage-holiday-settings .climanage-holiday-list-table {
        display: block;
        border: none;
    }

    .climanage-holiday-settings .climanage-holiday-list-table thead {
        display: none;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody {
        display: block;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        gap: 12px 16px;
        margin-bottom: 16px;
        padding: 16px;
        border: 1px solid var(--cliM-border-color, #e0e0e0);
        border-radius: 12px;
        background: var(--background-color, #fff);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td {
        display: block;
        padding: 0;
        border: none;
        background: transparent !important;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--sub-color, #666);
        margin-bottom: 4px;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td.leave-card-primary::before {
        content: none;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td.leave-card-primary {
        flex: 1 1 100%;
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--color, #1a1a1a);
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td[data-label="Include"] {
        flex: 0 0 auto;
        order: -1;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td[data-label="Include"]::before {
        content: none;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td[data-label="Date"],
    .climanage-holiday-settings .climanage-holiday-list-table tbody td[data-label="Type"] {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .climanage-holiday-settings .climanage-holiday-list-table tbody td select.form-control {
        min-width: 0;
        width: 100%;
    }

    /* User Leave page: card-style tables */
    .climanage-leave-management .holiday-calendar-table-wrap,
    .climanage-leave-management .leave-table-wrap {
        overflow: visible;
        max-height: none;
        border: none;
    }

    .climanage-leave-management .climanage-holiday-calendar-table,
    .climanage-leave-management .climanage-leave-table-styled {
        display: block;
        border: none;
    }

    .climanage-leave-management .climanage-holiday-calendar-table thead,
    .climanage-leave-management .climanage-leave-table-styled thead {
        display: none;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody,
    .climanage-leave-management .climanage-leave-table-styled tbody {
        display: block;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody tr,
    .climanage-leave-management .climanage-leave-table-styled tbody tr {
        display: flex;
        flex-wrap: wrap;
        gap: 12px 16px;
        margin-bottom: 16px;
        padding: 16px;
        border: 1px solid var(--cliM-border-color, #e0e0e0);
        border-radius: 12px;
        background: var(--background-color, #fff);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody tr.restricted {
        border-left: 4px solid #FF9800;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td,
    .climanage-leave-management .climanage-leave-table-styled tbody td {
        display: block;
        padding: 0;
        border: none;
        background: transparent !important;
    }

    /* Mobile holiday cards: keep fields clean, highlight only with border */
    .climanage-leave-management .climanage-holiday-calendar-table tbody tr.restricted td {
        background: transparent !important;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label]::before,
    .climanage-leave-management .climanage-leave-table-styled tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--sub-color, #666);
        margin-bottom: 4px;
    }

    /* Keep value text darker than labels, matching Team Leave Overview cards */
    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label] {
        color: var(--color, #1a1a1a);
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td.holiday-type-restricted {
        color: #E65100;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td.leave-card-primary::before,
    .climanage-leave-management .climanage-leave-table-styled tbody td.leave-card-primary::before {
        content: none;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td.leave-card-primary,
    .climanage-leave-management .climanage-leave-table-styled tbody td.leave-card-primary {
        flex: 1 1 100%;
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--color, #1a1a1a);
    }

    /* Holiday calendar: 2-column layout (like Team Leave Overview) */
    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label="S.No"] {
        flex: 0 0 auto;
        order: -1;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label="Date"],
    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label="Day"],
    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label="Type"],
    .climanage-leave-management .climanage-holiday-calendar-table tbody td[data-label="Your Selection"] {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        text-align: left;
    }

    .climanage-leave-management .climanage-holiday-calendar-table tbody td {
        text-align: left;
    }

    .climanage-leave-management .climanage-leave-table-styled tbody td {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .climanage-leave-management .climanage-leave-table-styled tbody td[data-label="Reason"],
    .climanage-leave-management .climanage-leave-table-styled tbody td[data-label="Action"] {
        flex: 1 1 100%;
    }

    .climanage-leave-management .climanage-leave-table-styled tbody td[data-label="Action"] {
        padding-top: 12px;
        margin-top: 8px;
        border-top: 1px solid var(--cliM-border-color, #e8e8e8);
    }

    .climanage-leave-management .climanage-leave-table-styled .climanage-button.small {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px;
    }

    /* Hide desktop Apply for Leave, show FAB */
    .climanage-leave-management .leave-content-grid .apply-leave {
        display: none;
    }

    .leave-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        right: calc(20px + env(safe-area-inset-right, 0px));
        z-index: 99;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: none;
        background: var(--e-global-color-accent, #8672a3);
        color: #fff;
        font-size: 24px;
        font-weight: 300;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(134, 114, 163, 0.4);
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .leave-fab:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(134, 114, 163, 0.5);
    }

    .leave-fab:active {
        transform: scale(0.98);
    }

    .leave-fab-icon {
        line-height: 1;
    }

    .leave-fab-label {
        display: none;
        font-size: 14px;
        font-weight: 500;
    }

    /* Bottom sheet */
    .leave-bottom-sheet {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1001;
        pointer-events: none;
    }

    .leave-bottom-sheet.leave-sheet-open {
        pointer-events: auto;
    }

    .leave-bottom-sheet-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.3s;
    }

    .leave-sheet-open .leave-bottom-sheet-backdrop {
        opacity: 1;
    }

    .leave-bottom-sheet-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 85vh;
        background: var(--background-color, #fff);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
    }

    .leave-sheet-open .leave-bottom-sheet-panel {
        transform: translateY(0);
    }

    .leave-bottom-sheet-handle {
        width: 40px;
        height: 4px;
        background: var(--cliM-border-color, #ddd);
        border-radius: 2px;
        margin: 12px auto;
    }

    .leave-bottom-sheet-content {
        padding: 0 20px 24px;
        overflow-y: auto;
        max-height: calc(85vh - 40px);
    }

    .leave-bottom-sheet-content h2 {
        margin: 0 0 20px 0;
        font-size: 1.2em;
    }

    .leave-bottom-sheet-content .form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }

    .leave-bottom-sheet-content .form-row .form-field {
        flex: 1 1 100%;
        min-width: 0;
    }

    .leave-bottom-sheet-content .form-row.form-row-dates .form-field {
        flex: 1 1 calc(50% - 6px);
    }

    .leave-bottom-sheet-content .form-field input,
    .leave-bottom-sheet-content .form-field select,
    .leave-bottom-sheet-content .form-field textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
        padding: 10px 12px;
        border: 1px solid var(--cliM-border-color, #ddd);
        border-radius: 6px;
    }

    .leave-bottom-sheet-content .climanage-button.primary {
        min-height: 48px;
        width: 100%;
    }

    /* Restricted holiday section: mobile-optimized */
    .climanage-leave-management .restricted-selection {
        padding: 16px;
        padding-bottom: 80px; /* Extra clearance for last items above FAB */
    }

    .climanage-leave-management .restricted-selection.is-scrollable {
        display: block;
        height: auto !important;
        max-height: none !important;
        overflow: visible;
    }

    .climanage-leave-management .restricted-selection.is-scrollable #rh-selection-form {
        display: block;
    }

    .climanage-leave-management .restricted-selection.is-scrollable .rh-list {
        overflow: visible;
        padding-right: 0;
    }

    .climanage-leave-management .restricted-selection.is-scrollable .rh-list::after {
        display: none;
    }

    .climanage-leave-management .restricted-selection.is-scrollable .rh-list::before {
        display: none;
    }

    .climanage-leave-management .restricted-selection h2 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .climanage-leave-management .restricted-selection .section-note {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .climanage-leave-management .rh-selection-count {
        display: block;
        text-align: center;
        margin-bottom: 14px;
        padding: 8px 14px;
    }

    .climanage-leave-management .rh-list {
        margin-bottom: 20px;
    }

    .climanage-leave-management .rh-list li {
        margin-bottom: 12px;
    }

    .climanage-leave-management .rh-item {
        min-height: 56px;
        padding: 14px 16px;
        gap: 16px;
        border-radius: 12px;
    }

    .climanage-leave-management .rh-item input[type="checkbox"] {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        margin-top: 0;
    }

    .climanage-leave-management .rh-name {
        font-size: 0.95rem;
    }

    .climanage-leave-management .rh-date {
        font-size: 0.8rem;
    }

    .climanage-leave-management .restricted-selection .climanage-button.primary {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }
}
