html, body { height: 100%; }
html { font-size: 14px; }
body { margin: 0; font-family: Arial, "Segoe UI", Tahoma, sans-serif; }

.alert-heading { font-weight: 600; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ---------- Login ---------- */
.login-body {
    background: #fff;
    min-height: 100vh;
}
.login-outer { padding: 0; }

/* Left decorative panel — abstract composition inspired by the logo's
   chevron motif (coral/orange/red) against the brand navy. */
.login-bg-panel {
    background:
        /* warm orange glow — echoes logo chevron top colour */
        radial-gradient(ellipse 75% 55% at 88% 8%,  rgba(255,122,0,0.50) 0%, transparent 58%),
        /* deep red glow — echoes logo chevron bottom colour */
        radial-gradient(ellipse 65% 50% at 8%  88%,  rgba(255,48,18,0.40) 0%, transparent 55%),
        /* coral bloom — centre-right depth layer */
        radial-gradient(ellipse 55% 45% at 65% 52%,  rgba(255,114,114,0.14) 0%, transparent 60%),
        /* rich navy base gradient */
        linear-gradient(158deg, #0d47a1 0%, #0b3d91 35%, #0a2f6e 70%, #07235a 100%);
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}
/* Centred logo watermark */
.login-bg-panel::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56%;
    aspect-ratio: 283 / 180;
    background: url('/images/logo_white.svg') center / contain no-repeat;
    opacity: 0.12;
    filter: brightness(1.8) saturate(1.2);
}
/* Rotated-square geometric accent — references the diamond/chevron of the logo */
.login-bg-panel::after {
    content: "";
    position: absolute;
    bottom: 6%;
    right: -70px;
    width: 240px;
    height: 240px;
    border-radius: 36px;
    background: rgba(255,122,0,0.10);
    border: 2px solid rgba(255,122,0,0.20);
    transform: rotate(45deg);
}

/* Right form panel */
.login-logo {
    height: 150px;
    width: auto;
    display: block;
}
.login-brand-text {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 2.5rem;
    margin-bottom: 3.5rem;
    background: linear-gradient(to right, #ff3012, #ff7a00, #ff7272);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.btn-login-submit {
    min-width: 160px;
}
/* Override browser autofill blue/yellow background on login fields */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #212529 !important;
}

/* Build version badge — bottom-left of login screen */
.login-version {
    position: fixed;
    bottom: 0.55rem;
    left: 0.75rem;
    font-size: 0.68rem;
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.4px;
    pointer-events: none;
    z-index: 10;
}

/* ---------- App shell ---------- */
.app-body {
    background: #f5f6fa;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.app-topbar {
    background: #fff;
    color: #0b3d91;
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-bottom: 1px solid #e1e4ea;
}
.app-topbar .brand a {
    display: inline-flex;
    align-items: center;
    gap: 1.6rem;
    color: #0b3d91;
    font-weight: 700;
    font-size: 2.6rem;
    text-decoration: none;  
    letter-spacing: 0.5px;

}
.app-topbar .brand-text {
    background: linear-gradient(to right, #ff3012, #ff7a00, #ff7272);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.app-topbar .brand a:hover,
.app-topbar .brand a:focus {
    text-decoration: none;
}
.app-topbar .brand-logo {
    width: auto;
    height: 90px;
    margin-right: 2.6rem;
}
.user-dropdown {
    color: #0b3d91 !important;
    text-decoration: none !important;
    text-align: right;
    line-height: 1.1;
}
.user-dropdown:hover { color: #1565c0 !important; }
.user-dropdown .user-name { font-weight: 600; }
.user-dropdown small { color: #546e7a !important; }

.app-shell {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}
.app-sidenav {
    width: 230px;
    background: #fff;
    border-right: 1px solid #e1e4ea;
    padding: 1rem 0.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}
.app-sidenav .nav-link {
    color: #263238;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin-bottom: 2px;
}
.app-sidenav .nav-link:hover { background: #eef3fb; color: #0b3d91; }
.app-sidenav .nav-group-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d50a0a;
    padding: 0.85rem 0.9rem 0.25rem;
    margin-top: 0.25rem;
}
.app-sidenav .nav-group-label:first-child { padding-top: 0.25rem; }

/* Branch-office context banner inside the sidenav */
.branch-context-banner {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 0.82rem;
}
.branch-context-label {
    color: #664d03;
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.branch-context-name {
    font-weight: 700;
    color: #333;
    word-break: break-word;
    font-size: 0.9rem;
}

.app-main {
    flex: 1 1 auto;
    padding: 1.5rem 2rem;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
}

/* ---------- Status cards ---------- */
.status-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    color: #222;
    height: 100%;
    background: #fff;
    border-left-width: 8px;
    border-left-style: solid;
    box-shadow: 0 1px 4px rgba(60,60,60,0.04);
}
.status-card .card-body { display: flex; flex-direction: column; justify-content: space-between; min-height: 110px; }
.status-card .status-label { font-size: 0.9rem; opacity: 0.9; }
.status-card .status-value { font-size: 1.7rem; font-weight: 300; }
.status-low      { border-left-color: #2e7d32 !important; }
.status-medium   { border-left-color: #0288d1 !important; }
.status-high     { border-left-color: #ef6c00 !important; }
.status-critical { border-left-color: #c62828 !important; }
.status-low .status-value,
.status-low .status-label { color: #2e7d32; }
.status-medium .status-value,
.status-medium .status-label { color: #0288d1; }
.status-high .status-value,
.status-high .status-label { color: #ef6c00; }
.status-critical .status-value,
.status-critical .status-label { color: #c62828; }

/* ---------- Inputs ---------- */
::placeholder { color: #b0b8c1 !important; opacity: 1; }

/* ---------- Links ---------- */
a:not(.btn) { text-decoration: none; }
a:not(.btn):hover { text-decoration: underline; }

/* ---------- Clickable table rows ---------- */
.app-row { cursor: pointer; }
.app-row:hover { background-color: #f1f5f9; }
.app-row a { color: inherit; text-decoration: none; }
.app-row a:hover { color: inherit; text-decoration: none; }

/* ---------- Footer ---------- */
.app-footer {
    background: #263238;
    color: #cfd8dc;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.app-footer a { color: #90caf9; text-decoration: none; margin-left: 0.75rem; }
.app-footer a:first-child { margin-left: 0; }
.app-footer a:hover { text-decoration: underline; }
.footer-links { white-space: nowrap; }