/* ============================================================================
   Meridian system theme
   ----------------------------------------------------------------------------
   The system was built on Bootstrap with the default palette, which is why it
   looked identical to APM. This file re-skins it from one place: brand tokens,
   Bootstrap component overrides, and polish for the shared shell.

   It is loaded AFTER each layout's inline <style> so it wins on colour, and it
   touches presentation only -- no layout structure, no behaviour. Every rule
   here changes how something looks, never what it does.

   Brand colours are sampled from the logo: navy #00296c, teal #019196.
   ========================================================================== */

:root {
    --m-navy-900: #00122c;
    --m-navy-800: #001740;
    --m-navy-700: #002057;
    --m-navy-600: #00296c;
    --m-navy-500: #00337f;
    --m-navy-400: #1f4ea3;

    --m-teal-600: #017a7f;
    --m-teal-500: #019196;
    --m-teal-400: #2aa9ac;
    --m-teal-300: #5cc5c6;
    --m-teal-100: #c8ecec;
    --m-teal-50: #e8f7f7;

    /* Neutral greys, not blue-tinted ones. The brand navy and teal are for
       actions and accents; surfaces stay quiet so the colour coding reads. */
    --m-ink: #1a1d23;
    --m-body: #434a55;
    --m-muted: #737b88;
    --m-line: #e4e6ea;
    --m-line-soft: #eeeff2;
    --m-surface: #ffffff;
    --m-canvas: #f7f8f9;
    --m-canvas-2: #f0f1f4;

    /* Dark chrome: graphite, with only a trace of blue. */
    --m-chrome: #1b2028;
    --m-chrome-2: #232932;
    --m-chrome-line: rgba(255, 255, 255, 0.08);

    --m-ok: #0d9488;
    --m-warn: #b45309;
    --m-bad: #b91c1c;

    --m-r-sm: 0.5rem;
    --m-r: 0.75rem;
    --m-r-lg: 1rem;

    --m-sh-sm: 0 1px 2px rgba(0, 18, 44, 0.05);
    --m-sh: 0 1px 3px rgba(0, 18, 44, 0.07), 0 1px 2px rgba(0, 18, 44, 0.04);
    --m-sh-md: 0 6px 16px -4px rgba(0, 18, 44, 0.10), 0 2px 6px -2px rgba(0, 18, 44, 0.05);
    --m-sh-lg: 0 18px 36px -12px rgba(0, 18, 44, 0.16), 0 4px 10px -4px rgba(0, 18, 44, 0.06);

    /* Bootstrap's own variables, repointed at the brand. */
    --bs-primary: #00296c;
    --bs-primary-rgb: 0, 41, 108;
    --bs-link-color: #00337f;
    --bs-link-hover-color: #017a7f;
    --bs-body-color: #434a55;
    --bs-border-color: #e4e6ea;
    --bs-border-radius: 0.75rem;
    --bs-border-radius-sm: 0.5rem;
    --bs-border-radius-lg: 1rem;
}

/* ------------------------------------------------------------- typography */

body {
    font-family: "Inter Tight", "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--m-body);
    background: var(--m-canvas);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--m-ink);
    font-weight: 600;
    letter-spacing: -0.018em;
}

.text-muted { color: var(--m-muted) !important; }
.small, small { letter-spacing: 0; }

a { color: var(--bs-link-color); text-underline-offset: 2px; }
a:hover { color: var(--bs-link-hover-color); }

