/* Lockdown Link — optimised modern portal CSS
   Load after assets/css/style.css. Preserve selector specificity for legacy overrides.
   Source: user-provided stylesheet, 21 October 2026. */

:root {
    --navy: #0b1329;
    --navy-light: #17233d;
    --blue: #2563eb;
    --brand: #74aec1;
    --brand-dark: #28647b;
    --brand-light: #edf6f8;
    --brand-border: #c7e1e9;
    --background: #f1f5f9;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Inter", Arial, sans-serif;
}

.portal-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    min-height: 100vh;
    background: var(--navy);
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 0;
}

/* SIDEBAR - LOCKDOWN LINK LOGO */
.portal-layout .sidebar .sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    padding: 22px 16px 20px;
    box-sizing: border-box;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-layout .sidebar .sidebar-logo-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    text-decoration: none;
}

.portal-layout .sidebar .sidebar-brand-image {
    display: block;
    width: 100%;
    max-width: 195px;
    height: auto;
    max-height: 70px;
    object-fit: contain;
    object-position: center;
}

.portal-layout .sidebar .sidebar-brand-subtitle {
    display: block;
    color: var(--brand);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
}

.portal-layout .sidebar .sidebar-logo img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
    padding: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 12px;
    padding: 14px;
    background: #111c34;
    border: 1px solid #26334b;
    border-radius: 12px;
}

.user-circle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
}

.sidebar-user-details {
    min-width: 0;
}

.sidebar-user-details strong {
    display: block;
    color: white;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-details span {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    margin-top: 3px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
}

.sidebar-menu a:hover {
    background: var(--navy-light);
    color: white;
}

.sidebar-menu a.active {
    background: var(--blue);
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 14px;
    border-top: 1px solid var(--text);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    text-decoration: none;
    padding: 12px;
    font-size: 13px;
    border-radius: 10px;
}

.logout-link:hover {
    color: #f87171;
    background: #2a1725;
}

.sidebar-version {
    text-align: center;
    color: var(--muted);
    font-size: 10px;
    margin-top: 14px;
}

.portal-content {
    flex: 1;
    min-width: 0;
    background: var(--background);
}

.topbar {
    background: white;
    min-height: 76px;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.notification-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #d97706;
    font-size: 19px;
    text-decoration: none;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 2px 5px;
    background: #dc2626;
    color: white;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.critical-warning {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 12px;
    font-weight: 700;
}

.status-dot {
    width: 9px;
    height: 9px;
    background: #10b981;
    border-radius: 50%;
}

.page-container {
    padding: 26px;
    max-width: 1440px;
    margin: 0 auto;
}

.portal-content .card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

@media (max-width: 800px) {
    .portal-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        min-height: 0;
        height: auto;
        position: relative;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-menu a {
        padding: 10px;
    }

    .sidebar-footer {
        margin-top: 0;
    }

    .topbar {
        position: relative;
        padding: 16px;
    }

    .page-container {
        padding: 16px;
    }

}

/* LAYOUT FIXES — Override conflicting legacy styles */
.portal-layout {
    display: flex !important;
    width: 100%;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    align-items: stretch;
}

.portal-layout > .sidebar {
    flex: 0 0 260px !important;
    width: 260px !important;
    min-width: 260px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.portal-layout > .portal-content {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
}

.portal-content > .topbar {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 18px 28px !important;
}

.portal-content > .page-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto !important;
    padding: 26px !important;
}

main.portal-content {
    float: none !important;
    position: relative;
    left: auto !important;
    right: auto !important;
}

.portal-layout > .sidebar {
    overflow-x: hidden;
}

@media (max-width: 800px) {
    .portal-layout {
        flex-direction: column !important;
    }

    .portal-layout > .sidebar {
        width: 100% !important;
        min-width: 0 !important;
        flex-basis: auto !important;
        height: auto !important;
        min-height: 0 !important;
        position: relative !important;
    }

    .portal-content > .page-container {
        padding: 16px !important;
    }

}

.portal-layout > .sidebar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.portal-layout > .sidebar::-webkit-scrollbar {
    display: none;
}

/* DASHBOARD VISUAL POLISH */
.portal-content .page-container {
    max-width: 1440px;
    padding: 28px 32px !important;
}

.portal-content h1,
.portal-content h2,
.portal-content h3 {
    color: #0f172a;
    letter-spacing: -0.025em;
}

.portal-content h1 {
    font-size: 28px;
    font-weight: 800;
}

.portal-content h2 {
    font-size: 22px;
    font-weight: 700;
}

.portal-content h3 {
    font-size: 18px;
    font-weight: 700;
}

.portal-content .card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s ease;
}

.portal-content .card:hover {
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07);
}

.portal-content .card h2,
.portal-content .card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
}

.portal-content .card p {
    color: var(--muted);
    line-height: 1.6;
}

.portal-content .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.portal-content .btn-primary {
    background: var(--blue);
    color: #ffffff;
    border: 1px solid var(--blue);
}

.portal-content .btn-primary:hover {
    background: #1d4ed8;
}

.portal-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.portal-content th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.portal-content td {
    padding: 14px;
    border-bottom: 1px solid var(--background);
    color: #334155;
}

.portal-content tbody tr:hover {
    background: #f8fafc;
}

.portal-content input:not([type="checkbox"]):not([type="radio"]),
.portal-content select,
.portal-content textarea {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    font-family: inherit;
    font-size: 13px;
}

.portal-content input:focus,
.portal-content select:focus,
.portal-content textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: var(--blue);
}

@media (max-width: 800px) {
    .portal-content .page-container {
        padding: 16px !important;
    }

    .portal-content .card {
        padding: 18px;
    }

}

/* MODERN DASHBOARD */
.modern-dashboard {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px;
}

.dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 30px;
    margin-bottom: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.dashboard-welcome h1 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 26px;
    font-weight: 800;
}

.dashboard-welcome p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.dashboard-welcome p strong {
    color: #334155;
}

.dashboard-welcome-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 14px;
    background: #eff6ff;
    color: var(--blue);
    font-size: 25px;
}

.dashboard-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

.dashboard-panel {
    min-width: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.dashboard-panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
}

.dashboard-panel-heading h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 17px;
    font-weight: 800;
}

.dashboard-panel-heading p {
    margin: 0;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.dashboard-text-link {
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-text-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.dashboard-alert-list {
    max-height: none !important;
    overflow: visible !important;
}

.dashboard-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-page-button:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--blue);
}

.dashboard-page-button.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
}

/* RECENT ALERTS PAGINATION */
.portal-content .dashboard-alerts-panel .dashboard-alert-pagination {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: 100%;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.portal-content .dashboard-alert-pagination .dashboard-page-button {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 32px;
    max-width: none !important;
    height: 32px !important;
    margin: 0 !important;
    padding: 0 9px !important;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: #475569;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.portal-content .dashboard-alert-pagination .dashboard-page-button:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--blue);
}

.portal-content .dashboard-alert-pagination .dashboard-page-button.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
}

.portal-content .dashboard-alert-pagination .dashboard-page-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dashboard-alert-item[hidden] {
    display: none !important;
}

.dashboard-alert-item {
    padding: 15px;
    border: 1px solid var(--border);
    border-left: 4px solid #94a3b8;
    border-radius: 12px;
    background: #f8fafc;
}

.dashboard-alert-item.severity-critical {
    border-color: #fecaca;
    border-left-color: #dc2626;
    background: #fef2f2;
}

.dashboard-alert-item.severity-warning {
    border-color: #fde68a;
    border-left-color: #d97706;
    background: #fffbeb;
}

.dashboard-alert-item.severity-info {
    border-color: #bfdbfe;
    border-left-color: var(--blue);
    background: #eff6ff;
}

