/* Global Base Styles - Dashboard Theme */

/* Smooth cross-document transition when navigating between pages — turns the
   hard page-reload flash into a gentle crossfade (and animates the active nav
   highlight). Progressive enhancement: ignored where unsupported. */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: reduce) {

    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
}

:root {
    --primary-blue: #1A237E;
    --primary-blue-dark: #000858;
    --secondary-blue: #2e368f;
    --light-blue: #eaf2ff;
    --light-gray: #D1D5DB;
    --primary-orange: #FB8B24;
    --primary-orange-dark: #DB700E;
    --background: #F0F0F0;
    --white: #ffffff;
    --text: #000000;
    --text-dim: #6B7280;
    --outline-blue: #2563EB;
    --accent-blue: #2563EB;
    --gradient-bg: radial-gradient(50% 50% at 50% 50%, #EEF2FF 0%, #FFF 100%);

    /* FIX: these tokens were referenced throughout the responsive rules
       below (sidebar/rail widths, topnav height offsets, drawer transforms,
       hamburger + loader colors) but were never defined here. An undefined
       var() invalidates the whole declaration it's used in, so things like
       the mobile off-canvas drawer transform and the hamburger icon color
       were silently failing. Values are derived from the layout that was
       already hardcoded elsewhere in this file (e.g. body::before's 92px
       matches the 30px top-nav margin + 62px top-nav height). */
    --primary-dark: var(--primary-blue-dark);
    --text-main: var(--text);
    --text-muted: var(--text-dim);
    --topnav-height: 92px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --rail-width: 72px;
    --context-width: 220px;

    /* Colour Palettes: Vibrant */
    --Mulberry: #9E0142;
    --Watermelon: #D53E4F;
    --Mandarin: #F46D43;
    --Mango: #FDAE61;
    --Butter: #FEE08C;
    --Pistachio: #E6F598;
    --Mint: #ABDDA4;
    --Aquamarine: #66C2A5;
    --Azure: #3288BD;
    --Amethyst: #5E4FA2;

    /* Colour Palettes: Pastel */
    --Cyan: #66C5CC;
    --Lemon: #F6CF71;
    --Orange: #F89C74;
    --Lilac: #DCB0F2;
    --Grass: #87C55F;
    --Periwinkle: #9EB9F3;
    --Pink: #FE88B1;
    --Gray: #B4B4B4;

    /* Error and Success */
    --error-bg: #FFCBE1;
    --error-text: #9E0142;
    --success-bg: #D6E5BE;
    --seccess-text: #87C55F;

    /* Glassmorphism & Backgrounds */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --blur-strength: blur(12px);

    --box-shadow: 0 6px 22px rgba(15, 23, 42, .04);

    --border-radius: 16px;
    --font-family: 'Inter', sans-serif;
    --transition-speed: 0.3s;
    --shadow: 0 4px 0px 0 rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    /* min-height: 100vh; */
    background-attachment: fixed;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

i {
    margin: 0px;
}

.main-content i {
    margin-left: 0px;
    margin-right: 8px;
}

a:hover {
    opacity: 0.8;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 92px;
    background: var(--background);
    z-index: 900;
}

/* The strip above masks content scrolling under the floating top-nav. The
   Admin Console has NO top-nav — neither its shell (body.ac-shell) nor the
   section frame documents inside its iframe (body.ac-frame) — so there the
   strip would just cover the first 92px of content (e.g. the User Management
   header with the Add User button). Drop it in both. */
body.ac-shell::before,
body.ac-frame::before {
    content: none;
}

/* Top Navigation */
.top-nav {
    margin: 30px 30px 0px 30px;
    padding: 0 2rem 0 0;
    height: 62px;

    top: 30px;
    position: sticky;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: space-between;

    color: var(--primary-blue-dark);
    background: var(--primary-blue-dark);
    border-bottom: var(--glass-border);
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(134, 134, 134, 0.51);
}

.top-nav .left-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-tz-tag {
    padding: 4px 12px;

    display: flex;
    align-items: center;
    gap: 6px;
    
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;

    color: var(--primary-blue);
    background: var(--light-blue);
    border-radius: 12px;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    /* flex-wrap: wrap; */
    justify-content: flex-end;
}

.top-nav-actions i {
    color: var(--primary-blue);
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.brand-logo-link:hover { 
    opacity: 100%; 
    transform: translateX(-5%);
}

.brand-logo {
    display: block;
    height: auto;
    width: auto;
    max-width: 189px;
    object-fit: contain;
    border-radius: 999px;
}

.top-nav .sidebar-toggle {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.top-nav .sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.top-nav h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-blue), #1e40af);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-nav h1 a {
    color: inherit;
    text-decoration: none;
}

.top-nav h1 a:hover {
    opacity: 1;
    color: var(--primary-blue);
    -webkit-text-fill-color: var(--primary-blue);
}

.top-nav .nav-links a {
    margin-left: 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.top-nav .nav-links a:hover {
    color: var(--primary-blue);
}

/* User Info in Top Nav */
.user-info {
    text-align: right;
    padding-right: 12px;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.user-info .user-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.user-info .user-org {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* User Dropdown Menu */
.user-dropdown {
    position: relative;
}

.dropdown-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    height: 42px;
    padding: 2px 8px 2px 2px;

    background: #fff;

    cursor: pointer;
    transition: all .2s ease;
}

.dropdown-button:hover {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dropdown-button.active {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dropdown-button i {
    font-size: 12px;
    color: #6b7280;
    transition: transform .2s ease;
}

.dropdown-button.active i {
    transform: rotate(180deg);
}

/* Avatar circle in nav */
.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--outline-blue);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Profile picture in nav */
.nav-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Name + org stacked */
.nav-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.nav-user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1f2937;
}

.nav-user-org {
    font-size: 0.75rem;
    color: #6b7280;
}

.dropdown-arrow {
    font-size: 0.65rem;
    color: #9ca3af;
    transition: transform 0.2s;
}

.dropdown-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: var(--blur-strength);
    -webkit-backdrop-filter: var(--blur-strength);
    border: var(--glass-border);
    border-radius: 14px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 1001;
    animation: slideDown 0.2s ease;
    overflow: hidden;
}

.dropdown-menu.active {
    display: flex;
    flex-direction: column;
}

/* Header block inside dropdown */
.dropdown-header {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
}

.dropdown-header-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #111827;
}

.dropdown-header-email {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
}

.dropdown-menu a {
    color: #374151;
    padding: 10px 16px;
    text-decoration: none;
    transition: all 0.15s;
    display: block;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: rgba(59, 130, 246, 0.07);
    color: var(--primary-blue);
    padding-left: 20px;
}

/* Icon Margin */
.dropdown-menu i { margin-right: 8px; }

.dropdown-menu a.logout-option,
.dropdown-menu a.logout-option i {
    color: #ef4444;
}

.dropdown-menu a.logout-option:hover {
    background: rgba(239, 68, 68, 0.07);
    color: #dc2626;
    padding-left: 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Password field with show/hide eye toggle (login, register, change-password) */
.pw-field {
    position: relative;
    margin: 0.4rem 0 1.2rem;
}

.pw-field input {
    margin: 0 !important;
    padding-right: 2.8rem !important;
    width: 100%;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
}

.pw-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #374151;
    transform: translateY(-50%);
    box-shadow: none;
}

.pw-toggle svg {
    width: 20px;
    height: 20px;
}

/* Masked (default): show the slashed eye = "password is hidden".
   Revealed (.is-on): show the open eye = "password is visible". */
.pw-toggle .pw-eye {
    display: none;
}

.pw-toggle .pw-eye-off {
    display: block;
}

.pw-toggle.is-on .pw-eye {
    display: block;
}

.pw-toggle.is-on .pw-eye-off {
    display: none;
}

/* Container Layout */
.container {
    display: block;
    min-height: calc(100vh - var(--topnav-height));
    overflow-x: hidden;
}

/* Logged-out pages (login / register): no nav rail or top bar is rendered, so
   drop the chrome offsets and let the content fill + centre full-width. */
body.no-chrome .container {
    display: block;
    min-height: 100vh;
}

body.no-chrome .main-content {
    overflow-x: hidden;
    /* vertically centre the auth card */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem 1rem;
}

/* Soft brand "mesh" gradient behind the frosted login card — light orange +
   blue glows on a warm→cool base. Looks good on phone and desktop alike. */
body.no-chrome {
    background:
        radial-gradient(1100px 560px at 12% 8%, rgba(59, 130, 246, 0.28), transparent 60%),
        /* blue, top-left */
        radial-gradient(950px 700px at 88% 92%, rgba(251, 146, 60, 0.30), transparent 55%),
        /* orange, bottom-right */
        radial-gradient(820px 520px at 92% 6%, rgba(96, 165, 250, 0.20), transparent 55%),
        /* light blue, top-right */
        radial-gradient(760px 520px at 8% 96%, rgba(253, 186, 116, 0.24), transparent 55%),
        /* light orange, bottom-left */
        linear-gradient(135deg, #fff7ed 0%, #eff6ff 100%);
    /* warm → cool base */
    background-attachment: fixed;

    position: relative;
}

body.no-chrome::before {
    content: "";
    position: fixed;

    inset: auto 0 0 0;

    width: 100vw;
    height: 100vh;

    background: url("../images/transparent.png") no-repeat bottom;
    background-size: contain;
    background-position: center bottom;

    opacity: 1;
    pointer-events: none;
    z-index: 0;
}


/* Modal (used for signature upload) */
.modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 1rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 12px 40px rgba(2, 6, 23, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.modal-body {
    padding: 8px 0 0 0;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.modal-close {
    padding: 0px 4px;
    
    font-size: 1.75rem;
    line-height: 1;

    color: #9ca3af;
    background: none;
    border: none;
    box-shadow: none;

    cursor: pointer;
}

.modal-close:hover {
    color: #1f2937;
    box-shadow: none;
}

/* Main Content */
.main-content {
    padding: 2.5rem 2.5rem;

    overflow-x: auto;

    transition: padding 0.22s ease;

    width: 100%;
    /* max-width: 1500px; */
    margin: auto;
}

/* Card Design */
.card {
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}


/* Buttons */
button {
    background: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    letter-spacing: 0.01em;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Flash Messages */
.flash { display: none; }
.flash.success { display: none; }
.flash.error { display: none; }
.flash.info { display: none; }

/* Form Inputs */
input,
textarea,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-top: 0.4rem;
    margin-bottom: 1.2rem; 

    font-size: 0.9rem;
    font-family: var(--font-family);

    border-radius: 16px;
    border: none;
    background: rgb(255, 255, 255);

    transition: all 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Page Transition Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.page-loader.active {
    opacity: 1;
    pointer-events: all;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 1rem;
}

.loader-text {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* =========================================================================
   Workspace navigation — compact top bar
   ========================================================================= */

.top-subnav {
    display: flex;
    align-items: center;
    gap: 15px;
    background: none;
    border-bottom: var(--primary-orange);
    overflow-x: auto;
    scrollbar-width: none;
    margin-top: 5px;
}

.top-subnav::-webkit-scrollbar {
    display: none;
}

.top-subnav-panel-link i { width: 20px; }

.top-subnav-link {
    padding: 0.5rem 0.7rem;

    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;

    color: var(--white);
    border-radius: 4px;
    box-shadow: none;

    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.top-subnav-link:hover {
    background: var(--primary-orange);
    color: var(--white);
    box-shadow: none;
    opacity: 1;
}

.top-subnav-link.active {
    color: var(--white);
    box-shadow: inset 0 -4px 0 var(--primary-orange);
}

.top-subnav-link--accent {
    background: var(--primary-orange);
    color: #fff7ed;
    border-radius: 999px;
    padding: 1.5rem 0.95rem;
    position: relative;
    z-index: 1;
}

.top-subnav-link--accent:hover {
    background: var(--primary-orange-dark);
    color: #ffffff;
}

.top-subnav-link--accent.active {
    box-shadow: inset 0 -3px 0 var(--primary-orange), 0 8px 18px rgba(15, 23, 42, 0.12);
}

.top-subnav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
}

.top-subnav-icon i {
    width: 34px;
    height: 34px;
    font-size: 1.5rem;
}

/* ==== Top-subnav per-area dropdown panels ==== */
.top-subnav-panels {
    position: fixed;
    top: 135px;
    left: 0;
    right: 0;
    z-index: 1050;

    pointer-events: none;
    transform: translateY(-15px);
    transition: 
        opacity 0.25s ease,
        transform 0.25s ease;
}

.top-subnav-panel {
    opacity: 1;
    transform: translateY(0);
    display: none;
    justify-content: center;
    pointer-events: auto;
}

.top-subnav-panel.is-active,
.top-subnav-panel[aria-hidden="false"] {
    display: flex;
}

/* = Top-subnav per-area dropdown panels = */
.top-subnav-panel-inner {
    background: var(--secondary-blue);
    border: var(--glass-border);
    backdrop-filter: var(--blur-strength);
    -webkit-backdrop-filter: var(--blur-strength);
    padding: 1.1rem;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(2, 6, 23, 0.12);
    gap: 0.7rem;
    /* max-width: min(92vw, 1000px); */
}

.top-subnav-panel-inner-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.top-subnav-panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    padding: 0 0.25rem;
    opacity: 0.85;
    margin-bottom: 12px;
}

.top-subnav-panel-without-section {
    display: flex;
    gap: 1.5rem;
    min-width: 180px;
    padding: 0.2rem 0.15rem;
    white-space: nowrap;
}

.top-subnav-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 180px;
    padding: 0.2rem 0.15rem;
}

.top-subnav-panel-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    padding: 0 0.25rem;
    opacity: 0.85;
}

.top-subnav-panel-section-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.top-subnav-panel-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 0.45rem 0.45rem 0.45rem;
    border-radius: 8px;
    color: var(--white);
    background: transparent;
    gap: 15px;
    font-size: 0.85rem;
}

.top-subnav-panel-link i {
    font-size: 1.1rem;
}


.top-subnav-panel-link:hover {
    background: var(--primary-blue-dark);
    transform: none;
}

/* =========================================================================
   Mobile off-canvas nav drawer (hamburger-toggled)
   Below 900px the top nav links collapse into a compact drawer, dimming the
   page behind a backdrop instead of leaving the old left-rail layout behind.
   ========================================================================= */

/* Hamburger toggle + backdrop are desktop-hidden; shown only in the mobile
   media query below. */
.mobile-nav-toggle {
    display: none;
}

.nav-backdrop {
    display: none;
}

/* ===========================================================================
   Notification bell (navbar) — Phase 1 in-app notifications
   =========================================================================== */
.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
}

.notif-button {
    position: relative;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .15s ease;
    padding: 6px;
    border-radius: 100%;

    color: var(--primary-blue);
    background: white;
}

.notif-button:hover {
    background: white;
    color: white;
}

.notif-icon {
    font-size: 20px;
    color: gray;
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e11d48;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.notif-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-width: 90vw;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.notif-menu.open {
    display: block;
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 700;
    font-size: 14px;
}

.notif-readall {
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.notif-readall:hover {
    text-decoration: underline;
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid #f4f4f5;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease;
    background: var(--background);
}

.notif-item:hover {
    background: #f9fafb;
}

.notif-item.unread {
    background: white;
}

.notif-item.unread:hover {
    background: #e4e9fd;
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.notif-item-body {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

.notif-item-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.notif-empty {
    padding: 28px 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.notif-viewall {
    display: block;
    padding: 11px 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
}
.notif-viewall:hover {
    background: #f9fafb;
}

.simulation-tag {
    padding: 4px 12px;
    
    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 12px;
    font-weight: 700;

    color: white;
    background: #b91c1c;
    border-radius: 12px;
}

.branch-tag {
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    
    font-size: 12px;
    font-weight: 700;
    
    color: white;
    border-radius: 12px;
}
/* ===========================================================================
   Global responsive rules — apply across every module page
   Tablet / small-laptop tweaks at 1024px, phone layout at 640px.
   =========================================================================== */

/* Phone & small tablet: condense the top bar */
@media (max-width: 1400px) {

    /* Never let any page scroll sideways — wide tables/boards get their own
       scroll containers; the page itself stays pinned to the viewport width. */
    html,
    body {
        max-width: 100%;
        /* overflow-x: hidden; */
    }

    .top-nav {
        padding: 0 0.85rem;
        gap: 8px;
        position: sticky;
        top: 30px;
        /* margin: 0; */
        margin: 30px 30px 0px 30px;

        z-index: 1000;
    }

    .top-nav h1 {
        font-size: 1.05rem;
    }

    /* Right cluster: tighten spacing + allow it to shrink so icons always fit */
    .top-nav-actions {
        gap: 10px !important;
        min-width: 0;
    }

    /* The git-branch badge is dev-context noise on a phone — hide it */
    .git-branch-tag {
        display: none !important;
    }

    /* Shrink the brand logo AND cap its width so a wide wordmark logo can't
       push the bell + avatar off the screen (it has no intrinsic max). */
    .top-nav img[src*="logo"] {
        height: 36px !important;
        width: auto !important;
        max-width: 120px !important;
        object-fit: contain !important;
        flex-shrink: 1;
    }

    .user-tz-tag {
        display: none;   /* timezone pill isn't essential on a phone */
    }

    /* Notification dropdown anchors to the viewport edge nicely */
    .notif-menu {
        width: 320px;
    }

    /* Keep page content within the viewport; inner widgets manage their own scroll */
    .main-content {
        overflow-x: hidden;
    }

    /* Tab bars (used by several modules: inventory, document-tracking, leave…)
       swipe horizontally instead of clipping when they exceed the screen. */
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tabs::-webkit-scrollbar {
        height: 0;
    }

    .tabs .tab-btn,
    .tabs>button {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Tablet & below: tighten the global shell a little */
@media (max-width: 1024px) {
    .top-nav {
        /* padding: 0 1.25rem; */
    }

    .user-tz-tag {
        display: none;   /* timezone pill isn't essential on a phone */
    }
    .simulation-tag {
        display: none;   /* simulation pill isn't essential on a phone */
    }
    .branch-tag {
        display: none;   /* git branch pill isn't essential on a phone */
    }

    .main-content {
        padding: 1.75rem;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Tables: never let a wide table blow out the layout on small screens.
   Wrap-free horizontal scroll keeps columns intact and swipeable.
   Applies to bare <table>s and common wrapper class names used across modules. */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .user-tz-tag {
        display: none;   /* timezone pill isn't essential on a phone */
    }
    .simulation-tag {
        display: none;   /* simulation pill isn't essential on a phone */
    }

    /* Moved up from 640px — this breakpoint is where the hamburger and
       side-nav collapse already happen, so the nav cleanup should match. */
    .top-nav h1 a {
        font-size: 0;
    }

    /* hide the wordmark, keep the tappable link */
    .top-nav img[src*="logo"] {
        height: 32px !important;
        max-width: 104px !important;
    }

    .nav-user-info {
        display: none;   /* keep just the avatar in the dropdown button */
    }
    .user-info {
        display: none;   /* the separate name/org block is redundant with the dropdown */
    }

    .top-nav {
        margin: 10px 10px 0 10px;
        top: 10px;   /* keep it matching, since top-nav is position: sticky */
    }

    .top-nav-actions {
        gap: 6px !important;
    }

    .main-content {
        margin-left: 0;
        padding-top: calc(var(--topnav-height) + 1rem);
    }

    /* Show the hamburger in the top bar */
    .mobile-nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        padding: 0 9px;
        background: transparent;
        border: 1px solid rgba(15, 23, 42, 0.12);
        border-radius: 10px;
        cursor: pointer;
        box-shadow: none;
    }

    .mobile-nav-toggle:hover {
        background: rgba(15, 23, 42, 0.05);
        transform: none;
        box-shadow: none;
    }

    .mobile-nav-toggle .hamburger-bar {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background: var(--primary-dark);
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    /* Animate into an "X" when the drawer is open */
    body.nav-open .mobile-nav-toggle .hamburger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    body.nav-open .mobile-nav-toggle .hamburger-bar:nth-child(2) {
        opacity: 0;
    }

    body.nav-open .mobile-nav-toggle .hamburger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* The rail keeps its vertical icon layout but slides off-canvas */
    .nav-rail {
        transform: translateX(calc(-1 * (var(--rail-width) + var(--context-width))));
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1200;
    }

    /* The context panel sits flush against the rail, also off-canvas, and is
       always revealed (no hover) once the drawer is open */
    .nav-context {
        transform: translateX(calc(-1 * (var(--rail-width) + var(--context-width))));
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        z-index: 1190;
    }

    .context-pin {
        display: none;
    }

    /* A desktop "pinned" choice must NOT force the drawer open on mobile —
       neutralise it so the off-canvas position holds until the hamburger opens. */
    html.nav-pinned .nav-context {
        transform: translateX(calc(-1 * (var(--rail-width) + var(--context-width))));
    }

    /* Slide both in together when the body is flagged open (wins over pinned
       via source order — same specificity). */
    body.nav-open .nav-rail,
    body.nav-open .nav-context {
        transform: translateX(0);
    }

    /* Backdrop dims the page behind the open drawer */
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: var(--topnav-height) 0 0 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.26s ease;
        z-index: 1100;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Content always spans the full width — the drawer overlays, never pushes */
    .main-content,
    html.nav-pinned .main-content,
    .nav-context~.main-content {
        margin-left: 0;
        padding: 1.25rem;
    }

    /* Prevent body scroll-jank while the drawer is open */
    body.nav-open {
        overflow: hidden;
    }

    .table-responsive,
    .table-wrap,
    .table-container,
    .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-content table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
}

/* ---------------------------------------------------------------------------
   Overrides for pages whose responsive CSS lives inline in their template's
   <style> block. Templates can be served stale by cached app workers, so these
   live here in the always-fresh stylesheet to guarantee they apply on mobile.
   --------------------------------------------------------------------------- */
@media (max-width: 720px) {
    /* Modals: full-width sheet feel on phones */
    .modal-content {
        width: 94%;
        max-width: 94%;
        max-height: 88vh;
        overflow-y: auto;
        border-radius: 14px;
    }

    /* Credentials page: agent-config grid → single column; credential cards
       must shrink instead of being propped open by their fields. */
    .agent-config-grid {
        grid-template-columns: 1fr !important;
    }

    #credentials-tab .card {
        min-width: 0;
        width: 100%;
    }

    /* long unbroken reference URLs must wrap, not overflow the card */
    #credentials-tab .card a,
    #credentials-tab .card p {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Knowledge base: stack the two-up content grid, 3-up stats → 2-up. */
    .content-grid {
        grid-template-columns: 1fr !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Notification dropdown: anchored right:0 to the bell, it spilled off the
       left edge (the avatar sits to the bell's right). Pin it as a full-width
       sheet under the top bar instead so it's always fully on-screen. */
    .notif-menu {
        position: fixed;
        top: calc(var(--topnav-height) - 4px);
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
    }

    /* Same treatment for the profile/avatar dropdown so it can't clip either. */
    .dropdown-menu {
        position: fixed;
        top: calc(var(--topnav-height) - 4px);
        right: 8px;
        left: auto;
        min-width: 200px;
        max-width: calc(100vw - 16px);
    }

    .top-subnav {
        gap: 4px;
    }

    .main-content {
        padding: 1rem 0.85rem;
    }

    .card {
        padding: 1.1rem;
        border-radius: 12px;
        margin-bottom: 1.25rem;
    }

    .card:hover {
        transform: none;
    }

    /* no lift on touch */

    /* Comfortable tap targets + readable inputs (prevents iOS zoom-on-focus).
       min-width:0 stops fields from propping their flex/grid container wider
       than the screen (a common source of mobile horizontal overflow). */
    input,
    textarea,
    select {
        font-size: 16px;
        padding: 0.7rem 0.85rem;
        min-width: 0;
    }

    button {
        padding: 0.7rem 1.1rem;
    }
}
