/* Base variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --border-color: #e0e0e0;
    --text-color: #333;
    --text-secondary: #666;
}

/* Base styles */
html {
    overflow-y: scroll;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    font-size: 16px;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
}

h1 {
    margin: 0;
    color: #333;
    font-size: 24px;
    margin-right: 20px;
    white-space: nowrap;
}

h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

/* Top Navigation Bar */
.top-nav {
    background-color: #f8f9fa;
    padding: 5px 10px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    /* Light border */
    box-sizing: border-box;
    width: 100%;
    /* Ensure it takes full width */
}

.top-nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.top-nav li {
    margin: 0 8px;
    /* Minimal spacing between items */
}

.top-nav a {
    text-decoration: none;
    color: #007bff;
    font-size: 1rem;
    line-height: 1;
    padding: 0.5px 5px;
    display: block;
}

.top-nav a:hover {
    text-decoration: underline;
    color: #0056b3;
    /* Darker blue on hover */
}

.top-nav a.active {
    font-weight: bold;
    color: #0056b3;
    /* Darker blue for active link */
}

.top-nav .nav-account {
    display: none !important;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid #d1d5db;
    position: relative;
}

/* Must beat the HTML [hidden] attribute (display:none !important in UA styles) */
html.external-user-mode .top-nav .nav-account,
body.external-user-mode .top-nav .nav-account,
html.external-user-mode .top-nav .nav-account[hidden],
body.external-user-mode .top-nav .nav-account[hidden] {
    display: list-item !important;
}

html.external-user-mode .nav-admin-only,
body.external-user-mode .nav-admin-only {
    display: none !important;
}

.top-nav .nav-account.nav-account-visible {
    display: list-item !important;
}

.top-nav .nav-account-menu {
    position: relative;
}

.top-nav .nav-account-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1.2;
    /* Fixed slot so email text cannot reflow the top nav */
    min-width: 200px;
    max-width: 220px;
    width: 200px;
    box-sizing: border-box;
}

.top-nav .nav-account-toggle:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.top-nav .nav-account-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.top-nav .nav-account-caret {
    color: #6b7280;
    font-size: 0.7rem;
}

.top-nav .nav-account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 1000;
    text-align: left;
}

.top-nav .nav-account-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
}

.top-nav .nav-account-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.top-nav .nav-account-item-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}