.dashboard-alert-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.dashboard-severity {
    color: #475569;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.severity-critical .dashboard-severity {
    color: #b91c1c;
}

.severity-warning .dashboard-severity {
    color: #b45309;
}

.severity-info .dashboard-severity {
    color: #1d4ed8;
}

.dashboard-alert-meta time {
    color: var(--muted);
    font-size: 10px;
    text-align: right;
    overflow-wrap: anywhere;
}

.dashboard-alert-item h3 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 750;
}

.dashboard-alert-item p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.dashboard-alert-site {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--muted);
    font-size: 11px;
}

.dashboard-alert-site i {
    margin-right: 5px;
}

.dashboard-panel-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    font-size: 16px;
}

.icon-blue {
    background: #dbeafe;
    color: var(--blue);
}

.icon-purple {
    background: #f3e8ff;
    color: #9333ea;
}

.dashboard-device-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

.dashboard-placeholder-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--blue);
    border-radius: 16px;
    font-size: 24px;
    margin-bottom: 15px;
}

.dashboard-device-placeholder h3 {
    margin: 0 0 8px;
    color: #334155;
    font-size: 15px;
}

.dashboard-device-placeholder p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.dashboard-users-panel {
    display: flex;
    flex-direction: column;
}

.dashboard-users-summary {
    padding: 20px 0 28px;
}

.dashboard-user-count {
    color: #0f172a;
    font-size: 56px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.dashboard-users-summary p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.dashboard-primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: auto;
    padding: 12px 16px;
    background: var(--blue);
    color: #ffffff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-primary-link:hover {
    background: #1d4ed8;
    color: #ffffff;
}

.dashboard-empty-state {
    padding: 30px 16px;
    text-align: center;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 12px;
}

.dashboard-empty-state i {
    font-size: 24px;
    margin-bottom: 10px;
}

.dashboard-empty-state p {
    margin: 0;
    font-size: 12px;
}

@media (max-width: 1200px) {
    .dashboard-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-alerts-panel {
        grid-column: 1 / -1;
    }

}

@media (max-width: 800px) {
    .modern-dashboard {
        padding: 16px;
    }

    .dashboard-welcome {
        padding: 20px;
    }

    .dashboard-card-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-alerts-panel {
        grid-column: auto;
    }

    .dashboard-panel {
        padding: 18px;
    }

}

/* COMPACT DASHBOARD CARDS */
.dashboard-card-grid {
    align-items: start !important;
}

.dashboard-panel {
    height: auto !important;
    min-height: 0 !important;
}

.dashboard-alert-list {
    max-height: none;
    overflow: visible;
}

.dashboard-alert-item {
    padding: 12px 14px;
}

.dashboard-alert-item h3 {
    margin-bottom: 4px;
}

.dashboard-alert-meta {
    margin-bottom: 7px;
}

.dashboard-device-placeholder {
    min-height: 180px;
    padding: 18px;
}

.dashboard-users-summary {
    padding: 12px 0 20px;
}

.dashboard-users-panel .dashboard-primary-link {
    margin-top: 10px;
}

.dashboard-alert-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.dashboard-alert-list::-webkit-scrollbar {
    width: 5px;
}

.dashboard-alert-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* DASHBOARD SITES OVERVIEW */
.dashboard-sites-panel {
    margin-top: 24px;
    padding: 30px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.dashboard-sites-panel .dashboard-panel-heading {
    margin-bottom: 20px;
}

.dashboard-sites-panel .dashboard-panel-heading h2 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}

.dashboard-sites-panel .dashboard-panel-heading p {
    font-size: 14px;
    color: var(--muted);
}

.dashboard-sites-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-site-card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    padding: 20px;
}

.dashboard-site-card:hover {
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
}

.dashboard-site-card:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}

.dashboard-site-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.dashboard-site-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #eff6ff;
    color: var(--blue);
    font-size: 16px;
}

.dashboard-site-label {
    padding: 5px 8px;
    border-radius: 6px;
    background: var(--background);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.dashboard-site-card h3 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 15px;
    font-weight: 800;
}

.dashboard-site-company {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-site-stats {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--background);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-site-stats > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-site-stats span {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-site-stats strong {
    color: #0f172a;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .dashboard-sites-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 650px) {
    .dashboard-sites-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sites-panel {
        padding: 18px;
    }

}

.dashboard-gateway-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-gateway-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-gateway-stat {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 16px;
}

.dashboard-gateway-stat strong {
    display: block;
    color: #0f172a;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
}

.dashboard-gateway-stat span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-gateway-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}

.dashboard-gateway-note i {
    color: var(--blue);
    margin-top: 3px;
}

.dashboard-site-status-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    min-height: 138px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 15px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-site-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.dashboard-site-status-card:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}

.dashboard-site-status-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.dashboard-site-status-top h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 800;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.dashboard-status-badge {
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.status-unknown {
    color: #92400e;
    background: #fef3c7;
}

.status-secure {
    color: #ffffff;
    background: #059669;
}

.status-lockdown {
    color: #ffffff;
    background: #dc2626;
}

.dashboard-site-status-bottom {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-site-status-bottom i {
    font-size: 16px;
}

@media (max-width: 1100px) {
    .dashboard-sites-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 650px) {
    .dashboard-sites-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sites-panel {
        padding: 20px;
    }

    .dashboard-site-status-top {
        flex-wrap: wrap;
    }

}

.dashboard-welcome-monitoring {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.dashboard-welcome-text {
    min-width: 0;
}

.dashboard-welcome-monitoring h1 {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

.dashboard-welcome-monitoring p {
    max-width: 550px;
    font-size: 15px;
    line-height: 1.6;
}

.dashboard-monitoring-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 220px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 15px;
}

.dashboard-monitoring-box > div:first-child {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.dashboard-monitoring-label {
    color: var(--muted);
    font-size: 13px;
}

#dashboard-live-clock {
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.dashboard-monitoring-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #dbeafe;
    color: var(--blue);
    font-size: 18px;
}

.dashboard-critical-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 24px;
    background: #dc2626;
    border-radius: 18px;
    color: #ffffff;
}

.dashboard-critical-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 27px;
}

.dashboard-critical-content {
    flex: 1;
    min-width: 0;
}

.dashboard-critical-labels {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-critical-badge {
    padding: 5px 10px;
    border-radius: 5px;
    background: #ffffff;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 800;
}

.dashboard-critical-site {
    padding: 5px 10px;
    border-radius: 5px;
    background: #991b1b;
    color: #ffffff;
    font-size: 12px;
}

.dashboard-critical-content h2 {
    margin: 0 0 6px;
    color: #ffffff;
    font-size: 21px;
    font-weight: 800;
}

.dashboard-critical-content p {
    margin: 0;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-critical-action {
    flex-shrink: 0;
}

.dashboard-acknowledgement-pending {
    display: inline-block;
    padding: 14px 18px;
    border-radius: 12px;
    background: #ffffff;
    color: #991b1b;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 800px) {
    .dashboard-welcome-monitoring {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-monitoring-box {
        width: 100%;
    }

    .dashboard-critical-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-critical-symbol {
        width: 48px;
        height: 48px;
    }

}

/* ALERTS PAGE — SUMMARY AND FILTERS */
.alerts-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.alerts-summary-card {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 17px;
    box-shadow: 0 2px 5px rgba(15,23,42,.04);
}

.alerts-summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 58px;
    height: 58px;
    border-radius: 14px;
    font-size: 23px;
}

.summary-red {
    background: #fee2e2;
    color: #dc2626;
}

.summary-green {
    background: #d1fae5;
    color: #059669;
}

.summary-blue {
    background: #dbeafe;
    color: var(--blue);
}

.summary-slate {
    background: var(--background);
    color: #334155;
}

.alerts-summary-card span {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .035em;
}

.alerts-summary-card strong {
    display: block;
    margin-top: 5px;
    color: #0f172a;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.alerts-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    margin-bottom: 28px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 17px;
    box-shadow: 0 2px 5px rgba(15,23,42,.04);
}

.alerts-search-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 320px;
    max-width: 560px;
    padding: 0 15px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 11px;
}

.alerts-search-wrap i {
    color: #94a3b8;
}

.portal-content .alerts-search-wrap input {
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 !important;
    border: 0 !important;
    outline: none;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
}

.alerts-filter-tabs {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px;
    background: var(--background);
    border-radius: 12px;
}

.portal-content .alerts-filter-tab {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 10px 13px !important;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.portal-content .alerts-filter-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(15,23,42,.1);
}

.portal-content #alerts-site-filter {
    width: auto !important;
    min-width: 150px;
    height: 43px;
    padding: 0 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 11px;
    font-size: 12px;
}

/* MODERN ALERTS PAGE */
.modern-alerts-page {
    max-width: 1440px;
    margin: 0 auto;
}

.alerts-page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.alerts-page-heading h1 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

.alerts-page-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.alerts-total-badge {
    padding: 9px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.modern-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modern-alert-card {
    padding: 22px 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 4px solid #94a3b8;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.modern-alert-card.alert-critical {
    border-left-color: #dc2626;
}

.modern-alert-card.alert-warning {
    border-left-color: #d97706;
}

.modern-alert-card.alert-info {
    border-left-color: var(--blue);
}

.modern-alert-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.modern-alert-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.modern-alert-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--background);
    color: var(--muted);
    font-size: 17px;
}

