:root {
    --navy: #132238;
    --navy-dark: #0a1320;
    --navy-light: #1e3557;
    --gold: #c59b27;
    --gold-hover: #b48a1c;
    --gold-light: #fef9ed;
    --gold-border: #f4dfa1;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --green: #15803d;
    --green-light: #ecfdf5;
    --amber: #b45309;
    --amber-light: #fffbeb;
    --red: #b91c1c;
    --red-light: #fef2f2;
    --white: #ffffff;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px -4px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Fluid Responsive Container */
.container {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 40px);
}

.site-header {
    background: #ffffff;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px clamp(16px, 3vw, 40px);
    flex-wrap: wrap;
    gap: 14px;
    min-height: 64px;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand-logo {
    height: 44px;
    width: auto;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
}

.brand-subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    color: #b48a1c;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-badge {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portal-badge-staff {
    background: #f1f5f9;
    color: var(--navy);
    border: 1px solid #cbd5e1;
}

.portal-badge-member {
    background: var(--gold-light);
    color: #854d0e;
    border: 1px solid var(--gold-border);
}

/* Mobile Toggle Hamburger */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.mobile-toggle .bar {
    width: 20px;
    height: 2px;
    background: #334155;
    border-radius: 2px;
    transition: all 0.2s ease;
}

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

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

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

/* Nav Container */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: 14px;
    gap: 10px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
}

.nav-item {
    color: #475569;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-item:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.nav-item.active {
    color: var(--navy);
    background: #e2e8f0;
    font-weight: 600;
}

.nav-item-badge {
    display: inline-block;
    background: #0284c7;
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    margin-left: 4px;
    vertical-align: middle;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 4px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--navy);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

.nav-link-subtle {
    font-size: 0.8rem;
    color: #64748b;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.nav-link-subtle:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.btn-signout {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-signout:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.btn-login {
    color: #334155;
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
}

.btn-login:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-join {
    background: var(--gold);
    color: #0a1320;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(197, 155, 39, 0.25);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-join:hover {
    background: var(--gold-hover);
    transform: translateY(-1px);
}

@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex;
    }

    .nav-container {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding-top: 14px;
        border-top: 1px solid var(--border);
        gap: 14px;
    }

    .nav-container.open {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .nav-item {
        padding: 10px 14px;
    }

    .nav-actions {
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        gap: 10px;
    }

    .user-profile-pill {
        justify-content: flex-start;
    }

    .btn-signout, .btn-join, .btn-login {
        text-align: center;
        width: 100%;
    }
}

.button-link, .link-button {
    background: var(--gold);
    color: var(--navy-dark) !important;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.92rem;
    transition: background 0.15s ease, transform 0.1s ease;
    display: inline-block;
    text-decoration: none;
}

.button-link:hover, .link-button:hover {
    background: var(--gold-hover);
    transform: translateY(-1px);
}

.inline-form { display: inline; }

.page {
    padding: clamp(24px, 4vw, 48px) 0 80px;
    min-height: 75vh;
}

h1 {
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h2 {
    font-size: clamp(1.3rem, 2.2vw, 1.65rem);
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 12px;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0 0 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: clamp(18px, 2.5vw, 32px);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
}

th, td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--navy);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:hover td {
    background: #fcfdfe;
}

form .field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(19, 34, 56, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--navy);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    background: var(--navy-dark);
}

.btn-secondary {
    background: #ffffff;
    color: var(--navy);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--navy);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* Soft Human Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-compliant, .badge-active, .badge-approved, .badge-paid {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid #bbf7d0;
}

.badge-expiring_soon, .badge-submitted, .badge-under_review, .badge-partially_paid {
    background: var(--amber-light);
    color: var(--amber);
    border: 1px solid #fde68a;
}

.badge-non_compliant, .badge-rejected, .badge-overdue, .badge-suspended {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid #fecaca;
}

.badge-draft, .badge-corrections_requested, .badge-unpaid {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid #cbd5e1;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.alert-success {
    background: var(--green-light);
    color: #14532d;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--red-light);
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.alert-error ul {
    margin: 4px 0 0;
    padding-left: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat .num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}

.stat .label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .main-nav { width: 100%; justify-content: flex-start; gap: 12px; }
}

.steps {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.step {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
}

.step:hover { border-color: var(--border); }
.step.active { background: var(--navy); color: var(--white); font-weight: 600; }
.step.done::before { content: "✓ "; }

.empty-state {
    color: var(--text-muted);
    padding: 36px 16px;
    text-align: center;
    font-size: 0.95rem;
}

.site-footer {
    background: var(--navy-dark);
    color: #94a3b8;
    padding: 36px 0 24px;
    font-size: 0.88rem;
    margin-top: auto;
}
