/* ==========================================================================
   SIG Management Platform — Corporate Enterprise Design System v3.0
   Inspired by Dark Slate-Teal & Emerald Reference UI + YouTube PiP Notifications
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root, [data-theme="dark"] {
    color-scheme: dark;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

    /* Corporate Slate-Teal Dark Surfaces (Reference UI Palette) */
    --bg-app:          #11191f;
    --bg-body:         #11191f;
    --bg-sidebar:      #18242c;
    --bg-header:       #18242c;
    --bg-card:         #17222b;
    --bg-card-alt:     #1e2d38;
    --bg-input:        #141e26;
    --bg-row-hover:    #1d2c36;
    --bg-table-head:   #2b3e4b;

    /* Borders */
    --border:          #273845;
    --border-color:    #273845;
    --border-subtle:   rgba(255, 255, 255, 0.06);
    --border-focus:    #00d47e;

    /* Typography */
    --text-primary:    #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-muted:      #64748b;
    --text-invert:     #091318;

    /* Emerald Corporate Accent */
    --accent:          #00d47e;
    --accent-hover:    #00b86c;
    --accent-tint:     rgba(0, 212, 126, 0.12);
    --accent-glow:     rgba(0, 212, 126, 0.24);
    --accent-border:   rgba(0, 212, 126, 0.35);

    /* Sidebar Navigation */
    --nav-text:           #94a3b8;
    --nav-hover-bg:       rgba(255, 255, 255, 0.05);
    --nav-hover-text:     #f1f5f9;
    --nav-active-bg:      #2a3d4a;
    --nav-active-text:    #ffffff;
    --nav-active-bar:     #00d47e;

    --sidebar-text:        #94a3b8;
    --sidebar-hover-bg:    rgba(255, 255, 255, 0.05);
    --sidebar-hover-text:  #f1f5f9;
    --sidebar-active-bg:   #2a3d4a;
    --sidebar-active-text: #ffffff;

    /* Semantic Status Colors */
    --green:        #00d47e;
    --green-bg:     rgba(0, 212, 126, 0.12);
    --green-border: rgba(0, 212, 126, 0.30);

    --amber:        #f59e0b;
    --amber-bg:     rgba(245, 158, 11, 0.12);
    --amber-border: rgba(245, 158, 11, 0.30);

    --red:          #f43f5e;
    --red-bg:       rgba(244, 63, 94, 0.12);
    --red-border:   rgba(244, 63, 94, 0.30);

    --blue:         #38bdf8;
    --blue-bg:      rgba(56, 189, 248, 0.12);
    --blue-border:  rgba(56, 189, 248, 0.30);

    --badge-danger-bg:     rgba(244, 63, 94, 0.15);
    --badge-danger-color:  #f43f5e;
    --badge-danger-border: rgba(244, 63, 94, 0.35);

    /* Controls & Elevations */
    --btn-ghost-bg:     #1d2b36;
    --btn-ghost-border: #2e4352;
    --btn-ghost-hover:  #263846;

    --shadow-sm:   0 2px 6px rgba(0, 0, 0, 0.28);
    --shadow-md:   0 8px 24px rgba(0, 0, 0, 0.42);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-pip:  0 18px 48px rgba(0, 0, 0, 0.65);

    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 12px;
}

