@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Playfair+Display:wght@600&family=Noto+Sans+Sinhala:wght@400;500;600;700&display=swap');

:root {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --primary: #1b3a57;
    --primary-dark: #12283c;
    --accent: #e2b04a;
    --text: #1b1f24;
    --muted: #6c7a89;
    --border: #e3e7ec;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', sans-serif;
    background: linear-gradient(135deg, #eef1f5 0%, #f8fafc 60%);
    color: var(--text);
    margin: 0;
}

.sinhala-text {
    font-family: 'Noto Sans Sinhala', 'Manrope', sans-serif;
}

h1, h2, h3, h4, h5 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 250px;
    background: var(--primary);
    color: #fff;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-sidebar .brand {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.app-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-sidebar .nav-link {
    color: #d9e2ec;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-topnav {
    background: var(--surface);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 20px;
    margin: 0;
}

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

.kpi-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(23, 35, 56, 0.08);
}

.kpi-label {
    color: var(--muted);
    font-size: 13px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 420px;
}

.auth-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.auth-branding-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.auth-logo {
    height: 48px;
    max-width: 160px;
    object-fit: contain;
}

.auth-branding-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.rich-text-editor {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
}

.rich-text-toolbar .btn {
    border-radius: 8px;
}

.rich-text-content {
    min-height: 180px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fdfdfd;
}

.rich-text-content:focus {
    outline: 2px solid rgba(27, 58, 87, 0.2);
    border-color: #cbd3db;
}

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

@media (max-width: 575px) {
    .leave-type-input {
        flex-direction: column;
        align-items: flex-start;
    }

    .leave-request-summary {
        font-size: 0.9rem;
    }

    .leave-request-actions .btn {
        width: 100%;
    }

    .table-mobile thead {
        display: none;
    }

    .table-mobile tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px;
        margin-bottom: 12px;
        background: #ffffff;
        box-shadow: 0 6px 14px rgba(16, 24, 40, 0.05);
    }

    .table-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
    }

    .table-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        padding-right: 10px;
    }
}

.card {
    border-radius: 14px;
    border: 1px solid var(--border);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.badge.bg-success-subtle {
    background: #e3f6ed;
}

.badge.bg-info-subtle {
    background: #e9f0fb;
}

.profile-photo {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    object-fit: cover;
    border: 2px solid #e9edf2;
}

.profile-photo.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e6edf5;
    color: var(--primary);
    font-weight: 700;
    border-radius: 50%;
}

.team-avatar {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #e9edf2;
}

.team-avatar.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e6edf5;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-header {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
    text-align: center;
}

.calendar-cell {
    min-height: 110px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.calendar-single .calendar-cell {
    min-height: 88px;
}

.calendar-single .calendar-leave {
    font-size: 0.65rem;
}

.calendar-cell.past {
    background: #f1f3f5;
}

.calendar-cell.upcoming {
    background: #ffffff;
}

.calendar-cell.sat {
    background: #eef6ff;
}

.calendar-cell.sun {
    background: #fff1f1;
}

.calendar-cell.holiday {
    background: #9b578a;
}

.calendar-cell.today {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(226, 176, 74, 0.2);
}

.calendar-cell.muted {
    background: #f8f9fb;
    border-style: dashed;
    box-shadow: none;
}

.calendar-day-number {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.calendar-holiday-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #f8e800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.calendar-leave {
    display: block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-leave.half {
    width: 48%;
}

.calendar-leave.half.am {
    margin-right: auto;
}

.calendar-leave.half.pm {
    margin-left: auto;
    text-align: right;
}

.calendar-leave.approved {
    background: #198754;
    color: #ffffff;
}

.calendar-leave.pending {
    background: #ffc107;
    color: #212529;
}

.calendar-holiday {
    display: block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 600;
    background: #eef2ff;
    color: #283593;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-holiday.mercantile {
    background: #e8f7ff;
    color: #0b5394;
}

.calendar-holiday.company {
    background: #f4edff;
    color: #6f42c1;
}

.calendar-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.calendar-legend-item.approved {
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
}

.calendar-legend-item.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #856404;
}

.calendar-popover-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.calendar-popover-avatar {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.calendar-popover-initial {
    display: inline-flex;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e6edf5;
    color: var(--primary);
    font-weight: 700;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.calendar-popover-name {
    font-weight: 600;
}

.calendar-popover-type {
    font-size: 12px;
    color: var(--muted);
}

.calendar-popover-body {
    font-size: 12px;
}

.leave-type-icon-preview {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: #f8fafc;
}

.leave-type-icon-preview:empty {
    border-style: dashed;
    background: transparent;
}

.leave-type-color-chip {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
}

.icon-picker-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    min-width: 190px;
}

.icon-picker-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon-picker-menu {
    max-height: 240px;
    overflow-y: auto;
}

.icon-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.color-swatch input {
    display: none;
}

.color-swatch .swatch {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.color-swatch .swatch-default {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
}

.color-swatch input:checked + .swatch {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.table thead th {
    font-weight: 600;
    color: var(--primary);
}

@media (max-width: 991px) {
    .app-sidebar {
        display: none;
    }
    .app-topnav {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .calendar-cell {
        min-height: 90px;
    }
}

@media (max-width: 575px) {
    .calendar-grid {
        gap: 6px;
    }

    .calendar-cell {
        min-height: 80px;
        padding: 4px;
    }

    .calendar-leave {
        font-size: 0.65rem;
    }
}
