/* =====================================================================
   DRD-IMD — Executive Dashboard styles
   Palette: black + yellow (branding) with light-grey workspace + accent colours
   ===================================================================== */

:root {
    /* Brand */
    --brand-yellow: #f5c400;
    --brand-yellow-dark: #d0a600;
    --brand-yellow-soft: rgba(245, 196, 0, 0.15);
    --brand-black: #111111;
    --brand-black-2: #1c1c1f;
    --brand-white: #ffffff;

    /* Neutrals */
    --grey-25:  #fbfbfc;
    --grey-50:  #f4f5f7;
    --grey-100: #eef0f3;
    --grey-150: #e4e7eb;
    --grey-200: #d9dde2;
    --grey-300: #c2c7ce;
    --grey-400: #9aa0a8;
    --grey-500: #6b7280;
    --grey-600: #4b5563;
    --grey-700: #333941;
    --grey-800: #24272d;
    --grey-900: #17181c;

    /* Accents */
    --accent-blue:   #2c6ef2;
    --accent-blue-soft:   rgba(44, 110, 242, 0.12);
    --accent-green:  #2f8a3e;
    --accent-green-soft:  rgba(47, 138, 62, 0.14);
    --accent-orange: #e68a00;
    --accent-orange-soft: rgba(230, 138, 0, 0.14);
    --accent-red:    #d43a3a;
    --accent-red-soft:    rgba(212, 58, 58, 0.14);
    --accent-purple: #7b3fe4;
    --accent-purple-soft: rgba(123, 63, 228, 0.14);
    --accent-cyan:   #0fa3b1;
    --accent-cyan-soft:   rgba(15, 163, 177, 0.14);
    --accent-high:   #e05500;

    /* Semantic */
    --danger:  var(--accent-red);
    --warn:    var(--accent-orange);
    --success: var(--accent-green);
    --info:    var(--accent-blue);

    /* Structural */
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   14px;
    --shadow-sm:   0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow:      0 2px 6px rgba(16, 24, 40, 0.06);
    --shadow-md:   0 4px 12px rgba(16, 24, 40, 0.08);
    --border:      1px solid var(--grey-150);

    /* Layout */
    --topbar-h:    64px;
    --sidebar-w:   240px;
    --sidebar-w-collapsed: 68px;
}

html[data-theme="dark"] {
    --brand-white: #17181c;
    --grey-25:  #17181c;
    --grey-50:  #1c1d22;
    --grey-100: #24262c;
    --grey-150: #2b2e35;
    --grey-200: #363a43;
    --grey-300: #4a4f59;
    --grey-400: #6b7180;
    --grey-500: #8a90a0;
    --grey-600: #a9afbc;
    --grey-700: #d2d6dd;
    --grey-800: #e6e8ec;
    --grey-900: #f4f5f7;
    --brand-black: #0a0a0c;
    --shadow:      0 2px 6px rgba(0,0,0,0.4);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--grey-900);
    background: var(--grey-50);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* =============== APP SHELL LAYOUT =============== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
        "topbar topbar"
        "sidebar workspace";
    min-height: 100vh;
    transition: grid-template-columns .2s ease;
}
body.sidebar-collapsed .app-shell { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.topbar   { grid-area: topbar; }
.sidebar  { grid-area: sidebar; }
.workspace{ grid-area: workspace; }

/* =============== TOP BAR =============== */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    background: var(--brand-black);
    color: var(--brand-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 60;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--brand-yellow); min-width: calc(var(--sidebar-w) - 24px);
    padding-right: 12px;
}
.brand-shield {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(245, 196, 0, 0.12);
    color: var(--brand-yellow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; letter-spacing: 1px; font-size: 20px; color: var(--brand-yellow); }
.brand-sub  { font-size: 11px; color: #cfcfd3; margin-top: 2px; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.nav-link {
    position: relative;
    display: inline-flex; align-items: center;
    padding: 22px 14px;
    color: #e5e5e7;
    font-weight: 500;
    font-size: 14px;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .15s;
}
.nav-link:hover { color: var(--brand-yellow); }
.nav-link.active { color: var(--brand-yellow); font-weight: 700; }
.nav-link.active::after {
    content: "";
    position: absolute; left: 14px; right: 14px; bottom: 10px; height: 3px;
    background: var(--brand-yellow); border-radius: 2px;
}
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--brand-white); color: var(--grey-900);
    box-shadow: var(--shadow-md); border-radius: var(--radius);
    min-width: 220px; padding: 6px 0; z-index: 80;
    border: var(--border);
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 10px 16px; font-size: 14px; }
.dropdown-menu a:hover { background: var(--grey-50); color: var(--brand-black); }