[data-theme="light"] {
    color-scheme: light;
    --bg-app:          #f1f5f9;
    --bg-body:         #f1f5f9;
    --bg-sidebar:      #ffffff;
    --bg-header:       #ffffff;
    --bg-card:         #ffffff;
    --bg-card-alt:     #f8fafc;
    --bg-input:        #ffffff;
    --bg-row-hover:    #f8fafc;
    --bg-table-head:   #e2e8f0;

    --border:          #cbd5e1;
    --border-color:    #cbd5e1;
    --border-subtle:   #e2e8f0;
    --border-focus:    #059669;

    --text-primary:    #0f172a;
    --text-secondary:  #475569;
    --text-muted:      #64748b;
    --text-invert:     #ffffff;

    --accent:          #059669;
    --accent-hover:    #047857;
    --accent-tint:     rgba(5, 150, 105, 0.10);
    --accent-glow:     rgba(5, 150, 105, 0.18);
    --accent-border:   rgba(5, 150, 105, 0.30);

    --nav-text:           #475569;
    --nav-hover-bg:       #f1f5f9;
    --nav-hover-text:     #0f172a;
    --nav-active-bg:      rgba(5, 150, 105, 0.10);
    --nav-active-text:    #059669;
    --nav-active-bar:     #059669;

    --sidebar-text:        #475569;
    --sidebar-hover-bg:    #f1f5f9;
    --sidebar-hover-text:  #0f172a;
    --sidebar-active-bg:   rgba(5, 150, 105, 0.10);
    --sidebar-active-text: #059669;

    --green:        #059669;
    --green-bg:     #ecfdf5;
    --green-border: #a7f3d0;

    --amber:        #d97706;
    --amber-bg:     #fffbeb;
    --amber-border: #fde68a;

    --red:          #e11d48;
    --red-bg:       #fff1f2;
    --red-border:   #fecdd3;

    --blue:         #0284c7;
    --blue-bg:      #f0f9ff;
    --blue-border:  #bae6fd;

    --badge-danger-bg:     #fff1f2;
    --badge-danger-color:  #e11d48;
    --badge-danger-border: #fecdd3;

    --btn-ghost-bg:     #ffffff;
    --btn-ghost-border: #cbd5e1;
    --btn-ghost-hover:  #f1f5f9;

    --shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md:   0 6px 18px rgba(15, 23, 42, 0.10);
    --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-pip:  0 16px 40px rgba(15, 23, 42, 0.22);
}

/* ── Reset & Shell ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Sleek theme-matched scrollbars */
html, * {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans) !important;
    background-color: var(--bg-app) !important;
    color: var(--text-primary) !important;
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 13.5px;
    line-height: 1.5;
}

body.login-body {
    height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

body.auth-body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

body.public-form-body,
body.status-tracker-body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-app) !important;
    min-width: 0;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 24px;
    background: var(--bg-app) !important;
    color: var(--text-primary) !important;
}

/* ── Top Header (Reference UI Style) ────────────────────────────────────── */
.header {
    background: var(--bg-header) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 16px;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Search Bar — Clean Left-Aligned Icon, Guaranteed Padding Never Overlaps */
.header-search {
    position: relative;
    width: 260px;
    max-width: 100%;
    min-width: 160px;
    flex: 0 1 260px;
}

.header-search input[type="text"],
.header-search input {
    width: 100% !important;
    height: 38px !important;
    box-sizing: border-box !important;
    padding: 0 14px 0 38px !important;
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    font-family: var(--font-sans) !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.header-search input::placeholder {
    color: var(--text-muted) !important;
}

.header-search input:focus {
    outline: none !important;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--accent-tint) !important;
}

.header-search svg {
    position: absolute !important;
    left: 12px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--text-muted) !important;
    width: 16px !important;
    height: 16px !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

/* Header Collapse / Back Circle Button (Reference UI '<' button) */
.header-circle-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.15s;
    flex-shrink: 0;
}
.header-circle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-tint);
}

/* Theme Toggle */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 13px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s;
}
.theme-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Notification Bell (with Emerald Badge like Reference UI) */
.header-bell {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.header-bell:hover,
.header-bell.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
}

.header-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: #062115;
    font-size: 10.5px;
    font-weight: 800;
    border-radius: 10px;
    padding: 1px 5px;
    line-height: 1.3;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-header);
}

/* User Profile Pill */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 4px 12px 4px 5px;
    box-sizing: border-box;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    border-radius: 24px;
    flex-shrink: 0;
}
.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #059669);
    color: #062115;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-name-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ── Sidebar (Reference UI Style) ───────────────────────────────────────── */
.sidebar {
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border) !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    position: sticky !important;
    top: 0 !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.sidebar-header {
    height: 62px !important;
    padding: 0 16px !important;
    border-bottom: 1px solid var(--border) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    background: var(--bg-sidebar) !important;
    flex-shrink: 0 !important;
}

.brand-icon-box {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #062115;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.04em;
    box-shadow: 0 0 12px var(--accent-glow);
    flex-shrink: 0;
}

.brand-title {
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em !important;
    line-height: 1.2 !important;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 6px;
    min-width: 0;
}