.font-mono, .m-mono {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* A shared focus treatment, so keyboard use is obvious and on-brand. */
:focus-visible {
    outline: 2px solid var(--m-teal-500);
    outline-offset: 2px;
    box-shadow: none;
}

::selection { background: var(--m-teal-100); color: var(--m-navy-800); }

/* ---------------------------------------------------------------- surfaces */

.card,
.eh-card {
    border: 1px solid var(--m-line) !important;
    border-radius: var(--m-r) !important;
    background: var(--m-surface);
    box-shadow: var(--m-sh-sm) !important;
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover,
.eh-card:hover { box-shadow: var(--m-sh-md) !important; }

.card-header {
    border-bottom: 1px solid var(--m-line-soft) !important;
    background: transparent !important;
    color: var(--m-ink);
    font-weight: 600;
    padding: 0.95rem 1.15rem;
}

.card-body { padding: 1.15rem; }
.card-footer { border-top: 1px solid var(--m-line-soft) !important; background: transparent !important; }

.shadow, .shadow-sm { box-shadow: var(--m-sh) !important; }
.shadow-lg { box-shadow: var(--m-sh-lg) !important; }
.border { border-color: var(--m-line) !important; }
.rounded, .rounded-3 { border-radius: var(--m-r) !important; }
.rounded-4 { border-radius: var(--m-r-lg) !important; }

/* ----------------------------------------------------------------- buttons */

.btn {
    --bs-btn-focus-box-shadow: none;
    border-radius: var(--m-r-sm);
    font-weight: 500;
    letter-spacing: -0.003em;
    padding: 0.5rem 1rem;
    transition: background-color 0.18s ease, border-color 0.18s ease,
                color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    --bs-btn-bg: var(--m-navy-600);
    --bs-btn-border-color: var(--m-navy-600);
    --bs-btn-hover-bg: var(--m-navy-500);
    --bs-btn-hover-border-color: var(--m-navy-500);
    --bs-btn-active-bg: var(--m-navy-700);
    --bs-btn-active-border-color: var(--m-navy-700);
    --bs-btn-disabled-bg: var(--m-navy-400);
    --bs-btn-disabled-border-color: var(--m-navy-400);
    box-shadow: var(--m-sh-sm);
}

.btn-success {
    --bs-btn-bg: var(--m-teal-500);
    --bs-btn-border-color: var(--m-teal-500);
    --bs-btn-hover-bg: var(--m-teal-400);
    --bs-btn-hover-border-color: var(--m-teal-400);
    --bs-btn-active-bg: var(--m-teal-600);
    --bs-btn-active-border-color: var(--m-teal-600);
}

.btn-outline-primary {
    --bs-btn-color: var(--m-navy-600);
    --bs-btn-border-color: var(--m-navy-600);
    --bs-btn-hover-bg: var(--m-navy-600);
    --bs-btn-hover-border-color: var(--m-navy-600);
    --bs-btn-active-bg: var(--m-navy-700);
}

.btn-outline-secondary {
    --bs-btn-color: var(--m-body);
    --bs-btn-border-color: var(--m-line);
    --bs-btn-hover-bg: var(--m-canvas-2);
    --bs-btn-hover-border-color: #c9d6e6;
    --bs-btn-hover-color: var(--m-ink);
}

.btn-light {
    --bs-btn-bg: #ffffff;
    --bs-btn-border-color: var(--m-line);
    --bs-btn-hover-bg: var(--m-canvas-2);
    --bs-btn-color: var(--m-body);
}

.btn-link { color: var(--bs-link-color); text-decoration: none; }
.btn-link:hover { color: var(--bs-link-hover-color); text-decoration: underline; }

/* ------------------------------------------------------------------- forms */

.form-control,
.form-select {
    border-color: var(--m-line);
    border-radius: var(--m-r-sm);
    color: var(--m-ink);
    padding: 0.55rem 0.8rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control::placeholder { color: #9fb0c6; }

.form-control:focus,
.form-select:focus {
    border-color: var(--m-teal-400);
    box-shadow: 0 0 0 3px rgba(1, 145, 150, 0.14);
}

.form-control:disabled,
.form-select:disabled { background: var(--m-canvas-2); color: var(--m-muted); }

.form-label { color: var(--m-ink); font-weight: 500; margin-bottom: 0.35rem; }
.form-text { color: var(--m-muted); }

.form-check-input:checked { background-color: var(--m-teal-500); border-color: var(--m-teal-500); }
.form-check-input:focus { border-color: var(--m-teal-400); box-shadow: 0 0 0 3px rgba(1, 145, 150, 0.14); }

.input-group-text { background: var(--m-canvas-2); border-color: var(--m-line); color: var(--m-muted); }

.is-invalid, .form-control.is-invalid, .form-select.is-invalid { border-color: var(--m-bad); }
.invalid-feedback { color: var(--m-bad); }

/* ------------------------------------------------------------------ tables */

.table {
    --bs-table-color: var(--m-body);
    --bs-table-border-color: var(--m-line-soft);
    margin-bottom: 0;
}

.table > thead {
    position: relative;
}

.table > thead th {
    background: var(--m-canvas-2);
    border-bottom: 1px solid var(--m-line) !important;
    color: var(--m-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0.7rem 0.85rem;
}

.table > tbody > tr > td {
    border-color: var(--m-line-soft);
    padding: 0.7rem 0.85rem;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--m-teal-50);
    background-color: var(--m-teal-50);
    color: var(--m-ink);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #fafcfe;
    background-color: #fafcfe;
}

/* Numeric columns line up. */
.table td.num, .table th.num, .table .text-end { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ badges */

.badge {
    border-radius: 999px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.38em 0.7em;
}

.badge.bg-primary { background: var(--m-navy-600) !important; }
.badge.bg-success { background: var(--m-teal-500) !important; }
.badge.bg-info { background: var(--m-teal-400) !important; color: #fff !important; }
.badge.text-bg-light { background: var(--m-canvas-2) !important; color: var(--m-body) !important; border-color: var(--m-line) !important; }
.badge.text-bg-primary { background: var(--m-navy-600) !important; color: #fff !important; }
.badge.text-bg-success { background: var(--m-teal-50) !important; color: var(--m-teal-600) !important; }

/* ------------------------------------------------------------------ alerts */

.alert { border-radius: var(--m-r); border-width: 1px; padding: 0.85rem 1rem; }
.alert-success { background: var(--m-teal-50); border-color: var(--m-teal-100); color: var(--m-teal-600); }
.alert-info { background: #eef4fd; border-color: #d6e4f8; color: var(--m-navy-500); }
.alert-danger { background: #fdf0f0; border-color: #f7d7d7; color: var(--m-bad); }
.alert-warning { background: #fdf6ec; border-color: #f6e5c8; color: var(--m-warn); }

/* ------------------------------------------------------------- app chrome */

.eh-navbar,
.hr-navbar,
.navbar-dark.bg-dark {
    background: var(--m-chrome) !important;
    border-bottom: 1px solid var(--m-chrome-line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.eh-navbar .navbar-brand,
.hr-navbar .navbar-brand {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.eh-sidebar,
.hr-sidebar {
    background: var(--m-chrome) !important;
    border-right: 1px solid var(--m-chrome-line) !important;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.eh-sidebar::-webkit-scrollbar-thumb,
.hr-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-color: transparent;
}

.eh-sidebar .nav-link,
.hr-sidebar .nav-link {
    color: #b8c9de;
    border-radius: var(--m-r-sm);
    border-color: transparent;
    font-weight: 450;
}

.eh-sidebar .nav-link:hover,
.hr-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

/* Section colour coding lives in its own block below. */

/* ------------------------------------------------------------------- misc */

.nav-tabs { border-bottom-color: var(--m-line); }
.nav-tabs .nav-link { border: 0; color: var(--m-muted); font-weight: 500; padding: 0.6rem 0.9rem; }
.nav-tabs .nav-link:hover { color: var(--m-ink); }
.nav-tabs .nav-link.active {
    color: var(--m-navy-600);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--m-teal-500);
}

.pagination { --bs-pagination-color: var(--m-body); --bs-pagination-border-color: var(--m-line); }
.page-item.active .page-link { background: var(--m-navy-600); border-color: var(--m-navy-600); }
.page-link:focus { box-shadow: 0 0 0 3px rgba(1, 145, 150, 0.14); }

.modal-content { border: 0; border-radius: var(--m-r-lg); box-shadow: var(--m-sh-lg); }
.modal-header, .modal-footer { border-color: var(--m-line-soft); }

.dropdown-menu {
    border: 1px solid var(--m-line);
    border-radius: var(--m-r);
    box-shadow: var(--m-sh-md);
    padding: 0.35rem;
}
.dropdown-item { border-radius: var(--m-r-sm); padding: 0.5rem 0.7rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--m-teal-50); color: var(--m-navy-600); }

.progress { background: var(--m-canvas-2); border-radius: 999px; }
.progress-bar { background: var(--m-teal-500); }

.list-group-item { border-color: var(--m-line-soft); }
.list-group-item.active { background: var(--m-navy-600); border-color: var(--m-navy-600); }

hr { border-color: var(--m-line); opacity: 1; }

.text-primary { color: var(--m-navy-600) !important; }
.bg-primary { background-color: var(--m-navy-600) !important; }
.bg-light { background-color: var(--m-canvas-2) !important; }
.border-primary { border-color: var(--m-navy-600) !important; }

/* Long tables should scroll inside their own container, not the page. */
.table-responsive { border-radius: var(--m-r-sm); }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ==================================================== sidebar colour coding
 *
 * The layout already defines a --sidebar-accent per module group. An earlier
 * pass of this file flattened all six to one grey hairline, which threw the
 * coding away -- this restores it and pushes it further: the group's colour
 * now drives the section title, the icons, the active pill, and the rail,
 * so you can find a module by colour before reading a word.
 *
 * Hues are spaced around the wheel so no two groups read alike, and tuned for
 * legibility on the graphite sidebar rather than for vividness.
 */

.eh-sidebar .section-title-employee,
.eh-sidebar .sidebar-section-employee,
#sidebarOffcanvas .section-title-employee,
#sidebarOffcanvas .sidebar-section-employee {
    --sidebar-accent: #5cc5c6;                        /* brand teal — people */
    --sidebar-accent-soft: rgba(92, 197, 198, 0.16);
}

.eh-sidebar .section-title-operations,
.eh-sidebar .sidebar-section-operations,
#sidebarOffcanvas .section-title-operations,
#sidebarOffcanvas .sidebar-section-operations {
    --sidebar-accent: #6cb3f0;                        /* sky — cargo moving */
    --sidebar-accent-soft: rgba(108, 179, 240, 0.16);
}

.eh-sidebar .section-title-billing,
.eh-sidebar .sidebar-section-billing,
#sidebarOffcanvas .section-title-billing,
#sidebarOffcanvas .sidebar-section-billing {
    --sidebar-accent: #74cf98;                        /* green — money in */
    --sidebar-accent-soft: rgba(116, 207, 152, 0.16);
}

.eh-sidebar .section-title-accounting,
.eh-sidebar .sidebar-section-accounting,
#sidebarOffcanvas .section-title-accounting,
#sidebarOffcanvas .sidebar-section-accounting {
    --sidebar-accent: #e9b45c;                        /* amber — the ledger */
    --sidebar-accent-soft: rgba(233, 180, 92, 0.16);
}

.eh-sidebar .section-title-technical,
.eh-sidebar .sidebar-section-technical,
#sidebarOffcanvas .section-title-technical,
#sidebarOffcanvas .sidebar-section-technical {
    --sidebar-accent: #ef9a76;                        /* clay — maintenance */
    --sidebar-accent-soft: rgba(239, 154, 118, 0.16);
}

.eh-sidebar .section-title-admin,
.eh-sidebar .sidebar-section-admin,
#sidebarOffcanvas .section-title-admin,
#sidebarOffcanvas .sidebar-section-admin {
    --sidebar-accent: #b49bea;                        /* violet — controls */
    --sidebar-accent-soft: rgba(180, 155, 234, 0.16);
}

/* --------------------------------------------------- applying the accent */

.eh-sidebar .section-title,
#sidebarOffcanvas .section-title {
    color: var(--sidebar-accent, #98a2b0) !important;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.14em !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* A dot of the group's colour, so the section reads at a glance. */
.eh-sidebar .section-title::after,
#sidebarOffcanvas .section-title::after {
    content: "";
    order: -1;
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 999px;
    background: var(--sidebar-accent, #98a2b0);
    box-shadow: 0 0 0 3px var(--sidebar-accent-soft, transparent);
}

.eh-sidebar .section-title:hover,
.eh-sidebar .section-title:focus,
#sidebarOffcanvas .section-title:hover {
    background: var(--sidebar-accent-soft, rgba(255, 255, 255, 0.05)) !important;
    color: #ffffff !important;
}

.eh-sidebar .sidebar-section,
#sidebarOffcanvas .sidebar-section {
    border-left: 2px solid var(--sidebar-accent, rgba(255, 255, 255, 0.12)) !important;
    border-left-color: var(--sidebar-accent, rgba(255, 255, 255, 0.12)) !important;
}

/* Links inherit their group's colour on hover and when active. */
.eh-sidebar .nav-link,
#sidebarOffcanvas .nav-link {
    color: #aeb6c2;
    border-radius: var(--m-r-sm);
    border-color: transparent;
    font-weight: 450;
}

.eh-sidebar .nav-link i,
#sidebarOffcanvas .nav-link i {
    color: var(--sidebar-accent, #8b94a3);
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

.eh-sidebar .nav-link:hover,
#sidebarOffcanvas .nav-link:hover {
    background: var(--sidebar-accent-soft, rgba(255, 255, 255, 0.06)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

.eh-sidebar .nav-link:hover i,
#sidebarOffcanvas .nav-link:hover i { opacity: 1; }

.eh-sidebar .nav-link.active,
#sidebarOffcanvas .nav-link.active {
    background: var(--sidebar-accent-soft, rgba(255, 255, 255, 0.10)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    font-weight: 500;
}

.eh-sidebar .nav-link.active i,
#sidebarOffcanvas .nav-link.active i { opacity: 1; }

.eh-sidebar .nav-link.active::before,
#sidebarOffcanvas .nav-link.active::before {
    background: var(--sidebar-accent, var(--m-teal-300)) !important;
}

/* The HR sidebar is a flat list with no groups, so it carries one brand
   accent rather than pretending to be colour coded. */
.hr-sidebar .nav-link { color: #aeb6c2; }
.hr-sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.06) !important; color: #fff !important; }
.hr-sidebar .nav-link.active {
    background: rgba(1, 145, 150, 0.18) !important;
    color: #ffffff !important;
}
.hr-sidebar .nav-link.active::before { background: var(--m-teal-300) !important; }
