/*
 * NexGen Legacy Modern UI Layer
 * --------------------------------
 * Visual overrides only: no routes, labels, permissions or workflow are
 * changed. Keep this file last in the cascade so deployment and rollback are
 * limited to one stylesheet plus the two link tags that load it.
 */

:root {
    --ng-navy-950: #071a3d;
    --ng-navy-900: #0b2554;
    --ng-navy-800: #123b73;
    --ng-cyan-600: #0891b2;
    --ng-cyan-500: #06b6d4;
    --ng-cyan-100: #cffafe;
    --ng-surface: #ffffff;
    --ng-canvas: #f3f7fb;
    --ng-text: #10213e;
    --ng-muted: #64748b;
    --ng-border: #dbe5f0;
    --ng-radius-sm: 10px;
    --ng-radius: 16px;
    --ng-shadow-sm: 0 1px 2px rgba(7, 26, 61, .05), 0 6px 18px rgba(7, 26, 61, .06);
    --ng-shadow: 0 16px 38px rgba(7, 26, 61, .10);
    --ng-focus: 0 0 0 4px rgba(6, 182, 212, .18);
}

html {
    background: var(--ng-canvas);
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 90% 4%, rgba(6, 182, 212, .08), transparent 25rem),
        var(--ng-canvas);
    color: var(--ng-text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
    font-size: 15px;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--ng-cyan-500) !important;
    outline-offset: 2px;
    box-shadow: var(--ng-focus) !important;
}

/* Shared application shell */
.header {
    min-height: 68px;
    height: 68px;
    padding: 0 24px;
    background: linear-gradient(105deg, var(--ng-navy-950), var(--ng-navy-800) 72%, #086b8f);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 28px rgba(7, 26, 61, .20);
}

.header .logo {
    gap: 12px;
}

.header .logo i {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #67e8f9;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
}

.header .logo h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1rem, 1.45vw, 1.3rem);
    font-weight: 750;
    letter-spacing: -.02em;
}

.header-actions {
    gap: 12px;
}

.notification-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 13px;
    background: rgba(255, 255, 255, .09);
    transition: background .2s ease, transform .2s ease;
}

.notification-icon:hover {
    background: rgba(255, 255, 255, .16);
    transform: translateY(-1px);
}

.notification-badge {
    top: -5px;
    right: -5px;
    border: 2px solid var(--ng-navy-900);
}

.user-profile {
    min-height: 44px;
    padding: 5px 10px 5px 6px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border: 2px solid #67e8f9;
}

.container {
    margin-top: 68px;
    min-height: calc(100vh - 68px);
}

.sidebar {
    top: 68px;
    width: 264px;
    height: calc(100vh - 68px);
    padding: 12px 10px 24px;
    background: rgba(255, 255, 255, .96);
    border-right: 1px solid var(--ng-border);
    box-shadow: 8px 0 28px rgba(7, 26, 61, .05);
    scrollbar-width: thin;
    scrollbar-color: #b6c7da transparent;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.menu-item {
    min-height: 46px;
    padding: 11px 14px;
    color: #40516c;
    border-radius: 12px;
    font-weight: 560;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.menu-item i {
    width: 24px;
    margin-right: 9px;
    color: #71829b;
    text-align: center;
}

.menu-item:hover {
    color: var(--ng-navy-800);
    background: #edf7fb;
    transform: translateX(2px);
}

.menu-item.active {
    color: #fff;
    background: linear-gradient(100deg, var(--ng-navy-800), #087fa4);
    box-shadow: 0 8px 18px rgba(18, 59, 115, .18);
}

.menu-item.active i {
    color: #a5f3fc;
}

.menu-item.active::before {
    display: none;
}

.menu-divider {
    margin: 12px 10px;
    background: var(--ng-border);
}

.menu-section-title {
    margin: 16px 12px 6px;
    color: #91a0b5;
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.main-content {
    margin-left: 264px;
    min-width: 0;
    min-height: calc(100vh - 68px);
    padding: clamp(18px, 2.2vw, 32px);
}

/* Reusable content surfaces */
.page-header,
.content-section,
.card,
.table-container,
.modal-content,
.fd-section {
    border-color: var(--ng-border) !important;
    border-radius: var(--ng-radius) !important;
    box-shadow: var(--ng-shadow-sm);
}

.page-title,
.fd-title,
h1,
h2,
h3 {
    color: var(--ng-text);
    letter-spacing: -.025em;
}

.btn,
button[class*="btn"] {
    min-height: 42px;
    border-radius: 11px;
    font-weight: 650;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover,
button[class*="btn"]:hover {
    transform: translateY(-1px);
}

.btn-primary,
.fd-btn.primary {
    color: #fff;
    background: linear-gradient(100deg, var(--ng-navy-800), #0785aa);
    box-shadow: 0 8px 18px rgba(18, 59, 115, .18);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    min-height: 44px;
    color: var(--ng-text);
    background-color: #fff;
    border: 1px solid #cbd8e6;
    border-radius: 11px;
}

input::placeholder,
textarea::placeholder {
    color: #93a2b7;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    color: #5c6d85;
    background: #f5f8fc;
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .045em;
    text-transform: uppercase;
}

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: #f5fbfd;
}

.notification-dropdown {
    border: 1px solid var(--ng-border);
    border-radius: var(--ng-radius);
    box-shadow: var(--ng-shadow);
}

/* Login: retain the familiar form while giving it the same brand system. */
body:has(.login-container),
body:has(.auth-container) {
    background:
        radial-gradient(circle at 78% 18%, rgba(34, 211, 238, .28), transparent 25rem),
        linear-gradient(135deg, var(--ng-navy-950), var(--ng-navy-800) 58%, #0689b2);
}

.login-container,
.auth-container,
.login-card {
    border: 1px solid rgba(255, 255, 255, .40);
    border-radius: 24px !important;
    box-shadow: 0 28px 75px rgba(4, 17, 42, .34) !important;
}

/* Responsive behaviour */
@media (max-width: 900px) {
    .header {
        padding: 0 14px;
    }

    .header .logo h1 {
        font-size: 1rem;
    }

    .user-profile span,
    .user-profile > .fa-chevron-down {
        display: none;
    }

    .sidebar {
        width: min(84vw, 300px);
        transform: translateX(-105%);
        box-shadow: 18px 0 48px rgba(7, 26, 61, .20);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 18px 14px 32px;
    }
}

@media (max-width: 600px) {
    .header {
        height: 62px;
        min-height: 62px;
    }

    .header .logo i {
        width: 34px;
        height: 34px;
    }

    .header .logo h1 {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .container {
        margin-top: 62px;
    }

    .sidebar {
        top: 62px;
        height: calc(100vh - 62px);
    }

    .notification-dropdown {
        position: fixed;
        top: 68px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 82px);
    }

    .page-header,
    .fd-header {
        align-items: flex-start !important;
        gap: 14px;
    }

    .fd-header-right,
    .header-actions-btn {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .fd-cards {
        grid-template-columns: 1fr !important;
    }

    .table-container,
    .fd-table-wrap,
    .content-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