.brand-text-stack {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.22;
}

.brand-badge {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-tint);
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--accent-border);
}

.sig-brand-flex {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}

.sig-name {
    font-size: 14.5px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    color: var(--text-primary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.sig-role {
    font-size: 10.5px !important;
    color: var(--accent) !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em !important;
    margin-top: 2px !important;
}

.sidebar-nav {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 14px 12px 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    background: var(--bg-sidebar) !important;
}

.sidebar-nav-title {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: var(--text-muted) !important;
    padding: 10px 12px 4px !important;
}

.sidebar-nav a,
.sidebar-nav button.sidebar-notif-trigger {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    padding: 10px 14px !important;
    color: var(--nav-text) !important;
    background: transparent;
    border: 1px solid transparent;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    text-decoration: none !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    border-radius: var(--radius-md) !important;
    cursor: pointer;
    position: relative !important;
    transition: all 0.15s ease;
}

.sidebar-nav a svg,
.sidebar-nav button.sidebar-notif-trigger svg {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
    stroke-width: 1.9 !important;
    fill: none !important;
    transition: color 0.15s ease;
}

.sidebar-nav a:hover,
.sidebar-nav button.sidebar-notif-trigger:hover {
    background: var(--nav-hover-bg) !important;
    color: var(--nav-hover-text) !important;
}

.sidebar-nav a.active {
    background: var(--nav-active-bg) !important;
    color: var(--nav-active-text) !important;
    font-weight: 600 !important;
    border-color: rgba(255, 255, 255, 0.06);
}

.sidebar-nav a.active svg {
    color: var(--accent) !important;
    stroke: var(--accent) !important;
}

.sidebar-nav a.active::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 7px !important;
    bottom: 7px !important;
    width: 3.5px !important;
    background: var(--accent) !important;
    border-radius: 0 4px 4px 0 !important;
    box-shadow: 0 0 8px var(--accent) !important;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--accent) !important;
    color: #062115 !important;
    font-size: 10.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    border: none;
    margin: 10px 8px !important;
}

/* ── Page Header & Action Buttons (Reference UI Style) ──────────────────── */
.page-header,
.header-action,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.page-header-left h1,
.header-action h1,
.content > h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary) !important;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle,
.header-action p {
    font-size: 13px;
    color: var(--text-secondary) !important;
    margin: 4px 0 0 0;
}

.page-actions,
.header-action-btns,
.export-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

@media (max-width: 1120px) {
    .page-actions,
    .header-action-btns,
    .export-bar {
        flex-wrap: wrap !important;
    }
}

.page-actions form,
.header-action-btns form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.page-actions form input[type="text"],
.page-actions form input[type="search"],
.page-actions form select {
    height: 38px !important;
    box-sizing: border-box !important;
}

.page-actions .btn,
.page-actions .btn-ghost,
.page-actions .btn-outline,
.page-actions .btn-cancel,
.page-actions .btn-cancel-red,
.page-actions .btn-secondary,
.page-actions .btn-action,
.page-actions .btn-danger,
.page-actions .btn-danger-ghost,
.page-actions .btn-danger-outline,
.page-actions .btn-danger-solid,
.page-actions .btn-red {
    height: 38px;
    box-sizing: border-box;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--accent) !important;
    color: #062115 !important;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px var(--accent-Tint);
}
.btn:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-ghost,
.btn-outline,
.btn-cancel,
.btn-secondary,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 15px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--btn-ghost-bg) !important;
    border: 1px solid var(--btn-ghost-border) !important;
    color: var(--text-primary) !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-ghost:hover,
.btn-outline:hover,
.btn-secondary:hover,
.btn-action:hover {
    background: var(--btn-ghost-hover) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* Red Cancel & Danger Action Buttons (Exact Same Dimensions & Shape as Primary .btn) */
.btn-cancel-red,
.btn-cancel,
.btn-danger-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--red-bg) !important;
    border: 1px solid var(--red-border) !important;
    color: var(--red) !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
}