.notif-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 6px;
    background: var(--accent-red); color: #fff;
    border-radius: 999px; font-size: 10px; font-weight: 800;
    margin-left: 6px;
}

.topbar-tools { display: flex; align-items: center; gap: 12px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06);
    color: #fff; border: 0; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: inline; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--grey-700); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; }
.user-role { color: #b8bcc4; font-size: 11px; }
.user-logout { color: #b8bcc4; padding: 6px; border-radius: 6px; }
.user-logout:hover { color: var(--brand-yellow); background: rgba(255,255,255,0.06); }

/* =============== SIDEBAR =============== */
.sidebar {
    background: var(--brand-black);
    color: #d4d5da;
    display: flex; flex-direction: column;
    padding: 12px 8px 16px;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    z-index: 40;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 8px;
    color: #c9cad0; font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden;
}
.side-link svg { flex: 0 0 auto; }
.side-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.side-link.active {
    background: var(--brand-yellow);
    color: var(--brand-black);
    font-weight: 700;
}
.side-link.active:hover { background: var(--brand-yellow-dark); }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-collapse {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: transparent; color: #b0b2b8;
    border: 0; cursor: pointer; font-size: 13px;
    border-radius: 8px;
}
.side-collapse:hover { color: #fff; background: rgba(255,255,255,0.05); }

.help-card {
    background: #202024;
    border-radius: 12px;
    padding: 14px;
    display: flex; gap: 10px;
    color: #d4d5da;
}
.help-icon {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--brand-yellow-soft); color: var(--brand-yellow);
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 30px;
}
.help-body { display: flex; flex-direction: column; gap: 4px; }
.help-body strong { color: #fff; font-size: 13px; }
.help-body p { margin: 0; color: #a9abb1; font-size: 12px; line-height: 1.35; }
.help-body .btn { margin-top: 6px; align-self: start; }

.version-footer {
    text-align: left; color: #7c7e85; font-size: 11px; padding: 0 6px;
    border-top: 1px solid #26272c; padding-top: 10px;
}

/* --- Collapsed sidebar --- */
body.sidebar-collapsed .side-link span,
body.sidebar-collapsed .side-collapse span,
body.sidebar-collapsed .help-card,
body.sidebar-collapsed .version-footer { display: none; }
body.sidebar-collapsed .side-link { justify-content: center; padding: 12px; }
body.sidebar-collapsed .side-collapse { justify-content: center; }
body.sidebar-collapsed .side-collapse svg { transform: rotate(180deg); }

/* =============== WORKSPACE =============== */
.workspace {
    background: var(--grey-50);
    padding: 20px 24px 24px;
    display: flex; flex-direction: column; gap: 16px;
    min-width: 0;
}
.workspace-footer {
    margin-top: auto;
    padding: 14px 4px 0;
    border-top: 1px solid var(--grey-150);
    display: flex; justify-content: space-between;
    color: var(--grey-500); font-size: 12px;
}
.footer-tag { color: var(--grey-500); }

/* =============== ANON MAIN (login) =============== */
.anon-main { padding: 0; }

/* =============== SHARED CARD / SURFACES =============== */
.card, .surface {
    background: var(--brand-white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.page-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.muted { color: var(--grey-500); }
.pre { white-space: pre-wrap; }
.app-main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.app-footer { padding: 12px 20px; color: var(--grey-500); font-size: 12px; text-align: center; }

/* =============== DASHBOARD HEADER =============== */
.dash-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
}
.dash-title h1 {
    margin: 0; font-size: 28px; font-weight: 800; color: var(--grey-900);
    position: relative; display: inline-block;
}
.dash-title h1::after {
    content: ""; position: absolute; left: 0; bottom: -6px;
    width: 44px; height: 4px; background: var(--brand-yellow); border-radius: 2px;
}
.dash-subtitle { color: var(--grey-500); margin: 14px 0 0; font-size: 14px; }
.dash-subtitle strong { color: var(--grey-800); }

.refresh-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--brand-white); border: var(--border);
    border-radius: 12px; box-shadow: var(--shadow-sm);
}
.refresh-pill .icon-yellow {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--brand-yellow-soft); color: var(--brand-yellow-dark);
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.refresh-meta { display: flex; flex-direction: column; line-height: 1.15; }
.refresh-meta .lbl { font-size: 11px; color: var(--brand-yellow-dark); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.refresh-meta .ts  { font-size: 13px; color: var(--grey-800); font-weight: 600; }
.refresh-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--grey-50); border: var(--border); color: var(--grey-700);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.refresh-btn:hover { background: var(--grey-100); color: var(--brand-black); }
.refresh-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============== FILTERS =============== */
.filters {
    padding: 18px;
    display: flex; flex-direction: column; gap: 12px;
}
.filters-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 16px;
}
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-field label,
.filter-field > .field-label {
    font-size: 12px; color: var(--grey-600); font-weight: 600;
}
.filter-field input,
.filter-field select {
    padding: 8px 10px; font-size: 13px;
    border: 1px solid var(--grey-200); border-radius: 8px;
    background: var(--brand-white); color: var(--grey-900);
    transition: border-color .15s, box-shadow .15s;
}
.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--brand-yellow);
    box-shadow: 0 0 0 3px var(--brand-yellow-soft);
}
.filters-actions {
    display: flex; justify-content: flex-end; gap: 10px; align-items: center;
    margin-top: 4px;
}