.alert-critical .modern-alert-icon {
    background: #fef2f2;
    color: #dc2626;
}

.alert-warning .modern-alert-icon {
    background: #fffbeb;
    color: #d97706;
}

.alert-info .modern-alert-icon {
    background: #eff6ff;
    color: var(--blue);
}

.modern-alert-heading h2 {
    margin: 0 0 5px;
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}

.modern-alert-heading time {
    color: #94a3b8;
    font-size: 12px;
}

.modern-alert-severity {
    flex-shrink: 0;
    padding: 7px 12px;
    background: var(--background);
    color: #475569;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
}

.alert-critical .modern-alert-severity {
    background: #fee2e2;
    color: #b91c1c;
}

.alert-warning .modern-alert-severity {
    background: #fef3c7;
    color: #92400e;
}

.alert-info .modern-alert-severity {
    background: #dbeafe;
    color: #1d4ed8;
}

.modern-alert-message {
    margin: 16px 0;
    padding-left: 56px;
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.modern-alert-locations {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-left: 56px;
}

.modern-alert-location {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 9px 12px;
    background: #f8fafc;
    border: 1px solid var(--background);
    border-radius: 9px;
    color: #475569;
    font-size: 12px;
}

.modern-alert-location i {
    color: var(--muted);
    flex-shrink: 0;
}

.modern-alert-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--background);
}

.modern-alert-footer form {
    margin: 0;
}

.modern-alert-acknowledged {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
}

.modern-alert-acknowledged > i {
    margin-top: 2px;
    font-size: 16px;
}

.modern-alert-acknowledged strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.modern-alert-acknowledged small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #15803d;
}

.portal-content .modern-ack-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto !important;
    min-height: 38px;
    margin: 0;
    padding: 10px 16px;
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 9px;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.portal-content .modern-ack-button:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.modern-alerts-empty {
    padding: 60px 20px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.modern-alerts-empty i {
    font-size: 28px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.modern-alerts-empty h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.modern-alerts-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 700px) {
    .modern-alert-card {
        padding: 18px;
    }

    .modern-alert-message,
    .modern-alert-locations {
        padding-left: 0;
    }

    .modern-alert-top {
        flex-wrap: wrap;
    }

    .modern-alert-location {
        width: 100%;
    }

}

.modern-alerts-list {
    gap: 20px;
}

.modern-alert-card {
    padding: 26px 30px;
    border: 1px solid var(--border);
    border-radius: 18px;
}

.modern-alert-card.alert-critical {
    border-left: 4px solid #dc2626;
}

.modern-alert-card[hidden],
#alerts-filter-empty[hidden] {
    display: none !important;
}

.modern-alert-message {
    padding-left: 0;
    margin: 22px 0 18px;
}

.modern-alert-locations {
    padding-left: 0;
    gap: 0;
    background: #f8fafc;
    border: 1px solid var(--background);
    border-radius: 12px;
    overflow: hidden;
}

.modern-alert-location {
    flex: 1 1 220px;
    padding: 13px 16px;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.modern-alert-footer {
    margin-top: 18px;
    padding-top: 0;
    border-top: 0;
}

#alerts-filter-empty {
    margin-bottom: 20px;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}

@media (max-width: 1150px) {
    .alerts-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 650px) {
    .alerts-summary-grid {
        grid-template-columns: 1fr;
    }

    .alerts-filter-bar {
        align-items: stretch;
    }

    .alerts-search-wrap {
        flex-basis: 100%;
    }

    .alerts-filter-tabs {
        overflow-x: auto;
    }

    .modern-alert-card {
        padding: 18px;
    }

}

/* MAIN ALERTS PAGE PAGINATION */
.portal-content .alerts-pagination {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 24px;
    padding: 20px 10px;
}

.portal-content .alerts-pagination[hidden] {
    display: none !important;
}

.portal-content .alerts-pagination .alerts-page-button {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 38px;
    max-width: none !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: #475569;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.portal-content .alerts-pagination .alerts-page-button:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--blue);
}

.portal-content .alerts-pagination .alerts-page-button.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
}

.portal-content .alerts-pagination .alerts-page-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.portal-content .modern-alert-card[hidden] {
    display: none !important;
}

.dashboard-alert-refresh-status {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.dashboard-alert-refresh-status.refresh-failed {
    color: #b45309;
}

.portal-content .dashboard-alert-pagination[hidden] {
    display: none !important;
}

.portal-content .dashboard-alert-item[hidden] {
    display: none !important;
}

.dashboard-new-alert-banner {
    position: sticky;
    top: 76px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    margin-bottom: 20px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-left: 5px solid var(--blue);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.dashboard-new-alert-banner[hidden] {
    display: none !important;
}

.dashboard-new-alert-banner.is-critical {
    background: #fff1f2;
    border-color: #fda4af;
    border-left-color: #dc2626;
}

.dashboard-new-alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.dashboard-new-alert-content > i {
    color: var(--blue);
    font-size: 22px;
}

.dashboard-new-alert-banner.is-critical
.dashboard-new-alert-content > i {
    color: #dc2626;
}

.dashboard-new-alert-content strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
}

.dashboard-new-alert-content p {
    margin: 5px 0 0;
    color: #475569;
    font-size: 13px;
}

.dashboard-new-alert-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.dashboard-new-alert-actions a {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.portal-content .dashboard-new-alert-actions button {
    width: 34px !important;
    height: 34px;
    padding: 0 !important;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.07);
    color: #334155;
    cursor: pointer;
}

.portal-content .dashboard-notifications-button {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    width: auto !important;
    max-width: 100%;
    margin: 0 0 12px;
    padding: 9px 13px !important;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 650px) {
    .dashboard-new-alert-banner {
        align-items: flex-start;
        flex-direction: column;
        top: 60px;
    }

    .dashboard-new-alert-actions {
        width: 100%;
        justify-content: space-between;
    }

}

/* EQUAL HEIGHT DASHBOARD PANELS */
.portal-content .dashboard-card-grid {
    align-items: stretch;
}

.portal-content .dashboard-card-grid > .dashboard-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}