.btn-cancel-red:hover,
.btn-cancel:hover,
.btn-danger-outline:hover {
    background: var(--red) !important;
    color: #ffffff !important;
    border-color: var(--red) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

.btn-danger-solid,
.btn-red {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--red) !important;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.btn-danger-solid:hover,
.btn-red:hover {
    background: #e11d48 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

/* Form Actions Bar - Standard Right-Aligned */
.form-actions-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.form-actions-right > .btn,
.form-actions-right > .btn-cancel-red,
.form-actions-right > .btn-cancel,
.form-actions-right > .btn-red,
.form-actions-right > .btn-ghost,
.form-actions-right > .btn-outline,
.form-actions-right > .btn-secondary,
.form-actions-right > .btn-danger,
.form-actions-right > .btn-danger-ghost,
.form-actions-right > .btn-danger-outline,
.form-actions-right > .btn-danger-solid {
    height: 38px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
}

.btn-danger,
.btn-danger-ghost,
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    box-sizing: border-box;
    line-height: 1;
    background: var(--red-bg) !important;
    border: 1px solid var(--red-border) !important;
    color: var(--red) !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-danger:hover,
.btn-danger-ghost:hover,
.logout-btn:hover {
    background: rgba(244, 63, 94, 0.22) !important;
}

.btn-reject {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 13px;
    background: var(--red-bg) !important;
    border: 1px solid var(--red-border) !important;
    color: var(--red) !important;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-reject:hover {
    background: rgba(244, 63, 94, 0.22) !important;
}

/* Compact secondary/table action button modifier */
.btn-sm {
    height: 30px !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    font-size: 12px !important;
    gap: 5px !important;
    border-radius: var(--radius-sm) !important;
}

.btn-approve,
.btn-checkin {
    background: var(--green-bg) !important;
    border: 1px solid var(--green-border) !important;
    color: var(--green) !important;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

.back-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    background: var(--btn-ghost-bg) !important;
    border: 1px solid var(--btn-ghost-border) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
}
.back-btn:hover,
.back-btn:active {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.back-btn-icon,
.back-btn svg {
    width: 17px !important;
    height: 17px !important;
    stroke: currentColor !important;
    stroke-width: 2.2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.back-btn-text {
    display: none !important;
}

/* ── Tables (Reference UI Distinct Slate Header & Clean Rows) ───────────── */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
    overflow-x: auto !important;
    overflow-y: hidden !important;
    box-shadow: var(--shadow-card);
}

/* Empty State Component - Centered & Balanced */
.empty-state {
    padding: 52px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    max-width: 440px;
    line-height: 1.5;
}

.empty-state > *:last-child {
    margin-bottom: 0 !important;
}

.empty-state .btn,
.empty-state a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.empty-state .empty-icon {
    margin-bottom: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

thead th {
    background: var(--bg-table-head) !important;
    color: var(--text-primary) !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 11px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border) !important;
    white-space: nowrap;
}

tbody td {
    padding: 11px 10px;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    vertical-align: middle;
    font-size: 13px;
}

thead th:first-child,
tbody td:first-child {
    padding-left: 16px;
}

thead th:last-child,
tbody td:last-child {
    padding-right: 16px;
}

tbody tr:last-child td { border-bottom: none !important; }
tbody tr:hover td { background: var(--bg-row-hover) !important; }

td .primary-text {
    font-weight: 600;
    color: var(--accent) !important;
}

td .secondary-text {
    font-size: 12px;
    color: var(--text-secondary) !important;
    margin-top: 2px;
}

.row-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

td:has(.row-actions),
td > .row-actions,
th:last-child,
td:last-child {
    white-space: nowrap;
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card-alt);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-tint);
}
.btn-icon.btn-icon-delete {
    color: var(--red);
    border-color: var(--red-border);
}
.btn-icon.btn-icon-delete:hover {
    background: var(--red-bg);
}

/* ── Cards & Stats Grid ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(185px, 100%), 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary) !important;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.stat-trend {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 6px;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3.5px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-active, .badge-published, .badge-open, .badge-completed, .badge-approved, .badge-evaluated {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green-border);
}
.badge-pending, .badge-draft, .badge-in-progress, .badge-assigned, .badge-revision-required {
    background: var(--amber-bg);
    color: var(--amber);
    border-color: var(--amber-border);
}
.badge-inactive, .badge-cancelled, .badge-closed, .badge-failed, .badge-rejected, .badge-suspended, .badge-archived {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-border);
}
.badge-info, .badge-global, .badge-sig, .badge-admin, .badge-submitted {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: var(--blue-border);
}

/* ── Forms, Checkboxes, & Help Boxes ────────────────────────────────────── */
.form-section-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.form-group { margin-bottom: 18px; }
.form-row, .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 16px;
}

.form-group label, label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-bottom: 6px;
}

