:root {
    --portal-ink: #0f1c3f;
    --portal-muted: #6b7280;
    --portal-accent: #1f3fb3;
    --portal-accent-light: #eef2ff;
    --portal-border: #e5e7eb;
    --portal-bg: linear-gradient(135deg, #f4f6fb 0%, #eef2ff 100%);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", "Segoe UI", sans-serif;
    background: var(--portal-bg);
    color: var(--portal-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 2rem;
    box-sizing: border-box;
}

.page--regular {
    max-width: 1200px;
}

.page--wide {
    max-width: 1400px;
}

.page--narrow {
    max-width: 1100px;
}

.page--grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: #0f1c3f;
    color: #fff;
    box-shadow: 0 10px 28px rgba(15, 28, 63, 0.25);
}

.top-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f4ba3, #1f3fb3);
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 18px rgba(15, 75, 163, 0.35);
    text-transform: uppercase;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-text .eyebrow {
    margin: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #9eb3ff;
}

.brand-text .user {
    font-weight: 700;
    margin: 0;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.projects-btn {
    display: inline-block;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    background: #fff;
    color: #0f1c3f;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.25);
    font-size: 0.95rem;
}

.projects-btn:hover {
    transform: translateY(-1px);
}

.profile-menu {
    position: relative;
}

.profile-toggle {
    background: #ffffff;
    color: #0f1c3f;
    border: none;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.25);
    font-size: 0.95rem;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 20;
}

.profile-dropdown a,
.profile-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.95rem;
    background: none;
    border: none;
    color: #0f1c3f;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
    background: #f3f4f6;
}

.profile-dropdown .disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.profile-dropdown form {
    margin: 0;
}

.card {
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 12px 30px rgba(15, 28, 63, 0.08);
}

.section-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.eyebrow {
    margin: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--portal-muted);
}

.muted {
    color: var(--portal-muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--portal-accent-light);
    border: 1px solid #e0e7ff;
    color: #1f3fb3;
    font-weight: 700;
    font-size: 0.9rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

thead {
    background: #f3f4f6;
}

th,
td {
    padding: 0.75rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--portal-border);
}

th {
    font-size: 0.9rem;
    color: #4b5563;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tr:hover td {
    background: #f9fafb;
}

.menu-cell {
    width: 48px;
    text-align: right;
    position: relative;
}

.menu-wrapper {
    position: relative;
    display: inline-block;
}

.menu-btn {
    background: var(--portal-accent-light);
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: #1f3fb3;
}

.versions-menu {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    padding: 0.4rem 0;
    display: none;
    z-index: 5;
}

.versions-menu a {
    display: block;
    padding: 0.55rem 0.75rem;
    color: #0f1c3f;
    text-decoration: none;
    font-size: 0.95rem;
}

.versions-menu a:hover {
    background: #f3f4f6;
}

.menu-open .versions-menu {
    display: block;
}

.sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 12px 30px rgba(15, 28, 63, 0.08);
    height: fit-content;
}

.sidebar h3 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
}

.nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
}

.nav a {
    display: block;
    padding: 0.6rem 0.75rem;
    color: #1f3fb3;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    background: var(--portal-accent-light);
    border: 1px solid #e0e7ff;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.nav a:hover,
.nav a.active {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(31, 63, 179, 0.16);
    background: #e0e7ff;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select,
.input {
    width: 100%;
    padding: 0.65rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--portal-border);
    font-size: 1rem;
    box-sizing: border-box;
    background: #f9fafb;
}

select.input {
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23343352' viewBox='0 0 16 16'%3E%3Cpath d='M3.204 5.5l4.796 4.796L12.796 5.5 14 6.704 8 12.704 2 6.704z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    appearance: none;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary {
    background: var(--portal-accent);
    color: #fff;
    box-shadow: 0 12px 26px rgba(31, 63, 179, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(31, 63, 179, 0.3);
}

.btn-ghost {
    background: var(--portal-accent-light);
    color: var(--portal-accent);
    border: 1px solid #dfe5ff;
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
    box-shadow: 0 10px 24px rgba(185, 28, 28, 0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(185, 28, 28, 0.3);
}

.portal-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.75rem 0.9rem;
    max-width: 1400px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    color: var(--portal-ink);
    font-size: 0.85rem;
}

.portal-footer .footer-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.portal-footer .footer-left a {
    color: #1f3fb3;
    text-decoration: none;
    font-weight: 700;
}

.portal-footer .footer-left a:hover {
    text-decoration: underline;
}

.portal-footer .footer-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #dbe2f7;
    background: #fff;
    color: #0f1c3f;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15, 28, 63, 0.08);
    font-size: 0.8rem;
}

@media (max-width: 980px) {
    .page {
        padding: 1.1rem 1.2rem 1.5rem;
    }

    .page--grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    table {
        min-width: 100%;
    }
}

@media (max-width: 900px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 700px) {
    .portal-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
