/* Shared EAN Portal components. Calendar event colours come from config/calendar.php. */
:root {
    --primary-color: #CC287A;
    --bs-primary-rgb: 204, 40, 122;
    --primary-hover: #ac1f65;
    --secondary-color: #667085;
    --success-color: #198754;
    --info-color: #0891b2;
    --warning-color: #d99a16;
    --danger-color: #dc3545;
    --sidebar-width: 250px;
    --portal-background: #f6f7fb;
    --portal-border: #e5e9f0;
    --portal-text: #253047;
    --portal-muted: #667085;
    --portal-radius: 0.75rem;
    --portal-shadow: 0 3px 16px rgba(25, 38, 66, 0.045);
    --bs-link-color-rgb: 172, 31, 101;
    --bs-link-hover-color-rgb: 136, 24, 80;
}
body.portal-shell {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--portal-text);
    background: var(--portal-background);
    line-height: 1.5;
}
#wrapper { display: flex; width: 100%; }
#sidebar-wrapper {
    min-height: 100vh;
    height: 100vh;
    width: var(--sidebar-width);
    overflow-y: auto;
    background: linear-gradient(180deg, #CC287A 0%, #833459 62%, #444d61 100%);
    transition: margin 0.25s ease-out;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
}
#sidebar-wrapper .sidebar-heading {
    padding: 1.25rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.025em;
}
#sidebar-wrapper .list-group { width: var(--sidebar-width); }
#sidebar-wrapper .list-group-item {
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.875rem;
    padding: 0.8rem 1.25rem;
    transition: background-color 0.15s;
}
#sidebar-wrapper .list-group-item:hover,
#sidebar-wrapper .list-group-item:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
#sidebar-wrapper .list-group-item.active {
    background: rgba(255, 255, 255, 0.16);
    border-left-color: #fff;
    color: #fff;
    font-weight: 700;
}
#page-content-wrapper { flex: 1; min-width: 0; margin-left: var(--sidebar-width); transition: margin 0.25s ease-out; }
.portal-auth #page-content-wrapper { margin-left: 0; }
.portal-shell .navbar {
    min-height: 64px;
    border-bottom: 1px solid var(--portal-border);
    box-shadow: none;
    position: relative;
    z-index: 1030;
}
.portal-shell .navbar .container-fluid { overflow: visible; }
.portal-shell .dropdown-menu {
    z-index: 1050;
    max-height: min(400px, 75vh);
    overflow-y: auto;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: 0 8px 28px rgba(25, 38, 66, 0.12);
    padding: 0.375rem;
}
.portal-shell .dropdown-item { padding: 0.6rem 0.75rem; border-radius: 0.375rem; }
.portal-shell .dropdown-item:hover { background: #f9edf3; color: var(--primary-hover); }
.portal-shell .dropdown-header { color: var(--portal-muted); font-weight: 600; }
.portal-main { min-width: 0; max-width: 100%; font-size: 0.875rem; }
.portal-main > .container-fluid { padding-right: 0; padding-left: 0; }
.portal-main h1, .portal-main h2 { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.3; }
.portal-main h1 small, .portal-main h2 small { font-size: 0.875rem; font-weight: 400; letter-spacing: normal; }
.portal-shell .page-header { margin-bottom: 1.5rem; padding-bottom: 0.875rem; border-bottom: 1px solid var(--portal-border); gap: 1rem; flex-wrap: wrap; }
.portal-shell .card {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow) !important;
    margin-bottom: 1.5rem;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
}
.portal-shell .card-header {
    background: #fff;
    color: var(--portal-text);
    border-bottom: 1px solid var(--portal-border);
    border-radius: var(--portal-radius) var(--portal-radius) 0 0;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.portal-shell .card-header h3, .portal-shell .card-header h4, .portal-shell .card-header h5, .portal-shell .card-header h6 { font-size: inherit; font-weight: inherit; line-height: inherit; }
.portal-shell .card-header > .bi { color: var(--primary-color); }
.portal-shell .card-body { padding: 1.25rem; min-width: 0; font-size: 0.875rem; }
.portal-shell .card-footer { background: #fafbfc; border-top-color: var(--portal-border); padding: 1rem 1.25rem; }
.portal-shell .stat-card { border-left-width: 3px; }
.portal-shell .stat-card.primary { border-left-color: var(--primary-color); }
.portal-shell .stat-card.success { border-left-color: var(--success-color); }
.portal-shell .stat-card.info { border-left-color: var(--info-color); }
.portal-shell .stat-card.warning { border-left-color: var(--warning-color); }
.portal-shell .stat-card.danger { border-left-color: var(--danger-color); }
.portal-shell .stat-card .h5 { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.portal-shell .table {
    --bs-table-color: var(--portal-text);
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: #f8f9fc;
    --bs-table-border-color: var(--portal-border);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0;
}
.portal-shell .table > :not(caption) > * > * {
    padding: 0.95rem 0.875rem;
    vertical-align: middle;
    overflow-wrap: break-word;
}
.portal-shell .table thead th {
    background: #f8f9fb;
    color: #596477;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    border-bottom-width: 1px;
}
.portal-shell .table tbody th { color: #596477; font-weight: 600; }
.portal-shell .table-borderless > :not(caption) > * > * { padding: 0.7rem 0.875rem; }
.portal-shell .table-responsive { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0.5rem; }
.portal-shell .table .btn-sm { font-size: 0.75rem; min-height: 1.875rem; }
.portal-shell .table td .btn { margin-block: 0.125rem; }
.portal-shell .table .text-end, .portal-shell .stat-card { font-variant-numeric: tabular-nums; }
.portal-shell .badge { font-size: 0.75rem; font-weight: 600; padding: 0.35em 0.55em; border-radius: 0.375rem; line-height: 1.35; }
.portal-shell .badge-role { font-size: 0.75rem; }
.portal-shell .btn {
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 0.875rem;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.portal-shell .btn-sm { padding: 0.35rem 0.625rem; font-size: 0.8125rem; }
.portal-shell .btn-lg { padding: 0.75rem 1rem; font-size: 1rem; }
.portal-shell .btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: #8e1953;
    --bs-btn-active-border-color: #8e1953;
    --bs-btn-disabled-bg: var(--primary-color);
    --bs-btn-disabled-border-color: var(--primary-color);
    --bs-btn-focus-shadow-rgb: 204, 40, 122;
}
.portal-shell .btn-outline-primary {
    --bs-btn-color: var(--primary-hover);
    --bs-btn-border-color: #dca7c1;
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-focus-shadow-rgb: 204, 40, 122;
}
.portal-shell .text-primary { color: var(--primary-color) !important; }
.portal-shell .form-label { font-size: 0.8125rem; font-weight: 600; color: #4c586e; margin-bottom: 0.4rem; }
.portal-shell .form-control, .portal-shell .form-select {
    font-size: 0.875rem;
    padding: 0.625rem 0.75rem;
    border-color: #d7dde7;
    border-radius: 0.5rem;
    color: var(--portal-text);
}
.portal-shell .form-control:focus, .portal-shell .form-select:focus {
    border-color: #cf719e;
    box-shadow: 0 0 0 0.2rem rgba(204, 40, 122, 0.12);
}
.portal-shell .form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.portal-shell .input-group-text { font-size: 0.875rem; color: var(--portal-muted); background: #f8f9fb; border-color: #d7dde7; }
.portal-shell .alert { border-radius: 0.625rem; font-size: 0.875rem; }
.portal-shell .pagination { --bs-pagination-color: var(--primary-hover); --bs-pagination-active-bg: var(--primary-color); --bs-pagination-active-border-color: var(--primary-color); font-size: 0.875rem; }
.portal-shell :focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }
.portal-shell [hidden] { display: none !important; }
.portal-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #f8e5ef, var(--portal-background) 65%) !important;
}
.login-container { width: 100%; max-width: 460px; padding: 1.25rem; margin: auto; }
.login-card { background: #fff; border: 1px solid var(--portal-border); border-radius: 1rem; box-shadow: var(--portal-shadow); overflow: hidden; }
.login-header { background: #CC287A; color: #fff; padding: 2rem 1.5rem; text-align: center; }
.login-header h3 { font-size: 1.5rem; font-weight: 700; }
.portal-login .login-header .text-primary { color: #fff !important; }
.portal-login .login-header .text-muted { color: rgba(255, 255, 255, 0.9) !important; }
.login-body { padding: 1.75rem; font-size: 0.875rem; }
@media (min-width: 769px) {
    #wrapper.toggled #sidebar-wrapper { margin-left: calc(-1 * var(--sidebar-width)); }
    #wrapper.toggled #page-content-wrapper { margin-left: 0; }
}
@media (max-width: 768px) {
    #sidebar-wrapper { margin-left: calc(-1 * var(--sidebar-width)); }
    #wrapper.toggled #sidebar-wrapper { margin-left: 0; }
    #page-content-wrapper { margin-left: 0; }
    .portal-main { padding: 1rem !important; }
    .portal-main h1, .portal-main h2 { font-size: 1.4rem; }
    .portal-shell .card-header { padding: 0.875rem 1rem; }
    .portal-shell .card-body { padding: 1rem; }
    .portal-shell .page-header small { display: block; margin-top: 0.5rem; }
    .portal-shell .card-header > .d-flex { flex-wrap: wrap; gap: 0.5rem; }
    .portal-shell .card-header input[type="date"] { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
    #sidebar-wrapper, #page-content-wrapper, .portal-shell .btn { transition: none; }
}

.report-list-table {
    min-width: 1120px;
    width: 100%;
    table-layout: fixed;
    font-size: 0.875rem;
}
.report-list-table .report-col-date { width: 112px; }
.report-list-table .report-col-employee { width: 116px; }
.report-list-table .report-col-client { width: 140px; }
.report-list-table .report-col-location { width: 120px; }
.report-list-table .report-col-status { width: 125px; }
.report-list-table .report-col-hours { width: 80px; }
.report-list-table .report-col-actions { width: 160px; }
.report-list-table > :not(caption) > * > * {
    padding: 1rem 0.875rem;
    vertical-align: middle;
    border-bottom-color: #e9ecef;
}
.report-list-table thead th {
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
    color: #495057;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.report-date, .report-hours {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.report-employee { font-weight: 600; overflow-wrap: anywhere; }
.report-client {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: #f1f3f5;
    color: #495057;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.report-task {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-weight: 500;
    line-height: 1.45;
}
.report-task-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
}
.report-category { color: #6c757d; font-size: 0.75rem; }
.report-location { color: #495057; overflow-wrap: anywhere; }
.report-status { display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; }
.report-status .badge { max-width: 100%; white-space: normal; text-align: left; line-height: 1.4; }
.report-lock { color: #6c757d; font-size: 0.75rem; }
.report-hours { font-weight: 600; }
.report-actions { display: flex; justify-content: center; gap: 0.25rem; }
.report-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0;
    flex-shrink: 0;
}
.report-actions form { display: inline-flex !important; margin: 0; }
.portal-shell .form-control.is-invalid, .portal-shell .form-select.is-invalid { border-color: var(--danger-color); }
.portal-shell .form-control.is-valid, .portal-shell .form-select.is-valid { border-color: var(--success-color); }
.portal-shell .table td:last-child:has(.btn) { white-space: nowrap; }
@media (max-width: 768px) {
    .portal-shell .table-responsive > .table:not(.report-list-table) { min-width: 640px; }
}

.portal-shell .stat-label { color: var(--portal-muted); font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.4rem; }
.portal-shell .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.portal-shell .text-xs { font-size: 0.75rem; letter-spacing: 0.025em; }
.portal-main .fc .fc-button-primary,
.portal-main .fc .fc-button-primary * { color: var(--primary-hover) !important; }
.portal-main .fc .fc-button-primary {
    background: #fff !important;
    border-color: #dca7c1 !important;
    border-radius: 0.5rem;
    box-shadow: none;
}
.portal-main .fc .fc-button-primary:hover,
.portal-main .fc .fc-button-primary:focus { background: #f9edf3 !important; }
.portal-main .fc .fc-button-active,
.portal-main .fc .fc-button-active *,
.portal-main .fc .fc-button-active:hover,
.portal-main .fc .fc-button-active:focus {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}
@media (max-width: 576px) {
    .portal-main .fc .fc-daygrid-block-event .fc-event-title {
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden !important;
        font-size: 0.6875rem;
        line-height: 1.35;
    }
}
.portal-shell .filter-card {
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.portal-shell .table .btn-info {
    --bs-btn-color: var(--primary-hover);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: #dca7c1;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}
/* Report detail cards share the same label, value and section rhythm. */
.report-details .card-body, .portal-profile .card-body, .portal-client .card-body { font-size: 0.875rem; }
.report-detail-list, .portal-detail-list {
    display: grid;
    grid-template-columns: min(42%, 12.5rem) minmax(0, 1fr);
    column-gap: 1.25rem;
    row-gap: 0.8rem;
    align-items: baseline;
    margin: 0;
}
.report-detail-list dt, .portal-detail-list dt, .report-detail-heading, .portal-section-heading {
    margin: 0;
    color: #596477;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.report-detail-list dd, .portal-detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.report-detail-list dt small, .portal-detail-list dt small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--portal-muted); }
.report-detail-heading, .portal-section-heading { margin-bottom: 0.5rem; }
.report-detail-notes, .portal-notes { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-detail-section, .portal-detail-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--portal-border); }
.report-cost-list { grid-template-columns: minmax(0, 1fr) auto; }
.report-cost-list dd { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-grand-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid #ead6e0;
    border-radius: 0.5rem;
    background: #fcf5f9;
    color: var(--primary-hover);
}
.report-grand-total strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.portal-form-section + .portal-form-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--portal-border);
}
.portal-form-section > .portal-section-heading { margin-bottom: 0.75rem; }
.portal-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

.portal-section-divider {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--portal-border);
}
.portal-shell .card-header i.bi { color: var(--primary-color); }
.portal-shell .table td > .btn-group { gap: 0.25rem; }
.portal-shell .table td > .btn-group > .btn { border-radius: 0.375rem !important; }

.portal-main > .d-flex, .portal-profile > .d-flex { flex-wrap: wrap; gap: 0.75rem; }
.portal-shell .col-form-label { font-size: 0.8125rem; font-weight: 600; color: #4c586e; }
.portal-shell .form-control-plaintext { font-size: 0.875rem; color: var(--portal-text); }
.portal-shell .text-warning { color: #946200 !important; }
.portal-shell .text-info { color: #0e7490 !important; }
.portal-shell .badge.bg-warning { color: #3d2c00 !important; }
.portal-shell .badge.bg-info { color: #083a46 !important; }
.portal-shell .user-manual h2 { font-size: 1.125rem; margin-top: 2rem; }
.portal-shell .user-manual h3 { font-size: 0.9375rem; margin-top: 1.5rem; font-weight: 600; }
.user-manual table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; font-size: 0.875rem; }
.user-manual th, .user-manual td { padding: 0.875rem; border: 1px solid var(--portal-border); }
.user-manual th { background: #f8f9fb; color: #596477; font-weight: 600; }

.portal-main hr { border-color: var(--portal-border); opacity: 1; margin-block: 1.25rem; }