.form-info, .help-text, .form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary) !important;
    margin-top: 5px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="url"], input[type="phone"],
select, textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 13px;
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md);
    color: var(--text-primary) !important;
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--accent-tint);
}

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* Split Date & Time Inputs (Responsive & Prevents Native Picker Overflow) */
.datetime-split-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.datetime-split-group input[type="date"],
.datetime-split-group input[type="time"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 38px;
    padding: 8px 10px;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}
.datetime-split-group input:focus {
    outline: none;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--accent-tint);
}

.checkbox-label {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary) !important;
}

/* Email Template & Role Permission Matrix Helpers */
.help-box, .security-note, .warning-box, .info-box {
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.code-key, .placeholder-tag, .code-pill {
    display: inline-block;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-tint);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    padding: 2px 8px;
    border-radius: 5px;
}

.perm-category, .perm-module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.perm-category-title, .perm-module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-table-head);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

.perm-grid, .perm-item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.perm-item, .perm-grid .checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s;
    margin: 0;
}
.perm-item:hover, .perm-grid .checkbox-label:hover {
    background: var(--bg-row-hover);
}

/* ── Portal Workspace Cards ─────────────────────────────────────────────── */
.portal-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.portal-sig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 18px;
}

.portal-sig-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.18s ease;
    min-height: 195px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.portal-sig-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.portal-sig-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.portal-sig-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.portal-sig-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.portal-role-pill {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-tint);
    border: 1px solid var(--accent-border);
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}
.portal-sig-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.portal-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

/* ── Alerts & Grid Utilities ────────────────────────────────────────────── */
.alert, .alert-success, .alert-error, .alert-info, .alert-warning, .error, .success {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success, .success { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.alert-error, .error     { background: var(--red-bg);   border: 1px solid var(--red-border);   color: var(--red); }
.alert-info              { background: var(--blue-bg);  border: 1px solid var(--blue-border);  color: var(--blue); }
.alert-warning           { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 18px; }
.grid-2 > *, .grid-3 > *, .card-grid > * { min-width: 0; }

/* ── YouTube-Style Picture-in-Picture (PiP) Notification Window ────────── */
.yt-notif-pip {
    position: fixed;
    top: 68px;
    right: 26px;
    width: 390px;
    max-width: calc(100vw - 32px);
    max-height: 510px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-pip);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: width 0.2s ease, height 0.2s ease, opacity 0.15s ease;
}

.yt-notif-pip.is-open {
    display: flex;
    animation: pipFadeIn 0.16s ease-out;
}

/* Docked Picture-in-Picture Bottom-Right Mode */
.yt-notif-pip.is-pip-docked {
    top: auto !important;
    bottom: 22px !important;
    right: 22px !important;
    left: auto !important;
    width: 350px;
    max-height: 400px;
    border: 1px solid var(--accent-border);
    box-shadow: var(--shadow-pip), 0 0 0 1px var(--accent-tint);
}

/* Minimized Picture-in-Picture Pill Bar */
.yt-notif-pip.is-minimized {
    max-height: 48px !important;
    width: 280px !important;
}
.yt-notif-pip.is-minimized .yt-notif-toolbar,
.yt-notif-pip.is-minimized .yt-notif-list {
    display: none !important;
}

@keyframes pipFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.yt-notif-header {
    background: var(--bg-table-head);
    padding: 11px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}
.yt-notif-header:active { cursor: grabbing; }

.yt-notif-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.yt-notif-count-pill {
    background: var(--accent);
    color: #062115;
    font-size: 10.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
}

.yt-notif-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.yt-pip-ctrl-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}
.yt-pip-ctrl-btn:hover,
.yt-pip-ctrl-btn.active {
    background: var(--bg-card);
    color: var(--accent);
    border-color: var(--accent-border);
}