.portal-content .dashboard-alerts-panel
.dashboard-alert-pagination {
    margin-top: auto;
}

.portal-content .dashboard-alerts-panel
.dashboard-alert-list {
    min-width: 0;
}

.portal-content .dashboard-alert-item h3,
.portal-content .dashboard-alert-item p {
    overflow-wrap: anywhere;
}

.portal-content .dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 28px 32px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.portal-content .dashboard-welcome-text {
    flex: 1;
    min-width: 0;
}

.portal-content .dashboard-welcome-text h1 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.portal-content .dashboard-welcome-text p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* RIGHT HAND CONTROLS */
.portal-content .dashboard-welcome-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 260px;
    flex: 0 0 260px;
}

.portal-content .dashboard-welcome-actions
.dashboard-monitoring-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 65px;
    margin: 0;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: none;
}

.portal-content .dashboard-monitoring-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.portal-content #dashboard-live-clock {
    display: block;
    color: #0f172a;
    font-size: 14px;
    font-weight: 750;
    white-space: nowrap;
}

.portal-content .dashboard-monitoring-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: #dbeafe;
    color: var(--blue);
    border-radius: 11px;
    font-size: 17px;
}

/* NOTIFICATION BUTTON */
.portal-content .dashboard-welcome-actions
.dashboard-notifications-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100% !important;
    min-height: 40px;
    margin: 0 !important;
    padding: 10px 14px !important;
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 10px;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.portal-content .dashboard-welcome-actions
.dashboard-notifications-button:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

.portal-content .dashboard-welcome-actions
.dashboard-notifications-button i {
    color: #ffffff;
    font-size: 13px;
}

.portal-content .dashboard-welcome-actions
.dashboard-notifications-button:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

/* RESPONSIVE WELCOME BANNER */
@media (max-width: 900px) {
    .dashboard-welcome-actions {
        align-items: flex-start;
        width: 100%;
    }

    .portal-content .dashboard-welcome-actions
    .dashboard-notifications-button {
        width: auto !important;
    }

}

@media (max-width: 800px) {
    .portal-content .dashboard-welcome {
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
    }

    .portal-content .dashboard-welcome-actions {
        width: 100%;
        flex: 0 1 auto;
    }

    .portal-content .dashboard-welcome-text h1 {
        font-size: 24px;
    }

}

@media (max-width: 600px) {
    .dashboard-welcome-actions {
        align-items: stretch;
    }

    .portal-content .dashboard-welcome-actions
    .dashboard-notifications-button {
        width: 100% !important;
    }

}

/* MODERN USERS DIRECTORY */
.portal-content .modern-users-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    color: #0f172a;
}

.modern-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}

.modern-users-header h1 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.7px;
}

.modern-users-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.portal-content .modern-users-add-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 18px;
    border-radius: 10px;
    background: var(--blue);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.portal-content .modern-users-add-button:hover {
    background: #1d4ed8;
    color: #ffffff;
}

.modern-users-company-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 18px 22px;
    margin-bottom: 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.modern-users-company-bar label {
    font-size: 13px;
    font-weight: 700;
}

.portal-content .modern-users-select {
    width: min(100%, 360px);
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
}

.modern-users-directory {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.modern-users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.modern-users-toolbar h2 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 750;
}

.modern-users-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.modern-users-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.modern-users-search {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 240px;
    padding: 0 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.modern-users-search i {
    color: #94a3b8;
    font-size: 13px;
}

.portal-content .modern-users-search input {
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 8px 0;
    border: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
}

.portal-content .modern-users-role-filter {
    width: auto;
    min-width: 135px;
    min-height: 42px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 13px;
}

.modern-users-list {
    padding: 0 12px;
}

.modern-user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 12px;
    border-bottom: 1px solid var(--background);
}

.modern-user-row:last-child {
    border-bottom: 0;
}

.modern-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 800;
}

.modern-user-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.modern-user-details strong {
    font-size: 14px;
    font-weight: 750;
}

.modern-user-email {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.modern-user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
}

.modern-user-meta i {
    margin-right: 4px;
    color: #94a3b8;
}

.modern-user-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 7px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.modern-user-status.is-active {
    background: #dcfce7;
    color: #166534;
}

.modern-user-status.is-inactive {
    background: var(--background);
    color: #475569;
}

.modern-user-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.portal-content .modern-user-manage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 9px 13px;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.portal-content .modern-user-manage:hover {
    background: #dbeafe;
}

.modern-users-empty {
    padding: 35px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.modern-users-error {
    margin: 16px 24px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
}

@media (max-width: 700px) {
    .modern-users-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .modern-users-filters,
    .modern-users-search {
        width: 100%;
        min-width: 0;
    }

    .portal-content .modern-users-role-filter {
        width: 100%;
    }

    .modern-user-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .modern-user-details {
        flex-basis: calc(100% - 65px);
    }

    .modern-user-status {
        margin-left: 56px;
    }

    .portal-content .modern-user-manage {
        margin-left: auto;
    }

}

/* MODERN EDIT USER PAGE */
.portal-content .modern-user-edit-page {
    max-width: 1300px;
    margin: 0 auto;
}

.modern-user-edit {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modern-user-edit > .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.modern-user-edit > .page-header h1 {
    margin: 0 0 5px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.6px;
}

.modern-user-edit > .page-header p {
    color: var(--muted);
    font-size: 14px;
}

.portal-content .modern-user-edit > .page-header .btn,
.portal-content .modern-user-edit > .page-header a {
    width: auto !important;
    flex: 0 0 auto;
    padding: 10px 18px !important;
    border-radius: 9px;
}

.modern-user-edit > .content-card {
    padding: 26px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}

.modern-user-edit > .content-card h2 {
    margin: 0 0 24px;
    color: #0f172a;
    font-size: 19px;
    font-weight: 750;
}

.modern-user-edit-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px;
    align-items: end;
}

.modern-user-edit-fields > label {
    font-size: 13px;
    font-weight: 650;
    color: #334155;
}

.portal-content .modern-user-edit-fields > input,
.portal-content .modern-user-edit-fields > select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 14px;
    color: #0f172a;
}

.portal-content .modern-user-edit-fields > input:focus,
.portal-content .modern-user-edit-fields > select:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(37, 99, 235, 0.12);
}

.modern-user-edit-fields > .content-card {
    grid-column: 1 / -1;
    padding: 22px;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}

.modern-user-edit-fields > .content-card h2 {
    margin-bottom: 10px;
    font-size: 17px;
}

.modern-user-edit-fields > .content-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.modern-user-edit-fields
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    accent-color: var(--blue);
}

.portal-content .modern-user-edit-fields
.content-card button {
    width: auto !important;
    min-height: 40px;
    padding: 10px 18px !important;
    border-radius: 9px;
}

.modern-user-edit-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.portal-content .modern-user-edit-actions .btn {
    width: auto !important;
    min-width: 140px;
    padding: 12px 20px !important;
    border-radius: 9px;
}

@media (max-width: 700px) {
    .modern-user-edit-fields {
        grid-template-columns: 1fr;
    }

    .modern-user-edit > .content-card {
        padding: 18px;
    }

    .modern-user-edit-actions {
        justify-content: stretch;
    }

    .portal-content .modern-user-edit-actions .btn {
        width: 100% !important;
    }

}

/* MODERN ADD USER PAGE */
.portal-content .modern-user-add-page {
    max-width: 1300px;
    margin: 0 auto;
}

.portal-content .modern-user-add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 26px;
}

.portal-content .modern-user-add-header h1 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.7px;
}

.portal-content .modern-user-add-header .page-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.portal-content .modern-user-add-header
.modern-user-back-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: auto !important;
    min-width: 140px;
    padding: 10px 16px !important;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #334155;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.portal-content .modern-user-add-header