/* =============== BUTTONS =============== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 8px; border: 0;
    font-weight: 600; cursor: pointer; font-size: 13px;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-yellow); color: var(--brand-black); }
.btn-primary:hover { background: var(--brand-yellow-dark); }
.btn-ghost {
    background: var(--brand-white); color: var(--grey-700);
    border: 1px solid var(--grey-200);
}
.btn-ghost:hover { background: var(--grey-50); color: var(--brand-black); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:focus-visible { outline: 3px solid var(--brand-yellow-soft); outline-offset: 2px; }

/* =============== KPI GRIDS =============== */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
.kpi-column { display: flex; flex-direction: column; gap: 12px; }
.kpi-row {
    display: grid; gap: 12px;
}
.kpi-row-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-row-6 { grid-template-columns: repeat(6, 1fr); }

.kpi {
    background: var(--brand-white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    align-items: start;
    position: relative; overflow: hidden;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s, border-color .15s;
}
.kpi:hover { box-shadow: var(--shadow-md); border-color: var(--grey-200); }
.kpi-plain { cursor: default; }
.kpi::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--grey-200);
}
.kpi-value {
    font-size: 26px; font-weight: 800; color: var(--grey-900); line-height: 1;
}
.kpi-label {
    font-size: 13px; font-weight: 700; color: var(--grey-800);
    margin-top: 8px;
}
.kpi-desc { color: var(--grey-500); font-size: 11px; margin-top: 3px; }
.kpi-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.kpi-body { display: flex; flex-direction: column; }