.yt-notif-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: var(--bg-card-alt);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11.5px;
}

.yt-notif-action-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    font-family: inherit;
}
.yt-notif-action-link:hover { text-decoration: underline; }
.yt-notif-action-link.danger { color: var(--red); }

.yt-notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 390px;
    divide-y: 1px solid var(--border-subtle);
}

.yt-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    position: relative;
    cursor: pointer;
}
.yt-notif-item:hover { background: var(--bg-row-hover); }
.yt-notif-item.unread {
    background: rgba(0, 212, 126, 0.05);
}

.yt-notif-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--accent);
}
.yt-notif-item.read .yt-notif-unread-dot {
    background: transparent;
    box-shadow: none;
}

.yt-notif-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-tint);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.yt-notif-content {
    flex: 1;
    min-width: 0;
}
.yt-notif-item-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 2px;
}
.yt-notif-item-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    word-break: break-word;
}
.yt-notif-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.yt-notif-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0.7;
}
.yt-notif-item:hover .yt-notif-item-actions { opacity: 1; }

.yt-notif-mini-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    font-size: 11px;
}
.yt-notif-mini-btn:hover { color: var(--accent); }
.yt-notif-mini-btn.del:hover { color: var(--red); }

.yt-notif-empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Remove awkward native browser number spinner arrows globally */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
input[type=number] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* ── Shared Responsive Helpers & Mobile Navigation Shell ────────────────── */
.header-left-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-title-slot {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
}

.header-title-slot > span,
.header-title-slot > a {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-btn {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s;
}
.mobile-menu-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sidebar-close-btn {
    display: none;
    margin-left: auto;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    background: var(--btn-ghost-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s;
}
.sidebar-close-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(2px);
    z-index: 1150;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper {
    -webkit-overflow-scrolling: touch;
}

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

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

.form-grid-2 > *,
.form-grid-3 > *,
.form-row > *,
.form-grid > *,
.stats-grid > * {
    min-width: 0;
}

body.portal-body {
    flex-direction: column;
    height: 100vh;
}

.header-left.portal-header-left {
    gap: 72px;
}

@media (min-width: 769px) {
    .header-left.portal-header-left .header-left-main {
        flex-shrink: 0;
    }
}

@media (max-width: 1120px) {
    .header-left.portal-header-left {
        gap: 44px;
    }
}

@media (max-width: 960px) {
    .header-left.portal-header-left {
        gap: 20px;
    }
}

.notif-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
}
.notif-item.unread {
    border-color: var(--accent-border);
    background: rgba(0, 212, 126, 0.04);
}
.notif-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-tint);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.notif-body {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.notif-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}
.notif-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-mobile-logout {
    display: none !important;
}