.modern-user-back-button:hover {
    background: var(--background);
    color: #0f172a;
}

.portal-content .modern-user-add-page
#user-add .content-card {
    padding: 28px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}

.portal-content .modern-user-add-page
#user-add .content-card h2 {
    margin: 0 0 24px;
    color: #0f172a;
    font-size: 19px;
    font-weight: 750;
}

.modern-user-add-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 24px;
}

.modern-user-add-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.modern-user-add-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 650;
}

.portal-content .modern-user-add-field input,
.portal-content .modern-user-add-field select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 45px;
    margin: 0;
    padding: 10px 13px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #0f172a;
    font-family: inherit;
    font-size: 14px;
}

.portal-content .modern-user-add-field input:focus,
.portal-content .modern-user-add-field select:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(37, 99, 235, 0.12);
}

.modern-user-add-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.portal-content .modern-user-add-actions button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 150px;
    min-height: 44px;
    padding: 11px 20px !important;
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 9px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.portal-content .modern-user-add-actions button:hover {
    background: #1d4ed8;
}

@media (max-width: 700px) {
    .modern-user-add-fields {
        grid-template-columns: 1fr;
    }

    .portal-content .modern-user-add-page
    #user-add .content-card {
        padding: 20px;
    }

    .modern-user-add-actions {
        justify-content: stretch;
    }

    .portal-content .modern-user-add-actions button {
        width: 100% !important;
    }

}

/* DESKTOP NOTIFY LOGIN PAGE */
body.portal-login-page {
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(
            circle at top left,
            rgba(37, 99, 235, 0.09),
            transparent 45%
        ),
        var(--background);
    font-family: Inter, Arial, sans-serif;
}

.portal-login-card {
    width: 100%;
    max-width: 410px;
    padding: 36px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
}

.portal-login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    margin-bottom: 28px;
}

.portal-login-page .portal-login-logo {
    display: block;
    width: 100%;
    max-width: 285px;
    height: auto;
    margin: 0 auto 8px;
    object-fit: contain;
}

.portal-login-brand-subtitle {
    margin: 0;
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-align: center;
}

.portal-login-description {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.portal-login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.portal-login-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 650;
}

.portal-login-card .portal-login-field input {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 11px 13px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #0f172a;
    font-family: inherit;
    font-size: 14px;
}

.portal-login-card .portal-login-field input:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(37, 99, 235, 0.12);
}

.portal-login-card .portal-login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    margin-top: 10px;
    padding: 12px 18px;
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 9px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.portal-login-card .portal-login-submit:hover {
    background: #1d4ed8;
}

.portal-login-card .portal-login-submit:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.portal-login-footer {
    margin: 22px 0 0;
    text-align: center;
    color: #94a3b8;
    font-size: 11px;
}

@media (max-width: 480px) {
    .portal-login-page .portal-login-logo {
        max-width: 235px;
    }

    .portal-login-page .portal-login-card {
        padding: 28px 22px;
    }

}

.portal-login-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 9px;
    color: #991b1b;
    font-size: 13px;
    line-height: 1.5;
}

.portal-login-error i {
    margin-top: 2px;
    flex-shrink: 0;
}

body.portal-login-page {
    box-sizing: border-box;
}

.portal-login-page *,
.portal-login-page *::before,
.portal-login-page *::after {
    box-sizing: border-box;
}

.portal-login-page .portal-login-card form {
    width: 100%;
}

.portal-login-page .portal-login-submit {
    width: 100% !important;
    margin-top: 8px;
}

/* MODERN SITES PAGE */
.modern-sites-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.portal-content .modern-sites-page .site-company-panel {
    padding: 24px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--border);
}

.sites-section-heading h2,
.sites-list-heading h2 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.sites-section-heading p,
.sites-list-heading p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.portal-content .modern-sites-page .company-select {
    width: 100%;
    max-width: 380px;
    margin-top: 20px;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
}

.sites-selected-company {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 15px;
    border: 1px solid var(--brand-border, var(--brand-border));
    border-radius: 10px;
    background: var(--brand-light, var(--brand-light));
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 600;
}

.sites-list-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.portal-content .modern-sites-page .sites-add-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: auto !important;
    padding: 11px 17px;
    border-radius: 9px;
    background: var(--blue);
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.portal-content .modern-sites-page .sites-add-button:hover {
    background: #1d4ed8;
}

.portal-content .modern-sites-page .sites-list-panel {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
}

.modern-sites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.modern-site-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modern-site-card:hover {
    border-color: var(--brand, var(--brand));
    box-shadow: 0 5px 16px rgba(116, 174, 193, 0.12);
}

.modern-site-details {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.modern-site-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--brand-light, var(--brand-light));
    color: var(--brand-dark);
    font-size: 17px;
}

.modern-site-text {
    min-width: 0;
}

.modern-site-text h3 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 15px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.modern-site-text p {
    margin: 0;
    color: #94a3b8;
    font-size: 12px;
}

.portal-content .modern-sites-page .modern-site-manage {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex: 0 0 auto;
    width: auto !important;
    min-width: 100px;
    padding: 10px 14px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.portal-content .modern-sites-page .modern-site-manage:hover {
    background: var(--brand-light, var(--brand-light));
    border-color: var(--brand, var(--brand));
    color: var(--brand-dark);
}

.portal-content .modern-sites-page .modern-site-manage:focus-visible,
.portal-content .modern-sites-page .sites-add-button:focus-visible {
    outline: 3px solid var(--brand, var(--brand));
    outline-offset: 3px;
}

.sites-feedback {
    margin: 0;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.sites-error {
    color: #b91c1c;
}

@media (max-width: 950px) {
    .modern-sites-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 550px) {
    .modern-site-card {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-content .modern-sites-page .modern-site-manage {
        width: 100% !important;
    }

    .portal-content .modern-sites-page .sites-add-button {
        width: 100% !important;
    }

    .portal-content .modern-sites-page .sites-list-panel {
        padding: 16px;
    }

}

/* =========================================
   EDIT SITE PAGE
   ========================================= */

.site-edit-page {
    max-width: 1200px !important;
}

.site-edit-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}

.site-edit-heading h1 {
    margin: 0 0 7px;
    font-size: 28px;
    font-weight: 800;
}

.site-edit-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.portal-content .site-edit-back,
.portal-content .site-edit-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto !important;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.site-edit-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.site-edit-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.site-edit-card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.site-edit-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-size: 18px;
}

.site-edit-card-heading h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
}

.site-edit-card-heading p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.site-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.site-edit-full {
    grid-column: 1 / -1;
}

.site-edit-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.site-edit-field label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.portal-content .site-edit-field input,
.portal-content .site-edit-field textarea {
    display: block;
    width: 100% !important;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-family: inherit;
}

.portal-content .site-edit-field input:focus,
.portal-content .site-edit-field textarea:focus {
    outline: 2px solid rgba(116, 174, 193, 0.22);
    border-color: var(--brand);
}

.site-edit-field input:disabled {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.site-edit-field small {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.site-logo-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 120px;
    padding: 20px;
    border: 1px dashed var(--brand-border);
    border-radius: 12px;
    background: #f8fafc;
}

.site-logo-preview img {
    display: block;
    width: 180px;
    max-width: 45%;
    height: 75px;
    object-fit: contain;
}

.site-logo-preview strong,
.site-logo-preview small {
    display: block;
}

.site-logo-preview strong {
    margin-bottom: 6px;
    color: #0f172a;
    font-size: 14px;
}

.site-edit-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.site-edit-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 10px;
    background: #f8fafc;
}

.site-edit-info-grid span {
    color: var(--muted);
    font-size: 12px;
}

.site-edit-info-grid strong {
    color: #0f172a;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.site-edit-note {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.site-edit-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 30px;
}