/* Coloured accents per KPI type */
.kpi-total     .kpi-icon { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.kpi-total::before        { background: var(--accent-blue); }
.kpi-posted    .kpi-icon { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.kpi-posted::before       { background: var(--accent-blue); }
.kpi-open      .kpi-icon { background: var(--accent-green-soft);  color: var(--accent-green); }
.kpi-open::before         { background: var(--accent-green); }
.kpi-progress  .kpi-icon { background: var(--accent-orange-soft); color: var(--accent-orange); }
.kpi-progress::before     { background: var(--accent-orange); }
.kpi-resolved  .kpi-icon { background: var(--accent-cyan-soft);   color: var(--accent-cyan); }
.kpi-resolved::before     { background: var(--accent-cyan); }
.kpi-unresolved .kpi-icon{ background: var(--accent-purple-soft); color: var(--accent-purple); }
.kpi-unresolved::before   { background: var(--accent-purple); }
.kpi-critical  .kpi-icon { background: var(--accent-red-soft);    color: var(--accent-red); }
.kpi-critical::before     { background: var(--accent-red); }
.kpi-high      .kpi-icon { background: rgba(224, 85, 0, 0.14);    color: var(--accent-high); }
.kpi-high::before         { background: var(--accent-high); }
.kpi-overdue   .kpi-icon { background: var(--accent-orange-soft); color: var(--accent-orange); }
.kpi-overdue::before      { background: var(--accent-orange); }
.kpi-rate      .kpi-icon { background: var(--accent-purple-soft); color: var(--accent-purple); }
.kpi-rate::before         { background: var(--accent-purple); }
.kpi-avg       .kpi-icon { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.kpi-avg::before          { background: var(--accent-blue); }
.kpi-opening   .kpi-icon { background: rgba(107,114,128,0.14);    color: var(--grey-600); }
.kpi-opening::before      { background: var(--grey-500); }

/* =============== RIGHT PANELS (Incident Overview / Opening Unresolved) =============== */
.right-panels { display: flex; flex-direction: column; gap: 12px; }
.overview-card, .opening-card {
    background: var(--brand-white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}
.overview-card h3, .opening-card h3 {
    margin: 0 0 14px; font-size: 15px; color: var(--grey-900); font-weight: 700;
}
.overview-list { display: flex; flex-direction: column; gap: 12px; }
.overview-item {
    display: grid; grid-template-columns: 40px 1fr auto; gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
}
.overview-item .oi-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
}
.overview-item .oi-body { display: flex; flex-direction: column; line-height: 1.1; }
.overview-item .oi-title { font-weight: 700; color: var(--grey-800); font-size: 14px; }
.overview-item .oi-sub   { font-size: 11px; color: var(--grey-500); margin-top: 3px; }
.overview-item .oi-value { font-size: 22px; font-weight: 800; color: var(--grey-900); }

.oi-total    { background: var(--accent-blue-soft); }
.oi-total    .oi-icon { background: var(--accent-blue);   color: #fff; }
.oi-open     { background: var(--accent-orange-soft); }
.oi-open     .oi-icon { background: var(--accent-orange); color: #fff; }
.oi-resolved { background: var(--accent-green-soft); }
.oi-resolved .oi-icon { background: var(--accent-green);  color: #fff; }
.oi-overdue  { background: var(--accent-red-soft); }
.oi-overdue  .oi-icon { background: var(--accent-red);    color: #fff; }

.opening-card { display: flex; align-items: center; gap: 14px; }
.opening-card .oi-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: var(--brand-yellow-soft); color: var(--brand-yellow-dark);
    display: inline-flex; align-items: center; justify-content: center;
}
.opening-card .oi-body { flex: 1; }
.opening-card .oi-title { font-size: 14px; color: var(--grey-800); font-weight: 700; }
.opening-card .oi-sub   { font-size: 11px; color: var(--grey-500); margin-top: 3px; }
.opening-card .oi-value { font-size: 24px; font-weight: 800; color: var(--grey-900); }

/* =============== CHARTS ROW =============== */
.charts-row {
    display: grid; gap: 16px;
    grid-template-columns: 1.4fr 1.2fr 1fr;
}
.chart-card {
    background: var(--brand-white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    display: flex; flex-direction: column;
    min-height: 320px;
}
.chart-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.chart-card h3, .card-head-title {
    margin: 0; font-size: 15px; font-weight: 700; color: var(--grey-900);
}
.chart-body {
    position: relative; flex: 1; min-height: 220px;
}
.chart-body canvas { width: 100% !important; height: 100% !important; }
.doughnut-wrap { position: relative; display: flex; align-items: center; gap: 22px; }
.doughnut-container { position: relative; width: 200px; height: 200px; }
.doughnut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    pointer-events: none;
}
.doughnut-center .dc-value { font-size: 32px; font-weight: 800; color: var(--grey-900); line-height: 1; }
.doughnut-center .dc-label { color: var(--grey-500); font-size: 12px; margin-top: 4px; }
.doughnut-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.doughnut-legend .lg-item {
    display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--grey-800);
}
.doughnut-legend .lg-swatch {
    width: 12px; height: 12px; border-radius: 3px; background: var(--grey-300);
    flex: 0 0 auto;
}

.select-inline {
    padding: 6px 10px; font-size: 12px;
    border: 1px solid var(--grey-200); border-radius: 8px;
    background: var(--brand-white); color: var(--grey-800);
}
.select-inline:focus { outline: none; border-color: var(--brand-yellow); }

/* Recent incidents card */
.recent-card { min-height: 320px; display: flex; flex-direction: column; }
.recent-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 8px; flex: 1;
    overflow-y: auto; max-height: 260px;
}
.recent-list li {
    padding: 10px; border: 1px solid var(--grey-150); border-radius: 8px;
    display: flex; flex-direction: column; gap: 4px;
}
.recent-list li:hover { border-color: var(--grey-300); }
.recent-list .r-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.recent-list .r-no  { font-size: 12px; font-weight: 700; color: var(--brand-yellow-dark); }
.recent-list .r-title { font-size: 13px; color: var(--grey-800); font-weight: 600; }
.recent-list .r-meta  { font-size: 11px; color: var(--grey-500); }

.link-btn {
    color: var(--grey-700); background: var(--grey-50);
    border: 1px solid var(--grey-200); padding: 5px 12px;
    font-size: 12px; border-radius: 8px; font-weight: 600;
}
.link-btn:hover { background: var(--grey-100); color: var(--brand-black); }

/* =============== TABLES =============== */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 18px; border-bottom: var(--border);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 12px 18px; text-align: left; font-size: 13px;
    border-bottom: 1px solid var(--grey-100);
}
.data-table th {
    color: var(--grey-500); font-weight: 700; text-transform: uppercase;
    font-size: 11px; letter-spacing: .6px;
    background: var(--grey-25);
}
.data-table tbody tr:hover { background: var(--grey-25); }
.data-table tr.pr-critical { box-shadow: inset 3px 0 0 var(--accent-red); }

/* Bottom tables side by side */
.bottom-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.bottom-row .table-card { min-height: 220px; display: flex; flex-direction: column; }
.bottom-row .table-scroll { overflow-x: auto; }

/* =============== EMPTY / LOADING STATES =============== */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 44px 20px; text-align: center; color: var(--grey-500); gap: 8px;
}
.empty-state svg { width: 44px; height: 44px; color: var(--grey-400); }
.empty-state strong { color: var(--grey-800); font-size: 14px; }
.empty-state span { font-size: 12px; }
.empty-row td { padding: 40px 12px; }
.load-state {
    display: flex; align-items: center; justify-content: center;
    padding: 22px; gap: 10px; color: var(--grey-500); font-size: 13px;
}
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--grey-200); border-top-color: var(--brand-yellow);
    animation: spin 0.8s linear infinite;
}
.error-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 22px; gap: 8px; color: var(--danger); font-size: 13px;
}
.error-state .btn { margin-top: 4px; }