/* ── Tablet & Drawer Navigation Breakpoint (<= 960px) ───────────────────── */
@media (max-width: 960px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body:not(.login-body):not(.auth-body):not(.public-form-body):not(.status-tracker-body) {
        min-height: 100dvh !important;
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.mobile-nav-open {
        overflow: hidden !important;
    }

    .main-content {
        width: 100% !important;
        height: auto !important;
        min-height: 100dvh !important;
        overflow: visible !important;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 90;
        padding: 10px 16px;
        height: auto;
        min-height: 60px;
    }

    .content {
        overflow: visible !important;
        overflow-x: clip !important;
        padding: 18px 16px 28px !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        width: 272px !important;
        min-width: 272px !important;
        max-width: 84vw !important;
        z-index: 1200 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1) !important;
        box-shadow: none !important;
    }

    .sidebar.is-open {
        transform: translateX(0) !important;
        box-shadow: 12px 0 36px rgba(0, 0, 0, 0.45) !important;
    }

    .sidebar-header .sig-brand-flex {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .sidebar-close-btn {
        display: inline-flex;
    }

    .sidebar-backdrop.is-open {
        display: block;
        opacity: 1;
    }

    .sidebar ~ .main-content .mobile-menu-btn,
    body.has-mobile-sidebar .mobile-menu-btn {
        display: inline-flex !important;
    }

    .sidebar ~ .main-content .header .logout-btn {
        display: none !important;
    }

    .sidebar-mobile-logout {
        display: block !important;
        margin-top: auto;
        padding-top: 6px;
        flex-shrink: 0;
    }

    .sidebar-nav a.sidebar-logout-link {
        color: var(--red) !important;
        background: var(--red-bg) !important;
        border: 1px solid var(--red-border) !important;
        font-weight: 600 !important;
    }

    .sidebar-nav a.sidebar-logout-link:hover {
        background: rgba(244, 63, 94, 0.22) !important;
        color: var(--red) !important;
    }
}

/* ── Mobile Header, Forms, Grids & Tables (<= 768px) ────────────────────── */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 8px 10px;
        padding: 8px 12px;
        height: auto;
    }

    .header-left {
        display: contents;
    }

    .header-left-main {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .header-title-slot.has-back-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        min-width: 0 !important;
    }

    .back-btn-text {
        display: none !important;
    }

    .header-left-main .back-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        padding: 0 !important;
        border-radius: var(--radius-md) !important;
        background: var(--btn-ghost-bg) !important;
        border: 1px solid var(--btn-ghost-border) !important;
        color: var(--text-primary) !important;
        line-height: 1 !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        transition: all 0.15s ease !important;
    }

    .header-left-main .back-btn:hover,
    .header-left-main .back-btn:active {
        border-color: var(--accent) !important;
        color: var(--accent) !important;
    }

    .header-left-main .back-btn .back-btn-icon {
        width: 17px !important;
        height: 17px !important;
        stroke: currentColor !important;
        stroke-width: 2.2 !important;
        margin: 0 !important;
    }

    .header-title-slot--text {
        display: none;
    }

    .header-right {
        order: 2;
        flex: 0 1 auto;
        gap: 6px;
        margin-left: auto;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .header-search {
        order: 3;
        flex: 1 0 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .header-search input[type="text"],
    .header-search input {
        height: 36px !important;
    }

    .back-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        padding: 0 !important;
    }

    .page-header,
    .header-action,
    .toolbar {
        gap: 10px;
        margin-bottom: 14px !important;
        align-items: flex-start;
    }

    .page-header-left h1,
    .header-action h1,
    .content > h1 {
        font-size: 18px !important;
        line-height: 1.25;
        margin: 0;
    }

    .page-subtitle,
    .header-action p {
        font-size: 12.5px !important;
        line-height: 1.4;
        margin: 3px 0 0 0 !important;
    }

    .page-actions,
    .header-action-btns,
    .export-bar {
        width: 100%;
        flex-wrap: wrap !important;
        white-space: normal !important;
        gap: 8px;
    }

    .page-actions form,
    .header-action-btns form {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .page-actions form select,
    .page-actions form input[type="text"],
    .page-actions form input[type="search"] {
        max-width: 100%;
        min-width: 0;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    thead th {
        padding: 9px 8px;
        font-size: 10.5px;
    }

    tbody td {
        padding: 9px 8px;
        font-size: 12.5px;
    }

    thead th:first-child,
    tbody td:first-child {
        padding-left: 12px;
    }

    thead th:last-child,
    tbody td:last-child {
        padding-right: 12px;
    }

    .form-grid-2,
    .form-grid-3,
    .grid-2,
    .grid-3,
    .card-grid,
    .portal-sig-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: 1.25fr"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .portal-sig-header,
    .portal-card-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

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

/* ── Portrait Phones (<= 640px) ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .content {
        padding: 24px 14px 28px !important;
    }

    .header-title-slot > .back-btn ~ .back-btn {
        display: none;
    }

    .header-right .user-name-text,
    .header-right .theme-text {
        display: none;
    }

    .header-right .theme-toggle-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: var(--radius-md);
    }

    .header-right .user-pill {
        height: 36px;
        padding: 3px;
        border-radius: 50%;
    }

    .header-right .header-bell,
    .mobile-menu-btn {
        width: 36px;
        height: 36px;
    }

    .header-right .logout-btn,
    .header-right .portal-admin-btn {
        height: 36px;
        padding: 0 10px;
        font-size: 12px;
    }

    .page-actions,
    .header-action-btns {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100%;
        align-items: stretch;
    }

    /* Direct action buttons: side-by-side 50/50 pairs by default */
    .page-actions > a,
    .page-actions > button,
    .page-actions > .btn,
    .page-actions > .btn-ghost,
    .header-action-btns > a,
    .header-action-btns > button {
        flex: 1 1 calc(50% - 4px);
        width: auto;
        min-width: 120px;
        height: 38px;
        min-height: 38px;
        padding: 0 12px;
        font-size: 13px;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        box-sizing: border-box;
    }

    /* Single direct button (e.g. + New SIG, SMTP Settings) stretches full width */
    .page-actions > a:only-child,
    .page-actions > button:only-child,
    .header-action-btns > a:only-child {
        flex: 1 1 100%;
        width: 100%;
    }

    /* In a 3-button toolbar, odd last child stretches full width */
    .page-actions > a:last-child:nth-child(odd),
    .header-action-btns > a:last-child:nth-child(odd) {
        flex: 1 1 100%;
    }

    /* Filter forms inside page-actions */
    .page-actions form,
    .header-action-btns form {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 8px !important;
        margin: 0 !important;
    }

    .page-actions form input[type="text"],
    .page-actions form input[type="search"],
    .header-action-btns form input[type="text"],
    .header-action-btns form input[type="search"] {
        flex: 1 0 100% !important;
        width: 100% !important;
        height: 38px !important;
        font-size: 13px !important;
    }

    .page-actions form select,
    .page-actions form input[type="date"],
    .page-actions form button[type="submit"],
    .page-actions form .btn,
    .page-actions form .btn-ghost,
    .header-action-btns form select,
    .header-action-btns form button[type="submit"] {
        flex: 1 1 calc(50% - 4px) !important;
        width: auto !important;
        min-width: 100px !important;
        max-width: 100%;
        height: 38px !important;
        min-height: 38px;
        font-size: 13px !important;
        justify-content: center;
    }

    /* Standalone export forms (such as in Platform Reports) pair 50/50 */
    .page-actions form[action*="export"] {
        width: auto !important;
        flex: 1 1 calc(50% - 4px) !important;
    }

    .page-actions form[action*="export"] button {
        width: 100% !important;
        height: 38px !important;
        font-size: 12.5px !important;
    }

    /* Action button following a form (e.g. "+ Create User" after filter form) stretches full width */
    .page-actions form ~ a,
    .page-actions form ~ button,
    .header-action-btns form ~ a {
        flex: 1 1 100% !important;
        width: 100% !important;
        height: 38px !important;
    }

    /* Standard Form Action Bars: Clean Stacked Full-Width Buttons on Mobile */
    .form-actions-right {
        display: flex !important;
        flex-direction: column-reverse !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
        margin-top: 18px !important;
        padding-top: 14px !important;
    }

    .form-actions-right > .btn,
    .form-actions-right > .btn-cancel-red,
    .form-actions-right > .btn-cancel,
    .form-actions-right > .btn-red,
    .form-actions-right > .btn-ghost,
    .form-actions-right > .btn-outline,
    .form-actions-right > .btn-secondary,
    .form-actions-right > .btn-danger,
    .form-actions-right > .btn-danger-ghost,
    .form-actions-right > .btn-danger-outline,
    .form-actions-right > .btn-danger-solid {
        width: 100% !important;
        height: 40px !important;
        min-height: 40px !important;
        justify-content: center !important;
        text-align: center !important;
        flex: none !important;
        margin: 0 !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .yt-notif-pip,
    .yt-notif-pip.is-pip-docked {
        top: 64px !important;
        left: 10px !important;
        right: 10px !important;
        bottom: auto !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100dvh - 80px) !important;
    }

    .yt-notif-pip.is-minimized {
        left: auto !important;
        right: 12px !important;
        bottom: 12px !important;
        top: auto !important;
        width: 220px !important;
    }

    .empty-state {
        padding: 34px 16px !important;
    }

    .empty-state p {
        white-space: normal !important;
    }

    .alert,
    .alert-success,
    .alert-error,
    .alert-info,
    .alert-warning {
        flex-wrap: wrap;
    }

    .notif-item {
        padding: 14px;
        gap: 10px;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 359px) {
    .page-actions > a,
    .page-actions > button,
    .header-action-btns > a,
    .header-action-btns > button {
        flex: 1 1 100% !important;
    }
}