.portal-content .site-edit-save {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: auto !important;
    margin: 0 !important;
    padding: 12px 22px !important;
    background: var(--blue);
    color: white;
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.portal-content .site-edit-save:hover {
    background: #1d4ed8;
}

.site-edit-error,
.site-edit-success {
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.site-edit-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.site-edit-success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
}

@media (max-width: 700px) {
    .site-edit-card {
        padding: 20px;
    }

    .site-edit-grid,
    .site-edit-info-grid {
        grid-template-columns: 1fr;
    }

    .site-edit-full {
        grid-column: auto;
    }

    .site-edit-actions {
        flex-wrap: wrap;
    }

    .site-logo-preview {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-logo-preview img {
        max-width: 100%;
    }
}
/* =========================================
   TOPBAR ORGANISATION BRANDING
   ========================================= */

.portal-layout .topbar .topbar-organisation-brand {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 140px;
    height: 44px;
    padding: 6px 12px;

    background: #f8fafc;
    border: 1px solid var(--brand-border, #c7e1e9);
    border-radius: 10px;

    box-sizing: border-box;
    flex-shrink: 0;
}

.portal-layout .topbar .topbar-organisation-brand img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center;
}

.portal-layout .topbar .topbar-organisation-brand[hidden] {
    display: none !important;
}

@media (max-width: 700px) {

    .portal-layout .topbar .topbar-organisation-brand {
        width: 82px;
        height: 36px;
        padding: 4px;
    }

}


/* =========================================
   MODERN LICENCE MANAGEMENT
   ========================================= */

.modern-licences-page {
    max-width: 1400px;
}

/* Page heading */

.licences-page-heading {
    margin-bottom: 26px;
}

.licences-page-heading h1 {
    margin: 0 0 7px;
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

.licences-page-heading p {
    margin: 0;
    font-size: 14px;
    color: var(--muted, #64748b);
}

/* Licence card grid */

.modern-licence-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

/* Individual licence */

.modern-licence-card {
    display: flex;
    flex-direction: column;
    min-width: 0;

    padding: 26px;
    background: #ffffff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;

    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.modern-licence-card:hover {
    border-color: var(--brand-border, #c7e1e9);
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.07);
}

/* Header */

.modern-licence-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.modern-licence-company {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.modern-licence-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;
    flex-shrink: 0;

    background: var(--brand-light, #edf6f8);
    color: var(--brand-dark, #28647b);
    border-radius: 12px;
    font-size: 18px;
}

.modern-licence-company-text {
    min-width: 0;
}

.modern-licence-company-text h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.modern-licence-type {
    color: #64748b;
    font-size: 13px;
}

/* Licence status badges */

.modern-licence-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    width: auto;
    padding: 7px 11px;

    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.licence-status-active {
    background: #dcfce7;
    color: #166534;
}

.licence-status-expired {
    background: #fee2e2;
    color: #b91c1c;
}

.licence-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.licence-status-suspended {
    background: #e2e8f0;
    color: #475569;
}

/* Expiry details */

.modern-licence-expiry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;

    padding: 22px 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.modern-licence-label {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 12px;
}

.modern-licence-date {
    display: block;
    color: #0f172a;
    font-size: 17px;
    font-weight: 800;
}

.modern-licence-remaining {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.modern-licence-remaining.is-expired {
    color: #b91c1c;
}

/* Usage section */

.modern-licence-usage {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px 0;
}

.modern-licence-usage h3 {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
}

.modern-usage-block {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.modern-usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.modern-usage-name {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.modern-usage-name i {
    width: 17px;
    color: var(--brand-dark, #28647b);
    text-align: center;
}

.modern-usage-header strong {
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
}

/* Usage bars */

.modern-usage-progress {
    height: 9px;
    width: 100%;
    overflow: hidden;

    background: #e2e8f0;
    border-radius: 999px;
}

.modern-usage-fill {
    height: 100%;
    background: var(--brand, #74aec1);
    border-radius: inherit;
    transition: width 0.25s ease;
}

/* Action buttons */

.modern-licence-actions {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border, #e2e8f0);
}

.portal-content .modern-licence-actions a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: auto !important;
    min-width: 0;
    padding: 11px 16px;

    border-radius: 9px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.portal-content .modern-licence-manage {
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #2563eb;
}

.portal-content .modern-licence-manage:hover {
    background: #1d4ed8;
}

.portal-content .modern-licence-history {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.portal-content .modern-licence-history:hover {
    background: var(--brand-light, #edf6f8);
    border-color: var(--brand, #74aec1);
}

/* Loading, empty and error messages */

.licences-feedback {
    padding: 30px;
    background: #ffffff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    color: #64748b;
    text-align: center;
    font-size: 14px;
}

.licences-error {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

/* Responsive */

@media (max-width: 1050px) {
    .modern-licence-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 550px) {
    .modern-licence-card {
        padding: 20px;
    }

    .modern-licence-header {
        flex-wrap: wrap;
    }

    .modern-licence-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-content .modern-licence-actions a {
        width: 100% !important;
    }
}

/* =========================================
   LICENCE EDIT + HISTORY PAGES
   ========================================= */

.modern-licence-detail-page {
    max-width: 1150px;
}

/* Page heading */

.licence-detail-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 26px;
}

.licence-detail-heading h1 {
    margin: 0 0 7px;
    color: #0f172a;
    font-size: 28px;
    font-weight: 800;
}

.licence-detail-heading p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.portal-content .licence-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    width: auto !important;
    padding: 10px 15px;

    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 9px;

    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.portal-content .licence-back-link:hover {
    background: #edf6f8;
    border-color: #74aec1;
}

/* Main card */

.licence-detail-card {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.licence-detail-card-header {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 26px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.licence-detail-company-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;
    flex-shrink: 0;

    background: #edf6f8;
    color: #28647b;
    border-radius: 12px;
    font-size: 19px;
}

.licence-detail-card-header h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 19px;
    font-weight: 800;
}

.licence-detail-card-header p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

/* Form layout */

.modern-licence-form {
    padding: 0 30px;
}

.licence-form-section {
    padding: 28px 0;
    border-bottom: 1px solid #e2e8f0;
}

.licence-form-section h3 {
    margin: 0 0 20px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 800;
}

.licence-section-description {
    margin: -10px 0 22px;
    color: #64748b;
    font-size: 13px;
}

.licence-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.licence-form-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.licence-form-field {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}

.licence-form-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.portal-content .licence-form-field input,
.portal-content .licence-form-field select {
    width: 100%;
    height: 44px;
    padding: 0 13px;

    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 9px;

    font-size: 13px;
    box-sizing: border-box;
}

.portal-content .licence-form-field input:focus,
.portal-content .licence-form-field select:focus {
    outline: none;
    border-color: #74aec1;
    box-shadow: 0 0 0 3px rgba(116, 174, 193, 0.15);
}

/* Active licence checkbox */

.licence-active-option {
    display: flex;
    align-items: center;
    gap: 13px;
    cursor: pointer;
}

.portal-content .licence-active-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #28647b;
    flex-shrink: 0;
}

.licence-active-option span {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.licence-active-option strong {
    color: #0f172a;
    font-size: 13px;
}

.licence-active-option small {
    color: #64748b;
    font-size: 12px;
}


/* =========================================
   LICENCE FORM BUTTON FIX
   ========================================= */

.portal-content .modern-licence-form .licence-form-actions {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;

    padding: 20px 0 24px;
    margin: 0;
}

/* Apply consistent sizing to both buttons */

.portal-content .modern-licence-form .licence-form-actions
:is(.licence-cancel-button, .licence-save-button) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;

    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 145px;
    height: 42px;

    padding: 0 18px;
    margin: 0;

    box-sizing: border-box;
    border-radius: 9px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;

    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

/* Cancel */

.portal-content .modern-licence-form
.licence-form-actions .licence-cancel-button {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.portal-content .modern-licence-form
.licence-form-actions .licence-cancel-button:hover {
    background: #f1f5f9;
}

/* Save */

.portal-content .modern-licence-form
.licence-form-actions .licence-save-button {
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #2563eb;
}

.portal-content .modern-licence-form
.licence-form-actions .licence-save-button:hover {
    background: #1d4ed8;
}

/* Mobile layout */

@media (max-width: 550px) {
    .portal-content .modern-licence-form .licence-form-actions {
        flex-direction: column-reverse !important;
        align-items: stretch;
    }

    .portal-content .modern-licence-form .licence-form-actions
    :is(.licence-cancel-button, .licence-save-button) {
        width: 100% !important;
    }
}


/* =========================================
   LICENCE HISTORY TIMELINE
   ========================================= */

.modern-licence-timeline {
    padding: 30px;
}

.modern-licence-timeline-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 16px;
    position: relative;
}

.modern-licence-timeline-item:not(:last-child) {
    padding-bottom: 26px;
}

.modern-licence-timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 40px;
    bottom: 0;
    left: 18px;
    width: 2px;
    background: #d9e8ed;
}

.licence-timeline-marker {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    position: relative;
    z-index: 1;

    background: #edf6f8;
    color: #28647b;
    border: 1px solid #c7e1e9;
    border-radius: 50%;
    font-size: 13px;
}

.licence-timeline-content {
    min-width: 0;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.licence-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.licence-timeline-header h3 {
    margin: 0 0 9px;
    color: #0f172a;
    font-size: 15px;
    font-weight: 800;
}

.licence-timeline-actor,
.licence-timeline-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #64748b;
    font-size: 12px;
}

.licence-history-changes {
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.licence-history-change-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
}

.licence-history-change-row + .licence-history-change-row {
    border-top: 1px solid #e2e8f0;
}

.licence-history-field {
    color: #334155;
    font-size: 12px;
}

.licence-history-values {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
}

.licence-history-values > i {
    color: #94a3b8;
}

.licence-history-old,
.licence-history-new {
    padding: 6px 10px;
    border-radius: 6px;
    overflow-wrap: anywhere;
}

.licence-history-old {
    background: #fee2e2;
    color: #991b1b;
}

.licence-history-new {
    background: #dcfce7;
    color: #166534;
}

/* Empty history */

.licence-history-empty {
    padding: 65px 20px;
    text-align: center;
}

.licence-history-empty > i {
    color: #74aec1;
    font-size: 30px;
}

.licence-history-empty h3 {
    margin: 15px 0 8px;
    color: #0f172a;
    font-size: 17px;
}

.licence-history-empty p {
    color: #64748b;
    font-size: 13px;
}

/* Responsive */

@media (max-width: 700px) {
    .licence-form-grid,
    .licence-form-grid-three {
        grid-template-columns: 1fr;
    }

    .modern-licence-form {
        padding: 0 20px;
    }

    .licence-detail-card-header {
        padding: 20px;
    }

    .modern-licence-timeline {
        padding: 20px;
    }

    .licence-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .portal-content .licence-cancel-button,
    .portal-content .licence-save-button {
        width: 100% !important;
    }

    .licence-history-change-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Edit User - Password Reset */

.user-password-reset {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.user-password-reset p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.user-password-reset-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.user-password-reset-fields label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.portal-content .user-password-reset-fields input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    box-sizing: border-box;
}

.portal-content .user-password-reset > button {
    align-self: flex-start;
    width: auto !important;
    min-width: 160px;
    padding: 11px 18px;
}

@media (max-width: 650px) {
    .user-password-reset-fields {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   GATEWAY SUBSCRIPTIONS
   ========================================= */

.modern-subscriptions-page {
    max-width: 1200px;
}

.subscriptions-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.subscriptions-heading h1 {
    margin: 0 0 6px;
    font-size: 28px;
    color: #0f172a;
}

.subscriptions-heading p,
.subscriptions-toolbar p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.portal-content .subscriptions-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto !important;
    padding: 10px 15px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.subscriptions-info-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 17px 20px;
    margin-bottom: 22px;
    background: #edf6f8;
    border: 1px solid #c7e1e9;
    border-radius: 12px;
    color: #28647b;
}

.subscriptions-info-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

.subscriptions-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
}

.subscriptions-toolbar h2 {
    margin: 0 0 5px;
    font-size: 17px;
    color: #0f172a;
}

.subscriptions-count {
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.subscriptions-list {
    display: grid;
    gap: 12px;
}

.subscription-gateway-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
}

.subscription-gateway-card:hover {
    border-color: #74aec1;
}

.portal-content .subscription-gateway-card input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #28647b;
}

.subscription-gateway-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: #edf6f8;
    color: #28647b;
}

.subscription-gateway-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

.subscription-gateway-details strong {
    color: #0f172a;
    font-size: 14px;
}

.subscription-gateway-details small {
    color: #64748b;
    font-size: 12px;
}

.subscription-gateway-badge {
    padding: 7px 11px;
    background: #f1f5f9;
    border-radius: 999px;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.subscription-gateway-badge.is-automatic {
    background: #dcfce7;
    color: #166534;
}

.subscription-gateway-card.is-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.subscriptions-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
}

.portal-content .subscriptions-save {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: auto !important;
    min-width: 185px;
    padding: 12px 20px;
    border: 0;
    border-radius: 9px;
    background: #28647b;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.portal-content .subscriptions-save:hover {
    background: #204f62;
}

.portal-content .subscriptions-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.subscriptions-feedback,
.subscriptions-empty {
    padding: 18px;
    border-radius: 10px;
    background: #edf6f8;
    color: #28647b;
    font-size: 13px;
}

.subscriptions-feedback.is-error {
    background: #fef2f2;
    color: #b91c1c;
}

.subscriptions-feedback[hidden],
#subscriptions-content[hidden] {
    display: none !important;
}

@media (max-width: 650px) {
    .subscription-gateway-card {
        flex-wrap: wrap;
        padding: 15px;
    }

    .subscription-gateway-badge {
        margin-left: 33px;
    }

    .portal-content .subscriptions-save {
        width: 100% !important;
    }
}
/* Gateway subscriptions - user selector */

#subscription-user-picker {
    max-width: 650px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.portal-content .subscription-user-select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    cursor: pointer;
}

/* Gateway Management — append to modern-portal.css or load separately */
.gateway-admin-page { 
    max-width: 1200px; 
    
}
.gateway-admin-heading { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    gap:16px; 
    flex-wrap:wrap; 
    margin-bottom:18px; 
    
}
.gateway-admin-heading h1 { 
    margin:0 0 6px; 
    color:#0f172a; 
    font-size:26px; 
    
}
.gateway-admin-heading p { 
    margin:0; 
    color:#64748b; 
    font-size:13px; 
    
}
.gateway-admin-note { 
    padding:14px 16px; 
    background:#edf6f8; 
    border:1px solid #c7e1e9; 
    border-radius:10px; 
    color:#28647b; 
    font-size:13px; 
    line-height:1.5; 
    
}
.gateway-table-wrap, .gateway-editor, .gateway-secret { 
    background:#fff; 
    border:1px solid #e2e8f0; 
    border-radius:12px; 
    margin-top:18px; 
    padding:20px; 
    
}
.gateway-table-wrap { 
    overflow-x:auto; 
    
}
.gateway-table { 
    width:100%; 
    border-collapse:collapse; 
    
}
.gateway-table th, .gateway-table td { 
    padding:13px 12px; 
    border-bottom:1px solid #e2e8f0; 
    text-align:left; 
    font-size:13px; 
    
}
.gateway-table th { 
    color:#475569; 
    font-weight:700; 
    
}
.gateway-table td { 
    color:#0f172a; 
    
}
.gateway-row-actions {
    white-space: nowrap;
    vertical-align: middle;
}

.gateway-row-actions .gateway-btn + .gateway-btn {
    margin-left: 10px;
}
.portal-content .gateway-btn,
.gateway-admin-page .gateway-btn {
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.portal-content .gateway-btn-primary,
.gateway-admin-page .gateway-btn-primary {
    background: #28647b;
    color: #fff;
    border-color: #28647b;
}

.portal-content .gateway-btn-warning,
.gateway-admin-page .gateway-btn-warning {
    color: #9a3412;
    border-color: #fed7aa;
}

.gateway-btn:disabled {
    opacity: .6;
    cursor: wait;
}

.gateway-editor[hidden],
.gateway-secret[hidden] {
    display: none !important;
}

.gateway-editor h2,
.gateway-secret h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.gateway-editor form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.gateway-editor label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    font-weight: 650;
}

.gateway-editor input,
.gateway-editor select,
.gateway-secret textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    padding: 11px 12px;
    font: inherit;
    color: #0f172a;
}

.gateway-editor-actions {
    grid-column: 1/-1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.gateway-secret p {
    font-size: 13px;
    color: #64748b;
}

.gateway-secret textarea {
    font-family: monospace;
    overflow-wrap: anywhere;
}

#gateway-feedback:not(:empty) {
    margin: 14px 0;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 13px;
}

.gateway-feedback-ok {
    color: #166534;
    background: #f0fdf4;
}

.gateway-feedback-error {
    color: #991b1b;
    background: #fef2f2;
}

@media(max-width:760px) {
    .gateway-editor form {
        grid-template-columns: 1fr;
    }
    .gateway-row-actions {
        gap: 6px;
    }

    .gateway-admin-page .gateway-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}


/* =========================================
   GATEWAY BUTTON FIX
   ========================================= */

/* Preserve normal table layout */
.gateway-admin-page .gateway-table td.gateway-row-actions {
    display: table-cell !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    text-align: left !important;
}

/* Force matching action button dimensions */
.gateway-admin-page .gateway-table td.gateway-row-actions button.gateway-btn {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: auto !important;
    min-width: 92px !important;
    height: 38px !important;
    min-height: 38px !important;

    padding: 0 14px !important;
    margin: 0 !important;

    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;

    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;

    background: #ffffff !important;
    color: #183153 !important;

    box-shadow: none !important;
    text-transform: none !important;
    vertical-align: middle !important;
    white-space: nowrap !important;

    cursor: pointer;
}

/* Space between Edit and Rotate key */
.gateway-admin-page .gateway-table td.gateway-row-actions button.gateway-btn + button.gateway-btn {
    margin-left: 8px !important;
}

/* Rotate key styling */
.gateway-admin-page .gateway-table td.gateway-row-actions button.gateway-btn-warning {
    background: #fff8f2 !important;
    border-color: #f3c4a5 !important;
    color: #a84316 !important;
}

/* Hover styling */
.gateway-admin-page .gateway-table td.gateway-row-actions button.gateway-btn:hover {
    background: #eef5f8 !important;
    border-color: #74aec1 !important;
}

.gateway-admin-page .gateway-table td.gateway-row-actions button.gateway-btn-warning:hover {
    background: #ffeddc !important;
    border-color: #e8a67c !important;
}

/* Register Gateway button */
.gateway-admin-page #gateway-add {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: auto !important;
    min-height: 40px !important;
    padding: 0 18px !important;

    background: #286781 !important;
    border: 1px solid #286781 !important;
    border-radius: 8px !important;

    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    box-shadow: none !important;
}

/* =========================================
   GLOBAL LOCKDOWN BUTTON
   ========================================= */

.lockdown-global-bar {
    display: flex;
    justify-content: flex-end;
    padding: 12px 24px 0;
}

.lockdown-activate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 12px 20px;
    min-height: 44px;

    background: #b91c1c;
    color: #ffffff;

    border: 1px solid #991b1b;
    border-radius: 9px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;
}

.lockdown-activate-btn:hover {
    background: #991b1b;
}

.lockdown-activate-btn:focus-visible {
    outline: 3px solid #74aec1;
    outline-offset: 3px;
}

/* Confirmation dialog */

.lockdown-confirm-dialog {
    width: min(440px, calc(100% - 32px));
    max-width: 440px;
    padding: 28px;

    background: #ffffff;
    color: #183153;

    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.lockdown-confirm-dialog::backdrop {
    background: rgba(10, 20, 35, 0.65);
}

.lockdown-confirm-dialog h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.lockdown-confirm-dialog p {
    margin: 0 0 16px;
    line-height: 1.5;
}

.lockdown-dialog-warning {
    font-size: 13px;
    color: #9a3412;
}

.lockdown-dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.lockdown-cancel-btn,
.lockdown-confirm-btn {
    padding: 11px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.lockdown-cancel-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.lockdown-confirm-btn {
    background: #b91c1c;
    border: 1px solid #991b1b;
    color: #ffffff;
}

.lockdown-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .lockdown-global-bar {
        padding: 12px 16px 0;
    }

    .lockdown-activate-btn {
        width: 100%;
    }
}

/* Lockdown button in the global topbar */

.topbar-right .lockdown-activate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex-shrink: 0;

    padding: 11px 17px;
    min-height: 44px;

    background: #b91c1c;
    color: #ffffff;

    border: 1px solid #991b1b;
    border-radius: 9px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.topbar-right .lockdown-activate-btn:hover {
    background: #991b1b;
}

.topbar-right .lockdown-activate-btn:focus-visible {
    outline: 3px solid #74aec1;
    outline-offset: 3px;
}

@media (max-width: 800px) {
    .topbar-right .lockdown-activate-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* =========================================
   LOCKDOWN TOPBAR LAYOUT FIX
   ========================================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-left {
    flex: 0 0 auto;
    min-width: 0;
}

.topbar-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 14px;
    min-width: 0;
}

/* Override global button styling */

.topbar-right #activate-lockdown-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto !important;

    width: auto !important;
    max-width: none !important;
    min-width: 0;

    height: 42px;
    min-height: 42px;

    margin: 0 !important;
    padding: 0 18px !important;

    background: #b91c1c !important;
    color: #ffffff !important;

    border: 1px solid #991b1b !important;
    border-radius: 9px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;

    cursor: pointer;
}

.topbar-right #activate-lockdown-btn:hover {
    background: #991b1b !important;
}

.topbar-right #activate-lockdown-btn:focus-visible {
    outline: 3px solid #74aec1;
    outline-offset: 3px;
}

.topbar-right .notification-link,
.topbar-right .critical-warning,
.topbar-right .system-status,
.topbar-right .topbar-organisation-brand {
    flex-shrink: 0;
}

/* Keep the header usable on smaller screens */

@media (max-width: 1100px) {
    .topbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 76px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .topbar-right {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* =========================================
   LOCKDOWN SITE AND GATEWAY SELECTORS
   ========================================= */

.lockdown-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
}

.lockdown-field label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.lockdown-field select {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;

    background: #ffffff;
    color: #183153;

    border: 1px solid #cbd5e1;
    border-radius: 8px;

    font-family: inherit;
    font-size: 14px;
}

.lockdown-field select:focus {
    outline: 2px solid #74aec1;
    outline-offset: 2px;
}

.lockdown-field select:disabled {
    background: #f1f5f9;
    color: #64748b;
}

.lockdown-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0;

    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    cursor: pointer;
}

.lockdown-confirm-check input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: #b91c1c;
}

#lockdown-result {
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#lockdown-result:empty {
    display: none;
}
