/* Company ERP — layout and theme (Bootstrap 5.3) */
:root {
    --erp-primary: #394a59;
    --erp-primary-dark: #2b3945;
    --erp-accent: #f0932b;
    --erp-bg: #eef1f5;
    --erp-border: #dde3ea;
    --header-h: 58px;
    --footer-h: 36px;
    --sidebar-w: 250px;
    --sidebar-mini-w: 68px;
    --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .875rem;
    --bs-primary: #394a59;
    --bs-primary-rgb: 57, 74, 89;
    --bs-link-color: #2f6f9f;
    --bs-link-color-rgb: 47, 111, 159;
    --bs-link-hover-color: #1f4f75;
}

body.app { background: var(--erp-bg); color: #25313c; }

.btn-primary {
    --bs-btn-bg: var(--erp-primary); --bs-btn-border-color: var(--erp-primary);
    --bs-btn-hover-bg: var(--erp-primary-dark); --bs-btn-hover-border-color: var(--erp-primary-dark);
    --bs-btn-active-bg: var(--erp-primary-dark); --bs-btn-active-border-color: var(--erp-primary-dark);
    --bs-btn-disabled-bg: var(--erp-primary); --bs-btn-disabled-border-color: var(--erp-primary);
}
.btn-accent {
    --bs-btn-color: #fff; --bs-btn-bg: var(--erp-accent); --bs-btn-border-color: var(--erp-accent);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #e07f14; --bs-btn-hover-border-color: #e07f14;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #d47510; --bs-btn-active-border-color: #d47510;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #8fa6bb; box-shadow: 0 0 0 .2rem rgba(57, 74, 89, .15);
}
.form-check-input:checked { background-color: var(--erp-primary); border-color: var(--erp-primary); }

/* ---------- Header ---------- */
.app-header {
    position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 1040;
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem 0 .6rem;
    background: var(--erp-primary); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.icon-btn {
    width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent;
    color: #fff; font-size: 1.4rem; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px; background: var(--erp-accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.05rem; flex: none;
}
.brand-text { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-weight: 500; opacity: .7; font-size: .75rem; margin-left: .15rem; }
.header-title {
    margin-left: 1.25rem; padding-left: 1.25rem; border-left: 1px solid rgba(255, 255, 255, .2);
    font-weight: 500; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.fy-chip, .date-chip {
    align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px;
    background: rgba(255, 255, 255, .12); font-size: .8rem; white-space: nowrap;
}
.fy-chip { background: rgba(240, 147, 43, .25); color: #ffd7a8; font-weight: 600; }
.user-btn {
    display: flex; align-items: center; gap: .5rem; border: 0; background: transparent; color: #fff;
    padding: .25rem .4rem; border-radius: 10px;
}
.user-btn:hover { background: rgba(255, 255, 255, .1); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--erp-primary);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: none;
}
.user-meta { flex-direction: column; align-items: flex-start; line-height: 1.1; }
.user-meta strong { font-size: .85rem; font-weight: 600; }
.user-meta small { font-size: .72rem; opacity: .75; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed; top: var(--header-h); bottom: var(--footer-h); left: 0; width: var(--sidebar-w); z-index: 1030;
    background: #fff; border-right: 1px solid var(--erp-border); overflow-y: auto; overflow-x: hidden;
    transition: width .2s ease, transform .25s ease; scrollbar-width: thin;
}
.side-nav { padding: .75rem .6rem 1.5rem; }
.side-heading {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: #8a96a3; padding: 1rem .75rem .35rem;
}
.side-parent { display: flex; align-items: center; }
.side-link {
    flex: 1; display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px;
    color: #33414e; text-decoration: none; font-weight: 500; white-space: nowrap; min-width: 0;
}
.side-link i { font-size: 1.1rem; width: 22px; text-align: center; color: var(--sec, #5b6b7a); flex: none; }
.side-link:hover { background: #f1f4f7; color: #1d2833; }
.side-link.active { background: rgba(57, 74, 89, .09); color: var(--erp-primary); font-weight: 600; }
.side-group.open > .side-parent .side-link { box-shadow: inset 3px 0 0 var(--sec, var(--erp-primary)); }
.side-caret {
    border: 0; background: transparent; color: #8a96a3; width: 30px; height: 30px; border-radius: 6px; flex: none;
}
.side-caret:hover { background: #f1f4f7; color: #33414e; }
.side-caret i { display: inline-block; transition: transform .2s; font-size: .75rem; }
.side-caret[aria-expanded="true"] i { transform: rotate(180deg); }
.side-sub { list-style: none; margin: .15rem 0 .35rem; padding: 0 0 0 1.55rem; }
.side-sub a {
    display: flex; align-items: center; gap: .55rem; padding: .38rem .7rem; border-radius: 6px;
    color: #56636f; text-decoration: none; font-size: .83rem; white-space: nowrap;
    border-left: 1px solid #e3e8ee; border-radius: 0 6px 6px 0;
}
.side-sub a i { font-size: .9rem; opacity: .7; }
.side-sub a:hover { background: #f5f7f9; color: #1d2833; }
.side-sub a.active { color: var(--erp-primary); font-weight: 600; background: #f1f4f7; border-left: 2px solid var(--sec, var(--erp-primary)); }
.side-sub2 { margin: 0 0 .2rem; padding-left: .9rem; }
.side-sub-toggle { font-weight: 500; }
.side-sub-toggle .side-sub-caret { margin-left: auto; font-size: .7rem; opacity: .6; transition: transform .2s; }
.side-sub-toggle[aria-expanded="true"] .side-sub-caret { transform: rotate(180deg); }
.sidebar-backdrop { display: none; }

/* ---------- Main + page frame ---------- */
.app-main {
    margin-left: var(--sidebar-w); padding: calc(var(--header-h) + 1rem) 1rem calc(var(--footer-h) + 1rem);
    min-height: 100vh; transition: margin-left .2s ease;
}
.page-frame {
    background: #fff; border: 1px solid var(--erp-border); border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05); min-height: calc(100vh - var(--header-h) - var(--footer-h) - 2rem);
    display: flex; flex-direction: column;
}
.page-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.25rem; border-bottom: 1px solid var(--erp-border);
}
.page-title { font-size: 1.2rem; font-weight: 700; margin: 0; color: #1f2b36; }
.page-head .breadcrumb { margin: .15rem 0 0; font-size: .78rem; }
.page-head .breadcrumb a { text-decoration: none; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.page-body { padding: 1.25rem; flex: 1; }

/* ---------- Footer ---------- */
.app-footer {
    position: fixed; inset: auto 0 0 0; height: var(--footer-h); z-index: 1035;
    display: flex; align-items: center; justify-content: space-between; padding: 0 1rem;
    background: #fff; border-top: 1px solid var(--erp-border); color: #6c7a88; font-size: .78rem;
}

/* ---------- Collapsed sidebar (desktop, default) ----------
   Icons only; while the mouse is over it (.sidebar-peek) it opens over the page without moving it. */
@media (min-width: 992px) {
    .sidebar-mini .app-sidebar { width: var(--sidebar-mini-w); }
    .sidebar-mini .app-main { margin-left: var(--sidebar-mini-w); }
    .sidebar-mini:not(.sidebar-peek) .side-link span, .sidebar-mini:not(.sidebar-peek) .side-caret,
    .sidebar-mini:not(.sidebar-peek) .side-sub, .sidebar-mini:not(.sidebar-peek) .side-heading span { display: none !important; }
    .sidebar-mini:not(.sidebar-peek) .side-heading { padding: .6rem 0; border-top: 1px solid #eef1f4; margin: .4rem .5rem 0; }
    .sidebar-mini:not(.sidebar-peek) .side-link { justify-content: center; padding: .6rem 0; }
    .sidebar-mini.sidebar-peek .app-sidebar { width: var(--sidebar-w); box-shadow: 8px 0 24px rgba(16, 24, 40, .14); }
}

/* ---------- Tablet / mobile: off-canvas sidebar ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 30px rgba(0, 0, 0, .2); bottom: 0; z-index: 1050; }
    .sidebar-open .app-sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15, 23, 32, .45); z-index: 1045;
    }
    .app-main { margin-left: 0; }
}
@media (max-width: 575.98px) {
    .app-main { padding: calc(var(--header-h) + .6rem) .5rem calc(var(--footer-h) + .6rem); }
    .page-head { padding: .75rem .9rem; }
    .page-body { padding: .9rem; }
    .brand-text small { display: none; }
}

/* ---------- Dashboard pieces ---------- */
.stat-card {
    border: 1px solid var(--erp-border); border-radius: 12px; padding: 1rem 1.1rem; height: 100%;
    display: flex; align-items: center; gap: .9rem; background: #fff;
}
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; flex: none; color: var(--c, var(--erp-primary)); background: color-mix(in srgb, var(--c, #394a59) 12%, #fff);
}
.stat-card .label { color: #6c7a88; font-size: .78rem; font-weight: 500; }
.stat-card .value { font-size: 1.35rem; font-weight: 700; color: #1f2b36; line-height: 1.2; }

.module-card {
    display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; height: 100%;
    border: 1px solid var(--erp-border); border-radius: 12px; text-decoration: none; color: inherit; background: #fff;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 24, 40, .08); border-color: color-mix(in srgb, var(--c, #394a59) 45%, #fff); color: inherit; }
.module-card .stat-icon { width: 42px; height: 42px; font-size: 1.2rem; }
.module-card h6 { margin: 0 0 .2rem; font-weight: 600; color: #1f2b36; }
.module-card p { margin: 0; font-size: .78rem; color: #6c7a88; }

.section-hero {
    border-radius: 12px; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; color: #fff;
    background: linear-gradient(120deg, var(--c) 0%, color-mix(in srgb, var(--c) 65%, #000) 100%);
    display: flex; align-items: center; gap: 1rem;
}
.section-hero .hero-icon {
    width: 54px; height: 54px; border-radius: 14px; background: rgba(255, 255, 255, .18);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; flex: none;
}
.section-hero h2, .section-hero .h2-hero { font-size: 1.15rem; margin: 0; font-weight: 700; }
.section-hero p { margin: .15rem 0 0; opacity: .85; font-size: .85rem; }

.panel { border: 1px solid var(--erp-border); border-radius: 12px; background: #fff; height: 100%; }
.panel-head { padding: .75rem 1rem; border-bottom: 1px solid var(--erp-border); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel-body { padding: 1rem; }

.badge-soft { background: #eef1f5; color: #56636f; font-weight: 500; }
.badge-ready { background: #d1f2e0; color: #11683d; }
.badge-todo { background: #fff1dc; color: #9a5a0c; }

/* ---------- Tables ---------- */
.table-erp { margin: 0; }
.table-erp thead th {
    background: var(--erp-primary); color: #fff; font-weight: 600; font-size: .8rem; white-space: nowrap; border-color: var(--erp-primary);
}
.table-erp td { vertical-align: middle; }
.table-wrap { border: 1px solid var(--erp-border); border-radius: 10px; overflow: auto; }
.pagination { margin: 0; }
.page-link { color: var(--erp-primary); }
.active > .page-link { background: var(--erp-primary); border-color: var(--erp-primary); }

.toast { background: #fff; }
.panel-head a, .auth-card a, .breadcrumb a { text-decoration: none; }

/* ---------- User rights ---------- */
.rights-table td:not(:first-child), .rights-table th:not(:first-child) { width: 9%; }
.rights-table thead th { font-size: .72rem; font-weight: 600; color: #6c7a88; text-transform: uppercase; letter-spacing: .03em; background: #f7f9fb; white-space: nowrap; }
.rights-table td, .rights-table th { padding-top: .45rem; padding-bottom: .45rem; }
.rights-table .form-check-input { width: 1.05em; height: 1.05em; cursor: pointer; }
.rights-panel .panel-head { border-top: 3px solid var(--sec); border-radius: 12px 12px 0 0; }
.rights-savebar {
    position: sticky; bottom: calc(var(--footer-h) + .5rem); z-index: 5; margin-top: 1rem;
    display: flex; align-items: center; justify-content: flex-end; gap: .6rem;
    background: #fff; border: 1px solid var(--erp-border); border-radius: 10px; padding: .6rem .8rem;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .08);
}
.rights-savebar > span { margin-right: auto; }

/* ---------- Lists (DataTables 3) ---------- */
div.dt-container { font-size: .83rem; }
div.dt-container .dt-search input { width: 260px; max-width: 60vw; margin-left: 0 !important; }
div.dt-container .dt-length select { width: auto; }
div.dt-container .dt-layout-row:first-child { margin-top: 0; }
table.dataTable.table-erp > thead > tr > th { background: var(--erp-primary); color: #fff; border-color: #4a5c6c; }
table.dataTable.table-erp > thead .dt-column-order::before, table.dataTable.table-erp > thead .dt-column-order::after { color: #fff; opacity: .55; }
table.dataTable.table-erp > tbody > tr > td { padding-top: .35rem; padding-bottom: .35rem; }
table.dataTable.table-erp > tbody > tr.row-overdue > td:first-child { box-shadow: inset 3px 0 0 #dc3545; }
table.dataTable > tbody > tr > .sorting_1, table.dataTable > tbody > tr > .dt-ordering-asc, table.dataTable > tbody > tr > .dt-ordering-desc { background-color: #fffbe6; }
.dtfc-fixed-start, .dtfc-fixed-left { background: #fff; }
.status-badge { font-weight: 600; font-size: .72rem; }
.filter-bar { background: #f7f9fb; border: 1px solid var(--erp-border); border-radius: 10px; padding: .6rem .75rem .75rem; margin-left: 0; margin-right: 0; }
.filter-bar .form-label { color: #6c7a88; font-weight: 500; }

/* ---------- Enquiry detail ---------- */
.enq-head { border: 1px solid var(--erp-border); border-radius: 12px; padding: 1rem 1.1rem; background: linear-gradient(180deg, #fff, #f9fbfc); }
.enq-kpis { display: grid; grid-template-columns: repeat(4, minmax(110px, auto)); gap: .4rem 1.4rem; }
.enq-kpis small { display: block; color: #6c7a88; font-size: .72rem; }
.enq-kpis strong { font-size: .95rem; }
@media (max-width: 767.98px) { .enq-kpis { grid-template-columns: repeat(2, 1fr); width: 100%; } }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.2rem; padding: 1rem; margin: 0; }
.detail-grid dt { font-size: .72rem; font-weight: 600; color: #6c7a88; text-transform: uppercase; letter-spacing: .03em; }
.detail-grid dd { margin: .1rem 0 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: .75rem 1rem 1rem 1.6rem; max-height: 70vh; overflow: auto; }
.timeline > li { position: relative; padding: 0 0 .9rem .9rem; border-left: 2px solid #e3e8ee; }
.timeline > li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #8a96a3; }
.timeline > li.tl-created::before, .timeline > li.tl-imported::before { border-color: #394a59; background: #394a59; }
.timeline > li.tl-follow_up::before { border-color: #2a78d6; }
.timeline > li.tl-status::before { border-color: #eb6834; }
.timeline > li.tl-transfer::before { border-color: #6f42c1; }
.tl-meta { font-size: .75rem; color: #6c7a88; }
.tl-note { margin-top: .15rem; }
.tl-changes { list-style: none; padding: 0; margin: .2rem 0 0; font-size: .78rem; }
.tl-changes del { color: #8a96a3; }

/* ---------- Forms ---------- */
.form-savebar {
    position: sticky; bottom: calc(var(--footer-h) + .5rem); z-index: 5; margin-top: 1rem;
    display: flex; justify-content: flex-end; gap: .5rem; background: #fff; border: 1px solid var(--erp-border);
    border-radius: 10px; padding: .6rem .8rem; box-shadow: 0 6px 20px rgba(16, 24, 40, .08);
}
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0; }
.ts-control { border-radius: var(--bs-border-radius); min-height: calc(1.5em + .75rem + 2px); }

/* ---------- Follow-up / pending ---------- */
.followup-tabs .nav-link { color: #33414e; border: 1px solid var(--erp-border); padding: .35rem .8rem; font-size: .85rem; }
.followup-tabs .nav-link.active { background: var(--erp-primary); border-color: var(--erp-primary); color: #fff; }
.age-chip { border: 1px solid var(--erp-border); border-radius: 10px; padding: .45rem .9rem; display: flex; align-items: baseline; gap: .45rem; background: #fff; }
.age-chip strong { font-size: 1.15rem; }
.age-chip span { color: #6c7a88; font-size: .8rem; }
.age-chip.age-old { border-color: #f1b0b7; background: #fff5f6; }
.min-w-0 { min-width: 0; }

@media print {
    .app-header, .app-sidebar, .app-footer, .page-actions, .form-savebar, .toast-container { display: none !important; }
    .app-main { margin: 0 !important; padding: 0 !important; }
    .page-frame { border: 0; box-shadow: none; }
}

/* ---------- Enquiry widget (Marketing dashboard) ---------- */
.ew-tile { display: block; height: 100%; border: 1px solid var(--erp-border); border-radius: 10px; padding: .7rem .85rem; background: #fff; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.ew-tile:hover { border-color: #b8c4d0; box-shadow: 0 4px 14px rgba(16, 24, 40, .06); color: inherit; }
.ew-label { font-size: .8rem; color: #33414e; display: flex; align-items: center; gap: .4rem; }
.ew-label i { color: #56636f; font-size: .85rem; }
.ew-value { font-size: 1.6rem; font-weight: 700; color: #1f2b36; line-height: 1.25; }
.ew-slash { font-size: 1rem; color: #8a96a3; font-weight: 500; }
.ew-sub { font-size: .74rem; color: #6c7a88; }
.ew-panel { border: 1px solid var(--erp-border); border-radius: 10px; padding: .85rem 1rem; background: #fff; }
.ew-title { font-weight: 600; margin-bottom: .6rem; }
.ew-months { display: flex; align-items: flex-end; gap: .45rem; height: 190px; padding-top: 1.1rem; border-bottom: 1px solid #e3e8ee; }
.ew-month { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.ew-bar { width: 72%; max-width: 34px; background: #2a78d6; border-radius: 4px 4px 0 0; }
.ew-num { font-size: .72rem; color: #56636f; margin-bottom: .2rem; }
.ew-mlabel { position: absolute; bottom: -1.4rem; font-size: .74rem; color: #8a96a3; }
.ew-panel .ew-months { margin-bottom: 1.6rem; }
.ew-prow { display: grid; grid-template-columns: minmax(0, 38%) 1fr 2.2rem; align-items: center; gap: .6rem; font-size: .82rem; padding: .18rem 0; }
.ew-ptrack { height: 11px; background: transparent; }
.ew-pbar { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; min-width: 3px; }
.ew-pnum { text-align: right; color: #33414e; }

/* Tom Select dropdowns attached to <body> must float above panels and the sticky save bar */
body > .ts-dropdown { z-index: 1060; }

/* Financial-year switcher in the header */
button.fy-chip { cursor: pointer; }
button.fy-chip:hover { background: rgba(240, 147, 43, .38); }
.fy-chip.fy-other { background: #f0932b; color: #fff; }
.filter-bar .d-flex > input[type="date"] { min-width: 0; flex: 1 1 0; }

/* Marketing dashboard sections (Enquiry / Drawing) */
.dash-section + .dash-section { margin-top: 2rem; }
.dash-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding-bottom: .6rem; margin-bottom: 1rem; border-bottom: 2px solid #fd7e14;
}
.dash-section-head h2 { font-size: 1.1rem; font-weight: 700; margin: 0; color: #1f2b36; display: flex; align-items: center; gap: .5rem; }
.dash-section-head h2 .bi { color: #fd7e14; }

/* Profile photos */
img.avatar.avatar-img { object-fit: cover; background: #eef1f5; padding: 0; border: 1px solid rgba(0, 0, 0, .06); }
.app-header img.avatar.avatar-img { border-color: rgba(255, 255, 255, .5); }
.photo-preview .avatar { font-size: 1.9rem !important; }

/* Dashboard calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: .72rem; font-weight: 700; color: #6c7a88; text-transform: uppercase; text-align: center; padding: .25rem 0; }
.cal-dow.is-sun { color: #c0392b; }
.cal-day {
    min-height: 84px; border: 1px solid var(--erp-border); border-radius: 8px; padding: .3rem .35rem; background: #fff;
    display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative;
}
.cal-day.is-out { background: #f8f9fb; opacity: .55; }
.cal-day.is-off { background: #fdf3f2; }
.cal-day.is-off .cal-num { color: #c0392b; }
.cal-num { font-weight: 600; font-size: .85rem; color: #1f2b36; line-height: 1.4; }
.cal-day.is-today { border: 2px solid #fd7e14; }
.cal-day.is-today .cal-num { background: #fd7e14; color: #fff; border-radius: 50%; width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center; }
.cal-hol { font-size: .68rem; line-height: 1.2; padding: 1px 4px; border-radius: 4px; color: #fff; background-color: var(--hc); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day.is-hol { background-color: var(--hb); border-color: var(--hbd); }
/* Holiday colours as fixed values (hc = text/pill, hb = day background, hbd = day border, hd = date badge). */
.h-public   { --hc: #c0392b; --hb: #f9edec; --hbd: #e9bab5; --hd: #f7e7e5; }
.h-festival { --hc: #e8590c; --hb: #fdf0e9; --hbd: #f7c5aa; --hd: #fceee6; }
.h-optional { --hc: #6f42c1; --hb: #f2eef9; --hbd: #cdbde9; --hd: #f1ecf9; }
.h-company  { --hc: #0f7b8a; --hb: #e9f3f5; --hbd: #abd1d6; --hd: #e2f1f3; }
.cal-marks { margin-top: auto; display: flex; flex-wrap: wrap; gap: 3px; }
.cal-chip { font-size: .68rem; font-weight: 600; text-decoration: none; border-radius: 10px; padding: 0 5px; display: inline-flex; align-items: center; gap: 3px; }
.cal-chip.chip-fu { background: #e7f0fc; color: #1a5fb4; } .cal-chip.chip-dw { background: #f0eafb; color: #5a32a3; }
.cal-chip:hover { filter: brightness(.95); }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.cal-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--hc); margin-right: 4px; vertical-align: -1px; }
.cal-legend .lg-off { background: #f6d5d1; }
.hol-date { flex: none; width: 44px; text-align: center; border-radius: 8px; background-color: var(--hd); color: var(--hc); font-size: .7rem; line-height: 1.1; padding: .3rem 0; text-transform: uppercase; }
.hol-date b { display: block; font-size: 1.05rem; }
@media (max-width: 575.98px) {
    .cal-grid { gap: 2px; }
    .cal-day { min-height: 54px; padding: .15rem; }
    .cal-hol { font-size: 0; height: 5px; padding: 0; }
    .cal-chip { font-size: .6rem; padding: 0 3px; } .cal-chip i { display: none; }
    .cal-num { font-size: .75rem; }
}

/* Holiday List: weekly offs */
.weekly-off-table td, .weekly-off-table th { vertical-align: middle; }
.weekly-off-table .wk-boxes { display: inline-flex; flex-wrap: wrap; gap: .25rem .75rem; }
.weekly-off-table tr:not(.mode-some) .wk-boxes { opacity: .35; pointer-events: none; }
#masterTable th.dt-type-date, #masterTable td.dt-type-date { text-align: left; }

/* Header clock: fixed-width digits so the chip does not jump every second */
#clockChip .clock-text { font-variant-numeric: tabular-nums; }

/* Enquiry status "New" (added on Enquiry New, details not filled in yet) */
.text-bg-new { background-color: #7048e8 !important; color: #fff !important; }
.text-bg-confirmed { background-color: #0ca678 !important; color: #fff !important; }

/* ---- CAPITALS across the portal (data is stored in capitals; fixed choices are shown in capitals).
   E-mail addresses, passwords, web addresses and the mail-server settings keep their case (.keep-case). ---- */
select.form-select, select.form-select option, .ts-control, .ts-control .item, .ts-control input, .ts-dropdown .option, .ts-dropdown .optgroup-header,
input.form-control:not([type=email]):not([type=password]):not([type=url]):not(.keep-case), textarea.form-control:not(.keep-case),
.table > tbody > tr > td, .detail-grid dd, .badge { text-transform: uppercase; }
.ts-control input::placeholder, input.form-control::placeholder, textarea.form-control::placeholder { text-transform: none; }
.keep-case, .keep-case * , a[href^="mailto:"] { text-transform: none !important; }

/* Space between stacked sections: a panel (or a form holding one) that follows another block gets a gap.
   (Panels side by side in grid columns are first in their column and are not affected; block margins collapse,
   so sections that already had mb-3 do not get a double gap.) */
.page-body :is(div, form, section, p, ul, table) + :is(.panel, form:has(> .panel)) { margin-top: 1rem; }
/* … and a grid row of panels that follows a panel: the row pulls up by its gutter, so give exactly a 1rem gap */
.page-body :is(.panel:not([class*="mb-"]), form:not([class*="mb-"]):has(> .panel:last-child:not([class*="mb-"]))) + .row { margin-top: calc(1rem - var(--bs-gutter-y, 0px)); }
/* A table / list that ends a panel follows the panel's rounded bottom corners (its square cells and last row line
   used to run over the corners) */
.panel > :is(.table-responsive, .list-group, table):last-child,
.panel > form:last-child > :is(.table-responsive, .list-group, table):last-child { border-bottom-left-radius: 11px; border-bottom-right-radius: 11px; overflow: hidden; }
.panel > .table-responsive:last-child { overflow-x: auto; }
.panel > :is(.table-responsive, form):last-child > table:last-child > :is(tbody, tfoot):last-child > tr:last-child > :is(td, th),
.panel > table:last-child > :is(tbody, tfoot):last-child > tr:last-child > :is(td, th) { border-bottom-width: 0; }
.panel > .list-group-flush:last-child > .list-group-item:last-child { border-bottom-width: 0; }
/* Dashboard calendar: due dates of the user's departments (App\Support\DueDates) */
.cal-chip.chip-mr { background: #fff3dc; color: #8a5a00; } .cal-chip.chip-pr { background: #e3f4ec; color: #146c43; }
.cal-chip.chip-rfq { background: #e6f6fa; color: #0b6e83; } .cal-chip.chip-po { background: #eef0f3; color: #394a59; }
.cal-chip.is-late { background: #fbe1df; color: #b02a37; }
/* PO line GST: fixed from the item's single tax (not changeable) */
select.gst-fixed { pointer-events: none; background-color: #f3f5f7; background-image: none; padding-right: .5rem; }