/* =============== PILLS =============== */
.pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; letter-spacing: .2px;
    background: var(--grey-100); color: var(--grey-700);
}
.pill-low       { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.pill-medium    { background: var(--accent-orange-soft); color: var(--accent-orange); }
.pill-high      { background: rgba(224,85,0,.14);        color: var(--accent-high); }
.pill-critical  { background: var(--accent-red-soft);    color: var(--accent-red); }
.pill-status-posted      { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.pill-status-open        { background: var(--accent-orange-soft); color: var(--accent-orange); }
.pill-status-in-progress { background: rgba(224,85,0,.14);        color: var(--accent-high); }
.pill-status-resolved    { background: var(--accent-green-soft);  color: var(--accent-green); }
.pill-module-op   { background: var(--accent-blue-soft);   color: var(--accent-blue); }
.pill-module-hr   { background: var(--accent-orange-soft); color: var(--accent-orange); }
.pill-module-sec  { background: var(--accent-red-soft);    color: var(--accent-red); }
.pill-module-gov  { background: var(--brand-yellow-soft);  color: var(--brand-yellow-dark); }
.pill-overdue     { background: var(--accent-red);         color: #fff; }
.pill-escalation  { background: var(--accent-orange);      color: #fff; }
.pill-assignment  { background: var(--accent-blue);        color: #fff; }
.pill-resolved    { background: var(--accent-green);       color: #fff; }
.pill-green       { background: var(--accent-green-soft);  color: var(--accent-green); }
.pill-red         { background: var(--accent-red-soft);    color: var(--accent-red); }
.pill-yellow      { background: var(--brand-yellow-soft);  color: var(--brand-yellow-dark); }
.pill-blue        { background: var(--accent-blue-soft);   color: var(--accent-blue); }

/* =============== FLASH MESSAGES =============== */
.flash-list { margin-bottom: 12px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; font-weight: 500; font-size: 13px; }
.flash-success { background: var(--accent-green-soft); color: var(--accent-green); border-left: 4px solid var(--accent-green); }
.flash-danger  { background: var(--accent-red-soft);   color: var(--accent-red);   border-left: 4px solid var(--accent-red); }
.flash-warning { background: var(--accent-orange-soft);color: var(--accent-orange);border-left: 4px solid var(--accent-orange); }
.flash-info    { background: var(--accent-blue-soft);  color: var(--accent-blue);  border-left: 4px solid var(--accent-blue); }

/* =============== FORMS (kept for other pages) =============== */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-inline { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.field-full { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.input, .form-control {
    padding: 8px 10px; border: 1px solid var(--grey-200); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; background: var(--brand-white); color: var(--grey-900);
}
.input:focus, .form-control:focus {
    outline: none; border-color: var(--brand-yellow);
    box-shadow: 0 0 0 3px var(--brand-yellow-soft);
}
.textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; gap: 10px; }
.form-row  { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--grey-800); }
.form-check label { font-weight: 400; display: flex; align-items: center; gap: 6px; }
.form-error { color: var(--danger); font-size: 12px; }
.form-fieldset {
    border: 1px solid var(--grey-200); border-radius: 6px;
    padding: 12px; background: var(--grey-50);
}
.form-fieldset legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.table-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.page-actions { display: flex; gap: 8px; }

/* =============== LOGIN =============== */
.login-body { background: #ffffff; min-height: 100vh; margin: 0; }
.login-body .anon-main { padding: 0; min-height: 100vh; display: flex; }
.login-body .flash-list { display: none; } /* handled inline on the form */

.login-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    width: 100%;
}

/* ---- Left panel ---- */
.login-side {
    position: relative;
    background: #f4f4f4;
    padding: 28px 32px;
    overflow: hidden;
    min-height: 100vh;
}
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #111;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    z-index: 2;
    position: relative;
}
.login-brand:hover { color: #111; }
.login-brand-logo { width: 40px; height: 40px; flex: 0 0 40px; }
.login-brand-text { color: #111; }

.login-watermark {
    position: absolute;
    right: -80px;
    bottom: -60px;
    width: 520px;
    height: 520px;
    opacity: 0.12;
    pointer-events: none;
    user-select: none;
    filter: grayscale(1);
}

/* ---- Right panel ---- */
.login-form-panel {
    background: #ffffff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 100vh;
}
.login-form-wrap {
    width: 100%;
    max-width: 380px;
}
.login-title {
    font-size: 40px;
    line-height: 1.1;
    margin: 0 0 6px;
    color: #111;
    font-weight: 800;
    letter-spacing: -0.5px;
    border-bottom: none;
    padding-bottom: 0;
}
.login-subtitle {
    color: #6b7280;
    margin: 0 0 28px;
    font-size: 14px;
}

.login-flash-list { margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.login-flash {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid transparent;
}
.login-flash-danger  { background: #fdecec; color: #a11d1d; border-color: #f5c2c2; }
.login-flash-warning { background: #fff6e0; color: #8a5b00; border-color: #f4dfa5; }
.login-flash-info    { background: #eaf2ff; color: #17408b; border-color: #cadcff; }
.login-flash-success { background: #e6f4ea; color: #1e6b34; border-color: #b6dcbe; }

/* ---- Form fields ---- */
.login-form { display: flex; flex-direction: column; gap: 14px; }
.lf-field { display: flex; flex-direction: column; gap: 6px; }
.lf-label {
    /* visually hidden — the design uses placeholders as labels, but the
       label element is preserved for accessibility */
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}
.lf-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    color: #111;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.lf-input::placeholder { color: #9ca3af; }
.lf-input:hover { border-color: #b3b8c1; }
.lf-input:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.35);
}
.lf-input[aria-invalid="true"],
.lf-field.has-error .lf-input {
    border-color: #d43a3a;
    box-shadow: 0 0 0 3px rgba(212, 58, 58, 0.15);
}
.lf-error {
    font-size: 12px;
    color: #d43a3a;
    min-height: 0;
}

.lf-input-group { position: relative; }
.lf-input-group .lf-input { padding-right: 44px; }
.lf-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lf-eye:hover { color: #111; background: #f3f4f6; }
.lf-eye:focus { outline: none; box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.4); }

.lf-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}
.lf-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.lf-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #111;
    cursor: pointer;
}
.lf-help {
    color: #2c6ef2;
    font-size: 14px;
    text-decoration: none;
}
.lf-help:hover { text-decoration: underline; }

.lf-submit {
    margin-top: 10px;
    width: 100%;
    height: 48px;
    background: #111;
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background .15s ease, transform .05s ease;
}
.lf-submit:hover { background: #000; }
.lf-submit:focus { outline: none; box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.5); }
.lf-submit:active { transform: translateY(1px); }
.lf-submit[disabled] {
    background: #6b7280;
    cursor: progress;
}
.lf-submit-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
.lf-form-error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fdecec;
    color: #a11d1d;
    border: 1px solid #f5c2c2;
    font-size: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-side {
        min-height: auto;
        padding: 20px;
    }
    .login-brand-logo { width: 32px; height: 32px; flex-basis: 32px; }
    .login-brand-text { font-size: 14px; }
    .login-watermark { display: none; }
    .login-form-panel { min-height: auto; padding: 32px 20px 48px; }
}
@media (max-width: 480px) {
    .login-title { font-size: 32px; }
    .login-form-wrap { max-width: 100%; }
    .lf-row-between { flex-wrap: wrap; }
}

/* =============== INCIDENT DETAIL (shared) =============== */
.incident-header { display: flex; justify-content: space-between; align-items: start; }
.incident-header h1 { margin: 0; color: var(--brand-black); }
.incident-header h2 { margin: 6px 0; font-weight: 500; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.incident-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; width: 40%; padding: 6px 8px; color: var(--grey-600); vertical-align: top; font-weight: 500; }
.kv td { padding: 6px 8px; vertical-align: top; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--grey-100); }
.timeline .ts { color: var(--grey-500); font-size: 11px; }
.module-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.module-card {
    padding: 30px; border-radius: var(--radius); text-align: center;
    background: var(--brand-white); box-shadow: var(--shadow); display: block;
}
.module-card:hover { transform: translateY(-2px); transition: 0.15s; }
.module-code { display: block; font-size: 42px; font-weight: 800; color: var(--brand-yellow); }
.module-name { display: block; font-size: 16px; margin-top: 4px; color: var(--brand-black); }
.module-op   .module-code { color: var(--accent-blue); }
.module-hr   .module-code { color: var(--accent-orange); }
.module-sec  .module-code { color: var(--accent-red); }
.module-gov  .module-code { color: var(--brand-yellow-dark); }
.link-list { list-style: none; padding: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--grey-100); }
.notif-list { list-style: none; padding: 0; }
.notif-list li { padding: 8px 0; border-bottom: 1px solid var(--grey-100); display: flex; align-items: center; gap: 10px; }
.notif-list li.unread { font-weight: 600; }
.pagination { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.pagination-info { color: var(--grey-600); font-size: 13px; }

/* Error page */
.error-shell { text-align: center; padding: 80px 20px; }
.error-shell h1 { font-size: 96px; margin: 0; color: var(--brand-yellow); }

/* =============== USER MANAGEMENT / ADMIN =============== */
.page-head { flex-wrap: wrap; gap: 12px; }
.page-head h1 { color: var(--brand-black); }
.page-sub { color: var(--grey-600); margin: 4px 0 0; font-size: 13px; }
.page-sub a { color: var(--grey-700); }

/* Yellow brand button — prominent CTA (e.g. "+ Register User") */
.btn-yellow {
    background: var(--brand-yellow);
    color: var(--brand-black);
    border: 1px solid var(--brand-yellow-dark);
    font-weight: 700;
}
.btn-yellow:hover { background: var(--brand-yellow-dark); color: var(--brand-black); }
.btn-yellow:focus { outline: none; box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.4); }
.btn-yellow[disabled] { opacity: 0.6; cursor: not-allowed; }

.btn-lg { padding: 12px 20px; font-size: 15px; height: 44px; display: inline-flex;
          align-items: center; justify-content: center; gap: 6px; }

/* Admin tiles (Administration landing) */
.admin-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.admin-tile {
    display: block;
    background: var(--brand-white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.admin-tile:hover {
    border-color: var(--brand-yellow);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.admin-tile-title { font-size: 13px; color: var(--grey-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-tile-value { font-size: 32px; font-weight: 800; color: var(--brand-black); margin: 8px 0 4px; }
.admin-tile-sub   { font-size: 13px; color: var(--grey-600); }
.admin-tile-primary { border-left: 6px solid var(--brand-yellow); }

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--grey-200);
    margin: 8px 0 16px;
    flex-wrap: wrap;
}
.settings-tabs .tab {
    padding: 10px 16px;
    color: var(--grey-700);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.settings-tabs .tab:hover { color: var(--brand-black); }
.settings-tabs .tab.active {
    color: var(--brand-black);
    border-bottom-color: var(--brand-yellow);
}

/* Users toolbar */
.users-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: var(--grey-50);
    border-bottom: 1px solid var(--grey-100);
    flex-wrap: wrap;
}
.users-search { flex: 1 1 280px; min-width: 220px; }

/* Users table */
.users-table { width: 100%; }
.users-table td { vertical-align: middle; padding: 10px 12px; }
.users-table th { padding: 10px 12px; text-align: left; font-size: 12px; color: var(--grey-600);
                  background: var(--grey-50); text-transform: uppercase; letter-spacing: 0.4px; }
.users-table .col-actions { text-align: right; white-space: nowrap; }
.users-table .row-highlight {
    background: rgba(245, 196, 0, 0.14);
    box-shadow: inset 4px 0 0 var(--brand-yellow);
}
.table-empty { padding: 32px 12px; text-align: center; color: var(--grey-600); }
.inline-form { display: inline-block; margin: 0; }
.table-wrap  { overflow-x: auto; }

/* Callouts */
.callout {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 0 12px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.callout-info { background: #eaf2ff; color: #17408b; border-color: #cadcff; }
.callout-success { background: #eaf7ec; color: #1e6b2f; border-color: #c6e6cf; }
.callout-error   { background: #fdecec; color: #8a1414; border-color: #f4c2c2; }
.link-strong  { font-weight: 600; text-decoration: underline; }

/* Registration/edit form layout tweaks */
.user-reg-form { grid-template-columns: 1fr; }
.user-reg-form .form-fieldset { background: var(--brand-white); }
.form-grid-2  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-span-2  { grid-column: 1 / -1; }
.form-help    { font-size: 12px; color: var(--grey-600); margin: 0 0 8px; }

/* Change-password page */
.change-password-card { max-width: 480px; margin: 0 auto; }

/* =============== MODAL =============== */
.drd-modal {
    position: fixed; inset: 0;
    display: none;
    z-index: 1000;
}
.drd-modal.is-open { display: block; }
body.drd-modal-open { overflow: hidden; }
.drd-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
.drd-modal-panel {
    position: relative;
    max-width: 560px;
    margin: 8vh auto;
    background: var(--brand-white, #fff);
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column;
    max-height: 84vh; overflow: hidden;
}
.drd-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.drd-modal-head h2 { margin: 0; font-size: 18px; }
.drd-modal-close {
    background: transparent; border: 0; cursor: pointer;
    font-size: 26px; line-height: 1; color: #64748b;
    padding: 0 6px;
}
.drd-modal-close:hover { color: #0f172a; }
.drd-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
}
.drd-modal-foot {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex; justify-content: flex-end; gap: 8px;
}
.tech-stack { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; }
.tech-stack dt { font-weight: 600; color: #0f172a; }
.tech-stack dd { margin: 0; color: #334155; }
@media (max-width: 520px) {
    .tech-stack { grid-template-columns: 1fr; }
    .tech-stack dt { margin-top: 8px; }
    .drd-modal-panel { margin: 4vh 12px; }
}

/* =============== RESPONSIVE =============== */
@media (max-width: 1400px) {
    .charts-row { grid-template-columns: 1fr 1fr; }
    .recent-card { grid-column: 1 / -1; }
    .filters-grid { grid-template-columns: repeat(4, 1fr); }
    .kpi-row-6 { grid-template-columns: repeat(3, 1fr); }
    .kpi-row-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas: "topbar" "workspace";
    }
    .sidebar { display: none; }
    .brand { min-width: auto; }
    .main-nav { justify-content: flex-start; overflow-x: auto; }
    .dash-grid { grid-template-columns: 1fr; }
    .bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .charts-row { grid-template-columns: 1fr; }
    .filters-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-row-6, .kpi-row-5 { grid-template-columns: repeat(2, 1fr); }
    .dash-header { grid-template-columns: 1fr; }
    .doughnut-wrap { flex-direction: column; }
    .brand-sub { display: none; }
    .user-meta { display: none; }
    .incident-grid, .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
}
